2020-12-05 13:08:24 +01:00
|
|
|
#include "stdafx.h"
|
2016-03-21 20:43:03 +01:00
|
|
|
#include "Emu/Cell/PPUModule.h"
|
2018-01-12 21:51:22 +01:00
|
|
|
#include "Emu/Cell/lv2/sys_lwmutex.h"
|
|
|
|
|
#include "Emu/Cell/lv2/sys_lwcond.h"
|
|
|
|
|
#include "Emu/Cell/lv2/sys_spu.h"
|
|
|
|
|
#include "cellSearch.h"
|
|
|
|
|
#include "cellSpurs.h"
|
2016-07-27 23:43:22 +02:00
|
|
|
#include "cellSysutil.h"
|
2015-09-10 15:09:31 +02:00
|
|
|
|
2018-01-12 21:51:22 +01:00
|
|
|
#include "cellMusic.h"
|
2017-05-15 13:58:32 +02:00
|
|
|
|
2018-08-25 14:39:00 +02:00
|
|
|
LOG_CHANNEL(cellMusic);
|
2015-07-30 02:10:36 +02:00
|
|
|
|
2020-07-15 21:44:06 +02:00
|
|
|
template<>
|
|
|
|
|
void fmt_class_string<CellMusicError>::format(std::string& out, u64 arg)
|
|
|
|
|
{
|
|
|
|
|
format_enum(out, arg, [](auto error)
|
|
|
|
|
{
|
|
|
|
|
switch (error)
|
|
|
|
|
{
|
|
|
|
|
STR_CASE(CELL_MUSIC_CANCELED);
|
|
|
|
|
STR_CASE(CELL_MUSIC_PLAYBACK_FINISHED);
|
|
|
|
|
STR_CASE(CELL_MUSIC_ERROR_PARAM);
|
|
|
|
|
STR_CASE(CELL_MUSIC_ERROR_BUSY);
|
|
|
|
|
STR_CASE(CELL_MUSIC_ERROR_NO_ACTIVE_CONTENT);
|
|
|
|
|
STR_CASE(CELL_MUSIC_ERROR_NO_MATCH_FOUND);
|
|
|
|
|
STR_CASE(CELL_MUSIC_ERROR_INVALID_CONTEXT);
|
|
|
|
|
STR_CASE(CELL_MUSIC_ERROR_PLAYBACK_FAILURE);
|
|
|
|
|
STR_CASE(CELL_MUSIC_ERROR_NO_MORE_CONTENT);
|
|
|
|
|
STR_CASE(CELL_MUSIC_DIALOG_OPEN);
|
|
|
|
|
STR_CASE(CELL_MUSIC_DIALOG_CLOSE);
|
|
|
|
|
STR_CASE(CELL_MUSIC_ERROR_GENERIC);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return unknown;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<>
|
|
|
|
|
void fmt_class_string<CellMusic2Error>::format(std::string& out, u64 arg)
|
|
|
|
|
{
|
|
|
|
|
format_enum(out, arg, [](auto error)
|
|
|
|
|
{
|
|
|
|
|
switch (error)
|
|
|
|
|
{
|
|
|
|
|
STR_CASE(CELL_MUSIC2_CANCELED);
|
|
|
|
|
STR_CASE(CELL_MUSIC2_PLAYBACK_FINISHED);
|
|
|
|
|
STR_CASE(CELL_MUSIC2_ERROR_PARAM);
|
|
|
|
|
STR_CASE(CELL_MUSIC2_ERROR_BUSY);
|
|
|
|
|
STR_CASE(CELL_MUSIC2_ERROR_NO_ACTIVE_CONTENT);
|
|
|
|
|
STR_CASE(CELL_MUSIC2_ERROR_NO_MATCH_FOUND);
|
|
|
|
|
STR_CASE(CELL_MUSIC2_ERROR_INVALID_CONTEXT);
|
|
|
|
|
STR_CASE(CELL_MUSIC2_ERROR_PLAYBACK_FAILURE);
|
|
|
|
|
STR_CASE(CELL_MUSIC2_ERROR_NO_MORE_CONTENT);
|
|
|
|
|
STR_CASE(CELL_MUSIC2_DIALOG_OPEN);
|
|
|
|
|
STR_CASE(CELL_MUSIC2_DIALOG_CLOSE);
|
|
|
|
|
STR_CASE(CELL_MUSIC2_ERROR_GENERIC);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return unknown;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-21 19:29:38 +02:00
|
|
|
struct music_state
|
2015-09-10 15:09:31 +02:00
|
|
|
{
|
2021-03-02 17:22:39 +01:00
|
|
|
shared_mutex mutex;
|
|
|
|
|
|
|
|
|
|
vm::ptr<void(u32 event, vm::ptr<void> param, vm::ptr<void> userData)> func{};
|
|
|
|
|
vm::ptr<void> userData{};
|
2015-09-10 15:09:31 +02:00
|
|
|
};
|
|
|
|
|
|
2020-07-15 21:44:06 +02:00
|
|
|
error_code cellMusicGetSelectionContext(vm::ptr<CellMusicSelectionContext> context)
|
2015-07-30 02:10:36 +02:00
|
|
|
{
|
2018-01-12 21:51:22 +01:00
|
|
|
cellMusic.todo("cellMusicGetSelectionContext(context=*0x%x)", context);
|
2018-06-07 09:59:06 +02:00
|
|
|
|
|
|
|
|
if (!context)
|
|
|
|
|
return CELL_MUSIC_ERROR_PARAM;
|
|
|
|
|
|
2017-02-05 17:27:53 +01:00
|
|
|
return CELL_OK;
|
2015-07-30 02:10:36 +02:00
|
|
|
}
|
|
|
|
|
|
2020-07-15 21:44:06 +02:00
|
|
|
error_code cellMusicSetSelectionContext2(vm::ptr<CellMusicSelectionContext> context)
|
2015-07-30 02:10:36 +02:00
|
|
|
{
|
2018-01-12 21:51:22 +01:00
|
|
|
cellMusic.todo("cellMusicSetSelectionContext2(context=*0x%x)", context);
|
|
|
|
|
|
2018-06-07 09:59:06 +02:00
|
|
|
if (!context)
|
|
|
|
|
return CELL_MUSIC2_ERROR_PARAM;
|
|
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
auto& music = g_fxo->get<music_state>();
|
2018-01-12 21:51:22 +01:00
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
if (!music.func)
|
2018-01-12 21:51:22 +01:00
|
|
|
return CELL_MUSIC2_ERROR_GENERIC;
|
|
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
sysutil_register_cb([=, &music](ppu_thread& ppu) -> s32
|
2018-01-12 21:51:22 +01:00
|
|
|
{
|
2021-03-02 12:59:19 +01:00
|
|
|
music.func(ppu, CELL_MUSIC2_EVENT_SET_SELECTION_CONTEXT_RESULT, vm::addr_t(CELL_OK), music.userData);
|
2018-01-12 21:51:22 +01:00
|
|
|
return CELL_OK;
|
|
|
|
|
});
|
|
|
|
|
|
2017-02-05 17:27:53 +01:00
|
|
|
return CELL_OK;
|
2015-07-30 02:10:36 +02:00
|
|
|
}
|
|
|
|
|
|
2020-07-15 21:44:06 +02:00
|
|
|
error_code cellMusicSetVolume2(f32 level)
|
2015-07-30 02:10:36 +02:00
|
|
|
{
|
2022-02-17 00:10:36 +01:00
|
|
|
cellMusic.todo("cellMusicSetVolume2(level=%f)", level);
|
2018-01-12 21:51:22 +01:00
|
|
|
|
2018-06-07 09:59:06 +02:00
|
|
|
level = std::clamp(level, 0.0f, 1.0f);
|
|
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
auto& music = g_fxo->get<music_state>();
|
2018-01-12 21:51:22 +01:00
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
if (!music.func)
|
2018-01-12 21:51:22 +01:00
|
|
|
return CELL_MUSIC2_ERROR_GENERIC;
|
|
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
sysutil_register_cb([=, &music](ppu_thread& ppu) -> s32
|
2018-01-12 21:51:22 +01:00
|
|
|
{
|
2021-03-02 12:59:19 +01:00
|
|
|
music.func(ppu, CELL_MUSIC2_EVENT_SET_VOLUME_RESULT, vm::addr_t(CELL_OK), music.userData);
|
2018-01-12 21:51:22 +01:00
|
|
|
return CELL_OK;
|
|
|
|
|
});
|
|
|
|
|
|
2017-02-05 17:27:53 +01:00
|
|
|
return CELL_OK;
|
2015-07-30 02:10:36 +02:00
|
|
|
}
|
|
|
|
|
|
2020-07-15 21:44:06 +02:00
|
|
|
error_code cellMusicGetContentsId(vm::ptr<CellSearchContentId> contents_id)
|
2015-07-30 02:10:36 +02:00
|
|
|
{
|
2018-01-12 21:51:22 +01:00
|
|
|
cellMusic.todo("cellMusicGetContentsId(contents_id=*0x%x)", contents_id);
|
2018-06-07 09:59:06 +02:00
|
|
|
|
|
|
|
|
if (!contents_id)
|
|
|
|
|
return CELL_MUSIC_ERROR_PARAM;
|
|
|
|
|
|
2017-02-05 17:27:53 +01:00
|
|
|
return CELL_OK;
|
2015-07-30 02:10:36 +02:00
|
|
|
}
|
|
|
|
|
|
2020-07-15 21:44:06 +02:00
|
|
|
error_code cellMusicSetSelectionContext(vm::ptr<CellMusicSelectionContext> context)
|
2015-07-30 02:10:36 +02:00
|
|
|
{
|
2018-01-12 21:51:22 +01:00
|
|
|
cellMusic.todo("cellMusicSetSelectionContext(context=*0x%x)", context);
|
|
|
|
|
|
2018-06-07 09:59:06 +02:00
|
|
|
if (!context)
|
|
|
|
|
return CELL_MUSIC_ERROR_PARAM;
|
|
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
auto& music = g_fxo->get<music_state>();
|
2018-01-12 21:51:22 +01:00
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
if (!music.func)
|
2018-01-12 21:51:22 +01:00
|
|
|
return CELL_MUSIC_ERROR_GENERIC;
|
|
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
sysutil_register_cb([=, &music](ppu_thread& ppu) -> s32
|
2018-01-12 21:51:22 +01:00
|
|
|
{
|
2021-03-02 12:59:19 +01:00
|
|
|
music.func(ppu, CELL_MUSIC_EVENT_SET_SELECTION_CONTEXT_RESULT, vm::addr_t(CELL_OK), music.userData);
|
2018-01-12 21:51:22 +01:00
|
|
|
return CELL_OK;
|
|
|
|
|
});
|
|
|
|
|
|
2017-02-05 17:27:53 +01:00
|
|
|
return CELL_OK;
|
2015-07-30 02:10:36 +02:00
|
|
|
}
|
|
|
|
|
|
2020-07-15 21:44:06 +02:00
|
|
|
error_code cellMusicInitialize2SystemWorkload(s32 mode, vm::ptr<CellMusic2Callback> func, vm::ptr<void> userData, vm::ptr<CellSpurs> spurs, vm::cptr<u8> priority, vm::cptr<struct CellSpursSystemWorkloadAttribute> attr)
|
2015-07-30 02:10:36 +02:00
|
|
|
{
|
2018-01-12 21:51:22 +01:00
|
|
|
cellMusic.todo("cellMusicInitialize2SystemWorkload(mode=0x%x, func=*0x%x, userData=*0x%x, spurs=*0x%x, priority=*0x%x, attr=*0x%x)", mode, func, userData, spurs, priority, attr);
|
|
|
|
|
|
2018-06-07 09:59:06 +02:00
|
|
|
if (!func)
|
|
|
|
|
return CELL_MUSIC2_ERROR_PARAM;
|
|
|
|
|
|
|
|
|
|
if (mode != CELL_MUSIC2_PLAYER_MODE_NORMAL)
|
|
|
|
|
{
|
|
|
|
|
cellMusic.todo("Unknown player mode: 0x%x", mode);
|
|
|
|
|
return CELL_MUSIC2_ERROR_PARAM;
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
auto& music = g_fxo->get<music_state>();
|
|
|
|
|
music.func = func;
|
|
|
|
|
music.userData = userData;
|
2018-01-12 21:51:22 +01:00
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
sysutil_register_cb([=, &music](ppu_thread& ppu) -> s32
|
2018-01-12 21:51:22 +01:00
|
|
|
{
|
2021-03-02 12:59:19 +01:00
|
|
|
music.func(ppu, CELL_MUSIC2_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), userData);
|
2018-01-12 21:51:22 +01:00
|
|
|
return CELL_OK;
|
|
|
|
|
});
|
|
|
|
|
|
2017-02-05 17:27:53 +01:00
|
|
|
return CELL_OK;
|
2015-07-30 02:10:36 +02:00
|
|
|
}
|
|
|
|
|
|
2020-07-15 21:44:06 +02:00
|
|
|
error_code cellMusicGetPlaybackStatus2(vm::ptr<s32> status)
|
2015-07-30 02:10:36 +02:00
|
|
|
{
|
2018-01-12 21:51:22 +01:00
|
|
|
cellMusic.todo("cellMusicGetPlaybackStatus2(status=*0x%x)", status);
|
2018-06-07 09:59:06 +02:00
|
|
|
|
|
|
|
|
if (!status)
|
|
|
|
|
return CELL_MUSIC2_ERROR_PARAM;
|
|
|
|
|
|
2017-02-05 17:27:53 +01:00
|
|
|
return CELL_OK;
|
2015-07-30 02:10:36 +02:00
|
|
|
}
|
|
|
|
|
|
2020-07-15 21:44:06 +02:00
|
|
|
error_code cellMusicGetContentsId2(vm::ptr<CellSearchContentId> contents_id)
|
2015-07-30 02:10:36 +02:00
|
|
|
{
|
2018-01-12 21:51:22 +01:00
|
|
|
cellMusic.todo("cellMusicGetContentsId2(contents_id=*0x%x)", contents_id);
|
2018-06-07 09:59:06 +02:00
|
|
|
|
|
|
|
|
if (!contents_id)
|
|
|
|
|
return CELL_MUSIC2_ERROR_PARAM;
|
|
|
|
|
|
2017-02-05 17:27:53 +01:00
|
|
|
return CELL_OK;
|
2015-07-30 02:10:36 +02:00
|
|
|
}
|
|
|
|
|
|
2020-07-15 21:44:06 +02:00
|
|
|
error_code cellMusicFinalize()
|
2015-07-30 02:10:36 +02:00
|
|
|
{
|
2018-01-12 21:51:22 +01:00
|
|
|
cellMusic.todo("cellMusicFinalize()");
|
|
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
auto& music = g_fxo->get<music_state>();
|
2018-01-12 21:51:22 +01:00
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
if (music.func)
|
2018-01-12 21:51:22 +01:00
|
|
|
{
|
2021-03-02 12:59:19 +01:00
|
|
|
sysutil_register_cb([=, &music](ppu_thread& ppu) -> s32
|
2018-01-12 21:51:22 +01:00
|
|
|
{
|
2021-03-02 12:59:19 +01:00
|
|
|
music.func(ppu, CELL_MUSIC_EVENT_FINALIZE_RESULT, vm::addr_t(CELL_OK), music.userData);
|
2018-01-12 21:51:22 +01:00
|
|
|
return CELL_OK;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-05 17:27:53 +01:00
|
|
|
return CELL_OK;
|
2015-07-30 02:10:36 +02:00
|
|
|
}
|
|
|
|
|
|
2020-07-15 21:44:06 +02:00
|
|
|
error_code cellMusicInitializeSystemWorkload(s32 mode, u32 container, vm::ptr<CellMusicCallback> func, vm::ptr<void> userData, vm::ptr<CellSpurs> spurs, vm::cptr<u8> priority, vm::cptr<struct CellSpursSystemWorkloadAttribute> attr)
|
2015-07-30 02:10:36 +02:00
|
|
|
{
|
2018-01-12 21:51:22 +01:00
|
|
|
cellMusic.todo("cellMusicInitializeSystemWorkload(mode=0x%x, container=0x%x, func=*0x%x, userData=*0x%x, spurs=*0x%x, priority=*0x%x, attr=*0x%x)", mode, container, func, userData, spurs, priority, attr);
|
|
|
|
|
|
2018-06-07 09:59:06 +02:00
|
|
|
if (!func)
|
|
|
|
|
return CELL_MUSIC_ERROR_PARAM;
|
|
|
|
|
|
|
|
|
|
if (mode != CELL_MUSIC_PLAYER_MODE_NORMAL)
|
2018-01-12 21:51:22 +01:00
|
|
|
{
|
|
|
|
|
cellMusic.todo("Unknown player mode: 0x%x", mode);
|
|
|
|
|
return CELL_MUSIC_ERROR_PARAM;
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
auto& music = g_fxo->get<music_state>();
|
|
|
|
|
music.func = func;
|
|
|
|
|
music.userData = userData;
|
2018-01-12 21:51:22 +01:00
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
sysutil_register_cb([=, &music](ppu_thread& ppu) -> s32
|
2018-01-12 21:51:22 +01:00
|
|
|
{
|
2021-03-02 12:59:19 +01:00
|
|
|
music.func(ppu, CELL_MUSIC_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), userData);
|
2018-01-12 21:51:22 +01:00
|
|
|
return CELL_OK;
|
|
|
|
|
});
|
|
|
|
|
|
2017-02-05 17:27:53 +01:00
|
|
|
return CELL_OK;
|
2015-07-30 02:10:36 +02:00
|
|
|
}
|
|
|
|
|
|
2020-07-15 21:44:06 +02:00
|
|
|
error_code cellMusicInitialize(s32 mode, u32 container, s32 spuPriority, vm::ptr<CellMusicCallback> func, vm::ptr<void> userData)
|
2015-07-30 02:10:36 +02:00
|
|
|
{
|
2018-01-12 21:51:22 +01:00
|
|
|
cellMusic.todo("cellMusicInitialize(mode=0x%x, container=0x%x, spuPriority=0x%x, func=*0x%x, userData=*0x%x)", mode, container, spuPriority, func, userData);
|
|
|
|
|
|
2018-06-07 09:59:06 +02:00
|
|
|
if (!func)
|
|
|
|
|
return CELL_MUSIC_ERROR_PARAM;
|
|
|
|
|
|
|
|
|
|
if (mode != CELL_MUSIC_PLAYER_MODE_NORMAL)
|
2018-01-12 21:51:22 +01:00
|
|
|
{
|
|
|
|
|
cellMusic.todo("Unknown player mode: 0x%x", mode);
|
|
|
|
|
return CELL_MUSIC_ERROR_PARAM;
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
auto& music = g_fxo->get<music_state>();
|
|
|
|
|
music.func = func;
|
|
|
|
|
music.userData = userData;
|
2018-01-12 21:51:22 +01:00
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
sysutil_register_cb([=, &music](ppu_thread& ppu) -> s32
|
2018-01-12 21:51:22 +01:00
|
|
|
{
|
2021-03-02 12:59:19 +01:00
|
|
|
music.func(ppu, CELL_MUSIC_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), userData);
|
2018-01-12 21:51:22 +01:00
|
|
|
return CELL_OK;
|
|
|
|
|
});
|
|
|
|
|
|
2017-02-05 17:27:53 +01:00
|
|
|
return CELL_OK;
|
2015-07-30 02:10:36 +02:00
|
|
|
}
|
|
|
|
|
|
2020-07-15 21:44:06 +02:00
|
|
|
error_code cellMusicFinalize2()
|
2015-07-30 02:10:36 +02:00
|
|
|
{
|
2018-01-12 21:51:22 +01:00
|
|
|
cellMusic.todo("cellMusicFinalize2()");
|
|
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
auto& music = g_fxo->get<music_state>();
|
2018-01-12 21:51:22 +01:00
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
if (music.func)
|
2018-01-12 21:51:22 +01:00
|
|
|
{
|
2021-03-02 12:59:19 +01:00
|
|
|
sysutil_register_cb([=, &music](ppu_thread& ppu) -> s32
|
2018-01-12 21:51:22 +01:00
|
|
|
{
|
2021-03-02 12:59:19 +01:00
|
|
|
music.func(ppu, CELL_MUSIC2_EVENT_FINALIZE_RESULT, vm::addr_t(CELL_OK), music.userData);
|
2018-01-12 21:51:22 +01:00
|
|
|
return CELL_OK;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-05 17:27:53 +01:00
|
|
|
return CELL_OK;
|
2015-07-30 02:10:36 +02:00
|
|
|
}
|
|
|
|
|
|
2020-07-15 21:44:06 +02:00
|
|
|
error_code cellMusicGetSelectionContext2(vm::ptr<CellMusicSelectionContext> context)
|
2015-07-30 02:10:36 +02:00
|
|
|
{
|
2018-01-12 21:51:22 +01:00
|
|
|
cellMusic.todo("cellMusicGetSelectionContext2(context=*0x%x)", context);
|
2018-06-07 09:59:06 +02:00
|
|
|
|
|
|
|
|
if (!context)
|
|
|
|
|
return CELL_MUSIC2_ERROR_PARAM;
|
|
|
|
|
|
2017-02-05 17:27:53 +01:00
|
|
|
return CELL_OK;
|
2015-07-30 02:10:36 +02:00
|
|
|
}
|
|
|
|
|
|
2020-07-15 21:44:06 +02:00
|
|
|
error_code cellMusicGetVolume(vm::ptr<f32> level)
|
2015-07-30 02:10:36 +02:00
|
|
|
{
|
2018-01-12 21:51:22 +01:00
|
|
|
cellMusic.todo("cellMusicGetVolume(level=*0x%x)", level);
|
2018-06-07 09:59:06 +02:00
|
|
|
|
|
|
|
|
if (!level)
|
|
|
|
|
return CELL_MUSIC_ERROR_PARAM;
|
|
|
|
|
|
2017-02-05 17:27:53 +01:00
|
|
|
return CELL_OK;
|
2015-07-30 02:10:36 +02:00
|
|
|
}
|
|
|
|
|
|
2020-07-15 21:44:06 +02:00
|
|
|
error_code cellMusicGetPlaybackStatus(vm::ptr<s32> status)
|
2015-07-30 02:10:36 +02:00
|
|
|
{
|
2018-01-12 21:51:22 +01:00
|
|
|
cellMusic.todo("cellMusicGetPlaybackStatus(status=*0x%x)", status);
|
2018-06-07 09:59:06 +02:00
|
|
|
|
|
|
|
|
if (!status)
|
|
|
|
|
return CELL_MUSIC_ERROR_PARAM;
|
|
|
|
|
|
2017-02-05 17:27:53 +01:00
|
|
|
return CELL_OK;
|
2015-07-30 02:10:36 +02:00
|
|
|
}
|
|
|
|
|
|
2020-07-15 21:44:06 +02:00
|
|
|
error_code cellMusicSetPlaybackCommand2(s32 command, vm::ptr<void> param)
|
2015-07-30 02:10:36 +02:00
|
|
|
{
|
2018-01-12 21:51:22 +01:00
|
|
|
cellMusic.todo("cellMusicSetPlaybackCommand2(command=0x%x, param=*0x%x)", command, param);
|
|
|
|
|
|
2018-06-07 09:59:06 +02:00
|
|
|
if (command < CELL_MUSIC_PB_CMD_STOP || command > CELL_MUSIC_PB_CMD_FASTREVERSE)
|
|
|
|
|
return CELL_MUSIC2_ERROR_PARAM;
|
|
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
auto& music = g_fxo->get<music_state>();
|
2018-01-12 21:51:22 +01:00
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
if (!music.func)
|
2018-01-12 21:51:22 +01:00
|
|
|
return CELL_MUSIC2_ERROR_GENERIC;
|
|
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
sysutil_register_cb([=, &music](ppu_thread& ppu) -> s32
|
2018-01-12 21:51:22 +01:00
|
|
|
{
|
2021-03-02 12:59:19 +01:00
|
|
|
music.func(ppu, CELL_MUSIC2_EVENT_SET_PLAYBACK_COMMAND_RESULT, vm::addr_t(CELL_OK), music.userData);
|
2018-01-12 21:51:22 +01:00
|
|
|
return CELL_OK;
|
|
|
|
|
});
|
|
|
|
|
|
2017-02-05 17:27:53 +01:00
|
|
|
return CELL_OK;
|
2015-07-30 02:10:36 +02:00
|
|
|
}
|
|
|
|
|
|
2020-07-15 21:44:06 +02:00
|
|
|
error_code cellMusicSetPlaybackCommand(s32 command, vm::ptr<void> param)
|
2015-07-30 02:10:36 +02:00
|
|
|
{
|
2018-01-12 21:51:22 +01:00
|
|
|
cellMusic.todo("cellMusicSetPlaybackCommand(command=0x%x, param=*0x%x)", command, param);
|
|
|
|
|
|
2018-06-07 09:59:06 +02:00
|
|
|
if (command < CELL_MUSIC_PB_CMD_STOP || command > CELL_MUSIC_PB_CMD_FASTREVERSE)
|
|
|
|
|
return CELL_MUSIC_ERROR_PARAM;
|
|
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
auto& music = g_fxo->get<music_state>();
|
2018-01-12 21:51:22 +01:00
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
if (!music.func)
|
2018-01-12 21:51:22 +01:00
|
|
|
return CELL_MUSIC_ERROR_GENERIC;
|
|
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
sysutil_register_cb([=, &music](ppu_thread& ppu) -> s32
|
2018-01-12 21:51:22 +01:00
|
|
|
{
|
2021-03-02 12:59:19 +01:00
|
|
|
music.func(ppu, CELL_MUSIC_EVENT_SET_PLAYBACK_COMMAND_RESULT, vm::addr_t(CELL_OK), music.userData);
|
2018-01-12 21:51:22 +01:00
|
|
|
return CELL_OK;
|
|
|
|
|
});
|
|
|
|
|
|
2017-02-05 17:27:53 +01:00
|
|
|
return CELL_OK;
|
2015-07-30 02:10:36 +02:00
|
|
|
}
|
|
|
|
|
|
2020-07-15 21:44:06 +02:00
|
|
|
error_code cellMusicSelectContents2()
|
2015-07-30 02:10:36 +02:00
|
|
|
{
|
2018-01-12 21:51:22 +01:00
|
|
|
cellMusic.todo("cellMusicSelectContents2()");
|
|
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
auto& music = g_fxo->get<music_state>();
|
2018-01-12 21:51:22 +01:00
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
if (!music.func)
|
2018-01-12 21:51:22 +01:00
|
|
|
return CELL_MUSIC2_ERROR_GENERIC;
|
|
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
sysutil_register_cb([=, &music](ppu_thread& ppu) -> s32
|
2018-01-12 21:51:22 +01:00
|
|
|
{
|
2021-03-02 12:59:19 +01:00
|
|
|
music.func(ppu, CELL_MUSIC2_EVENT_SELECT_CONTENTS_RESULT, vm::addr_t(CELL_OK), music.userData);
|
2018-01-12 21:51:22 +01:00
|
|
|
return CELL_OK;
|
|
|
|
|
});
|
|
|
|
|
|
2017-02-05 17:27:53 +01:00
|
|
|
return CELL_OK;
|
2015-07-30 02:10:36 +02:00
|
|
|
}
|
|
|
|
|
|
2020-07-15 21:44:06 +02:00
|
|
|
error_code cellMusicSelectContents(u32 container)
|
2015-07-30 02:10:36 +02:00
|
|
|
{
|
2018-01-12 21:51:22 +01:00
|
|
|
cellMusic.todo("cellMusicSelectContents(container=0x%x)", container);
|
|
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
auto& music = g_fxo->get<music_state>();
|
2018-01-12 21:51:22 +01:00
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
if (!music.func)
|
2018-01-12 21:51:22 +01:00
|
|
|
return CELL_MUSIC_ERROR_GENERIC;
|
|
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
sysutil_register_cb([=, &music](ppu_thread& ppu) -> s32
|
2018-01-12 21:51:22 +01:00
|
|
|
{
|
2021-03-02 12:59:19 +01:00
|
|
|
music.func(ppu, CELL_MUSIC_EVENT_SELECT_CONTENTS_RESULT, vm::addr_t(CELL_OK), music.userData);
|
2018-01-12 21:51:22 +01:00
|
|
|
return CELL_OK;
|
|
|
|
|
});
|
|
|
|
|
|
2017-02-05 17:27:53 +01:00
|
|
|
return CELL_OK;
|
2015-07-30 02:10:36 +02:00
|
|
|
}
|
|
|
|
|
|
2020-07-15 21:44:06 +02:00
|
|
|
error_code cellMusicInitialize2(s32 mode, s32 spuPriority, vm::ptr<CellMusic2Callback> func, vm::ptr<void> userData)
|
2015-07-30 02:10:36 +02:00
|
|
|
{
|
2016-01-12 22:57:16 +01:00
|
|
|
cellMusic.todo("cellMusicInitialize2(mode=%d, spuPriority=%d, func=*0x%x, userData=*0x%x)", mode, spuPriority, func, userData);
|
2015-09-10 15:09:31 +02:00
|
|
|
|
2018-06-07 09:59:06 +02:00
|
|
|
if (!func)
|
|
|
|
|
return CELL_MUSIC2_ERROR_PARAM;
|
|
|
|
|
|
2015-09-13 09:26:01 +02:00
|
|
|
if (mode != CELL_MUSIC2_PLAYER_MODE_NORMAL)
|
2015-09-10 15:09:31 +02:00
|
|
|
{
|
2016-01-12 22:57:16 +01:00
|
|
|
cellMusic.todo("Unknown player mode: 0x%x", mode);
|
2015-09-13 09:26:01 +02:00
|
|
|
return CELL_MUSIC2_ERROR_PARAM;
|
|
|
|
|
}
|
2015-09-10 15:09:31 +02:00
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
auto& music = g_fxo->get<music_state>();
|
|
|
|
|
music.func = func;
|
|
|
|
|
music.userData = userData;
|
2015-09-26 22:46:04 +02:00
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
sysutil_register_cb([=, &music](ppu_thread& ppu) -> s32
|
2015-09-13 09:26:01 +02:00
|
|
|
{
|
2021-03-02 12:59:19 +01:00
|
|
|
music.func(ppu, CELL_MUSIC2_EVENT_INITIALIZE_RESULT, vm::addr_t(CELL_OK), userData);
|
2015-09-26 22:46:04 +02:00
|
|
|
return CELL_OK;
|
|
|
|
|
});
|
2015-09-10 15:09:31 +02:00
|
|
|
|
|
|
|
|
return CELL_OK;
|
2015-07-30 02:10:36 +02:00
|
|
|
}
|
|
|
|
|
|
2020-07-15 21:44:06 +02:00
|
|
|
error_code cellMusicSetVolume(f32 level)
|
2015-07-30 02:10:36 +02:00
|
|
|
{
|
2022-02-17 00:10:36 +01:00
|
|
|
cellMusic.todo("cellMusicSetVolume(level=%f)", level);
|
2018-01-12 21:51:22 +01:00
|
|
|
|
2018-06-07 09:59:06 +02:00
|
|
|
level = std::clamp(level, 0.0f, 1.0f);
|
|
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
auto& music = g_fxo->get<music_state>();
|
2018-01-12 21:51:22 +01:00
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
if (!music.func)
|
2018-01-12 21:51:22 +01:00
|
|
|
return CELL_MUSIC_ERROR_GENERIC;
|
|
|
|
|
|
2021-03-02 12:59:19 +01:00
|
|
|
sysutil_register_cb([=, &music](ppu_thread& ppu) -> s32
|
2018-01-12 21:51:22 +01:00
|
|
|
{
|
2021-03-02 12:59:19 +01:00
|
|
|
music.func(ppu, CELL_MUSIC_EVENT_SET_VOLUME_RESULT, vm::addr_t(CELL_OK), music.userData);
|
2018-01-12 21:51:22 +01:00
|
|
|
return CELL_OK;
|
|
|
|
|
});
|
|
|
|
|
|
2017-02-05 17:27:53 +01:00
|
|
|
return CELL_OK;
|
2015-07-30 02:10:36 +02:00
|
|
|
}
|
|
|
|
|
|
2020-07-15 21:44:06 +02:00
|
|
|
error_code cellMusicGetVolume2(vm::ptr<f32> level)
|
2015-07-30 02:10:36 +02:00
|
|
|
{
|
2018-01-12 21:51:22 +01:00
|
|
|
cellMusic.todo("cellMusicGetVolume2(level=*0x%x)", level);
|
2018-06-07 09:59:06 +02:00
|
|
|
|
|
|
|
|
if (!level)
|
|
|
|
|
return CELL_MUSIC2_ERROR_PARAM;
|
|
|
|
|
|
2017-02-05 17:27:53 +01:00
|
|
|
return CELL_OK;
|
2015-07-30 02:10:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2016-03-21 20:43:03 +01:00
|
|
|
DECLARE(ppu_module_manager::cellMusic)("cellMusicUtility", []()
|
|
|
|
|
{
|
|
|
|
|
REG_FUNC(cellMusicUtility, cellMusicGetSelectionContext);
|
|
|
|
|
REG_FUNC(cellMusicUtility, cellMusicSetSelectionContext2);
|
|
|
|
|
REG_FUNC(cellMusicUtility, cellMusicSetVolume2);
|
|
|
|
|
REG_FUNC(cellMusicUtility, cellMusicGetContentsId);
|
|
|
|
|
REG_FUNC(cellMusicUtility, cellMusicSetSelectionContext);
|
|
|
|
|
REG_FUNC(cellMusicUtility, cellMusicInitialize2SystemWorkload);
|
|
|
|
|
REG_FUNC(cellMusicUtility, cellMusicGetPlaybackStatus2);
|
|
|
|
|
REG_FUNC(cellMusicUtility, cellMusicGetContentsId2);
|
|
|
|
|
REG_FUNC(cellMusicUtility, cellMusicFinalize);
|
|
|
|
|
REG_FUNC(cellMusicUtility, cellMusicInitializeSystemWorkload);
|
|
|
|
|
REG_FUNC(cellMusicUtility, cellMusicInitialize);
|
|
|
|
|
REG_FUNC(cellMusicUtility, cellMusicFinalize2);
|
|
|
|
|
REG_FUNC(cellMusicUtility, cellMusicGetSelectionContext2);
|
|
|
|
|
REG_FUNC(cellMusicUtility, cellMusicGetVolume);
|
|
|
|
|
REG_FUNC(cellMusicUtility, cellMusicGetPlaybackStatus);
|
|
|
|
|
REG_FUNC(cellMusicUtility, cellMusicSetPlaybackCommand2);
|
|
|
|
|
REG_FUNC(cellMusicUtility, cellMusicSetPlaybackCommand);
|
|
|
|
|
REG_FUNC(cellMusicUtility, cellMusicSelectContents2);
|
|
|
|
|
REG_FUNC(cellMusicUtility, cellMusicSelectContents);
|
|
|
|
|
REG_FUNC(cellMusicUtility, cellMusicInitialize2);
|
|
|
|
|
REG_FUNC(cellMusicUtility, cellMusicSetVolume);
|
|
|
|
|
REG_FUNC(cellMusicUtility, cellMusicGetVolume2);
|
2015-07-30 02:10:36 +02:00
|
|
|
});
|