Pages: 1
  Print  
Author Topic: ENIGMA IS A MAZE  (Read 3622 times)
Offline (Unknown gender) TheExDeus
Posted on: February 21, 2012, 03:17:10 PM

Developer
Joined: Apr 2008
Posts: 1872

View Profile
Maybe Josh can make a graph detailing how and what is called from the "Run" button to the first frame of the launched program. Right now I can't figure out what is called in what order and where it is called from. I am looking into Android now and in the new versions of NDK it can compile so called Native programs (that is C++ without any Java or even wrappers for Java code). So I can code everything in pure C++ and run it. I wanted to create the basic framework in ENIGMA so I could launch it, but I don't know where to start. The Platforms folder has functions that I know are called in the beginning (like win32 window create function) but I don't know where it is called from. I looked in the SHELLmain, but it didn't get any clearer. I can't actually find "main()". I also see that there is a lot of useless code (which I thought was removed last October when Josh did "the clean up"). One example of that is COLLIGMA which pops up here and there. I also think folders like Universal_System should be better structured (like Load and resource inits in one folder, general purpose functions in another and so on).
Basically, I really love ENIGMA and I want to use it everywhere, but there is a lot of obstacles in the way of that. Slow progress is one thing.. for example, the "Clean released" option with .ico support is still not there. MinGW didn't fix that bug you were having? And weren't there a workaround? Its just that the parser you are always working on actually does its job. There are bugs here and there, but mostly I can work around them. I think its much more important to make everything usable and structured and only then update/optimize/rewrite something.
« Last Edit: February 21, 2012, 03:20:57 PM by HaRRiKiRi » Logged
Post made February 22, 2012, 10:20:28 AM was deleted at the author's request.
Offline (Male) Josh @ Dreamland
Reply #2 Posted on: February 22, 2012, 11:38:35 AM

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2959

View Profile Email
I've been trying to think of a good graph structure for the job. Some kind of flow chart, obviously, but it'd be good if the nodes on it could be expanded and hidden. I'll think about that--it could be a cool new way to document applications.

Also, MinGW fixed that bug three days ago. It should be upstream here shortly. I think.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Post made February 22, 2012, 01:18:33 PM was deleted at the author's request.
Offline (Female) IsmAvatar
Reply #4 Posted on: February 22, 2012, 03:01:00 PM

LateralGM Developer
LGM Developer
Location: Pennsylvania/USA
Joined: Apr 2008
Posts: 886

View Profile Email
main() is a method for programs that compile into an exe. ENIGMA is a dll. DLLs have multiple external functions that another program will call. These are usually marked as `extern "C"`. In ENIGMA, we have a macro defining `dllexport` to the appropriate export flags. The main ones are defined in CompilerSource/main.cpp.

For an overview of the dll-exported functions, please see the Driver wiki page: http://enigma-dev.org/docs/Wiki/EnigmaDriver as well as the more general Backend page which covers everything lower-level from the Plugin's side: http://enigma-dev.org/docs/Wiki/Backend
« Last Edit: February 22, 2012, 03:02:38 PM by IsmAvatar » Logged
Offline (Unknown gender) TheExDeus
Reply #5 Posted on: February 22, 2012, 06:51:12 PM

Developer
Joined: Apr 2008
Posts: 1872

View Profile
Quote
main() is a method for programs that compile into an exe. ENIGMA is a dll.
I meant the game itself. The game has to have a main() as that is the entry point. I just want to know in which order the init functions are called when I launch the program. And where these functions are populated via the plugin. I will maybe make a graph later on how a basic Android application would call things.
Logged
Offline (Male) Josh @ Dreamland
Reply #6 Posted on: February 22, 2012, 08:21:09 PM

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2959

