Still can't build screensaver

Posted By: ngisiger

Still can't build screensaver - 05/10/09 13:28

Dear Conitec,

Congratulations on a GREAT product. smile

I am trying to make a screensaver, out of a level, that Windows can launch automatically when my computer is idle. Following the manual, I did the following:

1. I made a level (just a room), named it myscreen. Gave it an ordinary A6 script.

2. I built it like a level (Build BSP Map). It runs fine when I press "Run"

3. I published it by checking the "resource" and "compile EXE" checkboxes.

4. I get a folder named myscreen.cd which contains the files: acknex.dll, d3dx9_30.dll, myscreen.wrs, palette, and the application myscreen.exe.

5. I renamed the application myscreen in myscreen.cd folder to myscreen.scr (right click-> rename-> etc.).

6. I copy/paste these 5 files in the C:/Windows/system folder.

7. BUT, when I right-click on the desktop -> Properties -> Screen Saver -> List of screensavers, I do no see any of the files I copy/pasted (I also tried C/P in system32).

Also, when I simply click on myscreen.scr (in system or system 32), I get an error message about a bad image or it does not launch at all.

I tried this procedure on 3 PCs (all running WinXP pro), including a brand new Lenovo laptop set up at the factory, but with no success.

I think I used all the information in the manual on this subject. I tried getting help on the "Starting with Gamestudio" and "C-script and wdl" forums. Everybody kept saying that what I did should work. I did get some info about how to set up the screen saver to react to keyboard and mouse input (with the command_str command) when the screensaver is running.

However, I can't do the first step, i.e. selecting myscreen and getting Windows to launch it.

Since it's not 3DGS or my 3 PCs which are at fault, I'm assuming that I am the problem.

Please tell me what am I doing wrong? Is there a special build or Run option, or something I have to put in the script, or something else ...? Seems I can win 2 Gamestudio contests, but I cannot do that particular simple thing. crazy

Many Thanks in advance.

Thomas Gisiger

PS: I am using A7.7 Pro
Posted By: slacer

Re: Still can't build screensaver - 05/10/09 13:54

Hi,

you should rename your program back to .exe and start it again from your windows folder where you placed your screensaver.
What is your Windows Version? XP Home, XP Pro, Vista 32/64, Windows 7 Beta/RC...
Posted By: Cowabanga

Re: Still can't build screensaver - 05/10/09 15:37

@slacer:
Quote:
I tried this procedure on 3 PCs (all running WinXP pro)

Posted By: slacer

Re: Still can't build screensaver - 05/10/09 16:14

oops, missed that line...
Posted By: ngisiger

Re: Still can't build screensaver - 05/10/09 17:52

Thanks guys for your help. smile

Sorry about the long post. Yes, I have Win XP Pro on all machines.

If I rename myscreen.scr (the one in the Windows/system folder) back to myscreen.exe and double-click on it, I get the same Bad Image message as before.

It starts by complaining about avicap.dll, then avifile.dll, then commdlg.dll, then lzexpand.dll, then mmsystem.dll, then msvideo.dll, olecli.dll, then olescr.dll, then shell.dll, then tapi.dll, then ver.dll, before finally running level (all greek to me, I must admit).

Stupid question: to rename the application to myscreen.scr, I just do right click->rename-> and type .scr at the end. That's the correct way, right?

Thanks.
Posted By: Pappenheimer

Re: Still can't build screensaver - 05/10/09 19:52

You probably should test this with an extremely simple demo.
Just an empty level with a rotating object. Something like that.

BTW, in your quite detailed description I'm missing the part about testing the exe before you renamed it and copied it into the windows folder etc.
Posted By: ngisiger

Re: Still can't build screensaver - 05/10/09 21:18

Hi Pappenheimer, thanks for your input.

Quote:
You probably should test this with an extremely simple demo.

I am using a small room with 4 walls, ceiling and floor, with the default texture and a camera. Can't be simpler than that. smile

Quote:
BTW, in your quite detailed description I'm missing the part about testing the exe before you renamed it and copied it into the windows folder etc.

I think we might be getting somewhere here:

As long as I copy/paste the myscreen.cd folder with all its content (i.e. acknex.dll, d3dx9_30.dll, myscreen.scr, myscreen.wrs and palette), then the level runs fine when I double-click on myscreen.scr or myscreen.exe (if I rename it that way), no matter where it is on the computer: on the Desktop, C:, /c:windows, C:windows/system or C:windows/system32, etc. So, that parts works perfectly.

But, when I just copy the 5 files contained in myscreen.cd (see above), and then paste them (so without a folder to hold them), then clicking on myscreen.scr does not work in /c:windows, C:windows/system or C:windows/system32.

It does work however on the desktop, in C:, in C:Programs Files, etc.
Posted By: jcl

Re: Still can't build screensaver - 05/11/09 08:01

The reason of your problem is probably simple: Windows/system32 is not a folder where the engine should search for engine plugins. Set the plugins directory to a different folder.

From the manual:

