mirror of
https://github.com/aap/librw.git
synced 2025-12-19 17:09:51 +00:00
improved engine init and plugin registration
This commit is contained in:
@@ -36,6 +36,8 @@ getPDSPipe(uint32 data)
|
||||
void
|
||||
registerPDSPipe(Pipeline *pipe)
|
||||
{
|
||||
if(pdsGlobals.pipes == nil)
|
||||
pdsGlobals.pipes = rwNewT(Pipeline*, pdsGlobals.maxPipes, MEMDUR_GLOBAL | ID_PDS);
|
||||
assert(pdsGlobals.numPipes < pdsGlobals.maxPipes);
|
||||
pdsGlobals.pipes[pdsGlobals.numPipes++] = pipe;
|
||||
}
|
||||
@@ -56,12 +58,22 @@ materialPDSRights(void *object, int32, int32, uint32 data)
|
||||
// printf("mat pds: %x %x %x\n", data, m->pipeline->pluginID, m->pipeline->pluginData);
|
||||
}
|
||||
|
||||
static void *pdsOpen(void *object, int32 offset, int32 size) { return object; }
|
||||
static void*
|
||||
pdsClose(void *object, int32 offset, int32 size)
|
||||
{
|
||||
// TODO MEMORY: free registered pipelines
|
||||
rwFree(pdsGlobals.pipes);
|
||||
return object;
|
||||
}
|
||||
|
||||
void
|
||||
registerPDSPlugin(int32 n)
|
||||
{
|
||||
pdsGlobals.maxPipes = n;
|
||||
pdsGlobals.numPipes = 0;
|
||||
pdsGlobals.pipes = rwNewT(Pipeline*, n, MEMDUR_GLOBAL | ID_PDS);
|
||||
pdsGlobals.pipes = nil;
|
||||
Engine::registerPlugin(0, ID_PDS, pdsOpen, pdsClose);
|
||||
Atomic::registerPlugin(0, ID_PDS, nil, nil, nil);
|
||||
Atomic::setStreamRightsCallback(ID_PDS, atomicPDSRights);
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
namespace rw {
|
||||
namespace ps2 {
|
||||
|
||||
void*
|
||||
static void*
|
||||
driverOpen(void *o, int32, int32)
|
||||
{
|
||||
engine->driver[PLATFORM_PS2]->defaultPipeline = makeDefaultPipeline();
|
||||
@@ -34,14 +34,14 @@ driverOpen(void *o, int32, int32)
|
||||
return o;
|
||||
}
|
||||
|
||||
void*
|
||||
static void*
|
||||
driverClose(void *o, int32, int32)
|
||||
{
|
||||
return o;
|
||||
}
|
||||
|
||||
void
|
||||
initializePlatform(void)
|
||||
registerPlatformPlugins(void)
|
||||
{
|
||||
Driver::registerPlugin(PLATFORM_PS2, 0, PLATFORM_PS2,
|
||||
driverOpen, driverClose);
|
||||
|
||||
@@ -8,7 +8,7 @@ struct EngineStartParams
|
||||
|
||||
namespace ps2 {
|
||||
|
||||
void initializePlatform(void);
|
||||
void registerPlatformPlugins(void);
|
||||
|
||||
extern Device renderdevice;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user