SRL Archive - Senior News and General

Cbas


BenLand100

2008-07-02 16:38:20

As some of you know I am writing a Scar like macro that uses C++ as its "scripting" language. It compiles scripts with mingw so you will need that, and the gui is in java, so you will need that. I'll post Beta copies here if no one is against it, they include source as well. I'll trust you all to go on spoken word that this is released here only for now and is GPL at the moment, that will become more official as time goes on. There are a few example tests in the /Scripts folder, and the library's includes are in the /Includes folder. If you know c++ it should not be too hard to figure out.

Beta A: June 30
http://bland.no-ip.org/files/CBAS%20Beta%20A.zip

Beta B: July 2
-Fixed some stuff
-First release here
http://bland.no-ip.org/files/CBAS%20Beta%20B.7z

Beta C: July 5
-Added -Xcheck:jni to try to fix crashing problems
-Removed println, it was causing bugs, replaced with the ostream jout.
http://bland.no-ip.org/files/CBAS%20Beta%20C.7z

Beta D: July 5
-Added empty constructor for Finder for whole screen
-Fixed exception catching
-[Should] Fix not starting in some directories, it appears to be doctor watson trying to debug for no reason
http://bland.no-ip.org/files/CBAS%20Beta%20D.7z

Edit:
I know DebugWnd does not work on windows, it runs in wine however, I will have to look into that.

mastaraymond

2008-07-02 16:44:16

Epicly skill show-off. Gj. Could you make like a function list of what functions you can use? Something like ctrl + space!

(For others) MinGW:
http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=240780&release_id=595197

If MinGW is not installed in c:/MinGW/ then change something..
"22:20:37 (TheDoctor): Raym0nd`, if its not installed at C:/MinGW/ … then you will need to change the path in CBAS.props"

Lorax

2008-07-03 18:19:50

very nice Benland..

Smartzkid

2008-07-03 22:45:44

Still haven't managed to get it to run on my laptop (could it be because my windows drive is 'D'?), but I was messing around with it on my desktop today; very impressed.

bullzeye95

2008-07-03 22:52:41

Ah, nice! I've been meaning to learn more of C++. This will definitely help. :D
<3

Smartzkid

2008-07-04 02:30:03

Does it have any requirements other than java?

I just tried running it on a clean install of xp pro + latest java and it crashed ='(

The Claw

2008-07-04 03:37:55

Yep you need MinGW, whatever that is. The link was in ray's post - http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=240780&release_id=595197

the scar noob

2008-07-04 06:37:51

Thank you for releasing! I'll look into it this evening or tomorow, when I've got the time:)
From: BenLand100
I'll trust you all to go on spoken word that this is released here only for now and is GPL at the moment, that will become more official as time goes on.

What's GPL?:redface:

-Tsn.

Smartzkid

2008-07-04 07:29:51

From: the scar noob
Thank you for releasing! I'll look into it this evening or tomorow, when I've got the time:)

What's GPL?:redface:

-Tsn.


http://www.gnu.org/licenses/gpl.html


Also, this should run without MinGW, just not compile. Doesn't matter though, I can't get it to run -at all- on my laptop, VM or not =S

Loving the source code, though.

EDIT: It got better! Now, instead of loading ~18k of memory and quitting in about 30s without showing anything, it now loads ~22k of memory and hangs… *sigh*

EDIT: Got fed up with it and decided to copy it onto my C partition, and guess what? It worked!! No idea why, but I intend to find out. Take note, all ye who have weird partitions :p

BenLand100

2008-07-04 15:13:52

From: Smartzkid
EDIT: Got fed up with it and decided to copy it onto my C partition, and guess what? It worked!! No idea why, but I intend to find out. Take note, all ye who have weird partitions :p

Windows is on Z:/ in wine for me, so I don't see how that is the problem :) Unless your D: drive has funky permissions not letting it read files, etc.

Smartzkid

2008-07-04 16:03:06

It'll run in any non-user-specific folder for me. It's fine in the drive root, windows, program files, docs and settings, but once you go to, owner (+ etc) or all users, it crashes.

Weird.

The Un-Named

2008-07-04 17:46:32

Good job, Ben, and good luck, I'll have a look at it later in it's development. :p

Funnily enough though, I was going to do something like this but purely in Java, but then I sort of gave up(before finishing the design) and NetBeans started getting on my nerves, I was originally thinking of doing it in C++ but then again, I have yet to find a decent C++ IDE.

bullzeye95