"On startup, the engine scans for plugin DLLs in the current folder and in the PLUGINDIR folder. This can lead to a slow start when the folders contain lots of DLLs that are no engine plugins - for instance, when the engine is used as a screensaver and started from a Windows folder. If a DLL crashes on opening, the engine crashes also. Thus make sure that PLUGINDIR is set to a folder that only contains engine plugin DLLs."
Posted By: ngisiger

Re: Still can't build screensaver - 05/11/09 20:40

Many thanks to JCL, and to all the nice people who gave their input.

I put

PLUGINDIR = "dummy";

in the wdl file of my level, and published the level like I did before. I then copy/pasted the 5 files I obtained (acknex.dll, palette, mysaver.scr, mysaver.wrs and d3dx9_30.dll) into the C:windows/system32 folder, and I also added an empty folder "dummy" there. This way, the engine does not look for plugins in the windows folder, but in the empty "dummy" folder.

Now, when I click on myscreen.scr, the level launches perfectly. Great! grin

However, I still do not see anything that looks like "mysaver" in the list of screen savers I get when doing right click ->properties -> screen saver. cry cry cry

Isn't it supposed to be there somewhere, so that I can select the level as screensaver?

I really feel like such a pest, but I promise: if I ever get it to work, I'll write a tutorial so that the whole community can benefit from this. smile

Thomas
Posted By: Felixsg

Re: Still can't build screensaver - 05/11/09 22:24

you are put the .scr in a wrong folder?
also you try to press the rigth button over .scr and press
install screensaver
Posted By: EvilSOB

Re: Still can't build screensaver - 05/12/09 00:05

OK.
Ive managed to get an empty level to trigger sucessfully as a screen-saver in XP-pro.
I havent tried more complex than that yet as I only have commercial and cant create WRS's.
Heres how Ive done it.

I copied my EXE(renamed to SCR), my WDL, and acknex.dll to the C:\WINDOWS folder. (not system32)
The SCR file IS still found here automatically by Display-Properties, and it tries to activate it fine.
But my scr died from "twain.dll invalid image" error, so in the WDL, I put PLUGINDIR = "%";,
that way I needed no empty dummy directory, and it fires up OK.
Ive only got commercial, so it does a mini-compile splash-screen everytime something changes, or every time the
mini-preview window tries to draw, because our SCR app is being called separately each time.
I dont know if this will affect PRO users though. Suppress the winstart window should do the trick.

OK, thats got it going as a screen-saver. Heres the code I used in mine, its very rudimentary,
but you will easily see where to insert your code, as this following code is largely just
to show how to handle the different paramaters windows will pass in as a screensaver application.

Any questions or issues, just ask.
Click to reveal..
Code:
///////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>
///////////////////////////////////////////////////////////////
//
//
void config_popup()
{
	//open a configuration panel of some kind
	//remember to do a level_load unless you are using APIs
	//also, the hWnd of the display properties MAY be available
	//on the command line so you can get a window-position
	sys_exit("");	
}
//
//
void mini_preview()
{
	//Open a mini-screensaver version to display the the "virtual"
	//monitor in the Display Properties / ScreenSaver panel.
	//You can retrieve a size from the hWnd that IS on the command-line
	//and then do a video_set to that size and position it I suppose.
	//Ive never tried anything like that before.
	sys_exit("");	
}
//
//
void ScreenSaver()
{
	video_set(sys_metrics(0),sys_metrics(1),0,1);
	level_load(NULL);	wait(5);
	VECTOR old_mouse;
	vec_set(old_mouse, mouse_cursor);
	while(1)
	{
		if(vec_dist(old_mouse,mouse_cursor))	sys_exit("");
		wait(1);
	}
	sys_exit("");
}
//
//
function main()
{
	//      From Display Properties panel
	//      /p 123456        show in little monitor    123456 = Preview D3DWindow hWnd (size is resolution dependant)
	//      /s               run or preview
	//      /c:987654        configure                 987654 = DisplayProperties/ScreenSaver Tab-Dialog hWnd
	//
	//      From RightClick Menu	
	//      /S            Test = Instant run
	//                    Configure - no hWnd passed
	//                    Install - does nothing but start DisplayProperties/ScreenSaver panel
	//
	//
	if(str_stri(command_str,"/s"))            {    ScreenSaver();    }        //execute the actual screensaver
	else if(str_stri(command_str,"/p"))       {    mini_preview();    }        //show preview in mini-panel
	else                                      {    config_popup();    }        //otherwise show my config panel
}



Posted By: ngisiger

Re: Still can't build screensaver - 05/12/09 01:19

Thanks a million for your help EvilSOB!

It's late. So I will check it in detail tomorrow.

Thanks again! grin

Thomas

PS: If you ever need any help with particle programming or anything, let me know. smile
Posted By: EvilSOB

Re: Still can't build screensaver - 05/12/09 05:30

Footnote:

