2012-11-15 00:39:56 +01:00
|
|
|
#include "stdafx.h"
|
2014-06-17 17:44:03 +02:00
|
|
|
#include "Utilities/Log.h"
|
2014-06-02 19:27:24 +02:00
|
|
|
#include "Emu/Memory/Memory.h"
|
|
|
|
|
#include "Emu/System.h"
|
|
|
|
|
#include "Emu/Cell/PPUThread.h"
|
|
|
|
|
#include "Emu/SysCalls/SC_FUNC.h"
|
|
|
|
|
#include "Emu/SysCalls/Modules.h"
|
2012-11-15 00:39:56 +01:00
|
|
|
#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-06-25 23:59:23 +02:00
|
|
|
GSLockCurrent gslock(GS_LOCK_WAIT_FLUSH);
|
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-26 15:06:13 +01:00
|
|
|
if(res > 0) Memory.Copy(ctx.begin, 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-06-25 23:59:23 +02:00
|
|
|
//InterlockedExchange64((volatile long long*)((u8*)&ctrl + offsetof(CellGcmControl, put)), (u64)(u32)re(res));
|
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;
|
|
|
|
|
}
|