PocketMatrix forums

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

Deploy error

Hi!
When I'm trying to deploy project, I get an error:
Unable to start program: '%CSIDL_PROGRAM_FILES%\WM_2005\WM_2005.exe The system can not find the filed specified.

And in the output window I see
Code:
Deployment and/or registration failed with error: 0x8973190d. Error opening file '..\..\..\bin\VS2005 - PPC WM2005\GledPlay.dll'. Error 0x80070003: The system cannot find the path specified.

I'm using emulator for this project. All paths are set correct, I checked them, well, I hope they are?
Hi Ryumaster,
To make deployment easier, the Initial Application project is configured to copy the GledPlay.dll file in the same folder of your .exe file on the emulator, automatically when you run you program.
It seems that you have updated the paths, so linking is performed OK (Visual Studio can find the GledPlay.lib file) but you still need to configure your deployment setting.
Go to your project settings, Configuration Properties, Deployment. In the "Additional Files", you will find something like this:

GledPlay.dll|..\..\..\bin\VS2005 - PPC WM2005\|%CSIDL_PROGRAM_FILES%\WM2005|0

That is:

File|origin folder|destination folder|register file (0 or 1)

You must change the origin folder, to the {GLEDPLAY INSTALL DIR}\bin\VS2005 - PPC WM2005.

Anyway, your exe file was successfully built. If you copy the dll file right next to it on your emulator, and you execute it, it will run OK.

Please, let me know if this solved the problem.

Thank you,
Sergio Fierens Bayo.
Hi! Thanks a lot for explanation, everything deploys fine now.

Btw, looks like there is a mistake in http://www.gledplay.com/doc/GledSave/File.html#open code example, imageFile.close(); shoud be changed to textFile.close(); (first part for text file opening)

When I'm trying to open and read file into the buffer, I get linking error: error
LNK2019: unresolved external symbol "__declspec(dllimport) public: long __cdecl File::read(void *,unsigned int)" (__imp_?read@File@@QAAJPAXI@Z) referenced in function "public: virtual long __cdecl InitialApplication::onNextFrame(class Surface *)" (?onNextFrame@InitialApplication@@UAAJPAVSurface@@@Z)

Maybe it because of this part of the code
Code:
if ( (returnCode = zipFile.resolveFile(&textFile;, TEXT("DIALOG.txt"))) == ReturnCode:: OK )

because it is sthe only line I modified in http://www.gledplay.com/doc/GledSave/File.html#open example.

Many other functions works great, I'll write if something goes wrong.
Ryumaster,

An old .h slipped in the last distribution and that´s why we have the linking problem. It´s now fixed and working fine. Please download again the distribution:

http://www.gledplay.com/downloads/GledPlay_0-0-1.zip

I want to make a remark in the documentation. Please download again the gledsave open example. There was a mistake and the zip: theme was missing in the open command.

This is wrong:

Code:
fsm.resolveFile(&zipFile;, TEXT("mygame_res.zip"))


the correct example must be:

Code:
fsm.resolveFile(&zipFile;, TEXT("zip:mygame_res.zip"))


See the complete example here:

http://www.gledplay.com/doc/GledSave/File.html#open

Thank you very much for the bug report and the doc remark.

If you have any doubts, please, ask as many times as you want.

See you

Matias Saguir
Good day! Thanks for fixing, now this step works fine.
Could you please explain to me, from where or how GledPlay reads data path? For example, here is simple part of code:

Code:
if ( (returnCode = fsm.resolveFile(&textFile, TEXT("DIALOG22.TXT"))) == ReturnCode:: OK )
{
if ( (returnCode = textFile.open()) == ReturnCode::OK )
{
while ( (readBytes = textFile.read(buffer, 500)) > 0 )
{
}

if ( readBytes < 0 ) {
// your error code
}
textFile.close();
}
}

Text file "DIALOG22.txt" can even not exist at all, but I will still get program running, and get returning code "OK" and see empty variable "&textFile".
Well, after whole part of this code is finished, rerutncode is always changing from OK to "{The system cannot read from the specified device. )"
So I'm afraid I just do not understand how to set data path properly and will be happy to hear a soluton from you.
All the best!
First of all. If the file exists the open method must return ReturnCode::OK. I understand that the file does not exist and you are asking why the resolve method is returning OK. If I understand it wrong, please, ask again.


Now.

You are right.

DIALOG22.txt can even not exist at all, and the return code will be OK.

