mirror of
https://github.com/halpz/re3.git
synced 2025-07-03 12:00:51 +00:00
skeleton updated, windows specific stuff added
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user