VC 2008 release build no longer depends on ntdll.lib. VC 2005 still uses it to shrink dll size, as it comes with VC 2005 Pro. "GS Thread updates" disabled and grayed out for PSX emulators.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@520 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
mattmenke 2009-02-17 22:45:29 +00:00
parent 26f33da0b6
commit 77d57a78c7
6 changed files with 44 additions and 64 deletions

View File

@ -20,6 +20,8 @@
GeneralConfig config; GeneralConfig config;
u8 ps2e = 0;
HWND hWndProp = 0; HWND hWndProp = 0;
int selected = 0; int selected = 0;
@ -213,31 +215,6 @@ wchar_t *GetCommandStringW(u8 command, int pad) {
return L""; return L"";
} }
inline int GetLongType(int type) {
const static int types[] = {PSHBTN,TGLBTN,ABSAXIS,RELAXIS,POV};
return types[type];
}
inline int GetShortType(int type) {
if (type & POV) {
return 4;
}
else if (type & ABSAXIS) {
return 2;
}
else if (type & RELAXIS) {
return 3;
}
else if (type & PSHBTN) {
return 0;
}
else if (type & TGLBTN) {
return 1;
}
return 0;
}
inline void GetSettingsFileName(wchar_t *out) { inline void GetSettingsFileName(wchar_t *out) {
wcscpy(out, L"inis\\LilyPad.ini"); wcscpy(out, L"inis\\LilyPad.ini");
} }
@ -721,6 +698,9 @@ int LoadSettings(int force, wchar_t *file) {
} }
config.GSThreadUpdates = GetPrivateProfileBool(L"General Settings", L"GS Thread Updates", 1, file); config.GSThreadUpdates = GetPrivateProfileBool(L"General Settings", L"GS Thread Updates", 1, file);
if (!ps2e) config.GSThreadUpdates = 0;
config.escapeFullscreenHack = GetPrivateProfileBool(L"General Settings", L"Escape Fullscreen Hack", 1, file); config.escapeFullscreenHack = GetPrivateProfileBool(L"General Settings", L"Escape Fullscreen Hack", 1, file);
config.disableScreenSaver = GetPrivateProfileBool(L"General Settings", L"Disable Screen Saver", 0, file); config.disableScreenSaver = GetPrivateProfileBool(L"General Settings", L"Disable Screen Saver", 0, file);
@ -1519,6 +1499,9 @@ INT_PTR CALLBACK GeneralDialogProc(HWND hWnd, unsigned int msg, WPARAM wParam, L
CheckDlgButton(hWnd, IDC_MOUSE_UNFOCUS, BST_CHECKED * config.mouseUnfocus); CheckDlgButton(hWnd, IDC_MOUSE_UNFOCUS, BST_CHECKED * config.mouseUnfocus);
CheckDlgButton(hWnd, IDC_GS_THREAD_INPUT, BST_CHECKED * config.GSThreadUpdates); CheckDlgButton(hWnd, IDC_GS_THREAD_INPUT, BST_CHECKED * config.GSThreadUpdates);
if (!ps2e) {
EnableWindow(GetDlgItem(hWnd, IDC_GS_THREAD_INPUT), 0);
}
CheckDlgButton(hWnd, IDC_ESCAPE_FULLSCREEN_HACK, BST_CHECKED * config.escapeFullscreenHack); CheckDlgButton(hWnd, IDC_ESCAPE_FULLSCREEN_HACK, BST_CHECKED * config.escapeFullscreenHack);
CheckDlgButton(hWnd, IDC_DISABLE_SCREENSAVER, BST_CHECKED * config.disableScreenSaver); CheckDlgButton(hWnd, IDC_DISABLE_SCREENSAVER, BST_CHECKED * config.disableScreenSaver);

View File

@ -4,6 +4,8 @@
#include "InputManager.h" #include "InputManager.h"
#include "PS2Etypes.h" #include "PS2Etypes.h"
extern u8 ps2e;
struct GeneralConfig { struct GeneralConfig {
public: public:
u8 disablePad[2]; u8 disablePad[2];
@ -44,10 +46,6 @@ extern GeneralConfig config;
void UnloadConfigs(); void UnloadConfigs();
/*
inline int GetNeededInput(HWND hWnd, int configMode) {
return GetInput(hWnd, flags, configMode);
}*/
void AddIgnore(LPARAM k); void AddIgnore(LPARAM k);
int LoadSettings(int force = 0, wchar_t *file = 0); int LoadSettings(int force = 0, wchar_t *file = 0);

View File

@ -3,10 +3,6 @@
// dll size by over 100k while avoiding any dependencies on updated CRT dlls. // dll size by over 100k while avoiding any dependencies on updated CRT dlls.
#pragma once #pragma once
#ifndef _DEBUG
#define NO_CRT
#endif
#ifdef NO_CRT #ifdef NO_CRT
#define _CRT_ALLOCATION_DEFINED #define _CRT_ALLOCATION_DEFINED
#endif #endif

View File

@ -126,11 +126,11 @@ public:
u8 initialized; u8 initialized;
} pads[2]; } pads[2];
// Force value to be from 0 to 255.
u8 Cap (int i) { u8 Cap (int i) {
// If negative, zero out i. if (i<0) return 0;
i &= ~(i>>(sizeof(i)*8-1)); if (i>255) return 255;
// if i-255 is negative, return i. Else return 255. Slight overkill. return (u8) i;
return (u8) (255 + ((i-255) & ((i-255) >> (sizeof(int)*8-1))));
} }
@ -209,6 +209,7 @@ void AddForce(ButtonSum *sum, u8 cmd, int delta = 255) {
if (cmd<0x14) { if (cmd<0x14) {
sum->buttons[cmd-0x10] += delta; sum->buttons[cmd-0x10] += delta;
} }
// D-pad. Command numbering is based on ordering of digital values.
else if (cmd < 0x18) { else if (cmd < 0x18) {
if (cmd == 0x14) { if (cmd == 0x14) {
sum->sticks[0].vert -= delta; sum->sticks[0].vert -= delta;
@ -226,6 +227,7 @@ void AddForce(ButtonSum *sum, u8 cmd, int delta = 255) {
else if (cmd < 0x20) { else if (cmd < 0x20) {
sum->buttons[cmd-0x10-4] += delta; sum->buttons[cmd-0x10-4] += delta;
} }
// Left stick.
else if (cmd < 0x24) { else if (cmd < 0x24) {
if (cmd == 32) { if (cmd == 32) {
sum->sticks[2].vert -= delta; sum->sticks[2].vert -= delta;
@ -240,6 +242,7 @@ void AddForce(ButtonSum *sum, u8 cmd, int delta = 255) {
sum->sticks[2].horiz -= delta; sum->sticks[2].horiz -= delta;
} }
} }
// Right stick.
else if (cmd < 0x28) { else if (cmd < 0x28) {
if (cmd == 36) { if (cmd == 36) {
sum->sticks[1].vert -= delta; sum->sticks[1].vert -= delta;
@ -267,15 +270,16 @@ void ProcessButtonBinding(Binding *b, ButtonSum *sum, int value) {
} }
} }
// Restricts d-pad/analog stick values to be from -255 to 255 and button values to be from 0 to 255.
// With D-pad in DS2 native mode, the negative and positive ranges are both independently from 0 to 255,
// which is why I use 9 bits of all sticks. For left and right sticks, I have to remove a bit before sending.
void CapSum(ButtonSum *sum) { void CapSum(ButtonSum *sum) {
int i; int i;
for (i=0; i<3; i++) { for (i=0; i<3; i++) {
int a1 = abs(sum->sticks[i].horiz); int div = max(abs(sum->sticks[i].horiz), abs(sum->sticks[i].vert));
int a2 = abs(sum->sticks[i].vert); if (div > 255) {
if (a1 < a2) a1 = a2; sum->sticks[i].horiz = sum->sticks[i].horiz * 255 / div;
if (a1 > 255) { sum->sticks[i].vert = sum->sticks[i].vert * 255 / div;
sum->sticks[i].horiz = sum->sticks[i].horiz * 255 / a1;
sum->sticks[i].vert = sum->sticks[i].vert * 255 / a1;
} }
} }
for (i=0; i<12; i++) { for (i=0; i<12; i++) {
@ -297,12 +301,6 @@ int lockStateChanged[2] = {0,0};
extern HWND hWndStealing; extern HWND hWndStealing;
void Update(int pad);
void CALLBACK PADupdate(int pad) {
if (config.GSThreadUpdates) Update(pad);
}
void Update(int pad) { void Update(int pad) {
if ((unsigned int)pad > 2) return; if ((unsigned int)pad > 2) return;
if (summed[pad] > 0) { if (summed[pad] > 0) {
@ -473,6 +471,10 @@ void Update(int pad) {
summed[pad]--; summed[pad]--;
} }
void CALLBACK PADupdate(int pad) {
if (config.GSThreadUpdates) Update(pad);
}
inline void SetVibrate(Pad *pad, int motor, u8 val) { inline void SetVibrate(Pad *pad, int motor, u8 val) {
if (val | pad->vibrateVal[motor]) { if (val | pad->vibrateVal[motor]) {
dm->SetEffect(pad - pads, motor, val); dm->SetEffect(pad - pads, motor, val);
@ -481,18 +483,20 @@ inline void SetVibrate(Pad *pad, int motor, u8 val) {
} }
u32 CALLBACK PS2EgetLibType(void) { u32 CALLBACK PS2EgetLibType(void) {
ps2e = 1;
return PS2E_LT_PAD; return PS2E_LT_PAD;
} }
#define VERSION ((0<<8) | 9 | (9<<24)) #define VERSION ((0<<8) | 9 | (9<<24))
u32 CALLBACK PS2EgetLibVersion2(u32 type) { u32 CALLBACK PS2EgetLibVersion2(u32 type) {
ps2e = 1;
if (type == PS2E_LT_PAD) if (type == PS2E_LT_PAD)
return (PS2E_PAD_VERSION<<16) | VERSION; return (PS2E_PAD_VERSION<<16) | VERSION;
return 0; return 0;
} }
char* CALLBACK PS2EgetLibName(void) { char* CALLBACK PSEgetLibName() {
#ifdef _DEBUG #ifdef _DEBUG
return "LilyPad Debug"; return "LilyPad Debug";
#else #else
@ -500,6 +504,11 @@ char* CALLBACK PS2EgetLibName(void) {
#endif #endif
} }
char* CALLBACK PS2EgetLibName(void) {
ps2e = 1;
return PSEgetLibName();
}
//void CALLBACK PADgsDriverInfo(GSdriverInfo *info) { //void CALLBACK PADgsDriverInfo(GSdriverInfo *info) {
// info=info; // info=info;
//} //}
@ -807,7 +816,7 @@ u8 CALLBACK PADpoll(u8 value) {
b2 -= (sum->buttons[i+4]>=128) << i; b2 -= (sum->buttons[i+4]>=128) << i;
} }
if (config.guitar[query.pad] && !config.GH2) { if (config.guitar[query.pad] && !config.GH2) {
sum->sticks[0].horiz = -256; sum->sticks[0].horiz = -255;
// Not sure about this. Forces wammy to be from 0 to 0x7F. // Not sure about this. Forces wammy to be from 0 to 0x7F.
// if (sum->sticks[2].vert > 0) sum->sticks[2].vert = 0; // if (sum->sticks[2].vert > 0) sum->sticks[2].vert = 0;
} }
@ -830,12 +839,15 @@ u8 CALLBACK PADpoll(u8 value) {
// Good idea? No clue. // Good idea? No clue.
//query.response[3] &= pad->mask[0]; //query.response[3] &= pad->mask[0];
//query.response[4] &= pad->mask[1]; //query.response[4] &= pad->mask[1];
// Each value is from -255 to 255, so have to use cap to convert
// negative values to 0.
query.response[9] = Cap(sum->sticks[0].horiz); query.response[9] = Cap(sum->sticks[0].horiz);
query.response[10] = Cap(-sum->sticks[0].horiz); query.response[10] = Cap(-sum->sticks[0].horiz);
query.response[11] = Cap(-sum->sticks[0].vert); query.response[11] = Cap(-sum->sticks[0].vert);
query.response[12] = Cap(sum->sticks[0].vert); query.response[12] = Cap(sum->sticks[0].vert);
// No need to cap these. // No need to cap these, already done int CapSum().
query.response[13] = (unsigned char) sum->buttons[8]; query.response[13] = (unsigned char) sum->buttons[8];
query.response[14] = (unsigned char) sum->buttons[9]; query.response[14] = (unsigned char) sum->buttons[9];
query.response[15] = (unsigned char) sum->buttons[10]; query.response[15] = (unsigned char) sum->buttons[10];
@ -1136,10 +1148,6 @@ u32 CALLBACK PSEgetLibVersion() {
return (VERSION & 0xFFFFFF); return (VERSION & 0xFFFFFF);
} }
char* CALLBACK PSEgetLibName() {
return PS2EgetLibName();
}
// Little funkiness to handle rounding floating points to ints without the C runtime. // Little funkiness to handle rounding floating points to ints without the C runtime.
// Unfortunately, means I can't use /GL optimization option. // Unfortunately, means I can't use /GL optimization option.
#ifdef NO_CRT #ifdef NO_CRT

View File

@ -246,7 +246,7 @@
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
OmitFramePointers="true" OmitFramePointers="true"
WholeProgramOptimization="false" WholeProgramOptimization="false"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;TEST_EXPORTS" PreprocessorDefinitions="NO_CRT;WIN32;NDEBUG;_WINDOWS;_USRDLL;TEST_EXPORTS"
StringPooling="true" StringPooling="true"
ExceptionHandling="0" ExceptionHandling="0"
RuntimeLibrary="0" RuntimeLibrary="0"

View File

@ -154,7 +154,6 @@
EnableIntrinsicFunctions="true" EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
OmitFramePointers="true" OmitFramePointers="true"
WholeProgramOptimization="false"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;TEST_EXPORTS" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;TEST_EXPORTS"
StringPooling="true" StringPooling="true"
ExceptionHandling="0" ExceptionHandling="0"
@ -184,16 +183,13 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="ntdll.lib ole32.lib advapi32.lib user32.lib kernel32.lib Comdlg32.lib dinput8.lib dxguid.lib comctl32.lib" AdditionalDependencies="ole32.lib advapi32.lib user32.lib kernel32.lib Comdlg32.lib dinput8.lib dxguid.lib comctl32.lib"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="true" SuppressStartupBanner="true"
GenerateManifest="false"
IgnoreAllDefaultLibraries="true"
ModuleDefinitionFile=".\LilyPad.def" ModuleDefinitionFile=".\LilyPad.def"
OptimizeReferences="2" OptimizeReferences="2"
EnableCOMDATFolding="2" EnableCOMDATFolding="2"
LinkTimeCodeGeneration="0" EntryPointSymbol=""
EntryPointSymbol="MyDllMainCRTStartup"
RandomizedBaseAddress="1" RandomizedBaseAddress="1"
DataExecutionPrevention="0" DataExecutionPrevention="0"
ImportLibrary=".\Release/LilyPad.lib" ImportLibrary=".\Release/LilyPad.lib"
@ -204,7 +200,6 @@
/> />
<Tool <Tool
Name="VCManifestTool" Name="VCManifestTool"
EmbedManifest="false"
/> />
<Tool <Tool
Name="VCXDCMakeTool" Name="VCXDCMakeTool"