2008-07-04 17:56:27

I can't get it to run either, and I am not on my C partition either. I can't get it to work in any location, user specific or not.

Bobarkinator

2008-07-04 18:24:27

You released it :)

BenLand100

2008-07-05 00:04:55

From: The Un-Named
Good job, Ben, and good luck, I'll have a look at it later in it's development. :p


Its got all you need to do most things, key/mouse control, color searching, bitmaps, dtms, etc, already. ;)

From: bullzeye95
I can't get it to run either, and I am not on my C partition either. I can't get it to work in any location, user specific or not.

Error message… Run from command prompt… Is the computer on… "It won't work" doesn't give me anything to go on.

bullzeye95

2008-07-05 00:48:36

Sorry, I shouldn't have been that vague. When I try to run it by just double-clicking, nothing happens. When I try to run it from the command prompt, I get an "Application Error" popup. I'm not sure what other info you'd want, so just let me know please.

Bobarkinator

2008-07-05 01:44:35

I get the same thing as bullzeye

BenLand100

2008-07-05 03:00:24

From: bullzeye95
Sorry, I shouldn't have been that vague. When I try to run it by just double-clicking, nothing happens. When I try to run it from the command prompt, I get an "Application Error" popup.
I'm not sure what other info you'd want, so just let me know please.

That is *very* strange… The first thing it should do (the first line of code infact) is print "It's Alive!" to the command line. I have no clue why it won't do that at least.

nielsie95

2008-07-05 04:58:11

It wouldn't start for me either, but when I moved it to the c root (as Smartz said), it worked :)

The Un-Named

2008-07-05 06:18:33

From: BenLand100
Its got all you need to do most things, key/mouse control, color searching, bitmaps, dtms, etc, already. ;)


Hmm, well I guess I'll take a look at it later this week. :p

Lorax

2008-07-05 10:55:13

Yeah I had the same problem:
C:\CBAS\ = Fail
C:\ = Work :)

also even though I downloaded, installed and booted my computer then CBAS wouldn't compile or run any of the example scripts.. :) Am I being stupid?

Bobarkinator

2008-07-05 10:59:52

C:\=Application error

BenLand100

2008-07-05 12:21:10

From: Lorax
Also even though I downloaded, installed and booted my computer then CBAS wouldn't compile or run any of the example scripts.. :) Am I being stupid?

You need to install MinGW

Edit: I'll have to look at why its not running in some places, or giving an application error first, when I get back from vacation. There must be a dll it is not able to find, although it runs on all the computers in my house fine.

bullzeye95

2008-07-05 13:30:56

I tried what Lorax said worked for him, and put it in C:\ (well, F:\ for me), and I got an error log file thingy. If it's of any help, this is what it says:
#
# An unexpected error has been detected by Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7c911e58, pid=3696, tid=2384
#
# Java VM: Java HotSpot(TM) Client VM (10.0-b22 mixed mode windows-x86)
# Problematic frame:
# C [ntdll.dll+0x11e58]
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

————— T H R E A D —————

Current thread (0x009c5c00): JavaThread "main" [_thread_in_native, id=2384, stack(0x00030000,0x00230000)]

siginfo: ExceptionCode=0xc0000005, reading address 0x00000000

Registers:
EAX=0x003e5ff0, EBX=0x003e0000, ECX=0x00000000, EDX=0x00000000
ESP=0x0022eb74, EBP=0x0022eb80, ESI=0x003e5fe8, EDI=0x003e6000
EIP=0x7c911e58, EFLAGS=0x00010246

Top of Stack: (sp=0x0022eb74)
0x0022eb74: 003e0000 00000001 003e0001 0022ebb8
0x0022eb84: 7c918251 00000000 003e6000 0022ebac
0x0022eb94: 00000000 0000000a 003e0168 003e0000
0x0022eba4: 0022eb01 00000000 00000200 003e0640
0x0022ebb4: 7c910738 0022ede8 7c911c76 003e0000
0x0022ebc4: 00000050 00000001 00000048 00000001
0x0022ebd4: 7c910738 ffffffff 7c910732 003e01c8
0x0022ebe4: 7c9106eb 00000000 00000008 00000000

Instructions: (pc=0x7c911e58)
0x7c911e48: 85 97 7a 03 00 8b 4e 0c 8d 46 08 8b 10 89 4d 08
0x7c911e58: 8b 09 3b 4a 04 89 55 0c 0f 85 9d 00 00 00 3b c8


