mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-02 03:32:17 +00:00
Remove some RETURN, cleanup
This commit is contained in:
parent
86a27600af
commit
5e3590d94e
@ -6,7 +6,7 @@
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
@ -36,74 +36,48 @@ AudioChannel chans[8];
|
||||
// Not sure about the range of volume, I often see 0x800 so that might be either
|
||||
// max or 50%?
|
||||
|
||||
void sceAudioOutputBlocking(u32 chan, u32 vol, u32 samplePtr)
|
||||
{
|
||||
if (samplePtr == 0)
|
||||
{
|
||||
u32 sceAudioOutputBlocking(u32 chan, u32 vol, u32 samplePtr) {
|
||||
if (samplePtr == 0) {
|
||||
ERROR_LOG(HLE, "sceAudioOutputBlocking - Sample pointer null");
|
||||
RETURN(0);
|
||||
return 0;
|
||||
}
|
||||
if (chan < 0 || chan >= MAX_CHANNEL)
|
||||
{
|
||||
if (chan < 0 || chan >= MAX_CHANNEL) {
|
||||
ERROR_LOG(HLE,"sceAudioOutputBlocking() - BAD CHANNEL");
|
||||
RETURN(SCE_ERROR_AUDIO_INVALID_CHANNEL);
|
||||
}
|
||||
else if (!chans[chan].reserved)
|
||||
{
|
||||
return SCE_ERROR_AUDIO_INVALID_CHANNEL;
|
||||
} else if (!chans[chan].reserved) {
|
||||
ERROR_LOG(HLE,"sceAudioOutputBlocking() - channel not reserved");
|
||||
RETURN(SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED);
|
||||
}
|
||||
else
|
||||
{
|
||||
return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED;
|
||||
} else {
|
||||
DEBUG_LOG(HLE, "sceAudioOutputBlocking(%d, %d, %08x )",chan,vol,samplePtr);
|
||||
chans[chan].leftVolume = vol;
|
||||
chans[chan].rightVolume = vol;
|
||||
chans[chan].sampleAddress = samplePtr;
|
||||
RETURN(0);
|
||||
int retval = __AudioEnqueue(chans[chan], chan, true);
|
||||
if (retval != 0) {
|
||||
// There was an error and didn't block (block always returns 0 here). Fine to RETURN.
|
||||
RETURN(retval);
|
||||
}
|
||||
return __AudioEnqueue(chans[chan], chan, true);
|
||||
}
|
||||
}
|
||||
|
||||
void sceAudioOutputPannedBlocking(u32 chan, u32 volume1, u32 volume2, u32 samplePtr)
|
||||
{
|
||||
if (samplePtr == 0)
|
||||
{
|
||||
ERROR_LOG(HLE, "sceAudioOutputPannedBlocking - Sample pointer null");
|
||||
RETURN(0);
|
||||
}
|
||||
else if (chan < 0 || chan >= MAX_CHANNEL)
|
||||
{
|
||||
u32 sceAudioOutputPannedBlocking(u32 chan, u32 volume1, u32 volume2, u32 samplePtr) {
|
||||
if (samplePtr == 0) {
|
||||
ERROR_LOG(HLE, "sceAudioOutputPannedBlocking - Sample pointer null");
|
||||
return 0;
|
||||
} else if (chan < 0 || chan >= MAX_CHANNEL) {
|
||||
ERROR_LOG(HLE,"sceAudioOutputPannedBlocking() - BAD CHANNEL");
|
||||
RETURN(SCE_ERROR_AUDIO_INVALID_CHANNEL);
|
||||
}
|
||||
else if (!chans[chan].reserved)
|
||||
{
|
||||
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
|
||||
{
|
||||
DEBUG_LOG(HLE, "sceAudioOutputPannedBlocking(%d,%d,%d, %08x )", chan, volume1, volume2, samplePtr);
|
||||
return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED;
|
||||
} else {
|
||||
DEBUG_LOG(HLE, "sceAudioOutputPannedBlocking(%d,%d,%d, %08x )", chan, volume1, volume2, samplePtr);
|
||||
chans[chan].leftVolume = volume1;
|
||||
chans[chan].rightVolume = volume2;
|
||||
chans[chan].sampleAddress = samplePtr;
|
||||
RETURN(0);
|
||||
int retval = __AudioEnqueue(chans[chan], chan, true);
|
||||
if (retval != 0) {
|
||||
// There was an error and didn't block (block always returns 0 here). Fine to RETURN.
|
||||
RETURN(retval);
|
||||
}
|
||||
return __AudioEnqueue(chans[chan], chan, true);
|
||||
}
|
||||
}
|
||||
|
||||
u32 sceAudioOutput(u32 chan, u32 vol, u32 samplePtr)
|
||||
{
|
||||
if (chan < 0 || chan >= MAX_CHANNEL)
|
||||
{
|
||||
if (chan < 0 || chan >= MAX_CHANNEL) {
|
||||
ERROR_LOG(HLE,"sceAudioOutput() - BAD CHANNEL");
|
||||
return SCE_ERROR_AUDIO_INVALID_CHANNEL;
|
||||
}
|
||||
@ -175,7 +149,7 @@ int sceAudioGetChannelRestLength(u32 chan)
|
||||
static int GetFreeChannel()
|
||||
{
|
||||
for (int i = 0; i < MAX_CHANNEL; i++)
|
||||
{
|
||||
{
|
||||
if (!chans[i].reserved)
|
||||
{
|
||||
return i;
|
||||
@ -240,64 +214,64 @@ u32 sceAudioChRelease(u32 chan)
|
||||
|
||||
u32 sceAudioSetChannelDataLen(u32 chan, u32 len)
|
||||
{
|
||||
if (chan < 0 || chan >= MAX_CHANNEL)
|
||||
{
|
||||
ERROR_LOG(HLE,"sceAudioSetChannelDataLen(%i, %i) - BAD CHANNEL", chan, len);
|
||||
return SCE_ERROR_AUDIO_INVALID_CHANNEL;
|
||||
}
|
||||
else if (!chans[chan].reserved)
|
||||
{
|
||||
ERROR_LOG(HLE,"sceAudioSetChannelDataLen(%i, %i) - channel not reserved", chan, len);
|
||||
return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED;
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_LOG(HLE, "sceAudioSetChannelDataLen(%i, %i)", chan, len);
|
||||
if (chan < 0 || chan >= MAX_CHANNEL)
|
||||
{
|
||||
ERROR_LOG(HLE,"sceAudioSetChannelDataLen(%i, %i) - BAD CHANNEL", chan, len);
|
||||
return SCE_ERROR_AUDIO_INVALID_CHANNEL;
|
||||
}
|
||||
else if (!chans[chan].reserved)
|
||||
{
|
||||
ERROR_LOG(HLE,"sceAudioSetChannelDataLen(%i, %i) - channel not reserved", chan, len);
|
||||
return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED;
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_LOG(HLE, "sceAudioSetChannelDataLen(%i, %i)", chan, len);
|
||||
//chans[chan].dataLen = len;
|
||||
chans[chan].sampleCount = len;
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
u32 sceAudioChangeChannelConfig(u32 chan, u32 format)
|
||||
{
|
||||
if (chan < 0 || chan >= MAX_CHANNEL)
|
||||
{
|
||||
ERROR_LOG(HLE,"sceAudioChangeChannelConfig(%i, %i) - invalid channel number", chan, format);
|
||||
return SCE_ERROR_AUDIO_INVALID_CHANNEL;
|
||||
}
|
||||
else if (!chans[chan].reserved)
|
||||
{
|
||||
ERROR_LOG(HLE,"sceAudioChangeChannelConfig(%i, %i) - channel not reserved", chan, format);
|
||||
return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED;
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_LOG(HLE, "sceAudioChangeChannelConfig(%i, %i)", chan, format);
|
||||
chans[chan].format = format;
|
||||
return 0;
|
||||
}
|
||||
if (chan < 0 || chan >= MAX_CHANNEL)
|
||||
{
|
||||
ERROR_LOG(HLE,"sceAudioChangeChannelConfig(%i, %i) - invalid channel number", chan, format);
|
||||
return SCE_ERROR_AUDIO_INVALID_CHANNEL;
|
||||
}
|
||||
else if (!chans[chan].reserved)
|
||||
{
|
||||
ERROR_LOG(HLE,"sceAudioChangeChannelConfig(%i, %i) - channel not reserved", chan, format);
|
||||
return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED;
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_LOG(HLE, "sceAudioChangeChannelConfig(%i, %i)", chan, format);
|
||||
chans[chan].format = format;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
u32 sceAudioChangeChannelVolume(u32 chan, u32 lvolume, u32 rvolume)
|
||||
{
|
||||
if (chan < 0 || chan >= MAX_CHANNEL)
|
||||
{
|
||||
ERROR_LOG(HLE,"sceAudioChangeChannelVolume(%i, %i, %i) - invalid channel number", chan, lvolume, rvolume);
|
||||
return SCE_ERROR_AUDIO_INVALID_CHANNEL;
|
||||
}
|
||||
else if (!chans[chan].reserved)
|
||||
{
|
||||
ERROR_LOG(HLE,"sceAudioChangeChannelVolume(%i, %i, %i) - channel not reserved", chan, lvolume, rvolume);
|
||||
return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED;
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_LOG(HLE, "sceAudioChangeChannelVolume(%i, %i, %i)", chan, lvolume, rvolume);
|
||||
chans[chan].leftVolume = lvolume;
|
||||
chans[chan].rightVolume = rvolume;
|
||||
return 0;
|
||||
}
|
||||
if (chan < 0 || chan >= MAX_CHANNEL)
|
||||
{
|
||||
ERROR_LOG(HLE,"sceAudioChangeChannelVolume(%i, %i, %i) - invalid channel number", chan, lvolume, rvolume);
|
||||
return SCE_ERROR_AUDIO_INVALID_CHANNEL;
|
||||
}
|
||||
else if (!chans[chan].reserved)
|
||||
{
|
||||
ERROR_LOG(HLE,"sceAudioChangeChannelVolume(%i, %i, %i) - channel not reserved", chan, lvolume, rvolume);
|
||||
return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED;
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_LOG(HLE, "sceAudioChangeChannelVolume(%i, %i, %i)", chan, lvolume, rvolume);
|
||||
chans[chan].leftVolume = lvolume;
|
||||
chans[chan].rightVolume = rvolume;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
u32 sceAudioInit()
|
||||
@ -321,16 +295,13 @@ u32 sceAudioOutput2Reserve(u32 sampleCount)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sceAudioOutput2OutputBlocking(u32 vol, u32 dataPtr)
|
||||
u32 sceAudioOutput2OutputBlocking(u32 vol, u32 dataPtr)
|
||||
{
|
||||
DEBUG_LOG(HLE,"FAKE sceAudioOutput2OutputBlocking(%i, %08x)", vol, dataPtr);
|
||||
chans[0].leftVolume = vol;
|
||||
chans[0].rightVolume = vol;
|
||||
chans[0].sampleAddress = dataPtr;
|
||||
RETURN(0);
|
||||
u32 retval = __AudioEnqueue(chans[0], 0, true);
|
||||
if (retval < 0)
|
||||
RETURN(retval);
|
||||
return __AudioEnqueue(chans[0], 0, true);
|
||||
}
|
||||
|
||||
u32 sceAudioOutput2ChangeLength(u32 sampleCount)
|
||||
@ -342,7 +313,7 @@ u32 sceAudioOutput2ChangeLength(u32 sampleCount)
|
||||
|
||||
u32 sceAudioOutput2GetRestSample()
|
||||
{
|
||||
WARN_LOG(HLE,"UNTESTED sceAudioOutput2GetRestSample()");
|
||||
WARN_LOG(HLE,"UNTESTED sceAudioOutput2GetRestSample()");
|
||||
return chans[0].sampleQueue.size() * 2;
|
||||
}
|
||||
|
||||
@ -368,30 +339,30 @@ const HLEFunction sceAudio[] =
|
||||
{
|
||||
// Newer simplified single channel audio output. Presumably for games that use Atrac3
|
||||
// directly from Sas instead of playing it on a separate audio channel.
|
||||
{0x01562ba3, WrapU_U<sceAudioOutput2Reserve>, "sceAudioOutput2Reserve"},
|
||||
{0x2d53f36e, WrapV_UU<sceAudioOutput2OutputBlocking>, "sceAudioOutput2OutputBlocking"},
|
||||
{0x63f2889c, WrapU_U<sceAudioOutput2ChangeLength>, "sceAudioOutput2ChangeLength"},
|
||||
{0x647cef33, WrapU_V<sceAudioOutput2GetRestSample>, "sceAudioOutput2GetRestSample"},
|
||||
{0x43196845, WrapU_V<sceAudioOutput2Release>, "sceAudioOutput2Release"},
|
||||
{0x01562ba3, WrapU_U<sceAudioOutput2Reserve>, "sceAudioOutput2Reserve"},
|
||||
{0x2d53f36e, WrapU_UU<sceAudioOutput2OutputBlocking>, "sceAudioOutput2OutputBlocking"},
|
||||
{0x63f2889c, WrapU_U<sceAudioOutput2ChangeLength>, "sceAudioOutput2ChangeLength"},
|
||||
{0x647cef33, WrapU_V<sceAudioOutput2GetRestSample>, "sceAudioOutput2GetRestSample"},
|
||||
{0x43196845, WrapU_V<sceAudioOutput2Release>, "sceAudioOutput2Release"},
|
||||
|
||||
{0x80F1F7E0, WrapU_V<sceAudioInit>, "sceAudioInit"},
|
||||
{0x210567F7, WrapU_V<sceAudioEnd>, "sceAudioEnd"},
|
||||
|
||||
{0xA2BEAA6C, WrapU_U<sceAudioSetFrequency>, "sceAudioSetFrequency"},
|
||||
{0xA2BEAA6C, WrapU_U<sceAudioSetFrequency>, "sceAudioSetFrequency"},
|
||||
{0x927AC32B, 0, "sceAudioSetVolumeOffset"},
|
||||
|
||||
// The oldest and standard audio interface. Supports 8 channels, most games use 1-2.
|
||||
{0x8c1009b2, WrapU_UUU<sceAudioOutput>, "sceAudioOutput"},
|
||||
{0x136CAF51, WrapV_UUU<sceAudioOutputBlocking>, "sceAudioOutputBlocking"},
|
||||
{0xE2D56B2D, WrapU_UUUU<sceAudioOutputPanned>, "sceAudioOutputPanned"},
|
||||
{0x13F592BC, WrapV_UUUU<sceAudioOutputPannedBlocking>, "sceAudioOutputPannedBlocking"}, //(u32, u32, u32, void *)Output sound, blocking
|
||||
{0x5EC81C55, WrapU_UUU<sceAudioChReserve>, "sceAudioChReserve"}, //(u32, u32 samplecount, u32) Initialize channel and allocate buffer long, long samplecount, long);//init buffer? returns handle, minus if error
|
||||
{0x6FC46853, WrapU_U<sceAudioChRelease>, "sceAudioChRelease"}, //(long handle)Terminate channel and deallocate buffer //free buffer?
|
||||
{0xE9D97901, WrapI_U<sceAudioGetChannelRestLen>, "sceAudioGetChannelRestLen"},
|
||||
{0xB011922F, WrapI_U<sceAudioGetChannelRestLen>, "sceAudioGetChannelRestLength"}, // Is there a difference between this and sceAudioGetChannelRestLen?
|
||||
{0x8c1009b2, WrapU_UUU<sceAudioOutput>, "sceAudioOutput"},
|
||||
{0x136CAF51, WrapU_UUU<sceAudioOutputBlocking>, "sceAudioOutputBlocking"},
|
||||
{0xE2D56B2D, WrapU_UUUU<sceAudioOutputPanned>, "sceAudioOutputPanned"},
|
||||
{0x13F592BC, WrapU_UUUU<sceAudioOutputPannedBlocking>, "sceAudioOutputPannedBlocking"}, //(u32, u32, u32, void *)Output sound, blocking
|
||||
{0x5EC81C55, WrapU_UUU<sceAudioChReserve>, "sceAudioChReserve"}, //(u32, u32 samplecount, u32) Initialize channel and allocate buffer long, long samplecount, long);//init buffer? returns handle, minus if error
|
||||
{0x6FC46853, WrapU_U<sceAudioChRelease>, "sceAudioChRelease"}, //(long handle)Terminate channel and deallocate buffer //free buffer?
|
||||
{0xE9D97901, WrapI_U<sceAudioGetChannelRestLen>, "sceAudioGetChannelRestLen"},
|
||||
{0xB011922F, WrapI_U<sceAudioGetChannelRestLen>, "sceAudioGetChannelRestLength"}, // Is there a difference between this and sceAudioGetChannelRestLen?
|
||||
{0xCB2E439E, WrapU_UU<sceAudioSetChannelDataLen>, "sceAudioSetChannelDataLen"}, //(u32, u32)
|
||||
{0x95FD0C2D, WrapU_UU<sceAudioChangeChannelConfig>, "sceAudioChangeChannelConfig"},
|
||||
{0xB7E1D8E7, WrapU_UUU<sceAudioChangeChannelVolume>, "sceAudioChangeChannelVolume"},
|
||||
{0x95FD0C2D, WrapU_UU<sceAudioChangeChannelConfig>, "sceAudioChangeChannelConfig"},
|
||||
{0xB7E1D8E7, WrapU_UUU<sceAudioChangeChannelVolume>, "sceAudioChangeChannelVolume"},
|
||||
|
||||
// I guess these are like the others but do sample rate conversion?
|
||||
{0x38553111, 0, "sceAudioSRCChReserve"},
|
||||
@ -405,9 +376,9 @@ const HLEFunction sceAudio[] =
|
||||
// Microphone interface
|
||||
{0x7de61688, 0, "sceAudioInputInit"},
|
||||
{0xE926D3FB, 0, "sceAudioInputInitEx"},
|
||||
{0x6d4bec68, 0, "sceAudioInput"},
|
||||
{0x086e5895, 0, "sceAudioInputBlocking"},
|
||||
{0xa708c6a6, 0, "sceAudioGetInputLength"},
|
||||
{0x6d4bec68, 0, "sceAudioInput"},
|
||||
{0x086e5895, 0, "sceAudioInputBlocking"},
|
||||
{0xa708c6a6, 0, "sceAudioGetInputLength"},
|
||||
{0xA633048E, 0, "sceAudioPollInputEnd"},
|
||||
{0x87b2e651, 0, "sceAudioWaitInputEnd"},
|
||||
};
|
||||
@ -416,5 +387,5 @@ const HLEFunction sceAudio[] =
|
||||
|
||||
void Register_sceAudio()
|
||||
{
|
||||
RegisterModule("sceAudio", ARRAY_SIZE(sceAudio), sceAudio);
|
||||
RegisterModule("sceAudio", ARRAY_SIZE(sceAudio), sceAudio);
|
||||
}
|
||||
|
@ -34,133 +34,102 @@ void __PowerInit() {
|
||||
memset(powerCbSlots, 0, sizeof(powerCbSlots));
|
||||
}
|
||||
|
||||
int scePowerGetBatteryLifePercent()
|
||||
{
|
||||
int scePowerGetBatteryLifePercent() {
|
||||
DEBUG_LOG(HLE, "100=scePowerGetBatteryLifePercent");
|
||||
return 100;
|
||||
}
|
||||
|
||||
int scePowerIsPowerOnline()
|
||||
{
|
||||
int scePowerIsPowerOnline() {
|
||||
DEBUG_LOG(HLE, "1=scePowerIsPowerOnline");
|
||||
return 1;
|
||||
}
|
||||
|
||||
int scePowerIsBatteryExist()
|
||||
{
|
||||
int scePowerIsBatteryExist() {
|
||||
DEBUG_LOG(HLE, "1=scePowerIsBatteryExist");
|
||||
return 1;
|
||||
}
|
||||
|
||||
int scePowerIsBatteryCharging()
|
||||
{
|
||||
int scePowerIsBatteryCharging() {
|
||||
DEBUG_LOG(HLE, "0=scePowerIsBatteryCharging");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int scePowerGetBatteryChargingStatus()
|
||||
{
|
||||
int scePowerGetBatteryChargingStatus() {
|
||||
DEBUG_LOG(HLE, "0=scePowerGetBatteryChargingStatus");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int scePowerIsLowBattery()
|
||||
{
|
||||
int scePowerIsLowBattery() {
|
||||
DEBUG_LOG(HLE, "0=scePowerIsLowBattery");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int scePowerRegisterCallback(int slot, int cbId)
|
||||
{
|
||||
int scePowerRegisterCallback(int slot, int cbId) {
|
||||
DEBUG_LOG(HLE,"0=scePowerRegisterCallback(%i, %i)", slot, cbId);
|
||||
int foundSlot = -1;
|
||||
|
||||
if (slot == POWER_CB_AUTO) // -1 signifies auto select of bank
|
||||
{
|
||||
for(int i=0; i < numberOfCBPowerSlots; i++)
|
||||
{
|
||||
if ((powerCbSlots[i]==0) && (foundSlot == POWER_CB_AUTO)) // found an empty slot
|
||||
{
|
||||
if (slot == POWER_CB_AUTO) { // -1 signifies auto select of bank
|
||||
for (int i=0; i < numberOfCBPowerSlots; i++) {
|
||||
if ((powerCbSlots[i]==0) && (foundSlot == POWER_CB_AUTO)) { // found an empty slot
|
||||
powerCbSlots[i] = cbId;
|
||||
foundSlot = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (powerCbSlots[slot] == 0)
|
||||
{
|
||||
} else {
|
||||
if (powerCbSlots[slot] == 0) {
|
||||
powerCbSlots[slot] = cbId;
|
||||
foundSlot = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// slot already in use!
|
||||
foundSlot = POWER_CB_AUTO;
|
||||
}
|
||||
}
|
||||
if (foundSlot>=0)
|
||||
{
|
||||
if (foundSlot>=0) {
|
||||
__KernelRegisterCallback(THREAD_CALLBACK_POWER, cbId);
|
||||
|
||||
// Immediately notify
|
||||
RETURN(0);
|
||||
|
||||
__KernelNotifyCallbackType(THREAD_CALLBACK_POWER, cbId, 0x185); // TODO: I have no idea what the 0x185 is from the flags, but its needed for the test to pass. Need another example of it being called
|
||||
__KernelNotifyCallbackType(THREAD_CALLBACK_POWER, cbId, 0x185); // TODO: I have no idea what the 0x185 is from the flags, but its needed for the test to pass. Need another example of it being called
|
||||
}
|
||||
return foundSlot;
|
||||
}
|
||||
|
||||
int scePowerUnregisterCallback(int slotId)
|
||||
{
|
||||
if (slotId < 0 || slotId >= numberOfCBPowerSlots)
|
||||
{
|
||||
int scePowerUnregisterCallback(int slotId) {
|
||||
if (slotId < 0 || slotId >= numberOfCBPowerSlots) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (powerCbSlots[slotId] != 0)
|
||||
{
|
||||
if (powerCbSlots[slotId] != 0) {
|
||||
int cbId = powerCbSlots[slotId];
|
||||
DEBUG_LOG(HLE,"0=scePowerUnregisterCallback(%i) (cbid = %i)", slotId, cbId);
|
||||
__KernelUnregisterCallback(THREAD_CALLBACK_POWER, cbId);
|
||||
powerCbSlots[slotId] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return 0x80000025; // TODO: docs say a value less than 0, test checks for this specifically. why??
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sceKernelPowerLock(int lockType)
|
||||
{
|
||||
int sceKernelPowerLock(int lockType) {
|
||||
DEBUG_LOG(HLE,"0=sceKernelPowerLock(%i)", lockType);
|
||||
return 0;
|
||||
}
|
||||
int sceKernelPowerUnlock(int lockType)
|
||||
{
|
||||
|
||||
int sceKernelPowerUnlock(int lockType) {
|
||||
DEBUG_LOG(HLE,"0=sceKernelPowerUnlock(%i)", lockType);
|
||||
return 0;
|
||||
}
|
||||
int sceKernelPowerTick(int flag)
|
||||
{
|
||||
|
||||
int sceKernelPowerTick(int flag) {
|
||||
DEBUG_LOG(HLE,"UNIMPL 0=sceKernelPowerTick(%i)", flag);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define ERROR_POWER_VMEM_IN_USE 0x802b0200
|
||||
|
||||
int sceKernelVolatileMemTryLock(int type, int paddr, int psize)
|
||||
{
|
||||
|
||||
if (!volatileMemLocked)
|
||||
{
|
||||
int sceKernelVolatileMemTryLock(int type, int paddr, int psize) {
|
||||
if (!volatileMemLocked) {
|
||||
INFO_LOG(HLE,"sceKernelVolatileMemTryLock(%i, %08x, %i) - success", type, paddr, psize);
|
||||
volatileMemLocked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
ERROR_LOG(HLE, "sceKernelVolatileMemTryLock(%i, %08x, %i) - already locked!", type, paddr, psize);
|
||||
return ERROR_POWER_VMEM_IN_USE;
|
||||
}
|
||||
@ -174,47 +143,45 @@ int sceKernelVolatileMemTryLock(int type, int paddr, int psize)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sceKernelVolatileMemUnlock(int type)
|
||||
{
|
||||
INFO_LOG(HLE,"sceKernelVolatileMemUnlock(%i)", type);
|
||||
// TODO: sanity check
|
||||
volatileMemLocked = false;
|
||||
int sceKernelVolatileMemUnlock(int type) {
|
||||
if (volatileMemLocked) {
|
||||
INFO_LOG(HLE,"sceKernelVolatileMemUnlock(%i)", type);
|
||||
volatileMemLocked = false;
|
||||
} else {
|
||||
ERROR_LOG(HLE, "sceKernelVolatileMemUnlock(%i) FAILED - not locked", type);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sceKernelVolatileMemLock(int type, int paddr, int psize)
|
||||
{
|
||||
int sceKernelVolatileMemLock(int type, int paddr, int psize) {
|
||||
return sceKernelVolatileMemTryLock(type, paddr, psize);
|
||||
}
|
||||
|
||||
|
||||
void scePowerSetClockFrequency(u32 cpufreq, u32 busfreq, u32 gpufreq)
|
||||
{
|
||||
void scePowerSetClockFrequency(u32 cpufreq, u32 busfreq, u32 gpufreq) {
|
||||
CoreTiming::SetClockFrequencyMHz(cpufreq);
|
||||
|
||||
INFO_LOG(HLE,"scePowerSetClockFrequency(%i,%i,%i)", cpufreq, busfreq, gpufreq);
|
||||
}
|
||||
|
||||
void scePowerGetCpuClockFrequencyInt() {
|
||||
u32 scePowerGetCpuClockFrequencyInt() {
|
||||
int freq = CoreTiming::GetClockFrequencyMHz();
|
||||
INFO_LOG(HLE,"%i=scePowerGetCpuClockFrequencyInt()", freq);
|
||||
RETURN(freq);
|
||||
return freq;
|
||||
}
|
||||
|
||||
void scePowerGetPllClockFrequencyInt() {
|
||||
u32 scePowerGetPllClockFrequencyInt() {
|
||||
int freq = CoreTiming::GetClockFrequencyMHz() / 2;
|
||||
INFO_LOG(HLE,"%i=scePowerGetPllClockFrequencyInt()", freq);
|
||||
RETURN(freq);
|
||||
return freq;
|
||||
}
|
||||
|
||||
void scePowerGetBusClockFrequencyInt() {
|
||||
u32 scePowerGetBusClockFrequencyInt() {
|
||||
int freq = CoreTiming::GetClockFrequencyMHz() / 2;
|
||||
INFO_LOG(HLE,"%i=scePowerGetBusClockFrequencyInt()", freq);
|
||||
RETURN(freq);
|
||||
return freq;
|
||||
}
|
||||
|
||||
static const HLEFunction scePower[] =
|
||||
{
|
||||
static const HLEFunction scePower[] = {
|
||||
{0x04B7766E,&WrapI_II<scePowerRegisterCallback>,"scePowerRegisterCallback"},
|
||||
{0x2B51FE2F,0,"scePower_2B51FE2F"},
|
||||
{0x442BFBAC,0,"scePowerGetBacklightMaximum"},
|
||||
@ -249,27 +216,26 @@ static const HLEFunction scePower[] =
|
||||
{0xAC32C9CC,0,"scePowerRequestSuspend"},
|
||||
{0x2875994B,0,"scePower_2875994B"},
|
||||
{0x0074EF9B,0,"scePowerGetResumeCount"},
|
||||
{0xDFA8BAF8,&WrapI_I<scePowerUnregisterCallback>,"scePowerUnregisterCallback"},
|
||||
{0xDB9D28DD,&WrapI_I<scePowerUnregisterCallback>,"scePowerUnregitserCallback"}, //haha
|
||||
{0xDFA8BAF8,WrapI_I<scePowerUnregisterCallback>,"scePowerUnregisterCallback"},
|
||||
{0xDB9D28DD,WrapI_I<scePowerUnregisterCallback>,"scePowerUnregitserCallback"}, //haha
|
||||
{0x843FBF43,0,"scePowerSetCpuClockFrequency"},
|
||||
{0xB8D7B3FB,0,"scePowerSetBusClockFrequency"},
|
||||
{0xFEE03A2F,0,"scePowerGetCpuClockFrequency"},
|
||||
{0x478FE6F5,0,"scePowerGetBusClockFrequency"},
|
||||
{0xFDB5BFE9,scePowerGetCpuClockFrequencyInt,"scePowerGetCpuClockFrequencyInt"},
|
||||
{0xBD681969,scePowerGetBusClockFrequencyInt,"scePowerGetBusClockFrequencyInt"},
|
||||
{0xFDB5BFE9,WrapU_V<scePowerGetCpuClockFrequencyInt>,"scePowerGetCpuClockFrequencyInt"},
|
||||
{0xBD681969,WrapU_V<scePowerGetBusClockFrequencyInt>,"scePowerGetBusClockFrequencyInt"},
|
||||
{0xB1A52C83,0,"scePowerGetCpuClockFrequencyFloat"},
|
||||
{0x9BADB3EB,0,"scePowerGetBusClockFrequencyFloat"},
|
||||
{0x737486F2,&WrapV_UUU<scePowerSetClockFrequency>,"scePowerSetClockFrequency"},
|
||||
{0x34f9c463,scePowerGetPllClockFrequencyInt,"scePowerGetPllClockFrequencyInt"},
|
||||
{0x737486F2,WrapV_UUU<scePowerSetClockFrequency>,"scePowerSetClockFrequency"},
|
||||
{0x34f9c463,WrapU_V<scePowerGetPllClockFrequencyInt>,"scePowerGetPllClockFrequencyInt"},
|
||||
{0xea382a27,0,"scePowerGetPllClockFrequencyFloat"},
|
||||
{0xebd177d6,&WrapV_UUU<scePowerSetClockFrequency>,"scePower_driver_EBD177D6"}, //TODO: used in a few places, jpcsp says is the same as scePowerSetClockFrequency
|
||||
{0xebd177d6,WrapV_UUU<scePowerSetClockFrequency>,"scePower_driver_EBD177D6"}, //TODO: used in a few places, jpcsp says is the same as scePowerSetClockFrequency
|
||||
{0x469989ad,0,"scePower_469989ad"},
|
||||
{0xa85880d0,0,"scePower_a85880d0"},
|
||||
};
|
||||
|
||||
//890129c in tyshooter looks bogus
|
||||
const HLEFunction sceSuspendForUser[] =
|
||||
{
|
||||
const HLEFunction sceSuspendForUser[] = {
|
||||
{0xEADB1BD7,&WrapI_I<sceKernelPowerLock>,"sceKernelPowerLock"}, //(int param) set param to 0
|
||||
{0x3AEE7261,&WrapI_I<sceKernelPowerUnlock>,"sceKernelPowerUnlock"},//(int param) set param to 0
|
||||
{0x090ccb3f,&WrapI_I<sceKernelPowerTick>,"sceKernelPowerTick"},
|
||||
|
@ -16,35 +16,30 @@
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
#include "HLE.h"
|
||||
|
||||
#include "FunctionWrappers.h"
|
||||
#include "sceVaudio.h"
|
||||
|
||||
void sceVaudioOutputBlockingFunction()
|
||||
{
|
||||
WARN_LOG(HLE, "UNIMPL sceVaudioOutputBlockingFunction(...)");
|
||||
RETURN(0);
|
||||
u32 sceVaudioOutputBlocking() {
|
||||
ERROR_LOG(HLE, "UNIMPL sceVaudioOutputBlocking(...)");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sceVaudioChReserveFunction()
|
||||
{
|
||||
WARN_LOG(HLE, "UNIMPL sceVaudioChReserveFunction(...)");
|
||||
RETURN(0);
|
||||
u32 sceVaudioChReserve() {
|
||||
ERROR_LOG(HLE, "UNIMPL sceVaudioChReserve(...)");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sceVaudioChReleaseFunction()
|
||||
{
|
||||
WARN_LOG(HLE, "UNIMPL sceVaudioChReleaseFunction(...)");
|
||||
RETURN(0);
|
||||
u32 sceVaudioChRelease() {
|
||||
ERROR_LOG(HLE, "UNIMPL sceVaudioChRelease(...)");
|
||||
return 0;
|
||||
}
|
||||
|
||||
const HLEFunction sceVaudio[] =
|
||||
{
|
||||
{0x03b6807d, sceVaudioOutputBlockingFunction, "sceVaudioOutputBlockingFunction"},
|
||||
{0x67585dfd, sceVaudioChReserveFunction, "sceVaudioChReserveFunction"},
|
||||
{0x8986295e, sceVaudioChReleaseFunction, "sceVaudioChReleaseFunction"},
|
||||
const HLEFunction sceVaudio[] = {
|
||||
{0x03b6807d, WrapU_V<sceVaudioOutputBlocking>, "sceVaudioOutputBlockingFunction"},
|
||||
{0x67585dfd, WrapU_V<sceVaudioChReserve>, "sceVaudioChReserveFunction"},
|
||||
{0x8986295e, WrapU_V<sceVaudioChRelease>, "sceVaudioChReleaseFunction"},
|
||||
};
|
||||
|
||||
void Register_sceVaudio()
|
||||
{
|
||||
void Register_sceVaudio() {
|
||||
RegisterModule("sceVaudio",ARRAY_SIZE(sceVaudio), sceVaudio );
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 099ac403ddb436f94e7b2227e5c491027641e556
|
||||
Subproject commit e9b4496e32bb592dfff14b93abf284ff20783d3c
|
Loading…
x
Reference in New Issue
Block a user