skeleton updated, windows specific stuff added

This commit is contained in:
Fire-Head
2019-06-02 06:00:38 +03:00
parent 28fce310d5
commit b1f9e28cd1
237 changed files with 258817 additions and 437 deletions

View File

@ -3,7 +3,8 @@
#include "events.h"
//#include "main.h"
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
#include "common.h"
#include "Pad.h"
#include "ControllerConfig.h"
@ -350,7 +351,7 @@ HandleKeyDown(RsKeyStatus *keyStatus)
}
}
return rsEVENTPROCESSED;
return rsEVENTPROCESSED;
}
@ -688,7 +689,7 @@ HandleKeyUp(RsKeyStatus *keyStatus)
}
}
return rsEVENTPROCESSED;
return rsEVENTPROCESSED;
}
@ -698,26 +699,26 @@ HandleKeyUp(RsKeyStatus *keyStatus)
static RsEventStatus
KeyboardHandler(RsEvent event, void *param)
{
/*
* ...then the application events, if necessary...
*/
switch( event )
{
case rsKEYDOWN:
{
return HandleKeyDown((RsKeyStatus *)param);
}
/*
* ...then the application events, if necessary...
*/
switch( event )
{
case rsKEYDOWN:
{
return HandleKeyDown((RsKeyStatus *)param);
}
case rsKEYUP:
{
return HandleKeyUp((RsKeyStatus *)param);
}
case rsKEYUP:
{
return HandleKeyUp((RsKeyStatus *)param);
}
default:
{
return rsEVENTNOTPROCESSED;
}
}
default:
{
return rsEVENTNOTPROCESSED;
}
}
}
/*
@ -791,7 +792,7 @@ HandlePadButtonUp(RsPadButtonStatus *padButtonStatus)
ControlsManager.AffectControllerStateOn_ButtonUp(btn, JOYSTICK);
}
return rsEVENTPROCESSED;
return rsEVENTPROCESSED;
}
/*
@ -800,23 +801,23 @@ HandlePadButtonUp(RsPadButtonStatus *padButtonStatus)
static RsEventStatus
PadHandler(RsEvent event, void *param)
{
switch( event )
{
case rsPADBUTTONDOWN:
{
return HandlePadButtonDown((RsPadButtonStatus *)param);
}
switch( event )
{
case rsPADBUTTONDOWN:
{
return HandlePadButtonDown((RsPadButtonStatus *)param);
}
case rsPADBUTTONUP:
{
return HandlePadButtonUp((RsPadButtonStatus *)param);
}
case rsPADBUTTONUP:
{
return HandlePadButtonUp((RsPadButtonStatus *)param);
}
default:
{
return rsEVENTNOTPROCESSED;
}
}
default:
{
return rsEVENTNOTPROCESSED;
}
}
}
@ -826,11 +827,11 @@ PadHandler(RsEvent event, void *param)
RwBool
AttachInputDevices(void)
{
RsInputDeviceAttach(rsKEYBOARD, KeyboardHandler);
RsInputDeviceAttach(rsKEYBOARD, KeyboardHandler);
RsInputDeviceAttach(rsPAD, PadHandler);
RsInputDeviceAttach(rsPAD, PadHandler);
return TRUE;
return TRUE;
}

View File

@ -20,7 +20,9 @@ extern RwBool psCameraBeginUpdate(RwCamera *camera);
extern void psMouseSetPos(RwV2d *pos);
extern RwBool psSelectDevice(RwBool useDefault);
extern RwBool psSelectDevice();
extern RwMemoryFunctions *psGetMemoryFunctions(void);
/* install the platform specific file system */
extern RwBool psInstallFileSystem(void);

View File

