Skip to content

Commit

Permalink
cellMusic: add some param checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Megamouse committed May 31, 2018
1 parent 39bee89 commit eae6398
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions rpcs3/Emu/Cell/Modules/cellMusic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,20 @@ struct music_t
s32 cellMusicGetSelectionContext(vm::ptr<CellMusicSelectionContext> context)
{
cellMusic.todo("cellMusicGetSelectionContext(context=*0x%x)", context);

if (!context)
return CELL_MUSIC2_ERROR_PARAM;

return CELL_OK;
}

s32 cellMusicSetSelectionContext2(vm::ptr<CellMusicSelectionContext> context)
{
cellMusic.todo("cellMusicSetSelectionContext2(context=*0x%x)", context);

if (!context)
return CELL_MUSIC2_ERROR_PARAM;

const auto music = fxm::get_always<music_t>();

if (!music->func)
Expand All @@ -47,6 +54,9 @@ s32 cellMusicSetVolume2(f32 level)
{
cellMusic.todo("cellMusicSetVolume2(level=0x%x)", level);

//if (level > 1.0f)
// return CELL_MUSIC2_ERROR_PARAM;

const auto music = fxm::get_always<music_t>();

if (!music->func)
Expand All @@ -64,13 +74,20 @@ s32 cellMusicSetVolume2(f32 level)
s32 cellMusicGetContentsId(vm::ptr<CellSearchContentId> contents_id)
{
cellMusic.todo("cellMusicGetContentsId(contents_id=*0x%x)", contents_id);

if (!contents_id)
return CELL_MUSIC2_ERROR_PARAM;

return CELL_OK;
}

s32 cellMusicSetSelectionContext(vm::ptr<CellMusicSelectionContext> context)
{
cellMusic.todo("cellMusicSetSelectionContext(context=*0x%x)", context);

if (!context)
return CELL_MUSIC2_ERROR_PARAM;

const auto music = fxm::get_always<music_t>();

if (!music->func)
Expand Down Expand Up @@ -105,12 +122,20 @@ s32 cellMusicInitialize2SystemWorkload(s32 mode, vm::ptr<CellMusic2Callback> fun
s32 cellMusicGetPlaybackStatus2(vm::ptr<s32> status)
{
cellMusic.todo("cellMusicGetPlaybackStatus2(status=*0x%x)", status);

if (!status)
return CELL_MUSIC2_ERROR_PARAM;

return CELL_OK;
}

s32 cellMusicGetContentsId2(vm::ptr<CellSearchContentId> contents_id)
{
cellMusic.todo("cellMusicGetContentsId2(contents_id=*0x%x)", contents_id);

if (!contents_id)
return CELL_MUSIC2_ERROR_PARAM;

return CELL_OK;
}

Expand Down Expand Up @@ -199,18 +224,30 @@ s32 cellMusicFinalize2()
s32 cellMusicGetSelectionContext2(vm::ptr<CellMusicSelectionContext> context)
{
cellMusic.todo("cellMusicGetSelectionContext2(context=*0x%x)", context);

if (!context)
return CELL_MUSIC2_ERROR_PARAM;

return CELL_OK;
}

s32 cellMusicGetVolume(vm::ptr<f32> level)
{
cellMusic.todo("cellMusicGetVolume(level=*0x%x)", level);

if (!level)
return CELL_MUSIC2_ERROR_PARAM;

return CELL_OK;
}

s32 cellMusicGetPlaybackStatus(vm::ptr<s32> status)
{
cellMusic.todo("cellMusicGetPlaybackStatus(status=*0x%x)", status);

if (!status)
return CELL_MUSIC2_ERROR_PARAM;

return CELL_OK;
}

Expand Down Expand Up @@ -313,6 +350,9 @@ s32 cellMusicSetVolume(f32 level)
{
cellMusic.todo("cellMusicSetVolume(level=0x%x)", level);

//if (!level > 1.0f)
// return CELL_MUSIC2_ERROR_PARAM;

const auto music = fxm::get_always<music_t>();

if (!music->func)
Expand All @@ -330,6 +370,10 @@ s32 cellMusicSetVolume(f32 level)
s32 cellMusicGetVolume2(vm::ptr<f32> level)
{
cellMusic.todo("cellMusicGetVolume2(level=*0x%x)", level);

if (!level)
return CELL_MUSIC2_ERROR_PARAM;

return CELL_OK;
}

Expand Down

0 comments on commit eae6398

Please sign in to comment.