Correct some WinAPI usage
All the broken stuff just happened to work on 32-bit, but would cause MinGW-w64 to explode if you tried building as 64-bit. I guess thanks to Microsoft keeping the basic C int types the same size in 64-bit as they were in 32-bit, this branch compiles as 64-bit just fine, despite Cave Story's many int-size dependencies.
This commit is contained in:
parent
5dd3a5dd2d
commit
3bac7674f4
3 changed files with 50 additions and 45 deletions
|
@ -17,7 +17,7 @@ static const char *version_string =
|
||||||
;
|
;
|
||||||
|
|
||||||
// TODO - Inaccurate stack frame
|
// TODO - Inaccurate stack frame
|
||||||
BOOL __stdcall VersionDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
INT_PTR __stdcall VersionDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
char string_buffer[104];
|
char string_buffer[104];
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ BOOL __stdcall VersionDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL __stdcall DebugMuteDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
INT_PTR __stdcall DebugMuteDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch (Msg)
|
switch (Msg)
|
||||||
{
|
{
|
||||||
|
@ -98,7 +98,7 @@ BOOL __stdcall DebugMuteDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL __stdcall DebugSaveDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
INT_PTR __stdcall DebugSaveDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
char string[100];
|
char string[100];
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ BOOL __stdcall DebugSaveDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL __stdcall QuitDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
INT_PTR __stdcall QuitDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch (Msg)
|
switch (Msg)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include "WindowsWrapper.h"
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
BOOL __stdcall VersionDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
INT_PTR __stdcall VersionDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
||||||
BOOL __stdcall DebugMuteDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
INT_PTR __stdcall DebugMuteDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
||||||
BOOL __stdcall DebugSaveDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
INT_PTR __stdcall DebugSaveDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
||||||
BOOL __stdcall QuitDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
INT_PTR __stdcall QuitDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
|
@ -99,26 +99,53 @@ BOOL GetCompileVersion(int *v1, int *v2, int *v3, int *v4)
|
||||||
// TODO - Inaccurate stack frame
|
// TODO - Inaccurate stack frame
|
||||||
BOOL OpenVolumeConfiguration(HWND hWnd)
|
BOOL OpenVolumeConfiguration(HWND hWnd)
|
||||||
{
|
{
|
||||||
|
#ifdef FIX_BUGS
|
||||||
char path[MAX_PATH];
|
char path[MAX_PATH];
|
||||||
char path2[MAX_PATH];
|
char path2[MAX_PATH];
|
||||||
char path3[MAX_PATH];
|
char path3[MAX_PATH];
|
||||||
#ifdef FIX_BUGS
|
INT_PTR error;
|
||||||
char path4[MAX_PATH];
|
size_t i;
|
||||||
char path5[MAX_PATH];
|
|
||||||
#endif
|
GetSystemDirectoryA(path, sizeof(path));
|
||||||
int error1;
|
GetSystemDirectoryA(path2, sizeof(path2));
|
||||||
int error2;
|
|
||||||
#ifdef FIX_BUGS
|
i = strlen(path2);
|
||||||
int error3;
|
while (path2[i] != '\\')
|
||||||
int error4;
|
--i;
|
||||||
#endif
|
|
||||||
|
path2[i] = '\0';
|
||||||
|
|
||||||
|
sprintf(path3, "%s\\Sndvol32.exe", path);
|
||||||
|
error = (INT_PTR)ShellExecuteA(hWnd, "open", path3, NULL, NULL, SW_SHOW);
|
||||||
|
if (error > 32)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
sprintf(path3, "%s\\Sndvol32.exe", path2);
|
||||||
|
error = (INT_PTR)ShellExecuteA(hWnd, "open", path3, NULL, NULL, SW_SHOW);
|
||||||
|
if (error > 32)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
sprintf(path3, "%s\\Sndvol.exe", path);
|
||||||
|
error = (INT_PTR)ShellExecuteA(hWnd, "open", path3, NULL, NULL, SW_SHOW);
|
||||||
|
if (error > 32)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
sprintf(path3, "%s\\Sndvol.exe", path2);
|
||||||
|
error = (INT_PTR)ShellExecuteA(hWnd, "open", path3, NULL, NULL, SW_SHOW);
|
||||||
|
if (error > 32)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
#else
|
||||||
|
char path[MAX_PATH];
|
||||||
|
char path2[MAX_PATH];
|
||||||
|
char path3[MAX_PATH];
|
||||||
|
INT_PTR error1;
|
||||||
|
INT_PTR error2;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
GetSystemDirectoryA(path, sizeof(path));
|
GetSystemDirectoryA(path, sizeof(path));
|
||||||
sprintf(path2, "%s\\Sndvol32.exe", path);
|
sprintf(path2, "%s\\Sndvol32.exe", path);
|
||||||
#ifdef FIX_BUGS
|
|
||||||
sprintf(path4, "%s\\Sndvol.exe", path);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
i = strlen(path);
|
i = strlen(path);
|
||||||
while (path[i] != '\\')
|
while (path[i] != '\\')
|
||||||
|
@ -126,31 +153,9 @@ BOOL OpenVolumeConfiguration(HWND hWnd)
|
||||||
|
|
||||||
path[i] = '\0';
|
path[i] = '\0';
|
||||||
sprintf(path3, "%s\\Sndvol32.exe", path);
|
sprintf(path3, "%s\\Sndvol32.exe", path);
|
||||||
#ifdef FIX_BUGS
|
|
||||||
sprintf(path5, "%s\\Sndvol.exe", path);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FIX_BUGS
|
error1 = (INT_PTR)ShellExecuteA(hWnd, "open", path2, NULL, NULL, SW_SHOW);
|
||||||
error1 = (int)ShellExecuteA(hWnd, "open", path2, NULL, NULL, SW_SHOW);
|
error2 = (INT_PTR)ShellExecuteA(hWnd, "open", path3, NULL, NULL, SW_SHOW);
|
||||||
if (error1 > 32)
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
error2 = (int)ShellExecuteA(hWnd, "open", path3, NULL, NULL, SW_SHOW);
|
|
||||||
if (error2 > 32)
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
error3 = (int)ShellExecuteA(hWnd, "open", path4, NULL, NULL, SW_SHOW);
|
|
||||||
if (error3 > 32)
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
error4 = (int)ShellExecuteA(hWnd, "open", path5, NULL, NULL, SW_SHOW);
|
|
||||||
if (error4 > 32)
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
#else
|
|
||||||
error1 = (int)ShellExecuteA(hWnd, "open", path2, NULL, NULL, SW_SHOW);
|
|
||||||
error2 = (int)ShellExecuteA(hWnd, "open", path3, NULL, NULL, SW_SHOW);
|
|
||||||
|
|
||||||
if (error1 <= 32 && error2 <= 32)
|
if (error1 <= 32 && error2 <= 32)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
Loading…
Add table
Reference in a new issue