summaryrefslogtreecommitdiffstats
path: root/src/skel/win/win.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/skel/win/win.cpp')
-rw-r--r--src/skel/win/win.cpp48
1 files changed, 34 insertions, 14 deletions
diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp
index d67bd5f2..650f1648 100644
--- a/src/skel/win/win.cpp
+++ b/src/skel/win/win.cpp
@@ -1,8 +1,7 @@
-#if defined RW_D3D9 || defined RWLIBS
+#if defined RW_D3D9 || defined RWLIBS || defined __MWERKS__
#define _WIN32_WINDOWS 0x0500
#define WINVER 0x0500
-#define DIRECTINPUT_VERSION 0x0800
#include <winerror.h>
#include <windows.h>
@@ -20,13 +19,11 @@
#pragma warning( push )
#pragma warning( disable : 4005)
-#ifdef USE_D3D9
-#include <d3d9.h>
-#else
-#include <d3d8.h>
+#ifdef __MWERKS__
+#define MAPVK_VK_TO_CHAR (2) // this is missing from codewarrior win32 headers - but it gets used ... how?
#endif
+
#include <ddraw.h>
-#include <dinput.h>
#include <DShow.h>
#pragma warning( pop )
@@ -41,6 +38,9 @@
#pragma comment( lib, "strmiids.lib" )
#pragma comment( lib, "dinput8.lib" )
+#define WITHD3D
+#define WITHDINPUT
+#include "common.h"
#if (defined(_MSC_VER))
#include <tchar.h>
#endif /* (defined(_MSC_VER)) */
@@ -53,8 +53,6 @@
#define MAX_SUBSYSTEMS (16)
-// --MIAMI: file done
-
static RwBool ForegroundApp = TRUE;
static RwBool RwInitialised = FALSE;
@@ -83,7 +81,6 @@ static psGlobalType PsGlobal;
#define JIF(x) if (FAILED(hr=(x))) \
{debug(TEXT("FAILED(hr=0x%x) in ") TEXT(#x) TEXT("\n"), hr); return;}
-#include "common.h"
#include "main.h"
#include "FileMgr.h"
#include "Text.h"
@@ -94,12 +91,14 @@ static psGlobalType PsGlobal;
#include "Frontend.h"
#include "Game.h"
#include "PCSave.h"
-#include "MemoryCard.h"
-#include "Sprite2d.h"
#include "AnimViewer.h"
-#include "Font.h"
#include "MemoryMgr.h"
+#ifdef PS2_MENU
+#include "MemoryCard.h"
+#include "Font.h"
+#endif
+
VALIDATE_SIZE(psGlobalType, 0x28);
// DirectShow interfaces
@@ -578,6 +577,9 @@ _RETEX:
}
}
+#ifdef __MWERKS__
+#pragma dont_inline on
+#endif
void _psPrintCpuInfo()
{
RwUInt32 features = _psGetCpuFeatures();
@@ -592,6 +594,9 @@ void _psPrintCpuInfo()
if ( FeaturesEx & 0x80000000 )
debug("with 3DNow");
}
+#ifdef __MWERKS__
+#pragma dont_inline off
+#endif
#endif
/*
@@ -2150,8 +2155,15 @@ WinMain(HINSTANCE instance,
{
CFileMgr::SetDirMyDocuments();
+#ifdef LOAD_INI_SETTINGS
+ // At this point InitDefaultControlConfigJoyPad must have set all bindings to default and ms_padButtonsInited to number of detected buttons.
+ // We will load stored bindings below, but let's cache ms_padButtonsInited before LoadINIControllerSettings and LoadSettings clears it,
+ // so we can add new joy bindings **on top of** stored bindings.
+ int connectedPadButtons = ControlsManager.ms_padButtonsInited;
+#endif
+
int32 gta3set = CFileMgr::OpenFile("gta_vc.set", "r");
-
+
if ( gta3set )
{
ControlsManager.LoadSettings(gta3set);
@@ -2159,6 +2171,14 @@ WinMain(HINSTANCE instance,
}
CFileMgr::SetDir("");
+
+#ifdef LOAD_INI_SETTINGS
+ LoadINIControllerSettings();
+ if (connectedPadButtons != 0) {
+ ControlsManager.InitDefaultControlConfigJoyPad(connectedPadButtons);
+ SaveINIControllerSettings();
+ }
+#endif
}
SetErrorMode(SEM_FAILCRITICALERRORS);