diff --git a/Core/HLE/sceAudio.cpp b/Core/HLE/sceAudio.cpp index 9305852bcd..e2ad72349c 100644 --- a/Core/HLE/sceAudio.cpp +++ b/Core/HLE/sceAudio.cpp @@ -37,29 +37,29 @@ AudioChannel chans[8]; // max or 50%? void sceAudioOutputPannedBlocking(u32 chan, u32 volume1, u32 volume2, u32 samplePtr) { - DEBUG_LOG(HLE,"sceAudioOutputPannedBlocking(%d,%d,%d, %08x )", chan, volume1, volume2, samplePtr); - if (samplePtr == 0) { - ERROR_LOG(HLE, "Sample pointer null"); + ERROR_LOG(HLE, "sceAudioOutputPannedBlocking - Sample pointer null"); RETURN(0); } - - if (chan < 0 || chan >= MAX_CHANNEL) + else if (chan < 0 || chan >= MAX_CHANNEL) { ERROR_LOG(HLE,"sceAudioOutputPannedBlocking() - BAD CHANNEL"); RETURN(SCE_ERROR_AUDIO_INVALID_CHANNEL); } else if (!chans[chan].reserved) { + ERROR_LOG(HLE,"sceAudioOutputPannedBlocking() - CHANNEL NOT RESERVED"); RETURN(SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED); } else { - chans[chan].running = true; + DEBUG_LOG(HLE,"sceAudioOutputPannedBlocking(%d,%d,%d, %08x )", chan, volume1, volume2, samplePtr); + chans[chan].running = true; chans[chan].leftVolume = volume1; chans[chan].rightVolume = volume2; chans[chan].sampleAddress = samplePtr; + RETURN(0); __AudioEnqueue(chans[chan], chan, true); } } @@ -97,6 +97,11 @@ u32 sceAudioOutputPanned(u32 chan, u32 leftVol, u32 rightVol, u32 samplePtr) void sceAudioOutputBlocking(u32 chan, u32 vol, u32 samplePtr) { + if (samplePtr == 0) + { + ERROR_LOG(HLE, "sceAudioOutputBlocking - Sample pointer null"); + RETURN(0); + } if (chan < 0 || chan >= MAX_CHANNEL) { ERROR_LOG(HLE,"sceAudioOutputBlocking() - BAD CHANNEL"); @@ -114,6 +119,7 @@ void sceAudioOutputBlocking(u32 chan, u32 vol, u32 samplePtr) chans[chan].leftVolume = vol; chans[chan].rightVolume = vol; chans[chan].sampleAddress = samplePtr; + RETURN(0); __AudioEnqueue(chans[chan], chan, true); } } diff --git a/Core/HLE/sceCtrl.cpp b/Core/HLE/sceCtrl.cpp index 0667bc3d1e..5900e36a86 100644 --- a/Core/HLE/sceCtrl.cpp +++ b/Core/HLE/sceCtrl.cpp @@ -34,6 +34,13 @@ struct _ctrl_data u8 unused[6]; }; +struct CtrlLatch { + u32 btnMake; + u32 btnBreak; + u32 btnPress; + u32 btnRelease; +}; + ////////////////////////////////////////////////////////////////////////// // STATE BEGIN @@ -84,7 +91,7 @@ void sceCtrlInit() void sceCtrlSetSamplingMode() { u32 mode = PARAM(0); - DEBUG_LOG(HLE,"sceCtrlSetSamplingMode(%i) ra=%08x", mode, currentMIPS->r[MIPS_REG_RA]); + DEBUG_LOG(HLE,"sceCtrlSetSamplingMode(%i)", mode); if (ctrlInited) { RETURN((u32)analogEnabled); @@ -101,8 +108,9 @@ void sceCtrlSetIdleCancelThreshold() void sceCtrlReadBufferPositive() { - u32 ctrlData = PARAM(0); + u32 ctrlDataPtr = PARAM(0); // u32 nBufs = PARAM(1); + DEBUG_LOG(HLE,"sceCtrlReadBufferPositive(%08x)", PARAM(0)); std::lock_guard guard(ctrlMutex); // Let's just ignore if ctrl is inited or not; some games don't init it (Super Fruit Fall) @@ -155,11 +163,25 @@ void sceCtrlReadBufferPositive() data.analog[1] = analogY; #endif - memcpy(Memory::GetPointer(ctrlData), &data, sizeof(_ctrl_data)); + memcpy(Memory::GetPointer(ctrlDataPtr), &data, sizeof(_ctrl_data)); //} RETURN(1); } +void sceCtrlPeekLatch() { + u32 latchDataPtr = PARAM(0); + ERROR_LOG(HLE,"UNIMPL sceCtrlPeekLatch(%08x)", latchDataPtr); + + RETURN(1); +} + +void sceCtrlReadLatch() { + u32 latchDataPtr = PARAM(0); + ERROR_LOG(HLE,"UNIMPL sceCtrlReadLatch(%08x)", latchDataPtr); + + RETURN(1); +} + static const HLEFunction sceCtrl[] = { {0x6a2774f3, sceCtrlInit, "sceCtrlInit"}, //(int unknown), init with 0 @@ -172,8 +194,8 @@ static const HLEFunction sceCtrl[] = {0x3A622550,sceCtrlReadBufferPositive,"sceCtrlPeekBufferPositive"}, {0xC152080A,0,"sceCtrlPeekBufferNegative"}, {0x60B81F86,0,"sceCtrlReadBufferNegative"}, - {0xB1D0E5CD,0,"sceCtrlPeekLatch"}, - {0x0B588501,0,"sceCtrlReadLatch"}, + {0xB1D0E5CD,sceCtrlPeekLatch,"sceCtrlPeekLatch"}, + {0x0B588501,sceCtrlReadLatch,"sceCtrlReadLatch"}, {0x348D99D4,0,"sceCtrl_348D99D4"}, {0xAF5960F3,0,"sceCtrl_AF5960F3"}, {0xA68FD260,0,"sceCtrlClearRapidFire"}, diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index a3c4ab1c16..5d95d546c4 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -242,6 +242,13 @@ void sceDisplayWaitVblank() sceDisplayWaitVblankStart(); } +void sceDisplayWaitVblankCB() +{ + DEBUG_LOG(HLE,"sceDisplayWaitVblankCB()"); + __KernelWaitCurThread(WAITTYPE_VBLANK, 0, 0, 0, true); + __KernelCheckCallbacks(); +} + void sceDisplayWaitVblankStartCB() { DEBUG_LOG(HLE,"sceDisplayWaitVblankStartCB()"); @@ -285,8 +292,9 @@ const HLEFunction sceDisplay[] = {0x289D82FE,sceDisplaySetFramebuf, "sceDisplaySetFramebuf"}, {0x36CDFADE,sceDisplayWaitVblank, "sceDisplayWaitVblank"}, {0x984C27E7,sceDisplayWaitVblankStart, "sceDisplayWaitVblankStart"}, + {0x8EB9EC49,sceDisplayWaitVblankCB, "sceDisplayWaitVblankCB"}, {0x46F186C3,sceDisplayWaitVblankStartCB, "sceDisplayWaitVblankStartCB"}, - {0x8EB9EC49,sceDisplayWaitVblankStartCB, "sceDisplayWaitVblankCB"}, + {0x77ed8b3a,0,"sceDisplayWaitVblankStartMultiCB"}, {0xdba6c4c4,&WrapF_V,"sceDisplayGetFramePerSec"}, {0x773dd3a3,sceDisplayGetCurrentHcount,"sceDisplayGetCurrentHcount"}, @@ -301,7 +309,6 @@ const HLEFunction sceDisplay[] = {0xB4F378FA,0,"sceDisplayIsForeground"}, {0x31C4BAA8,0,"sceDisplayGetBrightness"}, {0x4D4E10EC,sceDisplayIsVblank,"sceDisplayIsVblank"}, - {0x77ed8b3a,0,"sceDisplay_77ed8b3a"}, }; void Register_sceDisplay() diff --git a/Core/HLE/sceKernel.cpp b/Core/HLE/sceKernel.cpp index a91ba5816e..49484e42cb 100644 --- a/Core/HLE/sceKernel.cpp +++ b/Core/HLE/sceKernel.cpp @@ -120,6 +120,17 @@ void sceKernelExitGame() RETURN(0); } +void sceKernelExitGameWithStatus() +{ + INFO_LOG(HLE,"sceKernelExitGameWithStatus"); + if (PSP_CoreParameter().headLess) + exit(0); + else + PanicAlert("Game exited (with status)"); + Core_Stop(); + RETURN(0); +} + void sceKernelRegisterExitCallback() { u32 cbId = PARAM(0); @@ -445,7 +456,7 @@ const HLEFunction LoadExecForUser[] = {0x05572A5F,sceKernelExitGame, "sceKernelExitGame"}, //() {0x4AC57943,sceKernelRegisterExitCallback,"sceKernelRegisterExitCallback"}, {0xBD2F1094,sceKernelLoadExec,"sceKernelLoadExec"}, - {0x2AC9954B,0,"sceKernelExitGameWithStatus"}, + {0x2AC9954B,sceKernelExitGameWithStatus,"sceKernelExitGameWithStatus"}, }; void Register_LoadExecForUser() diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index 295de2b62b..5b1017a392 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -290,7 +290,7 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro PspLibStubEntry *entry = (PspLibStubEntry *)Memory::GetPointer(modinfo->libstub); int numSyms=0; - for (int m=0; mnt.nativeSize = sz; + u32 wantedSize = *(u32 *)outptr; + u32 sz = sizeof(NativeThread); + if (wantedSize) { + t->nt.nativeSize = sz = std::min(sz, wantedSize); + } memcpy(outptr, &(t->nt), sz); RETURN(0); } @@ -449,7 +453,7 @@ void sceKernelGetThreadmanIdType() // Saves the current CPU context void __KernelSaveContext(ThreadContext *ctx) { - for (int i=0; i<32; i++) + for (int i = 0; i < 32; i++) { ctx->r[i] = currentMIPS->r[i]; ctx->f[i] = currentMIPS->f[i]; diff --git a/Core/HLE/scePsmf.cpp b/Core/HLE/scePsmf.cpp index bbf41d23d7..a119bfc20b 100644 --- a/Core/HLE/scePsmf.cpp +++ b/Core/HLE/scePsmf.cpp @@ -79,6 +79,7 @@ const HLEFunction scePsmf[] = {0xc7db3a5b,0,"scePsmfGetCurrentStreamTypeFunction"}, {0xB78EB9E9,0,"scePsmfGetHeaderSizeFunction"}, {0xA5EBFE81,0,"scePsmfGetStreamSizeFunction"}, + {0xE1283895,0,"scePsmfGetPsmfVersionFunction"}, }; void scePsmfPlayerCreate() { diff --git a/Core/HLE/sceUmd.cpp b/Core/HLE/sceUmd.cpp index c24a86875e..9bb4cc5e29 100644 --- a/Core/HLE/sceUmd.cpp +++ b/Core/HLE/sceUmd.cpp @@ -27,11 +27,20 @@ #define UMD_READY 0x10 #define UMD_READABLE 0x20 + u8 umdActivated = 1; u32 umdStatus = 0; u32 umdErrorStat = 0; +#define PSP_UMD_TYPE_GAME 0x10 +#define PSP_UMD_TYPE_VIDEO 0x20 +#define PSP_UMD_TYPE_AUDIO 0x40 + +struct PspUmdInfo { + int type; +}; + void __UmdInit() { umdActivated = 1; @@ -74,7 +83,14 @@ void sceUmdCheckMedium() void sceUmdGetDiscInfo() { - ERROR_LOG(HLE,"UNIMPL sceUmdGetDiscInfo(?)"); + u32 infoAddr = PARAM(0); + ERROR_LOG(HLE,"sceUmdGetDiscInfo(%08x)", infoAddr); + PspUmdInfo info; + info.type = PSP_UMD_TYPE_GAME; + if (Memory::IsValidAddress(infoAddr)) + { + Memory::WriteStruct(infoAddr, &info); + } RETURN(0); } diff --git a/android/project.properties b/android/project.properties index c82ac47fcf..924a2616fc 100644 --- a/android/project.properties +++ b/android/project.properties @@ -12,4 +12,4 @@ # Project target. target=android-8 -android.library.reference.1=../../../../workspace/native/android +android.library.reference.1=../native/android diff --git a/android/src/org/ppsspp/ppsspp/PpssppActivity.java b/android/src/org/ppsspp/ppsspp/PpssppActivity.java index 975765a049..be46ac6038 100644 --- a/android/src/org/ppsspp/ppsspp/PpssppActivity.java +++ b/android/src/org/ppsspp/ppsspp/PpssppActivity.java @@ -11,9 +11,8 @@ public class PpssppActivity extends NativeActivity { super(); } - @Override public boolean overrideKeys() { return false; } -} \ No newline at end of file +} \ No newline at end of file