Cleaned identation, solved bug in WrapI_UU64(). Ammended

sceIoWaitAsync and sceIoWaitAsyncCB since they can not be wrapped.
This commit is contained in:
Yn5an3 2012-12-05 22:19:14 +01:00 committed by Álvaro Acción Montes
parent fb919a392b
commit 8d5125ea8b
3 changed files with 509 additions and 460 deletions

View file

@ -29,25 +29,25 @@ template<u64 func()> void WrapU64_V() {
currentMIPS->r[3] = (retval >> 32) & 0xFFFFFFFF;
}
//This seems to be wrong
template<int func(u32, u64)> void WrapI_UU64() {
u64 param_one = currentMIPS->r[5];
param_one |= (u64)(currentMIPS->r[6])<< 32;
u64 param_one = currentMIPS->r[6];
param_one |= (u64)(currentMIPS->r[7]) << 32;
int retval = func(PARAM(0), param_one);
RETURN(retval);
}
template<int func(u32,u32,u64)> void WrapI_UUU64() {
template<int func(u32, u32, u64)> void WrapI_UUU64() {
u64 param_two = currentMIPS->r[6];
param_two |= (u64)(currentMIPS->r[7])<< 32;
param_two |= (u64)(currentMIPS->r[7]) << 32;
int retval = func(PARAM(0), PARAM(1), param_two);
RETURN(retval);
}
template<u32 func(int, s64, int)> void WrapU_II64I(){
s64 param_one = ((s64)PARAM(2)) | ((s64)(PARAM(3))<<32);
u32 retval = func(PARAM(0), param_one, PARAM(4));
RETURN(retval);
template<u32 func(int, s64, int)> void WrapU_II64I() {
s64 param_one = currentMIPS->r[6];
param_one |= (s64)(currentMIPS->r[7]) << 32;
u32 retval = func(PARAM(0), param_one, PARAM(4));
RETURN(retval);
}
//32bit wrappers
@ -59,9 +59,9 @@ template<u32 func()> void WrapU_V() {
RETURN(func());
}
template<u32 func(int, void *, int)> void WrapU_IVI(){
u32 retval = func(PARAM(0), Memory::GetPointer(PARAM(1)), PARAM(2));
RETURN(retval);
template<u32 func(int, void *, int)> void WrapU_IVI() {
u32 retval = func(PARAM(0), Memory::GetPointer(PARAM(1)), PARAM(2));
RETURN(retval);
}
template<float func()> void WrapF_V() {
@ -84,8 +84,8 @@ template<int func(u32)> void WrapI_U() {
}
template<u32 func(int, u32, int)> void WrapU_IUI() {
u32 retval = func(PARAM(0), PARAM(1),PARAM(2));
RETURN(retval);
u32 retval = func(PARAM(0), PARAM(1), PARAM(2));
RETURN(retval);
}
template<int func(u32, u32)> void WrapI_UU() {
@ -148,7 +148,6 @@ template<int func(u32, u32, int)> void WrapI_UUI() {
RETURN(retval);
}
template<int func(int, int)> void WrapI_II() {
int retval = func(PARAM(0), PARAM(1));
RETURN(retval);
@ -172,15 +171,16 @@ template<void func(u32, int)> void WrapV_UI() {
func(PARAM(0), PARAM(1));
}
template<u32 func(const char *)> void WrapU_C(){
u32 retval = func(Memory::GetCharPointer(PARAM(0)));
RETURN(retval);
template<u32 func(const char *)> void WrapU_C() {
u32 retval = func(Memory::GetCharPointer(PARAM(0)));
RETURN(retval);
}
template<u32 func(const char *, const char *, const char *, u32)> void WrapU_CCCU(){
u32 retval = func(Memory::GetCharPointer(PARAM(0)),Memory::GetCharPointer(PARAM(1)),
Memory::GetCharPointer(PARAM(2)), PARAM(3));
RETURN(retval);
template<u32 func(const char *, const char *, const char *, u32)> void WrapU_CCCU() {
u32 retval = func(Memory::GetCharPointer(PARAM(0)),
Memory::GetCharPointer(PARAM(1)), Memory::GetCharPointer(PARAM(2)),
PARAM(3));
RETURN(retval);
}
template<int func(const char *, u32)> void WrapI_CU() {
@ -189,33 +189,34 @@ template<int func(const char *, u32)> void WrapI_CU() {
}
template<int func(const char *, u32, u32, u32)> void WrapI_CUUU() {
int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3));
int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2),
PARAM(3));
RETURN(retval);
}
template<u32 func(const char *, u32)> void WrapU_CU() {
u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1));
RETURN((u32)retval);
u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1));
RETURN((u32) retval);
}
template<u32 func(u32, const char *)> void WrapU_UC() {
u32 retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)));
u32 retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)));
RETURN(retval);
}
template<u32 func(const char *, u32, u32)> void WrapU_CUU() {
u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2));
RETURN((u32)retval);
u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2));
RETURN((u32) retval);
}
template<u32 func(int, int, int)> void WrapU_III() {
u32 retval = func(PARAM(0), PARAM(1), PARAM(2));
RETURN(retval);
u32 retval = func(PARAM(0), PARAM(1), PARAM(2));
RETURN(retval);
}
template<u32 func(int, u32, u32)> void WrapU_IUU() {
u32 retval = func(PARAM(0), PARAM(1), PARAM(2));
RETURN(retval);
u32 retval = func(PARAM(0), PARAM(1), PARAM(2));
RETURN(retval);
}
template<u32 func(u32, u32, u32)> void WrapU_UUU() {
@ -252,11 +253,13 @@ template<void func(const char *, u32, int, u32)> void WrapV_CUIU() {
}
template<void func(u32, const char *, u32, int, u32)> void WrapV_UCUIU() {
func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), PARAM(3), PARAM(4));
func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), PARAM(3),
PARAM(4));
}
template<void func(const char *, u32, int, int, u32)> void WrapV_CUIIU() {
func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3),
PARAM(4));
}
template<u32 func(u32, u32, u32, u32)> void WrapU_UUUU() {
@ -289,32 +292,35 @@ template<void func(u32, u32, u32, u32, u32)> void WrapV_UUUUU() {
}
template<u32 func(const char *, const char *)> void WrapU_CC() {
int retval = func(Memory::GetCharPointer(PARAM(0)), Memory::GetCharPointer(PARAM(1)));
RETURN(retval);
int retval = func(Memory::GetCharPointer(PARAM(0)),
Memory::GetCharPointer(PARAM(1)));
RETURN(retval);
}
template<void func(const char *, int)> void WrapV_CI() {
func(Memory::GetCharPointer(PARAM(0)), PARAM(1));
func(Memory::GetCharPointer(PARAM(0)), PARAM(1));
}
template<u32 func(const char *, int)> void WrapU_CI() {
int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1));
RETURN(retval);
int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1));
RETURN(retval);
}
template<int func(const char *, int, u32, int, u32)> void WrapU_CIUIU() {
int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2),
PARAM(3), PARAM(4));
RETURN(retval);
}
template<u32 func(const char *, int, u32, int, u32, int)> void WrapU_CIUIUI() {
u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3), PARAM(4),
PARAM(5));
RETURN(retval);
u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2),
PARAM(3), PARAM(4), PARAM(5));
RETURN(retval);
}
template<u32 func(u32, u32, u32, u32, u32, u32)> void WrapU_UUUUUU() {
u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5));
u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4),
PARAM(5));
RETURN(retval);
}