Stack: [0x00030000,0x00230000], sp=0x0022eb74, free space=2042k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [ntdll.dll+0x11e58]
C [ntdll.dll+0x18251]
C [ntdll.dll+0x11c76]
C [msvcrt.dll+0x1c3c9]
C [msvcrt.dll+0x1c3e7]
C [msvcrt.dll+0x19cd4]
C [uxtheme.dll+0x868d]
C [uxtheme.dll+0x72f9]
C [uxtheme.dll+0x71ce]
C [uxtheme.dll+0x6b6a]
C [uxtheme.dll+0x7402]
C [uxtheme.dll+0x9841]
C [uxtheme.dll+0x960a]
C [uxtheme.dll+0xad7b]
C [USER32.dll+0x13f50]
C [USER32.dll+0x13c44]
C [ntdll.dll+0xeae3]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
v ~BufferBlob::Interpreter
v ~BufferBlob::Interpreter
v ~BufferBlob::Interpreter
v ~BufferBlob::StubRoutines (1)
v ~BufferBlob::Interpreter
v ~BufferBlob::Interpreter
v ~BufferBlob::Interpreter
v ~BufferBlob::Interpreter
v ~BufferBlob::Interpreter
v ~BufferBlob::Interpreter
v ~BufferBlob::Interpreter
v ~BufferBlob::Interpreter
v ~BufferBlob::StubRoutines (1)

————— P R O C E S S —————

Java Threads: ( => current thread )
0x0ad46c00 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=3296, stack(0x0b9b0000,0x0bbb0000)]
0x0ad38c00 JavaThread "CompilerThread0" daemon [_thread_blocked, id=3428, stack(0x0b7b0000,0x0b9b0000)]
0x0ad37c00 JavaThread "Attach Listener" daemon [_thread_blocked, id=3332, stack(0x0b5b0000,0x0b7b0000)]
0x0ad36c00 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=2844, stack(0x0b3b0000,0x0b5b0000)]
0x0ad29000 JavaThread "Finalizer" daemon [_thread_blocked, id=3544, stack(0x0b1b0000,0x0b3b0000)]
0x0ad24c00 JavaThread "Reference Handler" daemon [_thread_blocked, id=1136, stack(0x0afb0000,0x0b1b0000)]
=>0x009c5c00 JavaThread "main" [_thread_in_native, id=2384, stack(0x00030000,0x00230000)]

Other Threads:
0x0ad20400 VMThread [stack: 0x0adb0000,0x0afb0000] [id=1428]
0x0ad48000 WatcherThread [stack: 0x0bbb0000,0x0bdb0000] [id=4008]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap
def new generation total 960K, used 443K [0x02c10000, 0x02d10000, 0x030f0000)
eden space 896K, 49% used [0x02c10000, 0x02c7ed08, 0x02cf0000)
from space 64K, 0% used [0x02cf0000, 0x02cf0000, 0x02d00000)
to space 64K, 0% used [0x02d00000, 0x02d00000, 0x02d10000)
tenured generation total 4096K, used 0K [0x030f0000, 0x034f0000, 0x06c10000)
the space 4096K, 0% used [0x030f0000, 0x030f0000, 0x030f0200, 0x034f0000)
compacting perm gen total 12288K, used 3372K [0x06c10000, 0x07810000, 0x0ac10000)
the space 12288K, 27% used [0x06c10000, 0x06f5b0b0, 0x06f5b200, 0x07810000)
No shared spaces configured.

