![]() |
|
This thread is locked; no one can reply to it.
![]() ![]() |
1
2
|
AMGC2 Loader |
juvinious
Member #5,145
October 2004
![]() |
I wrote a command line utility to load AMGC2 plugins, making it easier for me to test and develop new plugins without having to load the GUI each time. The benefit of course is that it doesn't require me to use MASkinG and allows me to play the game. Feedback is appreciated. [edit] __________________________________________ |
miran
Member #2,407
June 2002
|
Nice. The links don't seem to work though. Could be a firewall thing on my side... Anyway, the games are basically just plugins and IGame.h fully defines the interface, so yeah, anyone can make a client. -- |
juvinious
Member #5,145
October 2004
![]() |
Updated the links, hopefully they'll go through. It does offer a menu for doing the settings and save them in a .cfg file. You can also create key bindings manually for it like you do in amgc2 in the .cfg file. I don't see the need for keeping highscores so I left that out. It does however print out your highscore on the cl when you are done. One thing to note is that many of the games, mine included, are dependant on the location from which they are started. ie they look for their data files and what not in ./games/pluginname __________________________________________ |
miran
Member #2,407
June 2002
|
The thing is I only added SetGamePath (is that what it's called? I forget) not long ago, in one of the most recent versions. So most of the games don't use it and still assume to be located where the author put them... EDIT: Links still don't work for me. I just get "loading ..." in the browser status bar and it never stops... -- |
Richard Phipps
Member #1,632
November 2001
![]() |
The webpage works for me. |
juvinious
Member #5,145
October 2004
![]() |
Miran: ok I attached the archive in the first post. __________________________________________ |
miran
Member #2,407
June 2002
|
As I said, could be a firewall thing on my side. I'm at work and there are some pretty paranoid people here, so half the internet doesn't work half the time... EDIT: I get this when running buildme.bat: Creating directory obj/... Creating directory dep/... Building... Compiling main.cpp... Linking amgc2load.exe... c:/mingw/bin/../lib/gcc-lib/mingw32/3.2.3/../../../libmingw32.a(main.o)(.text+0x 97):main.c: undefined reference to `WinMain@16'
EDIT: Adding END_OF_MAIN() fixed that. It works -- |
juvinious
Member #5,145
October 2004
![]() |
Oops forgot to add END_OF_MAIN() [edit] __________________________________________ |
miran
Member #2,407
June 2002
|
When I build in debug mode it says it can't load the dll... Otherwise this is what it prints: Initiating Allegro Loading game numbers.dll Successfully loaded Numbers This plugin has no configuration settings Couldn't init sound. Please check your configuration Disabling sound Opening in window Allocating screen buffer Please wait while game initiates . . . . . done! Your score was: 1 Unloading Resources Shutting down
-- |
juvinious
Member #5,145
October 2004
![]() |
Hmmm, when I get a chance I'll get my other box and play around with it on windows. So far that looks fine btw, could be problematic when deleting the game from memory, I'll need to check on that. But I assume the game otherwise plays fine? __________________________________________ |
miran
Member #2,407
June 2002
|
I'm home now, on Linux, and the program doesn't work! Any game I try it says this: Loading game template.so Failed to load games/template/template.so Doesn't matter if I build in debug or normal mode. When run in debug mode the main.log file looks like this: main.cpp, main (203) amgc2_wrapper.h, GetPlugin (319) amgc2_wrapper.h, GetPlugin (322) amgc2_wrapper.h, Plugin (244) amgc2_wrapper.h, Load (262) amgc2_wrapper.h, Load (265) amgc2_wrapper.h, Load (274) amgc2_wrapper.h, Load (280) amgc2_wrapper.h, Load (289) amgc2_wrapper.h, Load (294) amgc2_wrapper.h, Plugin (246) main.cpp, main (218) I just compiled the source, put the binary in the AMGC directory and ran it with amgc2loader games/template/template.so. Doing the same on windows works (although I haven't tried all games) except for crashing on exit... Btw, I noticed the following passage in your readme.txt: readme.txt said:
The benefit of course is that you don't need to I'd just like to say that you don't need to have MASkinG installed to play games with the original AMGC2 either. You just need MASkinG if you want to build the source code, which is only really applicable on Linux... -- |
Audric
Member #907
January 2001
|
juvinious said: (...) they all work except Blocks (...) Curse my metal body, I didn't update to the latest AMGC2 interface. |
miran
Member #2,407
June 2002
|
I think you don't need to change anything in the code, just recompile. The zip on the AMGC2 homepage has a windows exe that is already compiled with the latest specification. -- |
juvinious
Member #5,145
October 2004
![]() |
Hmm I figured out why it crashes on exit. Deleting the module from outside is not a good idea, which I was doing. You do include a creational method: extern "C" DLLEXPORT IGame* GetPlugin() { return new somegame; } It would be nice to add an additional: extern "C" DLLEXPORT void DestroyPlugin(IGame *game) { delete game; } It's recommended that deletion take place from inside the module just to play it safe. Oh and about not having MASkinG installed, I was more referring to having the entire AMGC2 installed and having to load the GUI each time to play/test a plugin. Which is what my utility allows me to do. I'll reword it... And the crashes loading plugins on linux seem to be a pain and consistent. __________________________________________ |
miran
Member #2,407
June 2002
|
Quote: It's recommended that deletion take place from inside the module just to play it safe.
Yeah, you're right. I'll make it so in the next revision while trying to keep backwards compatibility. Quote: And the crashes loading plugins on linux seem to be a pain and consistent.
They're not crashes, the plugins simply fail to load. I took a look at your code and it doesn't seem like you're doing anything any different than me. I really have no idea why simply loading a .so wouldn't work in your program when almost identical code works just fine for me. -- |
Thomas Fjellstrom
Member #476
June 2000
![]() |
Do either of you check dlerror for the reason the plugins are failing to load? -- |
miran
Member #2,407
June 2002
|
There is dlerror? -- |
juvinious
Member #5,145
October 2004
![]() |
Yes sir: [edit] __________________________________________ |
Thomas Fjellstrom
Member #476
June 2000
![]() |
I grepped through juvi's code, and didn't find one, so I had to ask. -- |
juvinious
Member #5,145
October 2004
![]() |
I updated the source to work mostly off of amgc2's source so you are going to need to have it to compile it, which will hopefully eliminate most if not all incompatibility issues. __________________________________________ |
Audric
Member #907
January 2001
|
Attached is the fixed version of Blockman, runs fine with AMGC2 Loader (tried MingW), except... the loader seems to reset and/or ignore the configuration ? push_config_state(); char path[1024]; snprintf(path, sizeof(path), "%s%s.cfg", game_path, GetName()); set_config_file(path); set_config_int("settings", blocks_settings[1].name, blocks_settings[1].value); pop_config_state(); Works fine, and is generic enough to suit any installation (game_path and GetName()) |
miran
Member #2,407
June 2002
|
Still doesn't work on linux. But now it says it failed to load .so (any .so I try, doesn't matter which) and then crashes... -- |
juvinious
Member #5,145
October 2004
![]() |
Ok I've updated it once again. Fixed tons of stuff and cleaned up the code. It's at version 1.8. Audric: Blocks works great and the configurations save correctly now with the latest changes. miran: I'm developing this in linux, I don't know what could be wrong. It re-uses your amgc2 code to properly handle the plugins. Could you try the latest version and see if it fixes any issues? Could be that the plugins need to be recompiled? Thanks all. __________________________________________ |
miran
Member #2,407
June 2002
|
I'll test when I get home this afternoon. I don't think anything needs to be recompiled because I recompile AMGC at the same time as your loader and it works while your loader doesn't. It's really weird... EDIT: Now it prints a different set of messages but basically still doesn't work: Initiating Allegro Opening in window Please wait while game initiates... Loading game template.so Failed to load template.so Oops! There was a problem with the plugin Terminating Unloading Resources Shutting down
-- |
juvinious
Member #5,145
October 2004
![]() |
That is very strange it shouldn't have a problem, especially if the plugins are being built against the same source. [edit] Quote:
EDIT: Now it prints a different set of messages but basically still doesn't work: Oops! There was a problem with the plugin
template.so? __________________________________________ |
|
1
2
|