In GledSave you can resolve files, even if they do not exist, because you resolve them before creating them or before opening them.

GledSave was desing to fulfill more than a simple file system. This abstraction let you handle any file in any file system in the same way. This aproach makes possible to add ftp or other network filesystem. We have not yet implemented them but they will be introduced in a near future.

For example in an ftp filesystem when you resolve the file you set the connection values (ip, user, password). Then the open method try to start the connection.

Also i want to make a remark in the ReturnCode enumeration from GledPlay
. You are reading the description that windows get from the return value ("The system cannot read from the specified device." ) This has nothing to do with GledPlay, you must compare with the ReturnCode:: enumerator. The correct value for your example will be ReturnCode::ERROR_OPENING_FILE




At last, I will make an example to show the benefits in coding process that GledSave introduces and the power of this abstraction.

The first code will show you how to acceses two files, a text file and an image in a directory located in c:\.


Code:

FileSystemManager fsm;
HRESULT returnCode;
File root;
File textFile;
File imageFile;

if ( (returnCode = fsm.resolveFile(&root;, TEXT("c:\\ testfolder"))) != ReturnCode::OK ) {
// you must handle the error.
}

if ( (returnCode = root.resolveFile(&textFile;, TEXT("banner.txt"))) != ReturnCode::OK ) {
// again, handle the error.
}

// you do what you want with your file
// you must open it first.

if ( (returnCode = root.resolveFile(&imageFile;, TEXT("image.png"))) != ReturnCode::OK ) {
// again, handle the error
}

// you do what you want with your files.


Now you want to package all your files in a zip, you just have to change very little in your code, watch..

Code:

FileSystemManager fsm;
HRESULT returnCode;
File root;
File textFile;
File imageFile;

if ( (returnCode = fsm.resolveFile(&root;, TEXT("zip:c:\\testfolder.zip"))) != ReturnCode::OK ) {
// you must handle the error.
}

if ( (returnCode = root.resolveFile(&textFile;, TEXT("banner.txt"))) != ReturnCode::OK ) {
// again, handle the error.
}

// you do what you want with your file
// you must open it first.

if ( (returnCode = root.resolveFile(&imageFile;, TEXT("image.png"))) != ReturnCode::OK ) {
// again, handle the error
}

// you do what you want with your files.


As you can see, you only have to change the path to a zip. All the others calls in the exmaple keep the same.

In the future you will be able to do the same with ftp. You will only have to get the root of the ftp and that´s all.

Or maybe better, you will change the source of your files dynamically on user commands (change the ftp or switch between ftp and zip files), and your code will keep perfectly nice.

If you have any doubts, or I wasn´t clear enough please, ask as many times as you want.

See you

Matias Saguir
Thanks a lot, your answer was very clear.
The only thing is that I still can't get it working.
I have tryed placing file DIALOG.txt in:
zip archive, project folder, C:\tempfolder (on pc and ppc), game folder at ppc (afcourse, modifing program code to fit situation), and in every case this part of code

Code:
if ( (returnCode = fsm.resolveFile(&textFile, TEXT("DIALOG.TXT"))) == ReturnCode::OK )
{

if ( (returnCode = textFile.open() ) == ReturnCode::OK )
{
while ( (readBytes = textFile.read(buffer, 500)) > 0 )
{
// do something with the buffer
}

if ( readBytes < 0 )
{
// your error code
}
textFile.close();
}
}

is being skipped from
Code:
if ( (returnCode = textFile.open() ) == ReturnCode::OK )
line as something wrong with the file.open (file do not exist?), too bad I can not track ReturnCode error. I tryed to use different files, like image.png and e.t.c. Mmm, when you did test code supplied as sample on your mashine, u just placed file in directory resolved by FSM and everything worked fine?
We are currently checking this issue. We'll come back to you in no time.
Yeah, sure, this is beta testing and I understand it pretty clear. Your new and now deleted version of fixed relatives paths is working anyway, dont know about absolute paths, but if I'll use them I'll test them :) And thanx for explanation about where to put files.
Hi Ryumaster,
We deleted that version because it still had some issues with the XP binaries. As I understand, you are working with the WM2005 project, so it didn't affect you.
Anyway, it may be better to download the new version now, where that issue is completely fixed (and documentation has been improved).
Also, I've published the explanation about where to put files in another thread, as it may be useful for other people too.

Thank you for all your feedback, we really appreciate it.

Regards,
Sergio.