Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - RetroX

Function Peer Review / Re: NEEDED FUNCTION LIST
« on: December 15, 2010, 08:38:23 PM »
Anyone can update it when they want.  But thanks.

Did you use the script that I wrote or did you just take out already implemented functions?

General ENIGMA / Re: variable_* Functions
« on: December 15, 2010, 08:21:19 PM »
Ah, okay.  I thought that you were just loading the symbols from the binary; apparently, you're just loading the symbols from the currently loaded part in memory.

Off-Topic / Re: Does the tracker need severity?
« on: December 15, 2010, 04:23:05 PM »
Aren't you agreeing then? The developers can set the ticket priorities so that users will know when their problem is fixed.
I agree with the OP.  I disagreed with the post before mine.

Sorry for not being specific.

General ENIGMA / Re: variable_* Functions
« on: December 15, 2010, 04:22:47 PM »
GetProcAddress uses a string map constructed with the symbols declared __declspec(dllexport). It's the same thing but a string map gives you control over the implementation and is cross-platform.
I also wasn't thinking when I made that other post. :V

Yeah, you're right.  That makes more sense, now that I think about it.

The problem that I still see is that you're getting a symbol for a variable.  You're not getting its value; that value is stored in memory, and not the binary.

Function Peer Review / Re: clamp()
« on: December 14, 2010, 07:34:40 PM »
eh I really wasn't paying attention when I wrote this

But yeah, median works. :V  So does minmax.

Off-Topic / Re: Does the tracker need severity?
« on: December 14, 2010, 07:03:28 PM »
I disagree.  Priority shows a user when their problem will be fixed.

General ENIGMA / Re: variable_* Functions
« on: December 14, 2010, 06:07:18 PM »
@RetroX  I do not see how this would conflict with ENIGMA's instances.

Also, see
Executables are basically shared libraries.

See also GetModuleHandle(NULL) and GetProcAddress (Windows-only, Linux has similar functions)

EDIT: Windows source-code:
Code: (C) [Select]
#include <stdio.h>
#include <windows.h>

typedef void (*func)(const char*);

extern "C" {
__declspec(dllexport) char* message = "HELLO WORLD!";

__declspec(dllexport) void display_message(const char* msg) {
        printf("Message: %s\n", msg);

int main() {
        HMODULE module = GetModuleHandle(NULL);
        char** msg = (char**) GetProcAddress(module, "message");
        func disp = (func) GetProcAddress(module, "display_message");


        return 0;

This works fine as an executable, without compile-time tricks. Note that this is NOT a DLL.
This probably would also work on Linux with some minor changes(dlopen instead of GetModuleHandle?)
Yes, this works with globals.  It does not work with locals.

Also, a string map would probably be faster.

General ENIGMA / Re: variable_* Functions
« on: December 13, 2010, 07:42:09 PM »
Regarding global variables, I'm pretty sure some nasty executable file format-based hacks might work. However, only if the variable type is known ahead-of-time. In other words, if you declared a global int x and then accessed it as a var it would fail miserably.

I mean, LLVM does stuff like that.
Note that on Windows it could require declaring all globals with __declspec(dllexport).

All this without requiring massive maps of pointers.
For local variables, though, you guys would be totally screwed.
That would only work if the game was compiled as a shared library, and it wouldn't work with how ENIGMA's instances are organised.

You can't just access variables by symbol at runtime; it doesn't work that way.

Function Peer Review / clamp()
« on: December 13, 2010, 04:15:09 PM »
Code: [Select]
double clamp(double x, double lower, double upper) { return (x < lower ? lower : (x > upper ? upper : x)); }
Simple function that would be useful.

General ENIGMA / Re: Cross-compiling
« on: December 12, 2010, 05:05:57 PM »
Opened ENIGMA settings lately, Retro?
Linkers aren't in there, though. :V

General ENIGMA / Re: Cross-compiling
« on: December 11, 2010, 08:53:05 PM »
Also, as a random thing to add, this will also allow us to use other libraries in our games by enabling usage of linker flags.

For example, if I wanted to use Box2D in a game, I could add the -lBox2D flag.

General ENIGMA / Cross-compiling
« on: December 10, 2010, 07:40:25 PM »
Would be a really neat feature to have.

But I don't see it as being possible currently.

Ideally, LGM would be able to specify a compile command (by default, g++) for the makefiles, as well as a list of default flags to the compilers (such as -m32 and -m64).  This would enable me to do things like turning on the -m32 flag, or using i486-mingw32-g++ as the compile command so that I can cross-compile to Windows.

I also propose that -mtune=generic is added to the default flags, because it avoids runtime conflicts or something like that.  I add that in my packages right now through sed, but it would be a good idea for default.  Probably would be ignored under everything but Linux and Android, but MinGW should still support it.

Function Peer Review / Re: NEEDED FUNCTION LIST
« on: December 10, 2010, 07:07:01 PM »
Damn, I don't have Linux. I could use cygwin, but I had problems with it before, so no thanks.

Install MSYS and you can run this script in it. :D

Just put it into a file and run script > list to make a text file with the list contents.

General ENIGMA / Re: Linux Repositories
« on: December 10, 2010, 06:21:22 PM »
Package has been updated so that now, all game objects are pre-compiled.  Systems such as graphics and audio, which are needed for every game, are already included in the package.

EDIT: Apparently, the packages are broken, currently.  Fixing later.

Function Peer Review / Re: NEEDED FUNCTION LIST
« on: December 10, 2010, 03:35:39 PM »
What did you use to match up thous two lists?
Code: [Select]
enigma=`cat enig | sort -u`
gm=`cat gm | sed '/^\/\//d' | sed '/^[[:space:]]*$/d' | sort -u`
while [[ "$gm" != "" ]]; do
  current=`echo "$gm" | sed '2,$d'`
  currentcheck=`echo "$current" | sed 's/[*#]$//' | sed 's/(.*)$//' | sed 's/\[.*\]$//'`
  if [[ `echo "$enigma" | grep "^$currentcheck"` == "" ]]; then
    echo "$current"
  gm=`echo "$gm" | sed '1d'`

enig being a copypaste of the keyword lists, while gm being fnames from GM