Page 1 of 1

The AddonManager

PostPosted: 19 Oct 2011, 13:17
by Edward_Lii
Hello all,

The addon manager should work now. :cool:
The addons are hosted on the project web space on Sourceforge.
I'm afraid that it might not work under Windows because of some file/directory functions I wrote.
Feedback is welcome! ;)

Currently these are the addons.
Levels:
    * Fragile by Edward_Lii (link)
    * Elevator by Edward_Lii (link)
Levelpacks:
    * Edward_Lii's_levelpack by Edward_Lii (link)
Themes:
    * Cloudscape by Tedium (link)

If you find any bugs please report them.
Todo:
- Add the other levels from this thread: http://forum.freegamedev.net/viewtopic.php?f=48&t=1402
- Test/fix for Windows. --(Done by acme_pjz)

Re: The AddonManager

PostPosted: 19 Oct 2011, 13:20
by charlie
If you install WINE you should be able to test on Windows, no?

Re: The AddonManager

PostPosted: 19 Oct 2011, 13:34
by Edward_Lii
Hello charlie,

charlie {l Wrote}:If you install WINE you should be able to test on Windows, no?

That's a good idea, never thought of that.
I'll try to cross compile meandmyshadow and then run it under wine.

Re: The AddonManager

PostPosted: 20 Oct 2011, 00:24
by KroArtem
Actually, internet option doesn't work for me (ubuntu 11.10, 64-bit). Also sometimes after entering 'levels' window icons of levels disappear and there is a white screen with buttons 'back', 'levels', etc. But I cannot choose a level to play. Don't know how to reproduce though.

Re: The AddonManager

PostPosted: 20 Oct 2011, 14:52
by acme_pjz
Hi,

I fixed the remove directory code for Windows but I'm not sure the mechanism of this function :|

As for addon manager, I got this message:

ERROR: Unable to create the installed_addons file.

Any ideas?

Re: The AddonManager

PostPosted: 21 Oct 2011, 07:30
by Edward_Lii
KroArtem {l Wrote}:Actually, internet option doesn't work for me (ubuntu 11.10, 64-bit).

It's probably because you've got an old meandmyshadow.cfg file which doesn't have the internet setting.
I've fixed the problem in the latest svn. (revision 98)

KroArtem {l Wrote}:Also sometimes after entering 'levels' window icons of levels disappear and there is a white screen with buttons 'back', 'levels', etc. But I cannot choose a level to play. Don't know how to reproduce though.

Strange, I was able to reproduce it by entering a non existing levelpack name.
I think that the "File name" option should be removed when selecting levels and levelpacks.

acme_pjz {l Wrote}:I fixed the remove directory code for Windows but I'm not sure the mechanism of this function :|

Thanks, the function loops the content of the folder and removes the files.
It will call itself recursively to do the same for the folder inside.
It has to be done this way because rmdir() only removes empty directories.

acme_pjz {l Wrote}:As for addon manager, I got this message:

ERROR: Unable to create the installed_addons file.

Any ideas?

It should just create the file installed_addons. (getUserPath()+"installed_addons")
I've changed the code so it will write a space with a carriage return before closing the file, hopes it helps.

Re: The AddonManager

PostPosted: 21 Oct 2011, 15:47
by acme_pjz
Hi Edward_Lii,

In Windows there is a function which can recursively delete files and folders. But I think if I use this function then it may probably delete some other files by mistake...

Re: The AddonManager

PostPosted: 21 Oct 2011, 16:29
by Edward_Lii
Hello acme_pjz,

acme_pjz {l Wrote}:In Windows there is a function which can recursively delete files and folders. But I think if I use this function then it may probably delete some other files by mistake...

I think I came across this function when looking for a way to remove a directory.
I think it isn't needed to change it, if it works don't fix it. ;)

acme_pjz {l Wrote}:ERROR: Unable to create the installed_addons file.

Do you still get this error?

Re: The AddonManager

PostPosted: 22 Oct 2011, 04:50
by acme_pjz
Hi,

Edward_Lii {l Wrote}:
acme_pjz {l Wrote}:ERROR: Unable to create the installed_addons file.

Do you still get this error?


I'm sorry I still get this error :( when I first use the addon feature. When I use it again there is no error but there is nothing displayed, and I try to click the "LevelPack" the game crashes :( and I fixed it in SVN version.

Re: The AddonManager

PostPosted: 22 Oct 2011, 05:01
by acme_pjz
And there is something wrong in archive extract path... maybe my libarchive build is incorrect...

