From 6c693e3bbfe46cb445e4664eb91ef85c811a6240 Mon Sep 17 00:00:00 2001 From: _AG Date: Tue, 2 Jul 2019 13:59:19 +0200 Subject: Implemented frontend inputs. Fixed #66 and few other stuff. --- src/skel/win/win.cpp | 12 ++++++++---- src/skel/win/win.h | 4 ++++ 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'src/skel/win') diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp index 9638e53a..1b91af24 100644 --- a/src/skel/win/win.cpp +++ b/src/skel/win/win.cpp @@ -1355,10 +1355,14 @@ psSelectDevice() { while ( !modeFound && GcurSelVM < RwEngineGetNumVideoModes() ) { + RECT Rect; + GetWindowRect(GetDesktopWindow(), &Rect); + printf(gString, "Cannot find %dx%dx32 video mode", Rect.right, Rect.bottom); + RwEngineGetVideoModeInfo(&vm, GcurSelVM); - if ( defaultFullscreenRes && vm.width != 640 - || vm.height != 480 - || vm.depth != 16 + if ( defaultFullscreenRes && vm.width != Rect.right + || vm.height != Rect.bottom + || vm.depth != 32 || !(vm.flags & rwVIDEOMODEEXCLUSIVE) ) ++GcurSelVM; else @@ -1367,7 +1371,7 @@ psSelectDevice() if ( !modeFound ) { - MessageBox(nil, "Cannot find 640x480 video mode", "GTA3", MB_OK); + MessageBox(nil, gString, "GTA3", MB_OK); return FALSE; } } diff --git a/src/skel/win/win.h b/src/skel/win/win.h index 371b9e44..13564a7f 100644 --- a/src/skel/win/win.h +++ b/src/skel/win/win.h @@ -79,6 +79,10 @@ void CenterVideo(void); void CloseClip(void); RwChar **_psGetVideoModeList(); +RwInt32 _psGetNumVideModes(); + +void _psSelectScreenVM(RwInt32 videoMode); +void HandleExit(); #ifdef __cplusplus } -- cgit v1.2.3 From e8215cf560318fdd77817cea485af50fca827552 Mon Sep 17 00:00:00 2001 From: aap Date: Tue, 2 Jul 2019 22:05:11 +0200 Subject: Revert "Implemented frontend inputs." --- src/skel/win/win.cpp | 12 ++++-------- src/skel/win/win.h | 4 ---- 2 files changed, 4 insertions(+), 12 deletions(-) (limited to 'src/skel/win') diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp index 1b91af24..9638e53a 100644 --- a/src/skel/win/win.cpp +++ b/src/skel/win/win.cpp @@ -1355,14 +1355,10 @@ psSelectDevice() { while ( !modeFound && GcurSelVM < RwEngineGetNumVideoModes() ) { - RECT Rect; - GetWindowRect(GetDesktopWindow(), &Rect); - printf(gString, "Cannot find %dx%dx32 video mode", Rect.right, Rect.bottom); - RwEngineGetVideoModeInfo(&vm, GcurSelVM); - if ( defaultFullscreenRes && vm.width != Rect.right - || vm.height != Rect.bottom - || vm.depth != 32 + if ( defaultFullscreenRes && vm.width != 640 + || vm.height != 480 + || vm.depth != 16 || !(vm.flags & rwVIDEOMODEEXCLUSIVE) ) ++GcurSelVM; else @@ -1371,7 +1367,7 @@ psSelectDevice() if ( !modeFound ) { - MessageBox(nil, gString, "GTA3", MB_OK); + MessageBox(nil, "Cannot find 640x480 video mode", "GTA3", MB_OK); return FALSE; } } diff --git a/src/skel/win/win.h b/src/skel/win/win.h index 13564a7f..371b9e44 100644 --- a/src/skel/win/win.h +++ b/src/skel/win/win.h @@ -79,10 +79,6 @@ void CenterVideo(void); void CloseClip(void); RwChar **_psGetVideoModeList(); -RwInt32 _psGetNumVideModes(); - -void _psSelectScreenVM(RwInt32 videoMode); -void HandleExit(); #ifdef __cplusplus } -- cgit v1.2.3 From 25865e68c4c87cfe3cf63c8721f3d0ec8dfca35c Mon Sep 17 00:00:00 2001 From: aap Date: Wed, 3 Jul 2019 13:13:55 +0200 Subject: cleaned up to be closer to original game --- src/skel/win/win.cpp | 42 +++++++++++++++--------------------------- src/skel/win/win.h | 4 ++-- 2 files changed, 17 insertions(+), 29 deletions(-) (limited to 'src/skel/win') diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp index 9638e53a..0481e104 100644 --- a/src/skel/win/win.cpp +++ b/src/skel/win/win.cpp @@ -626,9 +626,7 @@ psInitialise(void) C_PcSave::SetSaveDirectory(_psGetUserFilesFolder()); -#ifndef NASTY_GAME - InitialiseLanguage(); -#endif + InitialiseLanguage(); FrontEndMenuManager.LoadSettings(); @@ -1262,7 +1260,7 @@ UINT GetBestRefreshRate(UINT width, UINT height, UINT depth) ASSERT(d3d != nil); - INT refreshRate = -1; + UINT refreshRate = INT_MAX; D3DFORMAT format; if ( depth == 32 ) @@ -1284,12 +1282,9 @@ UINT GetBestRefreshRate(UINT width, UINT height, UINT depth) { if ( mode.RefreshRate == 0 ) return 0; -#pragma warning( push ) -#pragma warning( disable : 4018) if ( mode.RefreshRate < refreshRate && mode.RefreshRate >= 60 ) refreshRate = mode.RefreshRate; -#pragma warning( pop ) } } @@ -1540,8 +1535,6 @@ CommandLineToArgv(RwChar *cmdLine, RwInt32 *argCount) */ void InitialiseLanguage() { -#pragma warning( push ) -#pragma warning( disable : 4302) WORD primUserLCID = PRIMARYLANGID(GetSystemDefaultLCID()); WORD primSystemLCID = PRIMARYLANGID(GetUserDefaultLCID()); WORD primLayout = PRIMARYLANGID((DWORD)GetKeyboardLayout(0)); @@ -1549,7 +1542,6 @@ void InitialiseLanguage() WORD subUserLCID = SUBLANGID(GetSystemDefaultLCID()); WORD subSystemLCID = SUBLANGID(GetUserDefaultLCID()); WORD subLayout = SUBLANGID((DWORD)GetKeyboardLayout(0)); -#pragma warning( pop ) if ( primUserLCID == LANG_GERMAN || primSystemLCID == LANG_GERMAN @@ -1573,6 +1565,12 @@ void InitialiseLanguage() || subSystemLCID == SUBLANG_ENGLISH_AUS || subLayout == SUBLANG_ENGLISH_AUS ) CGame::noProstitutes = true; + +#ifdef NASTY_GAME + CGame::nastyGame = true; + CMenuManager::m_PrefsAllowNastyGame = true; + CGame::noProstitutes = false; +#endif int32 lang; @@ -2420,14 +2418,10 @@ void _InputInitialiseJoys() } } -#pragma warning( push ) -#pragma warning( disable : 4700) -HRESULT _InputAddJoyStick(LPDIRECTINPUTDEVICE8 lpDevice, INT num) +void _InputAddJoyStick(LPDIRECTINPUTDEVICE8 lpDevice, INT num) { - HRESULT hr; - DIDEVICEOBJECTINSTANCE objInst; - + objInst.dwSize = sizeof( DIDEVICEOBJECTINSTANCE ); DIPROPRANGE range; @@ -2445,7 +2439,7 @@ HRESULT _InputAddJoyStick(LPDIRECTINPUTDEVICE8 lpDevice, INT num) if ( SUCCEEDED( lpDevice->GetObjectInfo( &objInst, DIJOFS_X, DIPH_BYOFFSET ) ) ) { if( FAILED( lpDevice->SetProperty( DIPROP_RANGE, (LPCDIPROPHEADER)&range ) ) ) - return S_FALSE; + return; else ; } @@ -2457,7 +2451,7 @@ HRESULT _InputAddJoyStick(LPDIRECTINPUTDEVICE8 lpDevice, INT num) if ( SUCCEEDED( lpDevice->GetObjectInfo( &objInst, DIJOFS_Y, DIPH_BYOFFSET ) ) ) { if( FAILED( lpDevice->SetProperty( DIPROP_RANGE, (LPCDIPROPHEADER)&range ) ) ) - return S_FALSE; + return; else ; } @@ -2469,7 +2463,7 @@ HRESULT _InputAddJoyStick(LPDIRECTINPUTDEVICE8 lpDevice, INT num) if ( SUCCEEDED( lpDevice->GetObjectInfo( &objInst, DIJOFS_Z, DIPH_BYOFFSET ) ) ) { if( FAILED( lpDevice->SetProperty( DIPROP_RANGE, (LPCDIPROPHEADER)&range ) ) ) - return S_FALSE; + return; else AllValidWinJoys.m_aJoys[num].m_bHasAxisZ = true; // z rightStickPos.x } @@ -2481,15 +2475,12 @@ HRESULT _InputAddJoyStick(LPDIRECTINPUTDEVICE8 lpDevice, INT num) if ( SUCCEEDED( lpDevice->GetObjectInfo( &objInst, DIJOFS_RZ, DIPH_BYOFFSET ) ) ) { if( FAILED( lpDevice->SetProperty( DIPROP_RANGE, (LPCDIPROPHEADER)&range ) ) ) - return S_FALSE; + return; else AllValidWinJoys.m_aJoys[num].m_bHasAxisR = true; // r rightStickPos.y } } - - return hr; } -#pragma warning( pop ) HRESULT _InputAddJoys() { @@ -2973,9 +2964,7 @@ void _InputTranslateShiftKeyUpDown(RsKeyCodes *rs) } } -#pragma warning( push ) -#pragma warning( disable : 4805) -BOOL _InputTranslateShiftKey(RsKeyCodes *rs, UINT key, bool bDown) +BOOL _InputTranslateShiftKey(RsKeyCodes *rs, UINT key, BOOLEAN bDown) { *rs = rsNULL; switch ( key ) @@ -3002,7 +2991,6 @@ BOOL _InputTranslateShiftKey(RsKeyCodes *rs, UINT key, bool bDown) return TRUE; } -#pragma warning( pop ) BOOL _InputIsExtended(INT flag) { diff --git a/src/skel/win/win.h b/src/skel/win/win.h index 371b9e44..a1f37bfd 100644 --- a/src/skel/win/win.h +++ b/src/skel/win/win.h @@ -63,14 +63,14 @@ HRESULT _InputInitialise(); HRESULT _InputInitialiseMouse(); HRESULT CapturePad(RwInt32 padID); void _InputInitialiseJoys(); -HRESULT _InputAddJoyStick(LPDIRECTINPUTDEVICE8 lpDevice, INT num); +void _InputAddJoyStick(LPDIRECTINPUTDEVICE8 lpDevice, INT num); HRESULT _InputAddJoys(); HRESULT _InputGetMouseState(DIMOUSESTATE2 *state); void _InputShutdown(); BOOL CALLBACK _InputEnumDevicesCallback( const DIDEVICEINSTANCE* pdidInstance, VOID* pContext ); BOOL _InputTranslateKey(RsKeyCodes *rs, UINT flag, UINT key); void _InputTranslateShiftKeyUpDown(RsKeyCodes *rs);; -BOOL _InputTranslateShiftKey(RsKeyCodes *rs, UINT key, bool bDown); +BOOL _InputTranslateShiftKey(RsKeyCodes *rs, UINT key, BOOLEAN bDown); BOOL _InputIsExtended(INT flag); void InitialiseLanguage(); -- cgit v1.2.3 From 69b5c9f1e0aff9bc32f903b39f5c1673b43a9b37 Mon Sep 17 00:00:00 2001 From: _AG Date: Wed, 3 Jul 2019 17:26:15 +0200 Subject: Update Frontend. --- src/skel/win/win.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/skel/win') diff --git a/src/skel/win/win.h b/src/skel/win/win.h index a1f37bfd..69d38164 100644 --- a/src/skel/win/win.h +++ b/src/skel/win/win.h @@ -79,6 +79,10 @@ void CenterVideo(void); void CloseClip(void); RwChar **_psGetVideoModeList(); +RwInt32 _psGetNumVideModes(); + +void _psSelectScreenVM(RwInt32 videoMode); +void HandleExit(); #ifdef __cplusplus } -- cgit v1.2.3