@ -18,32 +18,10 @@ static RwBool DefaultVideoMode = TRUE;
//RsGlobalType RsGlobal;
RsGlobalType &RsGlobal = *(RsGlobalType*)0x8F4360;
////////////////////////////////////////////////////////////////////////
WRAPPER RwUInt32 psTimer(void) { EAXJMP(0x580CE0); }
WRAPPER RwBool psInitialise(void) { EAXJMP(0x581180); }
WRAPPER void psTerminate(void) { EAXJMP(0x581460); }
WRAPPER void psCameraShowRaster(RwCamera *camera) { EAXJMP(0x580CA0); }
WRAPPER RwBool psCameraBeginUpdate(RwCamera *camera) { EAXJMP(0x580C70); }
WRAPPER void psMouseSetPos(RwV2d *pos) { EAXJMP(0x580D20); }
WRAPPER RwBool psSelectDevice(RwBool useDefault) { EAXJMP(0x581D80); }
WRAPPER RwBool psInstallFileSystem(void) { EAXJMP(0x580E20); }
WRAPPER RwBool psNativeTextureSupport(void) { EAXJMP(0x580E30); }
////////////////////////////////////////////////////////////////////////
_TODO("psGetMemoryFunctions");
RwMemoryFunctions*
psGetMemoryFunctions(void)
{
return 0;
}
/*
*****************************************************************************
*/
RwUInt32
RsTimer(void)
{
return psTimer();
return psTimer();
}
@ -53,9 +31,9 @@ RsTimer(void)
void
RsCameraShowRaster(RwCamera * camera)
{
psCameraShowRaster(camera);
psCameraShowRaster(camera);
return;
return;
}
/*
@ -73,7 +51,7 @@ RsCameraBeginUpdate(RwCamera * camera)
RwBool
RsRegisterImageLoader(void)
{
return TRUE;
return TRUE;
}
/*
@ -82,7 +60,7 @@ RsRegisterImageLoader(void)
static RwBool
RsSetDebug(void)
{
return TRUE;
return TRUE;
}
/*
@ -91,9 +69,9 @@ RsSetDebug(void)
void
RsMouseSetPos(RwV2d * pos)
{
psMouseSetPos(pos);
psMouseSetPos(pos);
return;
return;
}
/*
@ -102,7 +80,7 @@ RsMouseSetPos(RwV2d * pos)
RwBool
RsSelectDevice(void)
{
return psSelectDevice(DefaultVideoMode);
return psSelectDevice();
}
/*
@ -110,35 +88,35 @@ RsSelectDevice(void)
*/
RwBool
RsInputDeviceAttach(RsInputDeviceType inputDevice,
RsInputEventHandler inputEventHandler)
RsInputEventHandler inputEventHandler)
{
switch (inputDevice)
{
case rsKEYBOARD:
{
RsGlobal.keyboard.inputEventHandler = inputEventHandler;
RsGlobal.keyboard.used = TRUE;
break;
}
case rsMOUSE:
{
RsGlobal.mouse.inputEventHandler = inputEventHandler;
RsGlobal.mouse.used = TRUE;
break;
}
case rsPAD:
{
RsGlobal.pad.inputEventHandler = inputEventHandler;
RsGlobal.pad.used = TRUE;
break;
}
default:
{
return FALSE;
}
}
switch (inputDevice)
{
case rsKEYBOARD:
{
RsGlobal.keyboard.inputEventHandler = inputEventHandler;
RsGlobal.keyboard.used = TRUE;
break;
}
case rsMOUSE:
{
RsGlobal.mouse.inputEventHandler = inputEventHandler;
RsGlobal.mouse.used = TRUE;
break;
}
case rsPAD:
{
RsGlobal.pad.inputEventHandler = inputEventHandler;
RsGlobal.pad.used = TRUE;
break;
}
default:
{
return FALSE;
}
}
return TRUE;
return TRUE;
}
@ -148,9 +126,9 @@ RsInputDeviceAttach(RsInputDeviceType inputDevice,
static RwBool
rsCommandLine(RwChar *arg)
{
RsEventHandler(rsFILELOAD, arg);
RsEventHandler(rsFILELOAD, arg);
return TRUE;
return TRUE;
}
@ -160,14 +138,14 @@ rsCommandLine(RwChar *arg)
static RwBool
rsPreInitCommandLine(RwChar *arg)
{
if( !strcmp(arg, RWSTRING("-vms")) )
{
DefaultVideoMode = FALSE;
if( !strcmp(arg, RWSTRING("-vms")) )
{
DefaultVideoMode = FALSE;
return TRUE;
}
return TRUE;
}
return FALSE;
return FALSE;
}
/*
@ -176,12 +154,12 @@ rsPreInitCommandLine(RwChar *arg)
RsEventStatus
RsKeyboardEventHandler(RsEvent event, void *param)
{
if (RsGlobal.keyboard.used)
{
return RsGlobal.keyboard.inputEventHandler(event, param);
}
if (RsGlobal.keyboard.used)
{
return RsGlobal.keyboard.inputEventHandler(event, param);
}
return rsEVENTNOTPROCESSED;
return rsEVENTNOTPROCESSED;
}
/*
@ -190,12 +168,12 @@ RsKeyboardEventHandler(RsEvent event, void *param)
RsEventStatus
RsPadEventHandler(RsEvent event, void *param)
{
if (RsGlobal.pad.used)
{
return RsGlobal.pad.inputEventHandler(event, param);
}
if (RsGlobal.pad.used)
{
return RsGlobal.pad.inputEventHandler(event, param);
}
return rsEVENTNOTPROCESSED;
return rsEVENTNOTPROCESSED;
}
/*
@ -204,85 +182,85 @@ RsPadEventHandler(RsEvent event, void *param)
RsEventStatus
RsEventHandler(RsEvent event, void *param)
{
RsEventStatus result;
RsEventStatus es;
RsEventStatus result;
RsEventStatus es;
/*
* Give the application an opportunity to override any events...
*/
es = AppEventHandler(event, param);
/*
* Give the application an opportunity to override any events...
*/
es = AppEventHandler(event, param);
/*
* We never allow the app to replace the quit behaviour,
* only to intercept...
*/
if (event == rsQUITAPP)
{
/*
* Set the flag which causes the event loop to exit...
*/
RsGlobal.quit = TRUE;
}
/*
* We never allow the app to replace the quit behaviour,
* only to intercept...
*/
if (event == rsQUITAPP)
{
/*
* Set the flag which causes the event loop to exit...
*/
RsGlobal.quit = TRUE;
}
if (es == rsEVENTNOTPROCESSED)
{
switch (event)
{
case rsSELECTDEVICE:
result =
(RsSelectDevice()? rsEVENTPROCESSED : rsEVENTERROR);
break;
if (es == rsEVENTNOTPROCESSED)
{
switch (event)
{
case rsSELECTDEVICE:
result =
(RsSelectDevice()? rsEVENTPROCESSED : rsEVENTERROR);
break;
case rsCOMMANDLINE:
result = (rsCommandLine((RwChar *) param) ?
rsEVENTPROCESSED : rsEVENTERROR);
break;
case rsPREINITCOMMANDLINE:
result = (rsPreInitCommandLine((RwChar *) param) ?
rsEVENTPROCESSED : rsEVENTERROR);
break;
case rsINITDEBUG:
result =
(RsSetDebug()? rsEVENTPROCESSED : rsEVENTERROR);
break;
case rsCOMMANDLINE:
result = (rsCommandLine((RwChar *) param) ?
rsEVENTPROCESSED : rsEVENTERROR);
break;
case rsPREINITCOMMANDLINE:
result = (rsPreInitCommandLine((RwChar *) param) ?
rsEVENTPROCESSED : rsEVENTERROR);
break;
case rsINITDEBUG:
result =
(RsSetDebug()? rsEVENTPROCESSED : rsEVENTERROR);
break;
case rsREGISTERIMAGELOADER:
result = (RsRegisterImageLoader()?
rsEVENTPROCESSED : rsEVENTERROR);
break;
case rsREGISTERIMAGELOADER:
result = (RsRegisterImageLoader()?
rsEVENTPROCESSED : rsEVENTERROR);
break;
case rsRWTERMINATE:
RsRwTerminate();
result = (rsEVENTPROCESSED);
break;
case rsRWTERMINATE:
RsRwTerminate();
result = (rsEVENTPROCESSED);
break;
case rsRWINITIALISE:
result = (RsRwInitialise(param) ?
rsEVENTPROCESSED : rsEVENTERROR);
break;
case rsRWINITIALISE:
result = (RsRwInitialise(param) ?
rsEVENTPROCESSED : rsEVENTERROR);
break;
case rsTERMINATE:
RsTerminate();
result = (rsEVENTPROCESSED);
break;
case rsTERMINATE:
RsTerminate();
result = (rsEVENTPROCESSED);
break;
case rsINITIALISE:
result =
(RsInitialise()? rsEVENTPROCESSED : rsEVENTERROR);
break;
case rsINITIALISE:
result =
(RsInitialise()? rsEVENTPROCESSED : rsEVENTERROR);
break;
default:
result = (es);
break;
default:
result = (es);
break;
}
}
else
{
result = (es);
}
}
}
else
{
result = (es);
}
return result;
return result;
}
/*
@ -291,13 +269,13 @@ RsEventHandler(RsEvent event, void *param)
void
RsRwTerminate(void)
{
/* Close RenderWare */
/* Close RenderWare */
RwEngineStop();
RwEngineClose();
RwEngineTerm();
RwEngineStop();
RwEngineClose();
RwEngineTerm();
return;
return;
}
/*
@ -306,76 +284,76 @@ RsRwTerminate(void)
RwBool
RsRwInitialise(void *displayID)
{
RwEngineOpenParams openParams;
RwEngineOpenParams openParams;
/*
* Start RenderWare...
*/
/*
* Start RenderWare...
*/
if (!RwEngineInit(psGetMemoryFunctions(), 0, rsRESOURCESDEFAULTARENASIZE))
{
return (FALSE);
}
{
return (FALSE);
}
/*
* Install any platform specific file systems...
*/
psInstallFileSystem();
/*
* Install any platform specific file systems...
*/
psInstallFileSystem();
/*
* Initialize debug message handling...
*/
RsEventHandler(rsINITDEBUG, NULL);
/*
* Initialize debug message handling...
*/
RsEventHandler(rsINITDEBUG, NULL);
/*
* Attach all plugins...
*/
if (RsEventHandler(rsPLUGINATTACH, NULL) == rsEVENTERROR)
{
return (FALSE);
}
/*
* Attach all plugins...
*/
if (RsEventHandler(rsPLUGINATTACH, NULL) == rsEVENTERROR)
{
return (FALSE);
}
/*
* Attach input devices...
*/
if (RsEventHandler(rsINPUTDEVICEATTACH, NULL) == rsEVENTERROR)
{
return (FALSE);
}
/*
* Attach input devices...
*/
if (RsEventHandler(rsINPUTDEVICEATTACH, NULL) == rsEVENTERROR)
{
return (FALSE);
}
openParams.displayID = displayID;
if (!RwEngineOpen(&openParams))
{
RwEngineTerm();
return (FALSE);
}
if (!RwEngineOpen(&openParams))
{
RwEngineTerm();
return (FALSE);
}
if (RsEventHandler(rsSELECTDEVICE, displayID) == rsEVENTERROR)
{
RwEngineClose();
RwEngineTerm();
return (FALSE);
}
{
RwEngineClose();
RwEngineTerm();
return (FALSE);
}
if (!RwEngineStart())
{
RwEngineClose();
RwEngineTerm();
return (FALSE);
}
{
RwEngineClose();
RwEngineTerm();
return (FALSE);
}
/*
* Register loaders for an image with a particular file extension...
*/
RsEventHandler(rsREGISTERIMAGELOADER, NULL);
/*
* Register loaders for an image with a particular file extension...
*/
RsEventHandler(rsREGISTERIMAGELOADER, NULL);
psNativeTextureSupport();
psNativeTextureSupport();
RwTextureSetMipmapping(FALSE);
RwTextureSetMipmapping(FALSE);
RwTextureSetAutoMipmapping(FALSE);
return TRUE;
return TRUE;
}
/*
@ -384,9 +362,9 @@ RsRwInitialise(void *displayID)
void
RsTerminate(void)
{
psTerminate();
psTerminate();
return;
return;
}
/*
@ -395,39 +373,39 @@ RsTerminate(void)
RwBool
RsInitialise(void)
{
/*
* Initialize Platform independent data...
*/
RwBool result;
/*
* Initialize Platform independent data...
*/
RwBool result;
RsGlobal.appName = RWSTRING("GTA3");
RsGlobal.maximumWidth = DEFAULT_SCREEN_WIDTH;
RsGlobal.appName = RWSTRING("GTA3");
RsGlobal.maximumWidth = DEFAULT_SCREEN_WIDTH;
RsGlobal.maximumHeight = DEFAULT_SCREEN_HEIGHT;
RsGlobal.width = DEFAULT_SCREEN_WIDTH;
RsGlobal.height = DEFAULT_SCREEN_HEIGHT;
RsGlobal.height = DEFAULT_SCREEN_HEIGHT;
RsGlobal.maxFPS = 30;
RsGlobal.quit = FALSE;
RsGlobal.quit = FALSE;
/* setup the keyboard */
RsGlobal.keyboard.inputDeviceType = rsKEYBOARD;
RsGlobal.keyboard.inputEventHandler = 0;
RsGlobal.keyboard.used = FALSE;
/* setup the keyboard */
RsGlobal.keyboard.inputDeviceType = rsKEYBOARD;
RsGlobal.keyboard.inputEventHandler = 0;
RsGlobal.keyboard.used = FALSE;
/* setup the mouse */
RsGlobal.mouse.inputDeviceType = rsMOUSE;
RsGlobal.mouse.inputEventHandler = 0;
RsGlobal.mouse.used = FALSE;
/* setup the mouse */
RsGlobal.mouse.inputDeviceType = rsMOUSE;
RsGlobal.mouse.inputEventHandler = 0;
RsGlobal.mouse.used = FALSE;
/* setup the pad */
RsGlobal.pad.inputDeviceType = rsPAD;
RsGlobal.pad.inputEventHandler = 0;
RsGlobal.pad.used = FALSE;
/* setup the pad */
RsGlobal.pad.inputDeviceType = rsPAD;
RsGlobal.pad.inputEventHandler = 0;
RsGlobal.pad.used = FALSE;
result = psInitialise();
result = psInitialise();
return result;
return result;
}

