Yes, I used your project file and I used it to build it. Didn't work with Visual Studio 9.0 Professional SP1.
Created this patch with TortoiseSVN with default settings, didn't check if it works.
I added usage for unreferenced parameters like (x);. That shouldn't change speed or size or anything, because things like that will be optimized away, because they don't really do anything.
Index: bitmap.cpp
===================================================================
--- bitmap.cpp (revision 47)
+++ bitmap.cpp (working copy)
@@ -16,28 +16,34 @@
EXPORT IMAGE BitmapFromString(int Width, int Height, std::string data)
{
- if(data[0] == 'b')
- {
- int outputSize;
- unsigned char* output;
- unsigned char* dOutput;
+ (Height);
+ (Width);
- data.erase(0, 1);
- output = base64Dec(data, outputSize);
- dOutput = decompress(output, outputSize, outputSize);
+ if(data[0] == 'b')
+ {
+ int outputSize;
+ unsigned char* output;
+ unsigned char* dOutput;
- delete[] output; // Avoid memory leaks
- output = NULL;
+ data.erase(0, 1);
+ output = base64Dec(data, outputSize);
+ dOutput = decompress(output, outputSize, outputSize);
- /* TODO (#1#): Write BitmapFromString Function */
- }
- return NULL;
+ delete[] output; // Avoid memory leaks
+ output = NULL;
+
+ /* TODO (#1#): Write BitmapFromString Function */
+ }
+ return NULL;
}
EXPORT IMAGE BitmapFromString2(bool Validate, std::string str)
{
- /* TODO (#1#): Write BitmapFromString2 function */
- return NULL;
+ (Validate);
+ (str);
+
+ /* TODO (#1#): Write BitmapFromString2 function */
+ return NULL;
}
EXPORT IMAGE BitmapFromMem(HDC hDC)
@@ -70,24 +76,38 @@
EXPORT IMAGE CreateBitmapMaskFromText(std::string Text, int Chars)
{
- /* TODO (#1#): Write CreateBitmapMaskFromText Function */
- return NULL;
+ (Text);
+ (Chars);
+
+ /* TODO (#1#): Write CreateBitmapMaskFromText Function */
+ return NULL;
}
EXPORT IMAGE CreateBitmapFromText(std::string Text, int Chars, int TextColor)
{
- /* TODO (#1#): Write CreateBitmapFromText Function */
- return NULL;
+ (Text);
+ (Chars);
+ (TextColor);
+
+ /* TODO (#1#): Write CreateBitmapFromText Function */
+ return NULL;
}
EXPORT IMAGE CreateMirroredBitmap(IMAGE bitmap)
{
- /* TODO (#1#): Write CreateMirroredBitmap */
+ (bitmap);
+
+ /* TODO (#1#): Write CreateMirroredBitmap */
return NULL;
}
EXPORT std::vector< std::vector<int> > GetBitmapAreaColors(int xs, int ys, int xe, int ye)
{
+ (xs);
+ (ys);
+ (xe);
+ (ye);
+
std::vector< std::vector<int> > empty;
return empty;
}
Index: cimath.h
===================================================================
--- cimath.h (revision 47)
+++ cimath.h (working copy)
@@ -4,7 +4,7 @@
// Compiler independant math
#include <math.h>
-#ifdef MSVC
+#ifdef _MSC_VER
int lround(double in);
#endif
#endif
\ No newline at end of file
Index: ColorFind.cpp
===================================================================
--- ColorFind.cpp (revision 47)
+++ ColorFind.cpp (working copy)
@@ -359,14 +359,19 @@
// The way my sprial tolerance looks makes these functions pretty much the same.
EXPORT bool FindColorCircle(int& x, int& y, int color, int mx, int my, int r)
{
- return FindColorSpiralTolerance(x, y, color, x - r, y - r, x + r, y + r, 0);
+ (mx);
+ (my);
+ return FindColorSpiralTolerance(x, y, color, x - r, y - r, x + r, y + r, 0);
}
EXPORT bool FindColorCircleTolerance(int& x, int& y, int color, int mx, int my,
int r, int Tolerance)
{
- return FindColorSpiralTolerance(x, y, color, x - r, y - r, x + r,
- y + r, Tolerance);
+ (mx);
+ (my);
+
+ return FindColorSpiralTolerance(x, y, color, x - r, y - r, x + r, y + r,
+ Tolerance);
}
/* EXPORT bool FindColorTriangle(int& x, int& y, int color, int x1, int y1, int x2,
Index: dtm.cpp
===================================================================
--- dtm.cpp (revision 47)
+++ dtm.cpp (working copy)
@@ -76,7 +76,7 @@
void DTM::setColor(int color, int nodeNum)
{
- if (nodeNum < nodes.size())
+ if ((unsigned)nodeNum < nodes.size())
{
nodes[nodeNum]->setColor(color);
}
@@ -84,7 +84,7 @@
void DTM::setTol(int tol, int nodeNum)
{
- if (nodeNum < nodes.size())
+ if ((unsigned)nodeNum < nodes.size())
{
nodes[nodeNum]->setTol(tol);
}
@@ -116,7 +116,7 @@
int shape = 0;
int tol = 0;
int parent = 0;
- int found = 0;
+ int found = false;
// This chunk will convert the from a DTM to a string.
for(int j = 4; j >= 1; --j)
@@ -131,7 +131,7 @@
parent = (parent << 8) + decompressed[(i * 36) + j + 31];
}
- if ((parent == -1) || (parent == nodes.size()))
+ if ((parent == -1) || ((unsigned int)parent == nodes.size()))
out = new DTMNode(NULL, x, y, color, shape, area, tol, found);
else
out = new DTMNode(nodes[parent], x, y, color, shape, area, tol, found);
@@ -154,7 +154,7 @@
std::string out = inStr.substr(0, inStr.size() / 2);
for (size_t i = 0; i < strSize; ++i)
{
- char currChar = tolower(inStr[i]);
+ char currChar = (char)tolower(inStr[i]);
size_t outIndex = (i / 2);
out[outIndex] = ((out[outIndex] & 0xF) << 4);
if ((currChar >= 'a') && (currChar <= 'f'))
@@ -184,7 +184,7 @@
DTMNode* DTM::nodeAt(int i) const
{
- if (i < nodes.size())
+ if ((unsigned)i < nodes.size())
return nodes[i];
else
return NULL;
@@ -242,20 +242,16 @@
}
else
{
- switch (node->getShape())
- {
- default:
- int gv;
- int dist = node->getArea() << 1;
- if((FindColorTolerance(gv, gv, node->getColor(),
- newCoord.x - dist, newCoord.y - dist, newCoord.x + dist,
- newCoord.y + dist, node->getTol())) != node->getFound())
- {
- valid = false;
- break;
- }
- }
- }
+ int gv;
+ int dist = node->getArea() << 1;
+ if((FindColorTolerance(gv, gv, node->getColor(),
+ newCoord.x - dist, newCoord.y - dist, newCoord.x + dist,
+ newCoord.y + dist, node->getTol())) != node->getFound())
+ {
+ valid = false;
+ break;
+ }
+ }
++i;
}
@@ -350,16 +346,12 @@
}
else
{
- switch(next->getShape())
- {
- default:
- int gv;
- int boxSize = next->getArea() << 1;
- if((FindColorTolerance(gv, gv, next->getColor(),
- lround(newX - boxSize), lround(newY - boxSize), lround(newX + boxSize),
- lround(newY + boxSize), next->getTol()) != next->getFound()))
- valid = false;
- }
+ int gv;
+ int boxSize = next->getArea() << 1;
+ if((FindColorTolerance(gv, gv, next->getColor(),
+ lround(newX - boxSize), lround(newY - boxSize), lround(newX + boxSize),
+ lround(newY + boxSize), next->getTol()) != next->getFound()))
+ valid = false;
}
}
++j;
Index: dtm.h
===================================================================
--- dtm.h (revision 47)
+++ dtm.h (working copy)
@@ -1,6 +1,6 @@
-#ifndef _DTM_H_
-#define _DTM_H_
-
+#ifndef _DTM_H_
+#define _DTM_H_
+
#include "preprocessor.h"
#include <vector>
#include <string>
@@ -12,13 +12,13 @@
public:
DTMNode(DTMNode* myParent, int myX, int myY, int myColor, int myShape,
int myArea, int myTol, bool myFound);
- POINT getCoords() const;
- void setColor(int inColor) { color = inColor; }
+ POINT getCoords() const;
+ void setColor(int inColor) { color = inColor; }
void setTol(int inTol) { tol = inTol; }
int getColor() const;
int getShape() const;
int getArea() const;
- int getTol() const;
+ int getTol() const;
bool getFound() const;
DTMNode* getParent() const;
private:
@@ -37,10 +37,10 @@
protected:
std::vector<DTMNode*> nodes;
std::string makeDecompressable(std::string inStr);
- public:
- void setAllColor(int color);
- void setAllTol(int tol);
- void setColor(int color, int nodenum);
+ public:
+ void setAllColor(int color);
+ void setAllTol(int tol);
+ void setColor(int color, int nodenum);
void setTol(int tol, int nodeNum);
DTM(std::vector<DTMNode*> newNodes);
DTM(std::string dtmFromString);
@@ -50,8 +50,8 @@
DTMNode* nodeAt(int i) const;
};
-EXPORT bool FindDTM(const DTM& theDTM, int& x, int& y, int x1, int y1, int x2, int y2);
-EXPORT bool FindDTMRotated(const DTM& theDTM, int& x, int& y, int x1,
- int y1, int x2, int y2, double minAngle,
- double maxAngle, double step, double& angle);
+EXPORT bool FindDTM(const DTM& theDTM, int& x, int& y, int x1, int y1, int x2, int y2);
+EXPORT bool FindDTMRotated(const DTM& theDTM, int& x, int& y, int x1,
+ int y1, int x2, int y2, double minAngle,
+ double maxAngle, double step, double& angle);
#endif
Index: extraFuncs.cpp
===================================================================
--- extraFuncs.cpp (revision 47)
+++ extraFuncs.cpp (working copy)
@@ -4,7 +4,7 @@
#include <assert.h>
#include <zlib.h>
-#ifdef MSVC
+#ifdef _MSC_VER
int lround(double in)
{
return (int)(in + .5);
@@ -143,7 +143,7 @@
short currByteSize = 0;
unsigned char carryOver;
- unsigned char outByte;
+ unsigned char outByte = 0;
while(i < inSize)
{
Index: extraFuncs.h
===================================================================
--- extraFuncs.h (revision 47)
+++ extraFuncs.h (working copy)
@@ -1,8 +1,8 @@
#ifndef _EXTRA_FUNCS_H_
#define _EXTRA_FUNCS_H_
#include "scarStructs.h"
-#include <string>
-#include "os.h"
+#include <string>
+#include "os.h"
/* This file is for any function that has its uses elsewhere but doesnt really
Fit in the other catgories */
@@ -15,16 +15,16 @@
return a;
else
return b;
-}
+}
bool tBoxCompair(TBox a, TBox b);
void tBoxCorrect(TBox& in);
-std::string literalStringValue(std::string inString);
-unsigned char* decompress(unsigned char* in, int inLen, int& outLen);
-unsigned char* base64Dec(std::string in, int& outLen);
-
-IMAGE GetRawScreenData(int& xs, int& ys, int& xe, int& ye, HDC screen);
-
+std::string literalStringValue(std::string inString);
+unsigned char* decompress(unsigned char* in, int inLen, int& outLen);
+unsigned char* base64Dec(std::string in, int& outLen);
+
+IMAGE GetRawScreenData(int& xs, int& ys, int& xe, int& ye, HDC screen);
+
unsigned int GetRawColor(int x, int y, IMAGE data);
#endif
Index: Keyboard.cpp
===================================================================
--- Keyboard.cpp (revision 47)
+++ Keyboard.cpp (working copy)
@@ -1,22 +1,22 @@
#include "Keyboard.h"
-#include "scarmain.h"
+#include "scarmain.h"
-#ifdef WINDOWS
+#ifdef WINDOWS
EXPORT void SendKeys(std::string S)
{
SendKeysWait(S, 0, 1); // Same function, nobody will notice 1ms
}
EXPORT void SendKeysWait(std::string text, int tWait, int tRandom)
-{
+{
Scar* window = returnScarObject();
- HWND client = window->returnClient();
+ HWND client = window->returnClient();
for(unsigned int i = 0; i < text.size(); ++i)
- {
+ {
#ifdef WINDOWS
if(GetFocus() != client)
- SetFocus(client);
+ SetFocus(client);
#endif
Sleep(tWait + rand() % tRandom);
KeyDown(GetKeyCode(text[i]));
@@ -37,12 +37,12 @@
EXPORT void SendArrowWait(int Key, int WaitTime)
{
- short newKey;
+ short newKey;
Scar* window = returnScarObject();
HWND client = window->returnClient();
switch (Key) // Microsoft Virtual key codes
- {
+ {
#ifdef WINDOWS
case 0:
newKey = VK_UP;
@@ -55,25 +55,25 @@
break;
case 3:
newKey = VK_LEFT;
- break;
-#else
- case 0:
- newKey = XK_Up;
- break;
- case 1:
- newKey = XK_Right;
- break;
- case 2:
- newKey = XK_Down;
- break;
- case 3:
- newKey = XK_Left;
- break;
+ break;
+#else
+ case 0:
+ newKey = XK_Up;
+ break;
+ case 1:
+ newKey = XK_Right;
+ break;
+ case 2:
+ newKey = XK_Down;
+ break;
+ case 3:
+ newKey = XK_Left;
+ break;
#endif
default:
newKey = 0;
}
-
+
#ifdef WINDOWS
if(GetFocus() != client) // Make sure the keys are going to the right place
SetFocus(client);
@@ -98,23 +98,23 @@
SendInput was for Win2k and Higher, so at least this should work with the few
Win98 people out there */
EXPORT void KeyDown(int Key)
-{
+{
#ifdef WINDOWS
keybd_event(Key, 0, 0, 0);
-#else
- Display* display = returnScarObject()->returnDisplay();
- XTestFakeKeyEvent(display, XKeysymToKeycode(display, Key), true, 0);
-#endif
+#else
+ Display* display = returnScarObject()->returnDisplay();
+ XTestFakeKeyEvent(display, XKeysymToKeycode(display, Key), true, 0);
+#endif
}
EXPORT void KeyUp(int Key)
-{
+{
#ifdef WINDOWS
keybd_event(Key, 0, KEYEVENTF_KEYUP, 0);
-#else
- Display* display = returnScarObject()->returnDisplay();
- XTestFakeKeyEvent(display, XKeysymToKeycode(display, Key), false, 0);
-#endif
+#else
+ Display* display = returnScarObject()->returnDisplay();
+ XTestFakeKeyEvent(display, XKeysymToKeycode(display, Key), false, 0);
+#endif
}
EXPORT void KeyDownSilent(int Key)
@@ -128,12 +128,12 @@
}
EXPORT int GetKeyCode(char Key)
-{
+{
#ifdef WINDOWS
- return VkKeyScan(Key);
-#else
- char buf[] = {Key, '\0'};
- return XStringToKeysym(buf);
+ return VkKeyScan(Key);
+#else
+ char buf[] = {Key, '\0'};
+ return XStringToKeysym(buf);
#endif
}
@@ -142,7 +142,7 @@
int newKey;
switch (Key) // I wish there was a better way to do this, but alas none of
- { // the key codes are in order :(
+ { // the key codes are in order :(
#ifdef WINDOWS
case 0:
newKey = VK_SHIFT;
@@ -170,8 +170,8 @@
break;
case 8:
newKey = VK_RMENU;
- break;
-#else
+ break;
+#else
case 0:
newKey = XK_Shift_Lock;
break;
@@ -198,17 +198,17 @@
break;
case 8:
newKey = VK_Hyper_R;
- break;
+ break;
#endif
default:
newKey = 0;
- }
+ }
#ifdef WINDOWS
- return (GetKeyState(newKey) < 0);
-#else
- Display* display = returnScarObject()->returnDisplay();
- char keys[32];
- XQueryKeymap(display, keys);
+ return (GetKeyState(newKey) < 0);
+#else
+ Display* display = returnScarObject()->returnDisplay();
+ char keys[32];
+ XQueryKeymap(display, keys);
#endif
}
@@ -251,4 +251,4 @@
{
return (GetKeyState(VK_NUMPAD0 + Key) < 0);
}
-#endif
+#endif
Index: Mouse.cpp
===================================================================
--- Mouse.cpp (revision 47)
+++ Mouse.cpp (working copy)
@@ -162,6 +162,13 @@
int ctrlSpacing, int ctrlVariance)
{
/* TODO (#1#): Write MoveMouseSplineEx */
+ (x);
+ (y);
+ (rx);
+ (ry);
+ (mouseSpeed);
+ (ctrlSpacing);
+ (ctrlVariance);
}
EXPORT void _MoveMouseSplineFrom(int x0, int y0, int x1, int y1, int rx, int ry)
Index: Plugin.cpp
===================================================================
--- Plugin.cpp (revision 47)
+++ Plugin.cpp (working copy)
@@ -1,9 +1,9 @@
#include "os.h"
#include "Plugin.h"
-#ifndef MSVC
-typedef long (*GFInfo)(int index, void** address, char** def) __attribute__((stdcall));
-typedef long (*GFCount)() __attribute__((stdcall));
+#ifndef _MSC_VER
+typedef long (*GFInfo)(int index, void** address, char** def) __attribute__((__stdcall));
+typedef long (*GFCount)() __attribute__((__stdcall));
#else
typedef long (__stdcall *GFInfo)(int index, void** address, char** def);
typedef long (__stdcall *GFCount)();
@@ -32,7 +32,6 @@
if ((space != string::npos) && (par != string::npos))
{
newName = newName.substr(space + 1, par - space - 1);
- size_t pos = newName.find_first_of("(;:) ");
functions[newName] = addr;
}
}
Index: preprocessor.h
===================================================================
--- preprocessor.h (revision 47)
+++ preprocessor.h (working copy)
@@ -1,28 +1,28 @@
#ifndef _PREPROCESSOR_H_
#define _PREPROCESSOR_H_
-
+
// Linux doesn't use the same dllexport stuff.
#ifndef LINUX
# if BUILDING_DLL
-# ifdef MSVC
+# ifdef _MSC_VER
# define EXPORT __declspec(dllexport)
# define CLASS class __declspec (dllexport)
# else
-# define EXPORT __declspec (dllexport) __attribute__((stdcall))
+# define EXPORT __declspec (dllexport) __attribute__((__stdcall))
# define CLASS class __declspec (dllexport)
# endif
# else /* Not BUILDING_DLL */
-# ifdef MSVC
+# ifdef _MSC_VER
# define EXPORT __declspec (dllimport)
# define CLASS class __declspec (dllimport)
# else
-# define EXPORT __declspec (dllimport) __attribute__((stdcall))
+# define EXPORT __declspec (dllimport) __attribute__((__stdcall))
# define CLASS class __declspec (dllimport)
# endif
# endif /* Not BUILDING_DLL */
#else /* Linux environment */
-# define EXPORT
+# define EXPORT
# define CLASS class
#endif
-
-#endif /* header endif */
+
+#endif /* header endif */
Index: Scar++.vcproj
===================================================================
--- Scar++.vcproj (revision 47)
+++ Scar++.vcproj (working copy)
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9.00"
+ Version="9,00"
Name="Scar++"
ProjectGUID="{B45C07E5-3055-4DC3-8124-78D20C1948BE}"
+ RootNamespace="Scar++"
Keyword="Win32Proj"
TargetFrameworkVersion="0"
>
@@ -41,13 +42,13 @@
Optimization="3"
OmitFramePointers="true"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SCAR_EXPORTS;WINDOWS;BUILDING_DLL"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
+ MinimalRebuild="false"
+ BasicRuntimeChecks="0"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
+ WarningLevel="4"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -60,6 +61,7 @@
/>
<Tool
Name="VCLinkerTool"
+ AdditionalDependencies="zdll.lib"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
Index: scarmain.cpp
===================================================================
--- scarmain.cpp (revision 47)
+++ scarmain.cpp (working copy)
@@ -1,4 +1,4 @@
-#ifdef MSVC
+#ifdef _MSC_VER
// MSVC is dumb, it won't let us use pre-processors unless one is
// declared on the first line.
#endif
@@ -52,6 +52,9 @@
DWORD reason /* Reason this function is being called. */ ,
LPVOID reserved /* Not used. */ )
{
+ (hInst);
+ (reserved);
+
switch (reason)
{
case DLL_PROCESS_ATTACH: