Assorted warning fixes

This commit is contained in:
Henrik Rydgård 2012-12-23 09:44:43 +01:00
parent fba61b2a2a
commit ce214b3943
5 changed files with 33 additions and 38 deletions

View file

@ -41,7 +41,7 @@ u32 sceAudioOutputBlocking(u32 chan, u32 vol, u32 samplePtr) {
ERROR_LOG(HLE, "sceAudioOutputBlocking - Sample pointer null");
return 0;
}
if (chan < 0 || chan >= MAX_CHANNEL) {
if (chan >= MAX_CHANNEL) {
ERROR_LOG(HLE,"sceAudioOutputBlocking() - BAD CHANNEL");
return SCE_ERROR_AUDIO_INVALID_CHANNEL;
} else if (!chans[chan].reserved) {
@ -60,7 +60,7 @@ u32 sceAudioOutputPannedBlocking(u32 chan, u32 volume1, u32 volume2, u32 sampleP
if (samplePtr == 0) {
ERROR_LOG(HLE, "sceAudioOutputPannedBlocking - Sample pointer null");
return 0;
} else if (chan < 0 || chan >= MAX_CHANNEL) {
} else if (chan >= MAX_CHANNEL) {
ERROR_LOG(HLE,"sceAudioOutputPannedBlocking() - BAD CHANNEL");
return SCE_ERROR_AUDIO_INVALID_CHANNEL;
} else if (!chans[chan].reserved) {
@ -77,7 +77,7 @@ u32 sceAudioOutputPannedBlocking(u32 chan, u32 volume1, u32 volume2, u32 sampleP
u32 sceAudioOutput(u32 chan, u32 vol, u32 samplePtr)
{
if (chan < 0 || chan >= MAX_CHANNEL) {
if (chan >= MAX_CHANNEL) {
ERROR_LOG(HLE,"sceAudioOutput() - BAD CHANNEL");
return SCE_ERROR_AUDIO_INVALID_CHANNEL;
}
@ -99,7 +99,7 @@ u32 sceAudioOutput(u32 chan, u32 vol, u32 samplePtr)
u32 sceAudioOutputPanned(u32 chan, u32 leftVol, u32 rightVol, u32 samplePtr)
{
if (chan < 0 || chan >= MAX_CHANNEL)
if (chan >= MAX_CHANNEL)
{
ERROR_LOG(HLE,"sceAudioOutputPanned() - BAD CHANNEL");
return SCE_ERROR_AUDIO_INVALID_CHANNEL;
@ -122,7 +122,7 @@ u32 sceAudioOutputPanned(u32 chan, u32 leftVol, u32 rightVol, u32 samplePtr)
int sceAudioGetChannelRestLen(u32 chan)
{
if (chan < 0 || chan >= MAX_CHANNEL)
if (chan >= MAX_CHANNEL)
{
ERROR_LOG(HLE, "sceAudioGetChannelRestLen(%i) - BAD CHANNEL", chan);
return SCE_ERROR_AUDIO_INVALID_CHANNEL;
@ -135,7 +135,7 @@ int sceAudioGetChannelRestLen(u32 chan)
int sceAudioGetChannelRestLength(u32 chan)
{
if (chan < 0 || chan >= MAX_CHANNEL)
if (chan >= MAX_CHANNEL)
{
ERROR_LOG(HLE, "sceAudioGetChannelRestLength(%i) - BAD CHANNEL", chan);
return SCE_ERROR_AUDIO_INVALID_CHANNEL;
@ -149,12 +149,8 @@ int sceAudioGetChannelRestLength(u32 chan)
static int GetFreeChannel()
{
for (int i = 0; i < MAX_CHANNEL; i++)
{
if (!chans[i].reserved)
{
return i;
}
}
return -1;
}
@ -170,7 +166,7 @@ u32 sceAudioChReserve(u32 channel, u32 sampleCount, u32 format) //.Allocate soun
return SCE_ERROR_AUDIO_NO_CHANNELS_AVAILABLE;
}
if (channel < 0 || channel >= MAX_CHANNEL)
if (channel >= MAX_CHANNEL)
{
ERROR_LOG(HLE ,"sceAudioChReserve(channel = %d, sampleCount = %d, format = %d) - BAD CHANNEL", channel, sampleCount, format);
return SCE_ERROR_AUDIO_INVALID_CHANNEL;
@ -195,7 +191,7 @@ u32 sceAudioChReserve(u32 channel, u32 sampleCount, u32 format) //.Allocate soun
u32 sceAudioChRelease(u32 chan)
{
if (chan < 0 || chan >= MAX_CHANNEL)
if (chan >= MAX_CHANNEL)
{
ERROR_LOG(HLE, "sceAudioChRelease(%i) - BAD CHANNEL", chan);
return SCE_ERROR_AUDIO_INVALID_CHANNEL;
@ -214,7 +210,7 @@ u32 sceAudioChRelease(u32 chan)
u32 sceAudioSetChannelDataLen(u32 chan, u32 len)
{
if (chan < 0 || chan >= MAX_CHANNEL)
if (chan >= MAX_CHANNEL)
{
ERROR_LOG(HLE,"sceAudioSetChannelDataLen(%i, %i) - BAD CHANNEL", chan, len);
return SCE_ERROR_AUDIO_INVALID_CHANNEL;
@ -234,7 +230,7 @@ u32 sceAudioSetChannelDataLen(u32 chan, u32 len)
u32 sceAudioChangeChannelConfig(u32 chan, u32 format)
{
if (chan < 0 || chan >= MAX_CHANNEL)
if (chan >= MAX_CHANNEL)
{
ERROR_LOG(HLE,"sceAudioChangeChannelConfig(%i, %i) - invalid channel number", chan, format);
return SCE_ERROR_AUDIO_INVALID_CHANNEL;
@ -254,7 +250,7 @@ u32 sceAudioChangeChannelConfig(u32 chan, u32 format)
u32 sceAudioChangeChannelVolume(u32 chan, u32 lvolume, u32 rvolume)
{
if (chan < 0 || chan >= MAX_CHANNEL)
if (chan >= MAX_CHANNEL)
{
ERROR_LOG(HLE,"sceAudioChangeChannelVolume(%i, %i, %i) - invalid channel number", chan, lvolume, rvolume);
return SCE_ERROR_AUDIO_INVALID_CHANNEL;
@ -272,7 +268,7 @@ u32 sceAudioChangeChannelVolume(u32 chan, u32 lvolume, u32 rvolume)
return 0;
}
}
u32 sceAudioInit()
{
DEBUG_LOG(HLE,"sceAudioInit()");

View file

@ -382,7 +382,7 @@ u32 sceKernelReleaseSubIntrHandler(u32 intrNumber, u32 subIntrNumber)
u32 sceKernelEnableSubIntr(u32 intrNumber, u32 subIntrNumber)
{
DEBUG_LOG(HLE,"sceKernelEnableSubIntr(%i, %i)", intrNumber, subIntrNumber);
if (intrNumber < 0 || intrNumber >= PSP_NUMBER_INTERRUPTS)
if (intrNumber >= PSP_NUMBER_INTERRUPTS)
return -1;
if (!intrHandlers[intrNumber].has(subIntrNumber))
@ -395,7 +395,7 @@ u32 sceKernelEnableSubIntr(u32 intrNumber, u32 subIntrNumber)
u32 sceKernelDisableSubIntr(u32 intrNumber, u32 subIntrNumber)
{
DEBUG_LOG(HLE,"sceKernelDisableSubIntr(%i, %i)", intrNumber, subIntrNumber);
if (intrNumber < 0 || intrNumber >= PSP_NUMBER_INTERRUPTS)
if (intrNumber >= PSP_NUMBER_INTERRUPTS)
return -1;
if (!intrHandlers[intrNumber].has(subIntrNumber))
@ -430,15 +430,14 @@ void QueryIntrHandlerInfo()
RETURN(0);
}
void sceKernelMemset()
// TODO: speedup
u32 sceKernelMemset(u32 addr, u32 fillc, u32 n)
{
u32 addr = PARAM(0);
u8 c = PARAM(1) & 0xff;
u32 n = PARAM(2);
u8 c = fillc & 0xff;
DEBUG_LOG(HLE, "sceKernelMemset(ptr = %08x, c = %02x, n = %08x)", addr, c, n);
for (size_t i = 0; i < n; i++)
Memory::Write_U8((u8)c, addr + i);
RETURN(0); /* TODO: verify it should return this */
return 0; // TODO: verify it should return this
}
u32 sceKernelMemcpy(u32 dst, u32 src, u32 size)
@ -451,21 +450,21 @@ u32 sceKernelMemcpy(u32 dst, u32 src, u32 size)
return 0;
}
const HLEFunction Kernel_Library[] =
const HLEFunction Kernel_Library[] =
{
{0x092968F4,sceKernelCpuSuspendIntr,"sceKernelCpuSuspendIntr"},
{0x5F10D406,WrapV_U<sceKernelCpuResumeIntr>, "sceKernelCpuResumeIntr"}, //int oldstat
{0x3b84732d,WrapV_U<sceKernelCpuResumeIntrWithSync>, "sceKernelCpuResumeIntrWithSync"},
{0x47a0b729,sceKernelIsCpuIntrSuspended, "sceKernelIsCpuIntrSuspended"}, //flags
{0xb55249d2,sceKernelIsCpuIntrEnable, "sceKernelIsCpuIntrEnable"},
{0xa089eca4,sceKernelMemset, "sceKernelMemset"},
{0xDC692EE3,&WrapI_UI<sceKernelTryLockLwMutex>, "sceKernelTryLockLwMutex"},
{0x37431849,&WrapI_UI<sceKernelTryLockLwMutex_600>, "sceKernelTryLockLwMutex_600"},
{0xbea46419,&WrapI_UIU<sceKernelLockLwMutex>, "sceKernelLockLwMutex"},
{0x1FC64E09,&WrapI_UIU<sceKernelLockLwMutexCB>, "sceKernelLockLwMutexCB"},
{0x15b6446b,&WrapI_UI<sceKernelUnlockLwMutex>, "sceKernelUnlockLwMutex"},
{0x293b45b8,sceKernelGetThreadId, "sceKernelGetThreadId"},
{0x1839852A,&WrapU_UUU<sceKernelMemcpy>,"sce_paf_private_memcpy"},
{0xb55249d2,sceKernelIsCpuIntrEnable, "sceKernelIsCpuIntrEnable"},
{0xa089eca4,WrapU_UUU<sceKernelMemset>, "sceKernelMemset"},
{0xDC692EE3,WrapI_UI<sceKernelTryLockLwMutex>, "sceKernelTryLockLwMutex"},
{0x37431849,WrapI_UI<sceKernelTryLockLwMutex_600>, "sceKernelTryLockLwMutex_600"},
{0xbea46419,WrapI_UIU<sceKernelLockLwMutex>, "sceKernelLockLwMutex"},
{0x1FC64E09,WrapI_UIU<sceKernelLockLwMutexCB>, "sceKernelLockLwMutexCB"},
{0x15b6446b,WrapI_UI<sceKernelUnlockLwMutex>, "sceKernelUnlockLwMutex"},
{0x293b45b8,sceKernelGetThreadId, "sceKernelGetThreadId"},
{0x1839852A,WrapU_UUU<sceKernelMemcpy>,"sce_paf_private_memcpy"},
};
void Register_Kernel_Library()
@ -474,7 +473,7 @@ void Register_Kernel_Library()
}
const HLEFunction InterruptManager[] =
const HLEFunction InterruptManager[] =
{
{0xCA04A2B9, WrapU_UUUU<sceKernelRegisterSubIntrHandler>, "sceKernelRegisterSubIntrHandler"},
{0xD61E6961, WrapU_UU<sceKernelReleaseSubIntrHandler>, "sceKernelReleaseSubIntrHandler"},
@ -483,7 +482,7 @@ const HLEFunction InterruptManager[] =
{0x5CB5A78B, 0, "sceKernelSuspendSubIntr"},
{0x7860E0DC, 0, "sceKernelResumeSubIntr"},
{0xFC4374B8, 0, "sceKernelIsSubInterruptOccurred"},
{0xD2E8363F, 0, "QueryIntrHandlerInfo"}, // No sce prefix for some reason
{0xD2E8363F, QueryIntrHandlerInfo, "QueryIntrHandlerInfo"}, // No sce prefix for some reason
{0xEEE43F47, 0, "sceKernelRegisterUserSpaceIntrStack"},
};

View file

@ -315,7 +315,7 @@ u32 sceSasGetEnvelopeHeight(u32 core, u32 voiceNum)
{
DEBUG_LOG(HLE,"UNIMPL 0=sceSasGetEnvelopeHeight(core=%08x, voicenum=%i)", core, voiceNum);
}
if (voiceNum >= PSP_SAS_VOICES_MAX || voiceNum < 0)
if (voiceNum >= PSP_SAS_VOICES_MAX)
{
WARN_LOG(HLE, "%s: invalid voicenum %d", __FUNCTION__, voiceNum);
return ERROR_SAS_INVALID_VOICE;

View file

@ -134,7 +134,7 @@ int sceUmdActivate(u32 unknown, const char *name)
int sceUmdDeactivate(u32 unknown, const char *name)
{
// Why 18? No idea.
if (unknown < 0 || unknown > 18)
if (unknown > 18)
return PSP_ERROR_UMD_INVALID_PARAM;
bool changed = umdActivated != 0;

@ -1 +1 @@
Subproject commit 9ea2847b5e793b9fae8ccd81f25cc8e4f6a81d7d
Subproject commit 5e5ae520672b816943acabed1f223ebcd7cff16f