View File

@ -24,17 +24,17 @@ extern "C"
enum RsInputDeviceType
{
rsKEYBOARD,
rsMOUSE,
rsPAD
rsKEYBOARD,
rsMOUSE,
rsPAD
};
typedef enum RsInputDeviceType RsInputDeviceType;
enum RsEventStatus
{
rsEVENTERROR,
rsEVENTPROCESSED,
rsEVENTNOTPROCESSED
rsEVENTERROR,
rsEVENTPROCESSED,
rsEVENTNOTPROCESSED
};
typedef enum RsEventStatus RsEventStatus;
@ -88,27 +88,27 @@ typedef RsEventStatus (*RsInputEventHandler)(RsEvent event, void *param);
typedef struct RsInputDevice RsInputDevice;
struct RsInputDevice
{
RsInputDeviceType inputDeviceType;
RwBool used;
RsInputEventHandler inputEventHandler;
RsInputDeviceType inputDeviceType;
RwBool used;
RsInputEventHandler inputEventHandler;
};
typedef struct RsGlobalType RsGlobalType;
struct RsGlobalType
{
const RwChar *appName;
RwInt32 width;
RwInt32 height;
RwInt32 maximumWidth;
RwInt32 maximumHeight;
const RwChar *appName;
RwInt32 width;
RwInt32 height;
RwInt32 maximumWidth;
RwInt32 maximumHeight;
RwInt32 maxFPS;
RwBool quit;
RwBool quit;
void *ps; /* platform specific data */
void *ps; /* platform specific data */
RsInputDevice keyboard;
RsInputDevice mouse;
RsInputDevice pad;
RsInputDevice keyboard;
RsInputDevice mouse;
RsInputDevice pad;
};
enum RsKeyCodes
@ -183,14 +183,14 @@ typedef enum RsKeyCodes RsKeyCodes;
typedef struct RsKeyStatus RsKeyStatus;
struct RsKeyStatus
{
RwInt32 keyCharCode;
RwInt32 keyCharCode;
};
typedef struct RsPadButtonStatus RsPadButtonStatus;
struct RsPadButtonStatus
{
RwInt32 padID;
RwUInt32 padButtons;
RwInt32 padID;
RwUInt32 padButtons;
};
enum RsPadButtons
@ -203,14 +203,14 @@ enum RsPadButtons
rsPADBUTTON4 = 4,
rsPADBUTTON5 = 5,
rsPADBUTTON6 = 6,
rsPADBUTTON7 = 7,
rsPADBUTTON8 = 8,
rsPADBUTTON6 = 6,
rsPADBUTTON7 = 7,
rsPADBUTTON8 = 8,
rsPADSELECT = 9,
rsPADBUTTONA1 = 10,
rsPADBUTTONA2 = 11,
rsPADBUTTONA2 = 11,
rsPADSTART = 12,
@ -245,7 +245,7 @@ RsSelectDevice(void);
extern RwBool
RsInputDeviceAttach(RsInputDeviceType inputDevice,
RsInputEventHandler inputEventHandler);
RsInputEventHandler inputEventHandler);
extern RwUInt32
RsTimer(void);