Dynamic libraries:
0x00400000 - 0x0044d000 F:\CBAS.exe
0x7c900000 - 0x7c9b0000 F:\WINDOWS\system32\ntdll.dll
0x7c800000 - 0x7c8f5000 F:\WINDOWS\system32\kernel32.dll
0x77dd0000 - 0x77e6b000 F:\WINDOWS\system32\ADVAPI32.DLL
0x77e70000 - 0x77f01000 F:\WINDOWS\system32\RPCRT4.dll
0x77c10000 - 0x77c68000 F:\WINDOWS\system32\msvcrt.dll
0x77d40000 - 0x77dd0000 F:\WINDOWS\system32\USER32.dll
0x77f10000 - 0x77f57000 F:\WINDOWS\system32\GDI32.dll
0x76390000 - 0x763ad000 F:\WINDOWS\system32\IMM32.DLL
0x5a900000 - 0x5a937000 F:\Program Files\iolo\common\lib\ioloHL.dll
0x77120000 - 0x771ac000 F:\WINDOWS\system32\oleaut32.dll
0x774e0000 - 0x7761d000 F:\WINDOWS\system32\ole32.dll
0x76b40000 - 0x76b6d000 F:\WINDOWS\system32\winmm.dll
0x6d7c0000 - 0x6da10000 F:\Program Files\Java\jre1.6.0_06\bin\client\jvm.dll
0x7c340000 - 0x7c396000 F:\WINDOWS\system32\MSVCR71.dll
0x6d270000 - 0x6d278000 F:\Program Files\Java\jre1.6.0_06\bin\hpi.dll
0x76bf0000 - 0x76bfb000 F:\WINDOWS\system32\PSAPI.DLL
0x6d770000 - 0x6d77c000 F:\Program Files\Java\jre1.6.0_06\bin\verify.dll
0x6d310000 - 0x6d32f000 F:\Program Files\Java\jre1.6.0_06\bin\java.dll
0x6d7b0000 - 0x6d7bf000 F:\Program Files\Java\jre1.6.0_06\bin\zip.dll
0x6d000000 - 0x6d12e000 F:\Program Files\Java\jre1.6.0_06\bin\awt.dll
0x73000000 - 0x73026000 F:\WINDOWS\system32\WINSPOOL.DRV
0x65cc0000 - 0x65d2d000 F:\Lib\libcbas.dll
0x5ad70000 - 0x5ada8000 F:\WINDOWS\system32\uxtheme.dll

VM Arguments:
jvm_args: -Xbootclasspath/a:F:\\ClassPath -Dsun.java2d.noddraw
java_command: <unknown>
Launcher Type: generic

Environment Variables:
CLASSPATH=.;F:\Program Files\Java\jre1.6.0_05\lib\ext\QTJava.zip
PATH=F:\Perl\site\bin;F:\Perl\bin;F:\WINDOWS\system32;F:\WINDOWS;F:\WINDOWS\System32\Wbem;F:\VAIO\;;F:\Program Files\Subversion\bin;F:\Program Files\RemObjects Software\Everwood\Bin;F:\Program Files\RemObjects Software\Pascal Script for Delphi\Dcu\D7;F:\Program Files\Delphi7SE\bin;F:\Program Files\Delphi7SE\Projects\BPL;F:\Program Files\Intel\DMIX;F:\Program Files\QuickTime\QTSystem\;F:\Program Files\Java\jdk1.6.0_05\bin\;F:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT;F:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin;F:\Program Files\Microsoft Visual Studio\Common\Tools;F:\Program Files\Microsoft Visual Studio\VC98\bin;F:\Program Files\Java\jdk1.6.0_05\bin\;F:\\LibY
USERNAME=Admin
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 6 Model 14 Stepping 8, GenuineIntel



————— S Y S T E M —————

OS: Windows XP Build 2600 Service Pack 2

CPU:total 1 (1 cores per cpu, 1 threads per core) family 6 model 14 stepping 8, cmov, cx8, fxsr, mmx, sse, sse2, sse3

Memory: 4k page, physical 1038384k(514268k free), swap 2499088k(2026560k free)

vm_info: Java HotSpot(TM) Client VM (10.0-b22) for windows-x86 JRE (1.6.0_06-b02), built on Mar 25 2008 01:22:05 by "java_re" with MS VC++ 7.1

time: Sat Jul 05 13:27:34 2008
elapsed time: 0 seconds


Smartzkid

2008-07-05 14:44:31

Ben…You can't include anything from a .cc / .cpp file? It has to be compiled into a dll?

BenLand100

2008-07-05 15:08:58

Meh, the java vm is too paranoid about other people running it >.< I'll make a version with -Xcheck:jni enabled and see if that fixes the problem. Smart will only run with that, I was hoping to avoid it however…

From: Smartzkid
Ben…You can't include anything from a .cc / .cpp file? It has to be compiled into a dll?

You can, it just has to be in the Includes folder. Think about the logic behind including a source file, however. If you include from source, it gets recompiled every time your program does, and linked into your programs binary. Nothing wrong with that if you don't mind the (small) time loss or the (small) size increase.

I could add a #warning compiles [sourcefileinlib] in addition to the #warning links [somelibraryinlib] so that you could distribute plugins as source only…

Added Beta C.

Lorax

2008-07-05 17:55:07

I am sorry that I was so bad in my description of what I had done..
As in downloaded, installed and booted I meant that I had downloaded MinGW, installed MinGW and then following booted my computer I will try out the new version asap.

