Should warn when can't write to config files. Getting sick of repeated posts by the unwashed masses about this (Though also find it bizarre that Vista chooses to not allow an app to write to its own subdirectories). Also, included VC 2005 project now builds successfully as long as you have an svnrev.h.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@758 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
mattmenke 2009-03-13 01:17:52 +00:00
parent 12cd3f8b6c
commit 93529360a2
5 changed files with 27 additions and 18 deletions

View File

@ -609,10 +609,12 @@ int SaveSettings(wchar_t *file=0) {
}
DeleteFileW(file);
WritePrivateProfileStringW(L"General Settings", L"Last Config Path", config.lastSaveConfigPath, ini);
WritePrivateProfileStringW(L"General Settings", L"Last Config Path", config.lastSaveConfigPath, ini);
WritePrivateProfileStringW(L"General Settings", L"Last Config Name", config.lastSaveConfigFileName, ini);
WritePrivateProfileInt(L"General Settings", L"Force Cursor Hide", config.forceHide, file);
// Just check first, last, and all pad bindings. Should be more than enough. No real need to check
// config path.
int noError = WritePrivateProfileInt(L"General Settings", L"Force Cursor Hide", config.forceHide, file);
WritePrivateProfileInt(L"General Settings", L"Close Hacks", config.closeHacks, file);
WritePrivateProfileInt(L"General Settings", L"Background", config.background, file);
@ -640,7 +642,7 @@ int SaveSettings(wchar_t *file=0) {
WritePrivateProfileInt(L"Pad1", L"Guitar", config.guitar[0], file);
WritePrivateProfileInt(L"Pad2", L"Guitar", config.guitar[1], file);
WritePrivateProfileInt(L"Pad1", L"Auto Analog", config.AutoAnalog[0], file);
WritePrivateProfileInt(L"Pad2", L"Auto Analog", config.AutoAnalog[1], file);
noError &= WritePrivateProfileInt(L"Pad2", L"Auto Analog", config.AutoAnalog[1], file);
for (int i=0; i<dm->numDevices; i++) {
wchar_t id[50];
@ -668,7 +670,7 @@ int SaveSettings(wchar_t *file=0) {
VirtualControl *c = &dev->virtualControls[b->controlIndex];
wsprintfW(temp, L"Binding %i", bindingCount++);
wsprintfW(temp2, L"0x%08X, %i, %i, %i, %i", c->uid, pad, b->command, b->sensitivity, b->turbo);
WritePrivateProfileStringW(id, temp, temp2, file);
noError &= WritePrivateProfileStringW(id, temp, temp2, file);
}
}
bindingCount = 0;
@ -683,11 +685,14 @@ int SaveSettings(wchar_t *file=0) {
AxisEffectInfo *info = b->axes + k;
wsprintfW(wcschr(temp2,0), L", %i, %i", axis->id, info->force);
}
WritePrivateProfileStringW(id, temp, temp2, file);
noError &= WritePrivateProfileStringW(id, temp, temp2, file);
}
}
}
return 0;
if (!noError) {
MessageBoxA(hWndProp, "Unable to save settings. Make sure the disk is not full or write protected, the file isn't write protected, and that the app has permissions to write to the directory. On Vista, try running in administrator mode.", "Error Writing Configuration File", MB_OK | MB_ICONERROR);
}
return !noError;
}
static int loaded = 0;
@ -1741,7 +1746,10 @@ INT_PTR CALLBACK GeneralDialogProc(HWND hWnd, unsigned int msg, WPARAM wParam, L
return 0;
case PSN_APPLY:
selected = 0;
if (SaveSettings() == -1) return 0;
if (SaveSettings()) {
SetWindowLong(hWnd, DWL_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE);
return 0;
}
SetWindowLong(hWnd, DWL_MSGRESULT, PSNRET_NOERROR);
return 1;
}

View File

@ -20,7 +20,7 @@ inline static u32 flipLong(u32 l) {
static void GUIDtoString(wchar_t *data, const GUID *pg) {
wsprintfW(data, L"%08X-%04X-%04X-%04X-%04X%08X",
pg->Data1, (u32)pg->Data2, (u32)pg->Data3,
flipShort(((u16*)pg->Data4)[0]),
flipShort(((u16*)pg->Data4)[0]),
flipShort(((u16*)pg->Data4)[1]),
flipLong(((u32*)pg->Data4)[1]));
}
@ -48,6 +48,9 @@ void ReleaseDirectInput() {
di8d.lpDI8 = 0;
}
}
else {
di8d.refCount=di8d.refCount;
}
}
static int StringToGUID(GUID *pg, wchar_t *dataw) {

View File

@ -203,10 +203,6 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD fdwReason, void* lpvReserved) {
return 1;
}
BOOL WINAPI MyDllMainCRTStartup(HANDLE hDllHandle, DWORD dwReason, LPVOID lpReserved) {
return DllMain((HINSTANCE) hDllHandle, dwReason, lpReserved);
}
void AddForce(ButtonSum *sum, u8 cmd, int delta = 255) {
if (!delta) return;
if (cmd<0x14) {

View File

@ -27,18 +27,18 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
// TEXTINCLUDE
//
1 TEXTINCLUDE
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
2 TEXTINCLUDE
BEGIN
"#include <winres.h>\r\n"
"\0"
END
3 TEXTINCLUDE
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
@ -270,7 +270,7 @@ BEGIN
CONTROL "Use GS thread (Recommended)",IDC_GS_THREAD_INPUT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,224,271,116,10
CONTROL "Always hide cursor",IDC_FORCE_HIDE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,336,223,71,10
CONTROL "Save state # in title",IDC_SAVE_STATE_TITLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,336,235,79,10
CONTROL "App Local Volume",IDC_VISTA_VOLUME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,336,247,71,10
CONTROL "Local volume control",IDC_VISTA_VOLUME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,336,247,77,10
CONTROL "Guitar Hero 2 Hack",IDC_GH2_HACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,336,259,76,10
GROUPBOX "Debugging",IDC_STATIC,216,285,79,25
CONTROL "Enable logging",IDC_DEBUG_FILE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,223,296,63,10
@ -303,7 +303,7 @@ END
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
GUIDELINES DESIGNINFO
BEGIN
IDD_CONFIG, DIALOG
BEGIN

View File

@ -51,6 +51,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\common\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;TEST_EXPORTS"
MinimalRebuild="true"
ExceptionHandling="2"
@ -246,6 +247,7 @@
FavorSizeOrSpeed="1"
OmitFramePointers="true"
WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\..\common\include"
PreprocessorDefinitions="NO_CRT;WIN32;NDEBUG;_WINDOWS;_USRDLL;TEST_EXPORTS"
StringPooling="true"
ExceptionHandling="0"
@ -285,7 +287,7 @@
EnableCOMDATFolding="2"
OptimizeForWindows98="1"
LinkTimeCodeGeneration="0"
EntryPointSymbol="MyDllMainCRTStartup"
EntryPointSymbol="DllMain"
ImportLibrary=".\Release/LilyPad.lib"
TargetMachine="1"
/>