View Profile Email
https://github.com/enigma-dev/enigma-dev/blob/master/ENIGMAsystem/SHELL/Platforms/Win32/WINDOWSmain.cpp
https://github.com/enigma-dev/enigma-dev/blob/master/ENIGMAsystem/SHELL/Platforms/xlib/XLIBmain.cpp
https://github.com/enigma-dev/enigma-dev/blob/master/ENIGMAsystem/SHELL/Platforms/Cocoa/CocoaMain.cpp
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Female) IsmAvatar
Reply #7 Posted on: February 22, 2012, 11:38:04 PM

LateralGM Developer
LGM Developer
Location: Pennsylvania/USA
Joined: Apr 2008
Posts: 886

View Profile Email
Ah, in that case, you're dealing with platform-specific code, since we generate platform-specific exes (or elfs or apps), and initialization sets up platform-specific things (like the window). As you can probably figure out from the wiki, ENIGMAsystem/SHELL houses the game code. From there, logically, you would look in Platforms for platform specific code, and then identify your platform, and then seek out the respective main.cpp (Josh points them out).
Hope that helps.
Logged
Offline (Male) ugriffin
Reply #8 Posted on: February 23, 2012, 03:31:12 AM

Member
Location: London, United Kingdom
Joined: Dec 2010
Posts: 23

View Profile WWW Email
The return key makes for an excellent way to make your post more readable.  :eng101:
Logged
Offline (Unknown gender) TheExDeus
Reply #9 Posted on: February 23, 2012, 03:27:43 PM

Developer
Joined: Apr 2008
Posts: 1872

View Profile
Quote
The return key makes for an excellent way to make your post more readable.  :eng101:
Yeah I wanted to write the topic just like ENIGMA is now structured.

IsmAvatar: I knew that. I just didn't know in what order everything is called. I just figured out that WinMain was the entry point for windows app. I thought it was main() like usual. I think I get kind of sort of what is going on now. I will probably not be able to use enigma::initialize_everything(); if that is not OS specific, as Android requires external resources and so on. But I should be able to make the basic functions.
Logged
Offline (Female) IsmAvatar
Reply #10 Posted on: February 24, 2012, 05:28:30 PM

LateralGM Developer
LGM Developer
Location: Pennsylvania/USA
Joined: Apr 2008
Posts: 886

View Profile Email
Oh yeah, I forgot that Windows does the goofy WinMain thing. Xlib/Linux still uses main() though. Understanding the ordering of things there really just depends on understanding the underlying library - windows.h or X. It's not really our fault if those systems are a maze :-p
Logged
Offline (Male) RetroX
Reply #11 Posted on: February 24, 2012, 08:39:25 PM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
Windows does WinMain because it differentiates between console and graphical applications. Linux doesn't. :P

You can technically still use main() with a Windows application, but it's usually messier.
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Unknown gender) TheExDeus
Reply #12 Posted on: February 25, 2012, 12:23:07 PM

Developer
Joined: Apr 2008
Posts: 1872

View Profile
Also, where can I specify an include directory? Is it searchdirs: in the .ey?

edit: Whatever. Somebody here with a half decent brain would hook up Android. I can't, because I just can't navigate that maze. The creator (e.g. Josh) could. So again, I will just wait for someone to hook it up and I will make functions for it (like OpenGLES drawing functions). The basic idea is to use the new NDK. Then create basic 5 functions or so (AndroidMain is the entry point, then like 3 feedback functions for cmd's (like destroy window) and inputs (sensors)) and make it compile using ndk-build.

An example: http://developer.android.com/reference/android/app/NativeActivity.html

I could get to the point where it asks for jni.h (which I know where it is). As I don't know where to specify the include dirs I just copied it to MinGW (which is creates a shitload of conflicts). Now I just have problems with Actions (like place_free) not being defined in some scope. No idea how I ended up with that error. Now even my Windows compile doesn't work.

I can compile that example using the ndk-build and so on. So that works. I can even run it on emulator. Its just that I can't make ENIGMA do the same.
« Last Edit: February 25, 2012, 12:29:28 PM by HaRRiKiRi » Logged
Pages: 1
  Print