Edit: Well apparently installing MinGW isn't enough by itself you need to check all those compilers aswell, then it works :)
Very impressive :p
still it gives me that error from the picture posted in an earlier post. That is if I chose a folder different than C:\

BenLand100

2008-07-05 18:35:50

From: Lorax
still it gives me that error from the picture posted in an earlier post. That is if I chose a folder different than C:\

Try running it from the command line and tell me if it gives any more information, I haven't got a clue whats happening to cause that error.

Smartzkid

2008-07-05 18:40:23

From: BenLand100
Meh, the java vm is too paranoid about other people running it >.< I'll make a version with -Xcheck:jni enabled and see if that fixes the problem. Smart will only run with that, I was hoping to avoid it however…


What are the disadvantages of -Xchet:jni?


You can, it just has to be in the Includes folder. Think about the logic behind including a source file, however. If you include from source, it gets recompiled every time your program does, and linked into your programs binary. Nothing wrong with that if you don't mind the (small) time loss or the (small) size increase.

I could add a #warning compiles [sourcefileinlib] in addition to the #warning links [somelibraryinlib] so that you could distribute plugins as source only…


That'd be great, it would make developing and debugging a large library a bit simpler..

Lorax

2008-07-05 18:45:22

I ran it from the command line and when I type run CBAS.exe the typical windows error pops-up:
CBAS.exe has encountered a problem and needs to close. We are sorry……
Do you want me to PM you the error log or something? I don't know if you can get anything out of that..
also it didn't write anything like it's alive or anything. it just gave me the windows error and then went on to the next line in the CMD..

also can anyone tell me what I did wrong here: ?
#include "Main.h"
#include "Find.h"

int scriptmain() {
jout << "Hello\n";
int i = 1;
jout << i << "\n";
int x, y;
RGB color = new RGB(100, 100, 100);
if ( findColor(x, y, color, 100, 100, 200, 200) ) {
jout << "yo yo\n";
}
return 0;
}

I get these errors:
Compile Failed! Exit Value: 1
Scripts\Hello world.cc: In function `int scriptmain()':
Scripts\Hello world.cc:9: error: expected identifier before ';' token
Scripts\Hello world.cc:10: error: `findColor' was not declared in this scope
Scripts\Hello world.cc:14:2: warning: no newline at end of file

BenLand100

2008-07-05 18:48:07

From: Lorax
I ran it from the command line and when I type run CBAS.exe the typical windows error pops-up:
CBAS.exe has encountered a problem and needs to close. We are sorry……
Do you want me to PM you the error log or something? I don't know if you can get anything out of that..
also it didn't write anything like it's alive or anything. it just gave me the windows error and then went on to the next line in the CMD..

Error log would be great.

RGB color = new RGB(100, 100, 100);

should be

RGB color = rgb(100,100,100);

the c++ new operator is not as you would expect if you are a java fan, and RGB is a union (struct) not a class. Also, you have to create a Finder for a search area like this:

Finder f(0); //Where 0 is the hwnd for the screen (zero is understood to be the whole screen)

and use it like

f.findColor(…);

Lorax

2008-07-05 18:57:35

Scripts\Hello world.cc:10: error: call of overloaded `Finder(int)' is ambiguous

that's what I get from calling Finder f(0); :S

BenLand100

2008-07-05 18:59:16

From: Lorax
Scripts\Hello world.cc:10: error: call of overloaded `Finder(int)' is ambiguous

that's what I get from calling Finder f(0); :S


Finder f((HWND)0);

Try that instead.

Lorax

2008-07-05 19:08:04

It compiles now :)
But when I run it CBAS closes. I guess it's because there's not set any HWND?
And I'm not going to be able to tell you anything more because no more info is given at the CMD, and CBAS just closes. And it doesn't give me any errors.

BenLand100

2008-07-05 20:27:38

From: Lorax
It compiles now :)
But when I run it CBAS closes. I guess it's because there's not set any HWND?
And I'm not going to be able to tell you anything more because no more info is given at the CMD, and CBAS just closes. And it doesn't give me any errors.

Windows likes to kill the process whenever an exception occurs, I have that fixed for the next version. Also, in the next version to search the whole screen I made a default constructor for Finder.

Finder f;

Now f targets the whole screen.

Smartzkid

2008-07-05 22:29:52

Oh, Ben, just noticed - addr2line comes with MinGW; makes things easy if you implement it.