Skip to content

Commit

Permalink
Fixes #37
Browse files Browse the repository at this point in the history
  • Loading branch information
Whitetigerswt committed Feb 17, 2019
1 parent 8f2f190 commit b964427
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 40 deletions.
Binary file modified crashes/Release/crashes.pdb
Binary file not shown.
78 changes: 38 additions & 40 deletions crashes/crashes/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ static void WINAPI Load(HMODULE hModule)
} else {
ofstream ofile(path);
ofile << "brightness -1" << endl;
ofile << "mousefix 1" << endl;
ofile << "mousefix 0" << endl;
ofile << "shadows 0" << endl;
ofile << "heathaze 0" << endl;
ofile << "sound 1" << endl;
Expand Down Expand Up @@ -511,58 +511,56 @@ static void WINAPI Load(HMODULE hModule)

bool laststate = false;
int previousbrightness = -1;
while(true) {

TCHAR wintitle[50];
ZeroMemory(wintitle, sizeof(wintitle));
if(brightness != -1 || mousefix == 1)
{
while (true) {

HWND hwnd = *(HWND*)0xC97C1C;
HWND ActiveWin = GetForegroundWindow(); // Gets a handle to the window..
TCHAR wintitle[50];
ZeroMemory(wintitle, sizeof(wintitle));

char WindowText[50];
GetWindowText(ActiveWin, WindowText, sizeof(WindowText));
GetWindowText(hwnd, wintitle, sizeof(wintitle));
if((!strcmp(wintitle, WindowText) || ((!strcmp(wintitle, "GTA: San Andreas") && !strcmp(WindowText, "GTA:SA:MP")) || !strcmp(WindowText, "GTA: San Andreas") && !strcmp(wintitle, "GTA:SA:MP"))) && strlen(wintitle) > 0 && strlen(WindowText) > 0) {
int newbright = 64;
HWND hwnd = *(HWND*)0xC97C1C;
HWND ActiveWin = GetForegroundWindow(); // Gets a handle to the window..

if(brightness == -1) {
int currentbrightness = *(int*)0x0BA6784;
int bars = (currentbrightness-9) / 24;
char WindowText[50];
GetWindowText(ActiveWin, WindowText, sizeof(WindowText));
GetWindowText(hwnd, wintitle, sizeof(wintitle));
if ((!strcmp(wintitle, WindowText) || ((!strcmp(wintitle, "GTA: San Andreas") && !strcmp(WindowText, "GTA:SA:MP")) || !strcmp(WindowText, "GTA: San Andreas") && !strcmp(wintitle, "GTA:SA:MP"))) && strlen(wintitle) > 0 && strlen(WindowText) > 0) {

newbright += 12 * bars;
} else {
newbright = brightness;
}
if (brightness != previousbrightness && brightness != -1)
{
GammaRamp.SetBrightness(NULL, brightness);
}

if(newbright != previousbrightness) GammaRamp.SetBrightness(NULL, newbright);
previousbrightness = brightness;

previousbrightness = newbright;
if (mousefix && laststate)
{

if(mousefix && laststate) {
// F6
keybd_event(0x75, 0, NULL, 0);
keybd_event(0x75, 0, KEYEVENTF_KEYUP, 0);
Sleep(50);

// F6
keybd_event(0x75, 0, NULL, 0);
keybd_event(0x75, 0, KEYEVENTF_KEYUP, 0);
Sleep(50);
// ESC
keybd_event(0x1B, 0, NULL, 0);
keybd_event(0x1B, 0, KEYEVENTF_KEYUP, 0);

// ESC
keybd_event(0x1B, 0, NULL, 0);
keybd_event(0x1B, 0, KEYEVENTF_KEYUP, 0);
// we should think of a better solution then opening chat to hide mouse.
laststate = false;
}

// we should think of a better solution then opening chat to hide mouse.
laststate = false;
}
else {
if (previousbrightness != 128 && brightness != -1) GammaRamp.SetBrightness(NULL, 128);
previousbrightness = 128;
if (mousefix && !laststate) {

} else {
if(previousbrightness != 128) GammaRamp.SetBrightness(NULL, 128);
previousbrightness = 128;
if(mousefix && !laststate) {

laststate = true;
laststate = true;
}
continue;
}
continue;
}

Sleep(500);
Sleep(500);
}
}
}

0 comments on commit b964427

Please sign in to comment.