Empegface

Posted by: Skunk

Empegface - 30/10/2003 10:58

I was upgraded to XP at work and run empegface to control my MKII but with one small problem. To aviod the VB/CPU issue, I minimize empegface when in use, only thing is that when I bring the face back up, it does not grab the screenshot. I have to right click, configure and clik ok to "refresh"
Is there a way around this?
Posted by: tfabris

Re: Empegface - 30/10/2003 11:30

That's odd. It shouldn't have to do that. I'm not sure what could be going on there. I'll take a peek at the code to see if there's anything in there that might cause it. That certainly didn't happen on any of my test systems.

Are you going by direct IP address or by network name?
Posted by: Skunk

Re: Empegface - 30/10/2003 11:34

IP address. Although it is not static, once I am plugged in, it never changes.
Posted by: tfabris

Re: Empegface - 30/10/2003 11:53

This is just an off-the-cuff experiment, dunno if it has anything to do with it, but give this a shot.

(It's just the EXE, not the whole install.)
Posted by: Skunk

Re: Empegface - 30/10/2003 12:10

Nothing.........I placed the exe within the Empegface folder and ran it. Same problem exists.
Posted by: tfabris

Re: Empegface - 30/10/2003 12:26

Hm. Anyone else who runs XP having this problem?
Posted by: tfabris

Re: Empegface - 30/10/2003 12:29

When it is "frozen", in other words, when it's not grabbing the screen shot, what are the contents of the file ~001empeg_screen.~tm located in the system's temporary folder?
Posted by: Skunk

Re: Empegface - 30/10/2003 13:01

Not quite sure what to open it with.
I have two, 000empeg-screen and 001empeg-screen.
001 I opened with notepad and got [Semaphore]
PaintPicture=Start
000 was some kind of code.
Posted by: tfabris

Re: Empegface - 30/10/2003 13:34

Opening it with Notepad is correct. And the contents were correct, so it's not a desynchronization issue. Darn...

By the way, the 00 file is the actual screen shot in raw mode.
Posted by: skibum

Re: Empegface - 30/10/2003 13:39

Tony, I've just discovered empegface and downloaded it. I've the same problem as above. On my XP Pro with a P4 3gz HT it effectively uses 1 'cpu'. The odd bit is, is if you open the configuration dialog up, the usage drops down to zero. Don't know if that helps or not.

Also, one think I noticed with it (slightly off topic), is that when I installed 2 copies into 2 different directories and ran them with different ip addresses (to talk to my 2 empegs) I found that they both keep flipping between the 2 displays. The poor things. I know it was probably never designed to be run with 2 empegs, but I had to try it.
Posted by: tfabris

Re: Empegface - 30/10/2003 14:32

Heh, cute, I never envisioned it to be used with two players. They both point to the same download file. Heh.

That's odd you've got the same issue. I'll play with it more tonght, thanks.
Posted by: JBjorgen

Re: Empegface - 30/10/2003 16:07

Same issue here.

XP Pro.
Posted by: tfabris

Re: Empegface - 30/10/2003 16:37

Argh, so there's something I'm doing wrong, I just don't know what yet.

All of you are on XP? Do all of you have really fast processors?
Posted by: JBjorgen

Re: Empegface - 30/10/2003 16:41

1.2 ghz Athlon
Posted by: SE_Sport_Driver

Re: Empegface - 30/10/2003 16:44

Sorry Tony, it's happening to me on XP Home w. a P4 1.6ghz.

BUT...... I hope this thread gets a few people to try this program - it rocks!!! Doing a search will give a few new "skins" too... If any of you have made skins, please submit them to RioCar.org so they are easy to find.
Posted by: skibum

Re: Empegface - 30/10/2003 17:04

my poor 1gz p3 laptop hits 100% running it as well on xp pro. Slowest machine I've got on XP.
Posted by: tfabris

Re: Empegface - 30/10/2003 17:23

Remember everyone that it doesn't really take up 100 percent of the CPU any more than the Windows "System Idle Process" takes up 100 percent of the CPU. It's just a pain to try to do a timing loop in Visual Basic without it showing up like that on the list. Any time a program needs the CPU, it will yield to it. It's only when all other programs are idle that this one moves to the top of your task list.
Posted by: tfabris

Re: Empegface - 30/10/2003 17:29

Oh now this is very interesting. On my XP test system, it's not running ImageGrabber.exe when I launch the program.

Those of you having this problem: Can you see ImageGrabber in your "Processes" list when the problem is happening?
Posted by: tman

Re: Empegface - 30/10/2003 17:38

It's still not the same as the system idle process however. empegface makes the cooling fans kick in on my laptop as it's looping fast enough to increase the CPU temperature.
Posted by: SE_Sport_Driver

Re: Empegface - 30/10/2003 17:46

EDIT: I see ImageGrabber.dll in processes and ImageGrabber.exe in Applications.
Posted by: skibum

Re: Empegface - 30/10/2003 17:48

Tony,

In applications I have imagegrabber, and in processes I have imagegrabber.dll.

laptop fan now going fullspeed as well.
Posted by: tfabris

Re: Empegface - 30/10/2003 17:50

Right, sorry, I renamed it .DLL so as not to confuse people.

Which explains why it wasn't working on the test system, thanks for the reminder.
Posted by: tfabris

Re: Empegface - 30/10/2003 17:57

Hmmm. Those having the trouble with the screen not getting updated... What's your refresh frequency set to?
Posted by: mlord

Re: Empegface - 31/10/2003 05:18

It does too take 100% --> not everybody runs MS-Wincrap as the native O/S, and apps that chew 100% cpu are a real P.I.T.A. when run inside a virtual machine (eg. VMWare).

Cheers
Posted by: JBjorgen

Re: Empegface - 31/10/2003 07:46

60 hz
Posted by: skibum

Re: Empegface - 31/10/2003 08:09

mine are 60hz as well. Dual screen DVI if that matters.
Posted by: tfabris

Re: Empegface - 31/10/2003 12:49

I'm sorry. I didn't mean the computer screen refresh frequency. I meant, what number is in the EmpegFace configuration screen that tells it how fast to download the screen shots?
Posted by: Skunk

Re: Empegface - 31/10/2003 13:16

Tony,
I'm @ 1000 milliseconds
but it doesnt work even with the defult of 100.
1.3.1 does the same.
Posted by: tfabris

Re: Empegface - 31/10/2003 13:16

Thanks. Does it work at 0?
Posted by: Skunk

Re: Empegface - 31/10/2003 13:53

yep!
Posted by: skibum

Re: Empegface - 31/10/2003 14:01

if by 'work' you mean does it still use all the cpu, then yes. Also using 1.3.1.
Posted by: tfabris

Re: Empegface - 31/10/2003 14:09

I'm not talking about the "known problem" of the app appearing at the top of the task list and seeming to consume a lot of CPU. There's nothing I can do about that.

I'm talking about the original bug reported at the very top of this thread. The bug where it doesn't show the screen updates until after you open and close the configuration dialog box.

Does configuring the app so that the refresh is zero solve that particular problem?
Posted by: Skunk

Re: Empegface - 31/10/2003 14:22

Sorry.......Yep, as in the app works and NO, it does not change the refresh issue.
1.3.1 also is NOT affected by changing to "0"
Posted by: skibum

Re: Empegface - 31/10/2003 14:24

In reply to:

I'm not talking about the "known problem" of the app appearing at the top of the task list and seeming to consume a lot of CPU. There's nothing I can do about that.




It's not 'appearing' to use cpu. It's actually using it. Although the 'system idle process' uses all free cpu, it at least doesn't cause laptop fans to start spinning and also when you look at the performance graph in taskmanager, the cpu is nailed at 100%.

A friend of mine had a similiar problem with one of his VB programs. It seems that VB doesn't really like looping around calls to releasing the cpu. As all that does, is use the cpu. I think but can't check until next week, that he had to use small sleeps instead.

As for the original problem, I'm not suffering from that, but then again running empegface takes cpus cycles away from looking for little green men so I've stopped running it.
Posted by: tfabris

Re: Empegface - 31/10/2003 14:46

I'm going to say this one last time, and then there will be no further discussion on the topic because it's going in the readme file:

If you don't like it using all the CPU, then instead of complaining, please do the following: Locate a piece of Visual Basic code which will download a file from a web site, directly into memory, without using the hard disk, and without using blocking calls. Oh, and without requring me to license and distribute a third party DLL.

The hard disk and blocking call thing comes because I'm using the IE "URLDownloadToFile" API to retreive the screen shot. As soon as I don't have to use that, then I don't have to sit in a loop waiting for the file to finish downloading, and the whole issue will go away.

I can't find code examples to do what I need, the only code examples I've seen use URLDownloadToFile.
Posted by: tman

Re: Empegface - 31/10/2003 15:04

I don't use VB but how complicated is network code in VB? If it's not too bad then you only need to do a few steps after setting up the connection.

1. Connect to port 80
2. Send "GET /proc/empeg_screen.png HTTP/1.0\r\n\r\n"
3. What you get back is the HTTP headers with the PNG file following it.
Posted by: tfabris

Re: Empegface - 31/10/2003 15:08

but how complicated is network code in VB?
There is no network code in VB itself. Unless I call the IE DLL, there's no functions for talking on the network. And I don't see a way to do what you're describing using the IE DLL. They don't expose it to me a that low a level. The lowest function I've got AFAIK is URLDownloadToFile.

If anyone has ACTUAL EXAMPLE CODE which shows how to do otherwise (as opposed to "how hard could it be" armchair theories), I'm all ears.
Posted by: tman

Re: Empegface - 31/10/2003 15:13

Isn't there a WinSock control? I know that the IE DLL only gives you a very basic interface.
Posted by: tfabris

Re: Empegface - 31/10/2003 15:17

Isn't there some EXAMPLE CODE showing exactly how to use it in VB?
Posted by: tman

Re: Empegface - 31/10/2003 15:30

here and download mailex.zip It's a POP3/SMTP client but it shows how to use winsock.
Posted by: skibum

Re: Empegface - 31/10/2003 15:30

Thanks for the explaination. Now I'm on a mission.
Posted by: Skunk

Re: Empegface - 31/10/2003 16:07

Wow!
it doesnt take much to spark a fire with you guys
Just for your efforts, I promise to put out (4) new skins for the beloved Empegface on Monday!!!
Posted by: tfabris

Re: Empegface - 31/10/2003 16:18

Looking at it now. Looks really straightforward. Changing the method for getting the image might just kill a few birds with one stone and solve both problems in the process. Thank you for the link!
Posted by: tfabris

Re: Empegface - 04/12/2003 15:27

2. Send "GET /proc/empeg_screen.png HTTP/1.0\r\n\r\n"
I'm having trouble getting anything from the player this way.

If I go to a remote site, such as bluesnews, and send:
GET
Then I get the whole proper page back.

If I send a specifica page, like GET /index.html I get that page back just fine. Or a nicely formatted error screen if it's not a valid page.

If I send anything with the HTTP/1.0 string appended like you show, I get nothing back at all.

And no matter what, if I send anything at all to the empeg (even when I know the IP address is right) I get nothing back, including the kinds of stuff that works for remote sites.

Any ideas how I'm supposed to format the GET string so that KHTTPD sends me back the file I'm looking for?
Posted by: tman

Re: Empegface - 04/12/2003 15:39

It should work... You do know that \r\n\r\n means two CRLFs tho?

Do this from the command prompt

telnet your_empeg_ip 80 <PRESS ENTER>
GET /proc/uptime HTTP/1.0<PRESS ENTER>
<PRESS ENTER>

You probably won't be able to see yourself typing GET /proc/uptime etc... but just do it blindly.

It should display some numbers and then close the connection.
Posted by: wfaulk

Re: Empegface - 04/12/2003 15:40

If you end with "HTTP/1.0", you have to hit return twice.
Posted by: skibum

Re: Empegface - 04/12/2003 15:49

Tony, I've got a small vb program I knocked up that tries to do 1/100th of empegface. It grabs the file, saves it to disc, reads it back and displays it. I'll email it to you when I power up my other pc.
Posted by: tman

Re: Empegface - 04/12/2003 15:52

He's already got part sorted in empegface. We're trying to avoid writing it to disk which is why we're messing around with doing the HTTP transfer manually
Posted by: tfabris

Re: Empegface - 04/12/2003 15:56

If you end with "HTTP/1.0", you have to hit return twice.
Aha found it.

Actually, my problem was that I was sending LF+CR's instead of CR+LF's. Picky web servers, hmph.

Thanks for the help everyone. On to the rest of the work.
Posted by: tfabris

Re: Empegface - 04/12/2003 16:52

Okay, so what's the syntax for the GET request if I only want it to send the file back and not the headers? Found some examples on Google but they don't seem to be working for me...
Posted by: tman

Re: Empegface - 04/12/2003 16:58

You can't with the HTTP server in Hijack. It's been hardcoded to always send headers.
Posted by: tfabris

Re: Empegface - 04/12/2003 17:01

Okay, then I'll just parse out everything that appeas after (what seems to be) "Content-Type: text/plain" followed by two CRLF pairs.

Does that sound right?
Posted by: tman

Re: Empegface - 04/12/2003 17:07

A better way would be to just junk everything before and including the first line with just a CRLF on it. That's what delimits the header from the data.
Posted by: wfaulk

Re: Empegface - 04/12/2003 17:45

Or, in other words, junk everything up to and including the first pair of CRLFs.
Posted by: tman

Re: Empegface - 04/12/2003 17:49

Yeah Not quite sure why I was thinking in such a convoluted way.
Posted by: tfabris

Re: Empegface - 05/12/2003 00:10

Thanks guys. I've got it working with the Winsock code now.

I'm not ready to release it just yet because it needs the Winsck.OCX and I have to check to find out how that needs to get distributed, if at all. Maybe I'm lucky and that gets included with IE5 or something? I can hope...
Posted by: Roger

Re: Empegface - 05/12/2003 03:53

Does that sound right?

Or you could RTFM, which explicitly says that each value in the header is terminated with CRLF and that the header itself is terminated by a blank line. So, just look for CR/LF/CR/LF to find the end of the headers.
Posted by: tfabris

Re: Empegface - 05/12/2003 10:28

Yeah, something funny is that, between those two CRLFs and the actual empeg_screen.raw file, there are two additional bytes that are coming through (I think they're nulls) that I have to account for. Dunno why. But it only works if I filter out those two CRLF and the two following bytes. Oh well.