2012-11-15 00:39:56 +01:00
|
|
|
#include "stdafx.h"
|
|
|
|
|
#include "Emu/SysCalls/SysCalls.h"
|
|
|
|
|
#include "Emu/GS/GCM.h"
|
|
|
|
|
|
2013-06-30 10:46:29 +02:00
|
|
|
extern Module cellGcmSys;
|
2013-08-26 16:18:59 +02:00
|
|
|
extern gcmInfo gcm_info;
|
2012-11-15 00:39:56 +01:00
|
|
|
|
2013-06-30 10:46:29 +02:00
|
|
|
int cellGcmCallback(u32 context_addr, u32 count)
|
|
|
|
|
{
|
2014-02-05 12:55:32 +01:00
|
|
|
GSLockCurrent gslock(GS_LOCK_WAIT_FLUSH); // could stall on exit
|
2013-06-30 10:46:29 +02:00
|
|
|
|
|
|
|
|
CellGcmContextData& ctx = (CellGcmContextData&)Memory[context_addr];
|
|
|
|
|
CellGcmControl& ctrl = (CellGcmControl&)Memory[gcm_info.control_addr];
|
|
|
|
|
|
2014-02-24 17:03:47 +01:00
|
|
|
const s32 res = ctx.current - ctx.begin - ctrl.put;
|
2013-06-30 10:46:29 +02:00
|
|
|
|
2014-02-24 17:03:47 +01:00
|
|
|
if(res > 0) memcpy(&Memory[ctx.begin], &Memory[ctx.current - res], res);
|
2013-06-30 10:46:29 +02:00
|
|
|
|
2014-02-24 17:03:47 +01:00
|
|
|
ctx.current = ctx.begin + res;
|
2013-06-30 10:46:29 +02:00
|
|
|
|
2014-02-24 17:03:47 +01:00
|
|
|
ctrl.put = res;
|
2013-06-30 10:46:29 +02:00
|
|
|
ctrl.get = 0;
|
|
|
|
|
|
|
|
|
|
return CELL_OK;
|
|
|
|
|
}
|