OpenCV and MicroMacro
Forum rules
This is a sub-forum for things specific to MicroMacro.
This is not the place to ask questions about the RoM bot, which uses MicroMacro. There is a difference.
This is a sub-forum for things specific to MicroMacro.
This is not the place to ask questions about the RoM bot, which uses MicroMacro. There is a difference.
- Administrator
- Site Admin
- Posts: 5314
- Joined: Sat Jan 05, 2008 4:21 pm
Re: OpenCV and MicroMacro
Good stuff. Make another reply once you get it all compiled and I'll add it to the main site.
Did you fork my repository? If so, what's the URL?
Did you fork my repository? If so, what's the URL?
Re: OpenCV and MicroMacro
I simple merge with WinMerge the whole time maybe I should make repository. I did once for the Bot-Framework but haven't the time to actually use it.
Anyway what I did was I moved the winsock.h into the wininclude.h and made sure that I haven't any other windows.h around this was what made the most trouble besides recursive definitions and I also renamed your Socket class to PSocket to avoid name conflicts.
Today I found a missing 'static' again with the logs but after I added it it worked.
What I have to do I add somehow at least : "with OpenCV extension" to the Version somehow and currently I have a buffer overflow when use your http.download.lua for testing. I'm not sure when I through with finding the problem.
--removed--
Edit2:
After watching the runInit function it seems I end here
I suspect it has maybe something to do with arguments
but we return only 1 argument if success
Anyway what I did was I moved the winsock.h into the wininclude.h and made sure that I haven't any other windows.h around this was what made the most trouble besides recursive definitions and I also renamed your Socket class to PSocket to avoid name conflicts.
Today I found a missing 'static' again with the logs but after I added it it worked.
What I have to do I add somehow at least : "with OpenCV extension" to the Version somehow and currently I have a buffer overflow when use your http.download.lua for testing. I'm not sure when I through with finding the problem.
--removed--
Edit2:
After watching the runInit function it seems I end here
Code: Select all
int failstate = lua_pcall(lstate, nargs, 0, stackbase+1);
Code: Select all
local connected,err = socket:connect(host, 80);
print("Connected:", connected, err);
Code: Select all
luaL_getmetatable(L, LuaType::metatable_socket);
lua_setmetatable(L, -2);
return 1;
Jack-of-all-trades, but master-of-only of a few
My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226
My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226
- Administrator
- Site Admin
- Posts: 5314
- Joined: Sat Jan 05, 2008 4:21 pm
Re: OpenCV and MicroMacro
That's OK. When you return in a C++ callback, Lua will pop anything down to keep things on track.
If you can narrow it down to maybe ~10 lines of Lua code that is causing a buffer overrun, I can fix it. I do know that the networking stuff does still need some work and likely has a number of issues. As for the static variable with the logger, do you have any more information so I can make the correction on my end?
If you can narrow it down to maybe ~10 lines of Lua code that is causing a buffer overrun, I can fix it. I do know that the networking stuff does still need some work and likely has a number of issues. As for the static variable with the logger, do you have any more information so I can make the correction on my end?
Re: OpenCV and MicroMacro
took me some while but I found the reason:
Printing userdata out I don't think that is a good idea. I think you forgot to mark it as such.
This caused the buffer overflow. I still have no connection but I suspect I must make the firewall free on foot.
(The line seems like the typical last minute change )
Edit: okay 32% download than again buffer overflow *wurg*
Edit2: After a few test it suddenly works.
Code: Select all
--print("Socket:", socket);
This caused the buffer overflow. I still have no connection but I suspect I must make the firewall free on foot.
(The line seems like the typical last minute change )
Edit: okay 32% download than again buffer overflow *wurg*
Edit2: After a few test it suddenly works.
Jack-of-all-trades, but master-of-only of a few
My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226
My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226
- Administrator
- Site Admin
- Posts: 5314
- Joined: Sat Jan 05, 2008 4:21 pm
Re: OpenCV and MicroMacro
Here's what printing a socket does:
Code: Select all
int Socket_lua::tostring(lua_State *L)
{
Socket *pSocket = *static_cast<Socket **>(lua_touserdata(L, 1));
char buffer[64];
slprintf(buffer, sizeof(buffer), "Socket (0x%p)", pSocket->socket);
lua_pushstring(L, buffer);
return 1;
}
I can't see any valid reason that should ever get anywhere close to 64+ characters, but even if it did slprintf() should prevent it from doing anything bad. Have you modified this function?Script> exec
Entering interactive mode. Enter 'exit' to quit.
> print( network.socket() );
Socket (0x00000344)
Re: OpenCV and MicroMacro
I found what it was your are practically returning that buffer from that function.
After that call is over there is no buffer any more, so make it also static.
But here it is but I'm still looking of a way to change the version.
http://www.mediafire.com/download/5zh6n ... 64-bit.zip
After that call is over there is no buffer any more, so make it also static.
But here it is but I'm still looking of a way to change the version.
http://www.mediafire.com/download/5zh6n ... 64-bit.zip
Jack-of-all-trades, but master-of-only of a few
My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226
My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226
- Administrator
- Site Admin
- Posts: 5314
- Joined: Sat Jan 05, 2008 4:21 pm
Re: OpenCV and MicroMacro
Can you elaborate? It is not returning any buffer. lua_pushstring() creates its own copy of the string, so it should not be causing any issues of the sort. Or did you mean slprintf()?I found what it was your are practically returning that buffer from that function.
After that call is over there is no buffer any more, so make it also static.
Re: OpenCV and MicroMacro
It run complete through tostring the other possibility is that there was a missing NULL termination.
When I look at this it could be also incompatible types, it is just mystic.lua_pushstring
const char *lua_pushstring (lua_State *L, const char *s);
Pushes the zero-terminated string pointed to by s onto the stack. Lua makes (or reuses) an internal copy of the given string, so the memory at s can be freed or reused immediately after the function returns.
Returns a pointer to the internal copy of the string.
If s is NULL, pushes nil and returns NULL.
Jack-of-all-trades, but master-of-only of a few
My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226
My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226
- Administrator
- Site Admin
- Posts: 5314
- Joined: Sat Jan 05, 2008 4:21 pm
Re: OpenCV and MicroMacro
slprintf() should enforce a NULL-terminator. I've changed the code to attempt to manually create a buffer overflow, and the code properly protected against it. Have you modified either the Socket_lua::tostring() or slprintf() functions? Have you tried changing the %p to %x?
Re: OpenCV and MicroMacro
No but I think it is possible that VS compiler did something that it shouldn't since I have all optimization on in the compiler.
So I have add " with OpenCV " in the version .
http://www.mediafire.com/download/lpzpq ... 64-bit.zip
That should work.
+ added socket API from admin
+ update Open CV library to release version.
+ some minor changes about directory work also admin.
So I have add " with OpenCV " in the version .
http://www.mediafire.com/download/lpzpq ... 64-bit.zip
That should work.
+ added socket API from admin
+ update Open CV library to release version.
+ some minor changes about directory work also admin.
Jack-of-all-trades, but master-of-only of a few
My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226
My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226
- Administrator
- Site Admin
- Posts: 5314
- Joined: Sat Jan 05, 2008 4:21 pm
Re: OpenCV and MicroMacro
Did you use the slprintf() that I wrote, or does your compiler include its own copy? That could explain it.
There's a few minor issues with your release:
I went ahead and fixed up your package and put it on the main page.
There's a few minor issues with your release:
- It does not include license.txt; this is legally required
- You should rename config.lua to config.default.lua; config.lua will be generated out of it when first run and if something goes wrong the user can just delete it to reset it to default.
- You probably don't want to include your scripts.
- You shouldn't include logs, as they could potentially contain sensitive information.
- You should include version number in the zip filename.
I went ahead and fixed up your package and put it on the main page.
- Attachments
-
- gen.release.lua
- (1.99 KiB) Downloaded 940 times
Re: OpenCV and MicroMacro
This sounds like it would be fun to use with some cam's and a pea shooter. Have cams watch for bugs, flys etc then pop a pea at them.
Your so lucky to have started learning this language early its so hard for me to figure out every bit I code. I need lots of examples to complete a project.
Your so lucky to have started learning this language early its so hard for me to figure out every bit I code. I need lots of examples to complete a project.
Re: OpenCV and MicroMacro
The licence.txt went somehow away
The logs I noticed it seems you load a version down before I removed them
The scripts are there for tests and as fist steps examples at the same times.
Maybe I move some stuff also in libs the next time.
About : slprintf() I will take a look but it works fine for now , there was a collision with Socket which I solved with renaming , there is also a collision with Mutex which on top has also the same header name but seems no problem.
I think Tools need a Readme in the next version
http://www.mediafire.com/download/7fs9r ... 17_x64.zip
The logs I noticed it seems you load a version down before I removed them
The scripts are there for tests and as fist steps examples at the same times.
Maybe I move some stuff also in libs the next time.
About : slprintf() I will take a look but it works fine for now , there was a collision with Socket which I solved with renaming , there is also a collision with Mutex which on top has also the same header name but seems no problem.
I think Tools need a Readme in the next version
http://www.mediafire.com/download/7fs9r ... 17_x64.zip
Jack-of-all-trades, but master-of-only of a few
My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226
My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226
Re: OpenCV and MicroMacro
I had the idea what could micromacro do with object recognition ? Pick up Sykpe when a call comes in and activate something when it sees your face.beanybabe wrote:This sounds like it would be fun to use with some cam's and a pea shooter. Have cams watch for bugs, flys etc then pop a pea at them.
Your so lucky to have started learning this language early its so hard for me to figure out every bit I code. I need lots of examples to complete a project.
Jack-of-all-trades, but master-of-only of a few
My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226
My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226
- Administrator
- Site Admin
- Posts: 5314
- Joined: Sat Jan 05, 2008 4:21 pm
Re: OpenCV and MicroMacro
I moved those both into the MicroMacro namespace which should prevent collisions. Is that not the case, or perhaps you weren't caught up to that commit?BlubBlab wrote:there was a collision with Socket which I solved with renaming , there is also a collision with Mutex which on top has also the same header name but seems no problem
Re: OpenCV and MicroMacro
I didn't got any error from the Mutex I think it is possible the problem from the Socket was because I moved the winsocket2.h include into the wininclude.h.
Okay they aren't exactly the same name Socket(SOCKET)but it is confusing to read. I changed it because the whole include winsock2.h before windows.h because of wrong include orders you will have redefine errors. It was just a possibility which I had to eliminate to find the include problem.
Code: Select all
using namespace std;
struct PSocket
{
SOCKET socket;
HANDLE hThread;
int protocol;
bool connected;
bool open;
std::queue<Event> eventQueue;
std::queue<std::string> recvQueue;
Mutex mutex;
};
Jack-of-all-trades, but master-of-only of a few
My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226
My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226
Re: OpenCV and MicroMacro
slprintf() is your definition.
But I have an idea why after I saw this:
Everytime I use a var which includes an extern var I must make it static in VS that was also the reason for the changes to static in the main.cpp.
It is very indirect in this case but the best idea I have.
But I have an idea why after I saw this:
Code: Select all
namespace LuaType
{
extern const char *metatable_socket;
}
It is very indirect in this case but the best idea I have.
Jack-of-all-trades, but master-of-only of a few
My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226
My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226
- Administrator
- Site Admin
- Posts: 5314
- Joined: Sat Jan 05, 2008 4:21 pm
Re: OpenCV and MicroMacro
Yeah, that could be related. It's very strange though. That's an extern variable that is declared at global scope, and shouldn't need to be static because, well, it's global! I'm going to chalk this one up to Microsoft's non-standard compiler causing issues.
Re: OpenCV and MicroMacro
*Merge with current version of MM2*
Check list:
-licence
-removed logs
-add manifest
-removed plugins directory
-updated source code in src (repository is also updated)
-add README to directory tools
-add a forgotten tool
Micromacro 2 with opencv 64-bit version http://www.mediafire.com/download/gdvex ... 05_x64.zip
Micromacro 2 with opencv 32-bit version http://www.mediafire.com/download/3on7x ... 05_x86.zip
Changes :
-added system.yield() for multi-threading
-updated to Lua 5.3.1
-added all the other new stuff from admin like press enter to choose your script from a menu
Check list:
-licence
-removed logs
-add manifest
-removed plugins directory
-updated source code in src (repository is also updated)
-add README to directory tools
-add a forgotten tool
Micromacro 2 with opencv 64-bit version http://www.mediafire.com/download/gdvex ... 05_x64.zip
Micromacro 2 with opencv 32-bit version http://www.mediafire.com/download/3on7x ... 05_x86.zip
Changes :
-added system.yield() for multi-threading
-updated to Lua 5.3.1
-added all the other new stuff from admin like press enter to choose your script from a menu
Jack-of-all-trades, but master-of-only of a few
My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226
My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226
Re: OpenCV and MicroMacro
*Merge with current version of MM2*
Check list:
-licence
-removed logs
-add manifest
-removed plugins directory
-updated source code in src
64-bit version: http://www.mediafire.com/download/dck9w ... 14_x64.zip
32-bit version: http://www.mediafire.com/download/exosl ... 14_x86.zip
changes:
- fix a bug with the manifest it should work now.
- recompiled the entire project PDcurse libs were out-dated behind everything (compiler: NO I don't want that.)
- added process.resume(Handle) , process.suspend(Handle) , (a suspended process will now first resumed)
(please don't try that with your desktop = the need to disconnect you PC)
- added ReadMemoryRepeat as part of an exception handling inside MM2.
- added handling of directory with white space per menu./FIX
- updated to git version of OpenAL32 (basically 1.17) was necessary because of otherwise compatibly problems with VS 2015
TODO:
- config about weather ReadMemoryRepeat and resumse/suspend is used.
Maybe add later:
- an algorithm from my Bachelor work to identify simple object on the numbers of corners.
- an interface for a driver communication and installation.
Check list:
-licence
-removed logs
-add manifest
-removed plugins directory
-updated source code in src
64-bit version: http://www.mediafire.com/download/dck9w ... 14_x64.zip
32-bit version: http://www.mediafire.com/download/exosl ... 14_x86.zip
changes:
- fix a bug with the manifest it should work now.
- recompiled the entire project PDcurse libs were out-dated behind everything (compiler: NO I don't want that.)
- added process.resume(Handle) , process.suspend(Handle) , (a suspended process will now first resumed)
(please don't try that with your desktop = the need to disconnect you PC)
- added ReadMemoryRepeat as part of an exception handling inside MM2.
- added handling of directory with white space per menu./FIX
- updated to git version of OpenAL32 (basically 1.17) was necessary because of otherwise compatibly problems with VS 2015
TODO:
- config about weather ReadMemoryRepeat and resumse/suspend is used.
Maybe add later:
- an algorithm from my Bachelor work to identify simple object on the numbers of corners.
- an interface for a driver communication and installation.
Jack-of-all-trades, but master-of-only of a few
My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226
My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226
Who is online
Users browsing this forum: No registered users and 0 guests