View file

@ -28,7 +28,6 @@
// TODO: This doesn't really belong here
static int state;
void __GeInit()
{
state = 0;
@ -42,26 +41,26 @@ void __GeShutdown()
// The GE is implemented wrong - it should be parallel to the CPU execution instead of
// synchronous.
u32 sceGeEdramGetAddr()
{
u32 retVal = 0x04000000;
DEBUG_LOG(HLE,"%08x = sceGeEdramGetAddr",retVal);
DEBUG_LOG(HLE, "%08x = sceGeEdramGetAddr", retVal);
return retVal;
}
u32 sceGeEdramGetSize()
{
u32 retVal = 0x00200000;
DEBUG_LOG(HLE,"%08x = sceGeEdramGetSize()",retVal);
DEBUG_LOG(HLE, "%08x = sceGeEdramGetSize()", retVal);
return retVal;
}
u32 sceGeListEnQueue(u32 listAddress, u32 stallAddress, u32 callbackId, u32 optParamAddr)
u32 sceGeListEnQueue(u32 listAddress, u32 stallAddress, u32 callbackId,
u32 optParamAddr)
{
DEBUG_LOG(HLE,"sceGeListEnQueue(addr=%08x, stall=%08x, cbid=%08x, param=%08x)",
listAddress,stallAddress,callbackId,optParamAddr);
DEBUG_LOG(HLE,
"sceGeListEnQueue(addr=%08x, stall=%08x, cbid=%08x, param=%08x)",
listAddress, stallAddress, callbackId, optParamAddr);
//if (!stallAddress)
// stallAddress = listAddress;
u32 listID = gpu->EnqueueList(listAddress, stallAddress);
@ -71,76 +70,83 @@ u32 sceGeListEnQueue(u32 listAddress, u32 stallAddress, u32 callbackId, u32 optP
else
state = SCE_GE_LIST_COMPLETED;
DEBUG_LOG(HLE,"List %i enqueued.", listID);
DEBUG_LOG(HLE, "List %i enqueued.", listID);
//return display list ID
return listID;
}
u32 sceGeListEnQueueHead(u32 listAddress, u32 stallAddress, u32 callbackId, u32 optParamAddr)
u32 sceGeListEnQueueHead(u32 listAddress, u32 stallAddress, u32 callbackId,
u32 optParamAddr)
{
DEBUG_LOG(HLE,"sceGeListEnQueueHead(addr=%08x, stall=%08x, cbid=%08x, param=%08x)",
listAddress,stallAddress,callbackId,optParamAddr);
DEBUG_LOG(HLE,
"sceGeListEnQueueHead(addr=%08x, stall=%08x, cbid=%08x, param=%08x)",
listAddress, stallAddress, callbackId, optParamAddr);
//if (!stallAddress)
// stallAddress = listAddress;
u32 listID = gpu->EnqueueList(listAddress,stallAddress);
u32 listID = gpu->EnqueueList(listAddress, stallAddress);
// HACKY
if (listID)
state = SCE_GE_LIST_STALLING;
else
state = SCE_GE_LIST_COMPLETED;
DEBUG_LOG(HLE,"List %i enqueued.", listID);
DEBUG_LOG(HLE, "List %i enqueued.", listID);
//return display list ID
return listID;
}
void sceGeListUpdateStallAddr(u32 displayListID, u32 stallAddress)
void sceGeListUpdateStallAddr(u32 displayListID, u32 stallAddress)
{
DEBUG_LOG(HLE,"sceGeListUpdateStallAddr(dlid=%i,stalladdr=%08x)",
displayListID,stallAddress);
DEBUG_LOG(HLE, "sceGeListUpdateStallAddr(dlid=%i,stalladdr=%08x)",
displayListID, stallAddress);
gpu->UpdateStall(displayListID, stallAddress);
}
void sceGeListSync(u32 displayListID, u32 mode) //0 : wait for completion 1:check and return
{
DEBUG_LOG(HLE,"sceGeListSync(dlid=%08x, mode=%08x)", displayListID,mode);
DEBUG_LOG(HLE, "sceGeListSync(dlid=%08x, mode=%08x)", displayListID, mode);
}
u32 sceGeDrawSync(u32 mode)
{
//wait/check entire drawing state
DEBUG_LOG(HLE,"FAKE sceGeDrawSync(mode=%d) (0=wait for completion)",mode);
DEBUG_LOG(HLE, "FAKE sceGeDrawSync(mode=%d) (0=wait for completion)",
mode);
gpu->DrawSync(mode);
return 0;
}
void sceGeContinue()
{
ERROR_LOG(HLE,"UNIMPL sceGeContinue");
ERROR_LOG(HLE, "UNIMPL sceGeContinue");
// no arguments
}
void sceGeBreak(u32 mode)
{
//mode => 0 : current dlist 1: all drawing
ERROR_LOG(HLE,"UNIMPL sceGeBreak(mode=%d)",mode);
//mode => 0 : current dlist 1: all drawing
ERROR_LOG(HLE, "UNIMPL sceGeBreak(mode=%d)", mode);
}
u32 sceGeSetCallback(u32 structAddr)
{
DEBUG_LOG(HLE,"sceGeSetCallback(struct=%08x)", structAddr);
DEBUG_LOG(HLE, "sceGeSetCallback(struct=%08x)", structAddr);
PspGeCallbackData ge_callback_data;
Memory::ReadStruct(structAddr, &ge_callback_data);
if (ge_callback_data.finish_func) {
sceKernelRegisterSubIntrHandler(PSP_GE_INTR, PSP_GE_SUBINTR_FINISH, ge_callback_data.finish_func, ge_callback_data.finish_arg);
if (ge_callback_data.finish_func)
{
sceKernelRegisterSubIntrHandler(PSP_GE_INTR, PSP_GE_SUBINTR_FINISH,
ge_callback_data.finish_func, ge_callback_data.finish_arg);
sceKernelEnableSubIntr(PSP_GE_INTR, PSP_GE_SUBINTR_FINISH);
}
if (ge_callback_data.signal_func) {
sceKernelRegisterSubIntrHandler(PSP_GE_INTR, PSP_GE_SUBINTR_SIGNAL, ge_callback_data.signal_func, ge_callback_data.signal_arg);
if (ge_callback_data.signal_func)
{
sceKernelRegisterSubIntrHandler(PSP_GE_INTR, PSP_GE_SUBINTR_SIGNAL,
ge_callback_data.signal_func, ge_callback_data.signal_arg);
sceKernelEnableSubIntr(PSP_GE_INTR, PSP_GE_SUBINTR_SIGNAL);
}
@ -148,9 +154,8 @@ u32 sceGeSetCallback(u32 structAddr)
return 0;
}
void sceGeUnsetCallback(u32 cbID)
{
DEBUG_LOG(HLE,"sceGeUnsetCallback(cbid=%08x)", cbID);
void sceGeUnsetCallback(u32 cbID) {
DEBUG_LOG(HLE, "sceGeUnsetCallback(cbid=%08x)", cbID);
sceKernelReleaseSubIntrHandler(PSP_GE_INTR, PSP_GE_SUBINTR_FINISH);
sceKernelReleaseSubIntrHandler(PSP_GE_INTR, PSP_GE_SUBINTR_SIGNAL);
}
@ -159,15 +164,17 @@ void sceGeUnsetCallback(u32 cbID)
// unless some insane game pokes it and relies on it...
u32 sceGeSaveContext(u32 ctxAddr)
{
DEBUG_LOG(HLE,"sceGeSaveContext(%08x)", ctxAddr);
DEBUG_LOG(HLE, "sceGeSaveContext(%08x)", ctxAddr);
if (sizeof(gstate) > 512 * 4) {
if (sizeof(gstate) > 512 * 4)
{
ERROR_LOG(HLE, "AARGH! sizeof(gstate) has grown too large!");
return 0;
}
// Let's just dump gstate.
if (Memory::IsValidAddress(ctxAddr)) {
if (Memory::IsValidAddress(ctxAddr))
{
Memory::WriteStruct(ctxAddr, &gstate);
}
@ -178,14 +185,16 @@ u32 sceGeSaveContext(u32 ctxAddr)
u32 sceGeRestoreContext(u32 ctxAddr)
{
DEBUG_LOG(HLE,"sceGeRestoreContext(%08x)", ctxAddr);
DEBUG_LOG(HLE, "sceGeRestoreContext(%08x)", ctxAddr);
if (sizeof(gstate) > 512 * 4) {
if (sizeof(gstate) > 512 * 4)
{
ERROR_LOG(HLE, "AARGH! sizeof(gstate) has grown too large!");
return 0;
}
if (Memory::IsValidAddress(ctxAddr)) {
if (Memory::IsValidAddress(ctxAddr))
{
Memory::ReadStruct(ctxAddr, &gstate);
}
ReapplyGfxState();
@ -195,16 +204,16 @@ u32 sceGeRestoreContext(u32 ctxAddr)
void sceGeGetMtx()
{
ERROR_LOG(HLE,"UNIMPL sceGeGetMtx()");
ERROR_LOG(HLE, "UNIMPL sceGeGetMtx()");
}
u32 sceGeEdramSetAddrTranslation(int new_size)
{
INFO_LOG(HLE,"sceGeEdramSetAddrTranslation(%i)", new_size);
INFO_LOG(HLE, "sceGeEdramSetAddrTranslation(%i)", new_size);
static int EDRamWidth;
int last = EDRamWidth;
EDRamWidth = new_size;
return last;
return last;
}
const HLEFunction sceGe_user[] =

File diff suppressed because it is too large Load diff