The AddonManager

The AddonManager

Postby Edward_Lii » 19 Oct 2011, 13:17

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)
From,
Edward_Lii
User avatar
Edward_Lii
MnMS Moderator
 
Posts: 777
Joined: 20 Dec 2010, 16:46

Re: The AddonManager

Postby charlie » 19 Oct 2011, 13:20

If you install WINE you should be able to test on Windows, no?
Free Gamer - it's the dogz
Vexi - web UI platform
User avatar
charlie
Global Moderator
 
Posts: 2131
Joined: 02 Dec 2009, 11:56
Location: Manchester, UK

Re: The AddonManager

Postby Edward_Lii » 19 Oct 2011, 13:34

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.
From,
Edward_Lii
User avatar
Edward_Lii
MnMS Moderator
 
Posts: 777
Joined: 20 Dec 2010, 16:46

Re: The AddonManager

Postby KroArtem » 20 Oct 2011, 00:24

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.
KroArtem
 
Posts: 375
Joined: 26 Aug 2010, 19:04

Re: The AddonManager

Postby acme_pjz » 20 Oct 2011, 14:52

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?
Some of my open source games on GitHub
User avatar
acme_pjz
 
Posts: 665
Joined: 10 Dec 2009, 15:32
Location: PeeKing, China

Re: The AddonManager

Postby Edward_Lii » 21 Oct 2011, 07:30

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.
From,
Edward_Lii
User avatar
Edward_Lii
MnMS Moderator
 
Posts: 777
Joined: 20 Dec 2010, 16:46

Re: The AddonManager

Postby acme_pjz » 21 Oct 2011, 15:47

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...
Some of my open source games on GitHub
User avatar
acme_pjz
 
Posts: 665
Joined: 10 Dec 2009, 15:32
Location: PeeKing, China

Re: The AddonManager

Postby Edward_Lii » 21 Oct 2011, 16:29

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?
From,
Edward_Lii
User avatar
Edward_Lii
MnMS Moderator
 
Posts: 777
Joined: 20 Dec 2010, 16:46

Re: The AddonManager

Postby acme_pjz » 22 Oct 2011, 04:50

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.
Some of my open source games on GitHub
User avatar
acme_pjz
 
Posts: 665
Joined: 10 Dec 2009, 15:32
Location: PeeKing, China

Re: The AddonManager

Postby acme_pjz » 22 Oct 2011, 05:01

And there is something wrong in archive extract path... maybe my libarchive build is incorrect...
Some of my open source games on GitHub
User avatar
acme_pjz
 
Posts: 665
Joined: 10 Dec 2009, 15:32
Location: PeeKing, China

Re: The AddonManager

Postby Edward_Lii » 23 Oct 2011, 08:24

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.
From,
Edward_Lii
User avatar
Edward_Lii
MnMS Moderator
 
Posts: 777
Joined: 20 Dec 2010, 16:46

Re: The AddonManager

Postby acme_pjz » 23 Oct 2011, 11:32

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 ;)
Some of my open source games on GitHub
User avatar
acme_pjz
 
Posts: 665
Joined: 10 Dec 2009, 15:32
Location: PeeKing, China

Re: The AddonManager

Postby Edward_Lii » 23 Oct 2011, 11:45

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?
From,
Edward_Lii
User avatar
Edward_Lii
MnMS Moderator
 
Posts: 777
Joined: 20 Dec 2010, 16:46

Re: The AddonManager

Postby acme_pjz » 24 Oct 2011, 09:57

I guess something is wrong in Windows implementation of archive_entry_set_pathname() or extracting files in libarchive...
Some of my open source games on GitHub
User avatar
acme_pjz
 
Posts: 665
Joined: 10 Dec 2009, 15:32
Location: PeeKing, China

Who is online

Users browsing this forum: No registered users and 1 guest