Re: The AddonManager

PostPosted: 23 Oct 2011, 08:24
by Edward_Lii
Hello acme_pjz,

acme_pjz {l Wrote}:I'm sorry I still get this error :( when I first use the addon feature. When I use it again there is no error but there is nothing displayed, and I try to click the "LevelPack" the game crashes :( and I fixed it in SVN version.

Somehow the addons file doesn't get downloaded.
When you selected the addons menu for the first time, is the addons file in the userPath?
All I can think of is that the userPath doesn't end on a \, or the downloading fails.
If you add these lines in FileManager.cpp:
{l Code}: {l Select All Code}
void downloadFile(const string &path, FILE* destination) {
   CURL* curl=curl_easy_init();
   /*// proxy test (test only)
   curl_easy_setopt(curl,CURLOPT_PROXY,"127.0.0.1");
   curl_easy_setopt(curl,CURLOPT_PROXYPORT,"8081");
   //*/
   curl_easy_setopt(curl,CURLOPT_URL,path.c_str());
   curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,writeData);
   curl_easy_setopt(curl,CURLOPT_WRITEDATA,destination);

   CURLcode res = curl_easy_perform(curl); //These two lines
   cerr<<res<<endl;

   curl_easy_cleanup(curl);
}

If there's a non zero value it's an error. (Error codes)

acme_pjz {l Wrote}:And there is something wrong in archive extract path... maybe my libarchive build is incorrect...

I'm afraid I don't know howto check if your libarchive is defect.

BTW, I've changed the code in the removeDirectory function.
The code wasn't working for me, it could be that you'll need to change the Windows code as well.

Re: The AddonManager

PostPosted: 23 Oct 2011, 11:32
by acme_pjz
Hi,

Edward_Lii {l Wrote}:
acme_pjz {l Wrote}:I'm sorry I still get this error :( when I first use the addon feature. When I use it again there is no error but there is nothing displayed, and I try to click the "LevelPack" the game crashes :( and I fixed it in SVN version.

Somehow the addons file doesn't get downloaded.
[/quote]

My fault :| because I write a wrong code:

{l Code}: {l Select All Code}
curl_easy_setopt(curl,CURLOPT_PROXYPORT,"8081");


It should be:

{l Code}: {l Select All Code}
curl_easy_setopt(curl,CURLOPT_PROXYPORT,8081);


Edward_Lii {l Wrote}:
acme_pjz {l Wrote}:And there is something wrong in archive extract path... maybe my libarchive build is incorrect...

I'm afraid I don't know howto check if your libarchive is defect.


I don't know, libarchive just extract files to wrong directory... More clearly, if the user path is "D:\Document and Settings\blah blah blah", then libarchive extract files to "<The game executable file's path>\D_\Document and Settings\blah blah blah", I don't know if it's libarchive's problem or wrong config of my own build...

Edward_Lii {l Wrote}:BTW, I've changed the code in the removeDirectory function.
The code wasn't working for me, it could be that you'll need to change the Windows code as well.


I'll check it soon ;)

Re: The AddonManager

PostPosted: 23 Oct 2011, 11:45
by Edward_Lii
Hello acme_pjz,

acme_pjz {l Wrote}:My fault :| because I write a wrong code:
{l Code}: {l Select All Code}
curl_easy_setopt(curl,CURLOPT_PROXYPORT,"8081");


It should be:

{l Code}: {l Select All Code}
curl_easy_setopt(curl,CURLOPT_PROXYPORT,8081);

I'm glad it's solved. :)

acme_pjz {l Wrote}:I don't know, libarchive just extract files to wrong directory... More clearly, if the user path is "D:\Document and Settings\blah blah blah", then libarchive extract files to "<The game executable file's path>\D_\Document and Settings\blah blah blah", I don't know if it's libarchive's problem or wrong config of my own build...

Well the magic happens in this line of code:
{l Code}: {l Select All Code}
archive_entry_set_pathname(entry,(destination+archive_entry_pathname(entry)).c_str());

destination = /home/edward/.meandmyshadow/levelpacks/edward/ (getUserPath()+"/levelpacks/"+selected->folder+"/")
And the archive_entry_pathname is something like Blockade.map, levels.lst, etc..

Maybe under Windows the archive_entry_pathname is different?

Re: The AddonManager

PostPosted: 24 Oct 2011, 09:57
by acme_pjz
I guess something is wrong in Windows implementation of archive_entry_set_pathname() or extracting files in libarchive...