Since my last post, Ive tested with a real, multi-entity animated level.
Steps required, leaving off from my previous posts ending point.
1> Created a sub-directory off my projects called "whatever".
2> Dumped WMB and all MDL's into the folder "whatever".
3> Added #define PRAGMA_PATH = "whatever" to source file.
4> Added PATH = "whatever" to WDL file.
5> Publish EXE (no ideas about resources or binding, I have no PRO)
6> Move newly-created EXE(as SCR), WDL, Acknex.dll to WINDOWS folder.
7> Copy whole "whatever" folder into WINDOWS folder, as a folder. (C:\WINDOWS\whatever)
Enable screensaver and level is visible and ALIVE!
(till I hit the mouse at least)
Posted By: ngisiger

Re: Still can't build screensaver - 05/13/09 13:33

Ok, I'm trying to retrace your steps.

I think I understand the lite-c script you C/P in your post: according to the value of command_str, your application either displays a preview, the level or a configuration panel. From what I gathered on a few web sites, these options are a requirement for windows to consider an application a screensaver. So far so good.

I am stuck here however: where does the wdl file you mention enter the picture? How can I mix c-files and wdl files in a single project? Is it in the wdl file that command_str is set? How does Windows set the value of command_str?

Thanks again for your help and patience.
Posted By: EvilSOB

Re: Still can't build screensaver - 05/13/09 21:48

Preview and Execution of screensaver are actually the same.
The mini pre-view ("/p xxxx" parameter) needs to display IN the little monitor image displayed on the
DisplayProperties/Screensaver control panel. Im still working on this, and on a savable(to resgistry) control panel.
More on that when Im closer.

Its just a publish WDL. All it contains are two lines. (for this project anyway)
It has the same filename as your application filename.
Code:
Example of a complete screensaver project.
Files to copy:
Acknex.dll                  (as generated by publish process)
Folder _scrsave             (contains all PROJECT files besides the main EXE)     
MyProject.EXE               (Renamed as MyProject.SCR)
MyProject.WDL               (contains only the following two lines)
                            PLUGINDIR = "_scrsave";
                            PATH "_scrsave";
The WDL file is (as far as I can tell) needed by commercial version to control the compiled application in some way.

Im only using it for two things ::
PLUGINDIR is aiming the app at our folder as the only place to look for DLL's.
PATH is telling the app to look for all files in the folder we have supplied.

Finally, command_str is an engine function. It gets set by A7 itself when the engine starts.

ngisiger : this post changes nothing I said in my PM
Posted By: ngisiger

Eureka: finally... It WORKS!! - 05/15/09 20:01

Alright, as usual the problem was somewhere between the chair and the keyboard: me. crazy

Apparently, I did not know how to change the extension of a file in Windows, or to be more precise, to change myProject.EXE into myProject.SCR.

Just in case I am not the last Windows-challenged person to get his hands on Gamestudio, here is the rename procedure:

1) make sure that you can actually SEE the extensions of the files. (e.g. myProject.exe, and not simply myProject).

If you don't, go in the menu of the folder which contains the files of your project, select Tools, Folder Options, then in View, uncheck the checkbox entitled Hide extensions for known file types (which seems to be the default Windows setting). Click on OK.

Now, when you go back to the folder holding the files of your project, you should see myProject.exe, etc.

2) Select the executable of the project you want to turn into a screensaver, select its name, erase the characters "exe" and replace them by "scr". Press ENTER.

3) Now, you should get a warning message saying that you're about to change the file type. Click OK to continue.

4) Now, your file type should have changed from "Application" to "Screen Saver".

5) Now do what EvilSOB said (to handle the resources of the level, the folder where to look for dlls, etc. smile ), and it should work.

Many thanks to EvilSOB for his help and patience, and everybody who participated to this thread.

Thomas
Posted By: EvilSOB

Re: Eureka: finally... It WORKS!! - 05/16/09 00:43

hehehe, so you were renaming your file from screensaver.exe to screensaver.scr.exe
Been there done that myself in the past too.

Keep your eyes on the lite-c contributions for my upcoming Screensaver-Template.
Or it may even me a Screensaver-Adapt4er_Include...
Posted By: ngisiger

Re: Eureka: finally... It WORKS!! - 05/16/09 02:50

Yeap, screensaver.scr.exe. Avast warned me, but hey, what does it know, right? wink

I look forward to getting my paws on that template! How is it coming along? Do you plan to write some doc for it? I'd be happy to help if I can (writing, proofreading, etc.).

Cheers
Posted By: EvilSOB

Re: Eureka: finally... It WORKS!! - 05/16/09 03:03

Ive just posted it in Lite-C Contributions a few minutes ago.
Much easier to use and more advanced than anything Ive posted on this thread.
Its no longer a "template" as such, its nowmore of an adapter.
It is an include for your EXISTING project, rather than something to need to
transfer your project into.

Read the instructions and see...

Hope you like it....
Posted By: EvilSOB

Re: Eureka: finally... It WORKS!! - 05/16/09 03:07

Moderators, I vote towards this thread as closed.
A new THREAD exists to carry on this subject.
Posted By: jcl

Re: Eureka: finally... It WORKS!! - 05/18/09 06:28

Thanks for your example. We'll add a screensaver to the samples folder for making clear how it works.
© 2024 lite-C Forums