20
src/skel/win/resource.h Normal file
View File

@ -0,0 +1,20 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by dungeon.rc
//
#define IDD_DIALOG1 104
#define IDC_DEVICESEL 1000
#define IDC_VIDMODE 1001
#define IDEXIT 1002
#define IDC_SELECTDEVICE 1005
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 104
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

2152
src/skel/win/win.cpp Normal file

File diff suppressed because it is too large Load Diff

46
src/skel/win/win.h Normal file
View File

@ -0,0 +1,46 @@
#if (!defined(_PLATFORM_WIN_H))
#define _PLATFORM_WIN_H
#if (!defined(RSREGSETBREAKALLOC))
#define RSREGSETBREAKALLOC(_name) /* No op */
#endif /* (!defined(RSREGSETBREAKALLOC)) */
enum eGameState
{
GS_START_UP = 0,
GS_INIT_LOGO_MPEG,
GS_LOGO_MPEG,
GS_INIT_INTRO_MPEG,
GS_INTRO_MPEG,
GS_INIT_ONCE,
GS_INIT_FRONTEND,
GS_FRONTEND,
GS_INIT_PLAYING_GAME,
GS_PLAYING_GAME,
};
enum eWinVersion
{
OS_WIN95 = 0,
OS_WIN98,
oS_WINNT,
OS_WIN2000,
OS_WINXP,
};
extern RwUInt32 &gGameState;
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
extern LRESULT CALLBACK
MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* (!defined(_PLATFORM_WIN_H)) */

37
src/skel/win/win.rc Normal file
View File

@ -0,0 +1,37 @@
#include "resource.h"
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#if !defined(__GNU_C__)
#include "afxres.h"
#else
#include "winresrc.h"
#endif /* !defined(__GNU_C__) */
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_DIALOG1 DIALOG DISCARDABLE 0, 0, 186, 90
STYLE DS_MODALFRAME | DS_CENTER | DS_CENTERMOUSE | WS_POPUP | WS_CAPTION |
WS_SYSMENU
CAPTION "Device Selection"
FONT 8, "MS Sans Serif"
BEGIN
COMBOBOX IDC_DEVICESEL,7,25,172,33,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
COMBOBOX IDC_VIDMODE,7,46,172,74,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
DEFPUSHBUTTON "EXIT",IDEXIT,103,69,52,14
DEFPUSHBUTTON "OK",IDOK,28,69,50,14
LTEXT "Please select the device to use:",IDC_SELECTDEVICE,7,7,
137,8
END