mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-01-08 01:30:13 +01:00
split rpcs3 and hle libraries
merge rpcs3 utilities
This commit is contained in:
parent
b33e2662b6
commit
62ad27d1e2
|
|
@ -37,7 +37,7 @@ if [ "$DEPLOY_APPIMAGE" = "true" ]; then
|
|||
APPIMAGE_SUFFIX="linux64"
|
||||
fi
|
||||
|
||||
COMM_TAG=$(awk '/version{.*}/ { printf("%d.%d.%d", $5, $6, $7) }' ../rpcs3/rpcs3/rpcs3_version.cpp)
|
||||
COMM_TAG=$(awk '/version{.*}/ { printf("%d.%d.%d", $5, $6, $7) }' ../rpcs3/rpcs3_version.cpp)
|
||||
COMM_COUNT="$(git rev-list --count HEAD)"
|
||||
COMM_HASH="$(git rev-parse --short=8 HEAD)"
|
||||
RPCS3_APPIMAGE="rpcs3-v${COMM_TAG}-${COMM_COUNT}-${COMM_HASH}_${APPIMAGE_SUFFIX}.AppImage"
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ mv "$CCACHE_SH_DIR"/ccache-*/* "$CCACHE_SH_DIR"
|
|||
cp "$CCACHE_SH_DIR"/ccache.exe "$CCACHE_SH_DIR"/cl.exe
|
||||
|
||||
# Gather explicit version number and number of commits
|
||||
COMM_TAG=$(awk '/version{.*}/ { printf("%d.%d.%d", $5, $6, $7) }' ./rpcs3/rpcs3/rpcs3_version.cpp)
|
||||
COMM_TAG=$(awk '/version{.*}/ { printf("%d.%d.%d", $5, $6, $7) }' ./rpcs3/rpcs3_version.cpp)
|
||||
COMM_COUNT=$(git rev-list --count HEAD)
|
||||
COMM_HASH=$(git rev-parse --short=8 HEAD)
|
||||
|
||||
|
|
|
|||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -59,3 +59,4 @@ compile_commands.json
|
|||
|
||||
build*/
|
||||
.cache/
|
||||
rpcs3/git-version.h
|
||||
|
|
|
|||
|
|
@ -178,6 +178,7 @@ endif()
|
|||
|
||||
if (WITH_RPCS3)
|
||||
add_subdirectory(rpcs3)
|
||||
add_subdirectory(ps3fw)
|
||||
endif()
|
||||
|
||||
if (NOT ANDROID AND WITH_RPCS3_QT_UI AND WITH_RPCS3)
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ else()
|
|||
endif()
|
||||
|
||||
add_compile_options(-Wall)
|
||||
add_compile_options(-fno-exceptions)
|
||||
# add_compile_options(-fno-exceptions)
|
||||
add_compile_options(-fstack-protector)
|
||||
|
||||
if(USE_NATIVE_INSTRUCTIONS AND COMPILER_SUPPORTS_MARCH_NATIVE)
|
||||
|
|
|
|||
32
ps3fw/.clang-format
Normal file
32
ps3fw/.clang-format
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
Standard: c++20
|
||||
UseTab: AlignWithSpaces
|
||||
TabWidth: 4
|
||||
IndentWidth: 4
|
||||
AccessModifierOffset: -4
|
||||
PointerAlignment: Left
|
||||
NamespaceIndentation: All
|
||||
ColumnLimit: 0
|
||||
BreakBeforeBraces: Allman
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeTernaryOperators: false
|
||||
AlwaysBreakTemplateDeclarations: Yes
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AllowShortBlocksOnASingleLine: Never
|
||||
AllowShortCaseLabelsOnASingleLine: true
|
||||
AllowShortFunctionsOnASingleLine: Empty
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AllowShortLambdasOnASingleLine: Empty
|
||||
Cpp11BracedListStyle: true
|
||||
IndentCaseLabels: false
|
||||
SortIncludes: false
|
||||
ReflowComments: true
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignTrailingComments: true
|
||||
AlignAfterOpenBracket: DontAlign
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
AlwaysBreakAfterReturnType: None
|
||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||
IndentWrappedFunctionNames: false
|
||||
149
ps3fw/CMakeLists.txt
Normal file
149
ps3fw/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
|
||||
add_library(rpcsx_fw_ps3_api INTERFACE)
|
||||
|
||||
target_include_directories(rpcsx_fw_ps3_api INTERFACE include)
|
||||
|
||||
add_library(rpcsx_fw_ps3 OBJECT
|
||||
cellAdec.cpp
|
||||
cellAtrac.cpp
|
||||
cellAtracMulti.cpp
|
||||
cellAtracXdec.cpp
|
||||
cellAudio.cpp
|
||||
cellAudioOut.cpp
|
||||
cellAuthDialog.cpp
|
||||
cellAvconfExt.cpp
|
||||
cellBgdl.cpp
|
||||
cellCamera.cpp
|
||||
cellCelp8Enc.cpp
|
||||
cellCelpEnc.cpp
|
||||
cellCrossController.cpp
|
||||
cellDaisy.cpp
|
||||
cellDmux.cpp
|
||||
cellDmuxPamf.cpp
|
||||
cellDtcpIpUtility.cpp
|
||||
cellFiber.cpp
|
||||
cellFont.cpp
|
||||
cellFontFT.cpp
|
||||
cell_FreeType2.cpp
|
||||
cellFs.cpp
|
||||
cellGame.cpp
|
||||
cellGameExec.cpp
|
||||
cellGcmSys.cpp
|
||||
cellGem.cpp
|
||||
cellGifDec.cpp
|
||||
cellHttp.cpp
|
||||
cellHttpUtil.cpp
|
||||
cellImeJp.cpp
|
||||
cellJpgDec.cpp
|
||||
cellJpgEnc.cpp
|
||||
cellKb.cpp
|
||||
cellKey2char.cpp
|
||||
cellL10n.cpp
|
||||
cellLibprof.cpp
|
||||
cellMic.cpp
|
||||
cellMouse.cpp
|
||||
cellMsgDialog.cpp
|
||||
cellMusic.cpp
|
||||
cellMusicDecode.cpp
|
||||
cellMusicSelectionContext.cpp
|
||||
cellMusicExport.cpp
|
||||
cellNetAoi.cpp
|
||||
cellNetCtl.cpp
|
||||
cellOskDialog.cpp
|
||||
cellOvis.cpp
|
||||
cellPad.cpp
|
||||
cellPamf.cpp
|
||||
cellPesmUtility.cpp
|
||||
cellPhotoDecode.cpp
|
||||
cellPhotoExport.cpp
|
||||
cellPhotoImport.cpp
|
||||
cellPngDec.cpp
|
||||
cellPngEnc.cpp
|
||||
cellPrint.cpp
|
||||
cellRec.cpp
|
||||
cellRemotePlay.cpp
|
||||
cellResc.cpp
|
||||
cellRtcAlarm.cpp
|
||||
cellRtc.cpp
|
||||
cellRudp.cpp
|
||||
cellSail.cpp
|
||||
cellSailRec.cpp
|
||||
cellSaveData.cpp
|
||||
cellScreenshot.cpp
|
||||
cellSearch.cpp
|
||||
cellSheap.cpp
|
||||
cellSpudll.cpp
|
||||
cellSpurs.cpp
|
||||
cellSpursJq.cpp
|
||||
cellSpursSpu.cpp
|
||||
cellSsl.cpp
|
||||
cellStorage.cpp
|
||||
cellSubDisplay.cpp
|
||||
cellSync2.cpp
|
||||
cellSync.cpp
|
||||
cellSysconf.cpp
|
||||
cellSysCache.cpp
|
||||
cellSysmodule.cpp
|
||||
cellSysutilAp.cpp
|
||||
cellSysutilAvc2.cpp
|
||||
cellSysutilAvc.cpp
|
||||
cellSysutilAvcExt.cpp
|
||||
cellSysutil.cpp
|
||||
cellSysutilMisc.cpp
|
||||
cellSysutilNpEula.cpp
|
||||
cellUsbd.cpp
|
||||
cellUsbpspcm.cpp
|
||||
cellUserInfo.cpp
|
||||
cellVdec.cpp
|
||||
cellVideoExport.cpp
|
||||
cellVideoOut.cpp
|
||||
cellVideoPlayerUtility.cpp
|
||||
cellVideoUpload.cpp
|
||||
cellVoice.cpp
|
||||
cellVpost.cpp
|
||||
cellWebBrowser.cpp
|
||||
HLE_PATCHES.cpp
|
||||
libad_async.cpp
|
||||
libad_core.cpp
|
||||
libmedi.cpp
|
||||
libmixer.cpp
|
||||
libsnd3.cpp
|
||||
libsynth2.cpp
|
||||
sceNp2.cpp
|
||||
sceNpClans.cpp
|
||||
sceNpCommerce2.cpp
|
||||
sceNp.cpp
|
||||
sceNpMatchingInt.cpp
|
||||
sceNpPlus.cpp
|
||||
sceNpSns.cpp
|
||||
sceNpTrophy.cpp
|
||||
sceNpTus.cpp
|
||||
sceNpUtil.cpp
|
||||
StaticHLE.cpp
|
||||
sys_crashdump.cpp
|
||||
sys_game_.cpp
|
||||
sys_heap.cpp
|
||||
sys_io_.cpp
|
||||
sys_libc_.cpp
|
||||
sys_libc.cpp
|
||||
sys_lv2dbg.cpp
|
||||
sys_lwcond_.cpp
|
||||
sys_lwmutex_.cpp
|
||||
sys_mempool.cpp
|
||||
sys_mmapper_.cpp
|
||||
sys_net_.cpp
|
||||
sys_ppu_thread_.cpp
|
||||
sys_prx_.cpp
|
||||
sysPrxForUser.cpp
|
||||
sys_rsxaudio_.cpp
|
||||
sys_spinlock.cpp
|
||||
sys_spu_.cpp
|
||||
libfs_utility_init.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(rpcsx_fw_ps3 PUBLIC rpcs3 rpcsx_fw_ps3_api 3rdparty::stblib)
|
||||
target_compile_definitions(rpcsx_fw_ps3 PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX)
|
||||
target_include_directories(rpcsx_fw_ps3 PRIVATE include/rpcsx/fw/ps3)
|
||||
|
||||
add_library(rpcsx::fw::ps3 ALIAS rpcsx_fw_ps3)
|
||||
add_library(rpcsx::fw::ps3::api ALIAS rpcsx_fw_ps3_api)
|
||||
|
|
@ -1,13 +1,14 @@
|
|||
#include "stdafx.h"
|
||||
#include "Emu/IdManager.h"
|
||||
#include "Emu/Cell/PPUModule.h"
|
||||
#include "Utilities/Thread.h"
|
||||
#include "Emu/IdManager.h"
|
||||
#include "stdafx.h"
|
||||
#include "util/Thread.h"
|
||||
|
||||
#include "Emu/Cell/lv2/sys_spu.h"
|
||||
|
||||
#include <thread>
|
||||
|
||||
// SONIC THE HEDGEDOG: a fix for a race condition between SPUs and PPUs causing missing graphics (SNR is overriden when non-empty)
|
||||
// SONIC THE HEDGEDOG: a fix for a race condition between SPUs and PPUs causing
|
||||
// missing graphics (SNR is overriden when non-empty)
|
||||
void WaitForSPUsToEmptySNRs(ppu_thread& ppu, u32 spu_id, u32 snr_mask)
|
||||
{
|
||||
ppu.state += cpu_flag::wait;
|
||||
|
|
@ -20,7 +21,8 @@ void WaitForSPUsToEmptySNRs(ppu_thread& ppu, u32 spu_id, u32 snr_mask)
|
|||
}
|
||||
|
||||
// Wait until specified SNRs are reported empty at least once
|
||||
for (bool has_busy = true; has_busy && !ppu.is_stopped(); std::this_thread::yield())
|
||||
for (bool has_busy = true; has_busy && !ppu.is_stopped();
|
||||
std::this_thread::yield())
|
||||
{
|
||||
has_busy = false;
|
||||
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
#include "stdafx.h"
|
||||
#include "Emu/system_config.h"
|
||||
#include "Emu/Cell/PPUModule.h"
|
||||
#include "Emu/IdManager.h"
|
||||
#include "Emu/RSX/rsx_utils.h"
|
||||
#include "Utilities/StrUtil.h"
|
||||
#include "Emu/system_config.h"
|
||||
#include "stdafx.h"
|
||||
#include "util/StrUtil.h"
|
||||
|
||||
#include "cellMic.h"
|
||||
#include "cellAudioIn.h"
|
||||
#include "cellAudioOut.h"
|
||||
#include "cellMic.h"
|
||||
#include "cellVideoOut.h"
|
||||
|
||||
#include <optional>
|
||||
|
|
@ -39,10 +39,12 @@ struct avconf_manager
|
|||
{
|
||||
shared_mutex mutex;
|
||||
std::vector<CellAudioInDeviceInfo> devices;
|
||||
CellAudioInDeviceMode inDeviceMode = CELL_AUDIO_IN_SINGLE_DEVICE_MODE; // TODO: use somewhere
|
||||
CellAudioInDeviceMode inDeviceMode =
|
||||
CELL_AUDIO_IN_SINGLE_DEVICE_MODE; // TODO: use somewhere
|
||||
|
||||
void copy_device_info(u32 num, vm::ptr<CellAudioInDeviceInfo> info) const;
|
||||
std::optional<CellAudioInDeviceInfo> get_device_info(vm::cptr<char> name) const;
|
||||
std::optional<CellAudioInDeviceInfo>
|
||||
get_device_info(vm::cptr<char> name) const;
|
||||
|
||||
avconf_manager();
|
||||
|
||||
|
|
@ -55,7 +57,8 @@ avconf_manager::avconf_manager()
|
|||
{
|
||||
u32 curindex = 0;
|
||||
|
||||
const std::vector<std::string> mic_list = fmt::split(g_cfg.audio.microphone_devices.to_string(), {"@@@"});
|
||||
const std::vector<std::string> mic_list =
|
||||
fmt::split(g_cfg.audio.microphone_devices.to_string(), {"@@@"});
|
||||
|
||||
if (!mic_list.empty())
|
||||
{
|
||||
|
|
@ -71,9 +74,13 @@ avconf_manager::avconf_manager()
|
|||
devices[curindex].state = CELL_AUDIO_IN_DEVICE_STATE_AVAILABLE;
|
||||
devices[curindex].deviceId = 0xE11CC0DE + curindex;
|
||||
devices[curindex].type = 0xC0DEE11C;
|
||||
devices[curindex].availableModes[0].type = CELL_AUDIO_IN_CODING_TYPE_LPCM;
|
||||
devices[curindex].availableModes[0].type =
|
||||
CELL_AUDIO_IN_CODING_TYPE_LPCM;
|
||||
devices[curindex].availableModes[0].channel = CELL_AUDIO_IN_CHNUM_2;
|
||||
devices[curindex].availableModes[0].fs = CELL_AUDIO_IN_FS_8KHZ | CELL_AUDIO_IN_FS_12KHZ | CELL_AUDIO_IN_FS_16KHZ | CELL_AUDIO_IN_FS_24KHZ | CELL_AUDIO_IN_FS_32KHZ | CELL_AUDIO_IN_FS_48KHZ;
|
||||
devices[curindex].availableModes[0].fs =
|
||||
CELL_AUDIO_IN_FS_8KHZ | CELL_AUDIO_IN_FS_12KHZ |
|
||||
CELL_AUDIO_IN_FS_16KHZ | CELL_AUDIO_IN_FS_24KHZ |
|
||||
CELL_AUDIO_IN_FS_32KHZ | CELL_AUDIO_IN_FS_48KHZ;
|
||||
devices[curindex].deviceNumber = curindex;
|
||||
strcpy_trunc(devices[curindex].name, mic_list[index]);
|
||||
|
||||
|
|
@ -92,7 +99,10 @@ avconf_manager::avconf_manager()
|
|||
devices[curindex].type = 0x14150000;
|
||||
devices[curindex].availableModes[0].type = CELL_AUDIO_IN_CODING_TYPE_LPCM;
|
||||
devices[curindex].availableModes[0].channel = CELL_AUDIO_IN_CHNUM_2;
|
||||
devices[curindex].availableModes[0].fs = CELL_AUDIO_IN_FS_8KHZ | CELL_AUDIO_IN_FS_12KHZ | CELL_AUDIO_IN_FS_16KHZ | CELL_AUDIO_IN_FS_24KHZ | CELL_AUDIO_IN_FS_32KHZ | CELL_AUDIO_IN_FS_48KHZ;
|
||||
devices[curindex].availableModes[0].fs =
|
||||
CELL_AUDIO_IN_FS_8KHZ | CELL_AUDIO_IN_FS_12KHZ |
|
||||
CELL_AUDIO_IN_FS_16KHZ | CELL_AUDIO_IN_FS_24KHZ |
|
||||
CELL_AUDIO_IN_FS_32KHZ | CELL_AUDIO_IN_FS_48KHZ;
|
||||
devices[curindex].deviceNumber = curindex;
|
||||
strcpy_trunc(devices[curindex].name, mic_list[0]);
|
||||
|
||||
|
|
@ -104,18 +114,23 @@ avconf_manager::avconf_manager()
|
|||
devices[curindex].portType = CELL_AUDIO_IN_PORT_USB;
|
||||
devices[curindex].availableModeCount = 1;
|
||||
devices[curindex].state = CELL_AUDIO_IN_DEVICE_STATE_AVAILABLE;
|
||||
devices[curindex].deviceId = 0x12BA00FF; // Specific to rocksmith usb input
|
||||
devices[curindex].deviceId =
|
||||
0x12BA00FF; // Specific to rocksmith usb input
|
||||
devices[curindex].type = 0xC0DE73C4;
|
||||
devices[curindex].availableModes[0].type = CELL_AUDIO_IN_CODING_TYPE_LPCM;
|
||||
devices[curindex].availableModes[0].channel = CELL_AUDIO_IN_CHNUM_1;
|
||||
devices[curindex].availableModes[0].fs = CELL_AUDIO_IN_FS_8KHZ | CELL_AUDIO_IN_FS_12KHZ | CELL_AUDIO_IN_FS_16KHZ | CELL_AUDIO_IN_FS_24KHZ | CELL_AUDIO_IN_FS_32KHZ | CELL_AUDIO_IN_FS_48KHZ;
|
||||
devices[curindex].availableModes[0].fs =
|
||||
CELL_AUDIO_IN_FS_8KHZ | CELL_AUDIO_IN_FS_12KHZ |
|
||||
CELL_AUDIO_IN_FS_16KHZ | CELL_AUDIO_IN_FS_24KHZ |
|
||||
CELL_AUDIO_IN_FS_32KHZ | CELL_AUDIO_IN_FS_48KHZ;
|
||||
devices[curindex].deviceNumber = curindex;
|
||||
strcpy_trunc(devices[curindex].name, mic_list[0]);
|
||||
|
||||
curindex++;
|
||||
break;
|
||||
case microphone_handler::null:
|
||||
default: break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -130,7 +145,10 @@ avconf_manager::avconf_manager()
|
|||
devices[curindex].type = 0xBEEFDEAD;
|
||||
devices[curindex].availableModes[0].type = CELL_AUDIO_IN_CODING_TYPE_LPCM;
|
||||
devices[curindex].availableModes[0].channel = CELL_AUDIO_IN_CHNUM_NONE;
|
||||
devices[curindex].availableModes[0].fs = CELL_AUDIO_IN_FS_8KHZ | CELL_AUDIO_IN_FS_12KHZ | CELL_AUDIO_IN_FS_16KHZ | CELL_AUDIO_IN_FS_24KHZ | CELL_AUDIO_IN_FS_32KHZ | CELL_AUDIO_IN_FS_48KHZ;
|
||||
devices[curindex].availableModes[0].fs =
|
||||
CELL_AUDIO_IN_FS_8KHZ | CELL_AUDIO_IN_FS_12KHZ |
|
||||
CELL_AUDIO_IN_FS_16KHZ | CELL_AUDIO_IN_FS_24KHZ |
|
||||
CELL_AUDIO_IN_FS_32KHZ | CELL_AUDIO_IN_FS_48KHZ;
|
||||
devices[curindex].deviceNumber = curindex;
|
||||
strcpy_trunc(devices[curindex].name, "USB Camera");
|
||||
|
||||
|
|
@ -138,14 +156,16 @@ avconf_manager::avconf_manager()
|
|||
}
|
||||
}
|
||||
|
||||
void avconf_manager::copy_device_info(u32 num, vm::ptr<CellAudioInDeviceInfo> info) const
|
||||
void avconf_manager::copy_device_info(
|
||||
u32 num, vm::ptr<CellAudioInDeviceInfo> info) const
|
||||
{
|
||||
memset(info.get_ptr(), 0, sizeof(CellAudioInDeviceInfo));
|
||||
ensure(num < devices.size());
|
||||
*info = devices[num];
|
||||
}
|
||||
|
||||
std::optional<CellAudioInDeviceInfo> avconf_manager::get_device_info(vm::cptr<char> name) const
|
||||
std::optional<CellAudioInDeviceInfo>
|
||||
avconf_manager::get_device_info(vm::cptr<char> name) const
|
||||
{
|
||||
for (const CellAudioInDeviceInfo& device : devices)
|
||||
{
|
||||
|
|
@ -160,13 +180,17 @@ std::optional<CellAudioInDeviceInfo> avconf_manager::get_device_info(vm::cptr<ch
|
|||
|
||||
error_code cellAudioOutUnregisterDevice(u32 deviceNumber)
|
||||
{
|
||||
cellAvconfExt.todo("cellAudioOutUnregisterDevice(deviceNumber=0x%x)", deviceNumber);
|
||||
cellAvconfExt.todo("cellAudioOutUnregisterDevice(deviceNumber=0x%x)",
|
||||
deviceNumber);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellAudioOutGetDeviceInfo2(u32 deviceNumber, u32 deviceIndex, vm::ptr<CellAudioOutDeviceInfo2> info)
|
||||
error_code cellAudioOutGetDeviceInfo2(u32 deviceNumber, u32 deviceIndex,
|
||||
vm::ptr<CellAudioOutDeviceInfo2> info)
|
||||
{
|
||||
cellAvconfExt.todo("cellAudioOutGetDeviceInfo2(deviceNumber=0x%x, deviceIndex=0x%x, info=*0x%x)", deviceNumber, deviceIndex, info);
|
||||
cellAvconfExt.todo("cellAudioOutGetDeviceInfo2(deviceNumber=0x%x, "
|
||||
"deviceIndex=0x%x, info=*0x%x)",
|
||||
deviceNumber, deviceIndex, info);
|
||||
|
||||
if (deviceIndex != 0 || !info)
|
||||
{
|
||||
|
|
@ -178,7 +202,8 @@ error_code cellAudioOutGetDeviceInfo2(u32 deviceNumber, u32 deviceIndex, vm::ptr
|
|||
|
||||
error_code cellVideoOutSetXVColor(u32 unk1, u32 unk2, u32 unk3)
|
||||
{
|
||||
cellAvconfExt.todo("cellVideoOutSetXVColor(unk1=0x%x, unk2=0x%x, unk3=0x%x)", unk1, unk2, unk3);
|
||||
cellAvconfExt.todo("cellVideoOutSetXVColor(unk1=0x%x, unk2=0x%x, unk3=0x%x)",
|
||||
unk1, unk2, unk3);
|
||||
|
||||
if (unk1 != 0)
|
||||
{
|
||||
|
|
@ -200,9 +225,12 @@ error_code cellVideoOutSetupDisplay(u32 videoOut)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellAudioInGetDeviceInfo(u32 deviceNumber, u32 deviceIndex, vm::ptr<CellAudioInDeviceInfo> info)
|
||||
error_code cellAudioInGetDeviceInfo(u32 deviceNumber, u32 deviceIndex,
|
||||
vm::ptr<CellAudioInDeviceInfo> info)
|
||||
{
|
||||
cellAvconfExt.trace("cellAudioInGetDeviceInfo(deviceNumber=0x%x, deviceIndex=0x%x, info=*0x%x)", deviceNumber, deviceIndex, info);
|
||||
cellAvconfExt.trace("cellAudioInGetDeviceInfo(deviceNumber=0x%x, "
|
||||
"deviceIndex=0x%x, info=*0x%x)",
|
||||
deviceNumber, deviceIndex, info);
|
||||
|
||||
if (deviceIndex != 0 || !info)
|
||||
{
|
||||
|
|
@ -220,22 +248,33 @@ error_code cellAudioInGetDeviceInfo(u32 deviceNumber, u32 deviceIndex, vm::ptr<C
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellVideoOutConvertCursorColor(u32 videoOut, s32 displaybuffer_format, f32 gamma, s32 source_buffer_format, vm::ptr<void> src_addr, vm::ptr<u32> dest_addr, s32 num)
|
||||
error_code cellVideoOutConvertCursorColor(u32 videoOut,
|
||||
s32 displaybuffer_format, f32 gamma,
|
||||
s32 source_buffer_format,
|
||||
vm::ptr<void> src_addr,
|
||||
vm::ptr<u32> dest_addr, s32 num)
|
||||
{
|
||||
cellAvconfExt.todo("cellVideoOutConvertCursorColor(videoOut=%d, displaybuffer_format=0x%x, gamma=0x%x, source_buffer_format=0x%x, src_addr=*0x%x, dest_addr=*0x%x, num=0x%x)", videoOut,
|
||||
displaybuffer_format, gamma, source_buffer_format, src_addr, dest_addr, num);
|
||||
cellAvconfExt.todo(
|
||||
"cellVideoOutConvertCursorColor(videoOut=%d, displaybuffer_format=0x%x, "
|
||||
"gamma=0x%x, source_buffer_format=0x%x, src_addr=*0x%x, dest_addr=*0x%x, "
|
||||
"num=0x%x)",
|
||||
videoOut, displaybuffer_format, gamma, source_buffer_format, src_addr,
|
||||
dest_addr, num);
|
||||
|
||||
if (!dest_addr || num == 0)
|
||||
{
|
||||
return CELL_VIDEO_OUT_ERROR_ILLEGAL_PARAMETER;
|
||||
}
|
||||
|
||||
if (displaybuffer_format > CELL_VIDEO_OUT_BUFFER_COLOR_FORMAT_R16G16B16X16_FLOAT || src_addr)
|
||||
if (displaybuffer_format >
|
||||
CELL_VIDEO_OUT_BUFFER_COLOR_FORMAT_R16G16B16X16_FLOAT ||
|
||||
src_addr)
|
||||
{
|
||||
return CELL_VIDEO_OUT_ERROR_PARAMETER_OUT_OF_RANGE;
|
||||
}
|
||||
|
||||
if (displaybuffer_format < CELL_VIDEO_OUT_BUFFER_COLOR_FORMAT_R16G16B16X16_FLOAT)
|
||||
if (displaybuffer_format <
|
||||
CELL_VIDEO_OUT_BUFFER_COLOR_FORMAT_R16G16B16X16_FLOAT)
|
||||
{
|
||||
if (gamma < 0.8f || gamma > 1.2f)
|
||||
{
|
||||
|
|
@ -243,10 +282,12 @@ error_code cellVideoOutConvertCursorColor(u32 videoOut, s32 displaybuffer_format
|
|||
}
|
||||
}
|
||||
|
||||
error_code cellVideoOutGetConvertCursorColorInfo(vm::ptr<u8> rgbOutputRange); // Forward declaration
|
||||
error_code cellVideoOutGetConvertCursorColorInfo(
|
||||
vm::ptr<u8> rgbOutputRange); // Forward declaration
|
||||
|
||||
vm::var<u8> rgbOutputRange;
|
||||
if (error_code error = cellVideoOutGetConvertCursorColorInfo(rgbOutputRange))
|
||||
if (error_code error =
|
||||
cellVideoOutGetConvertCursorColorInfo(rgbOutputRange))
|
||||
{
|
||||
return error;
|
||||
}
|
||||
|
|
@ -256,7 +297,8 @@ error_code cellVideoOutConvertCursorColor(u32 videoOut, s32 displaybuffer_format
|
|||
|
||||
error_code cellVideoOutGetGamma(u32 videoOut, vm::ptr<f32> gamma)
|
||||
{
|
||||
cellAvconfExt.warning("cellVideoOutGetGamma(videoOut=%d, gamma=*0x%x)", videoOut, gamma);
|
||||
cellAvconfExt.warning("cellVideoOutGetGamma(videoOut=%d, gamma=*0x%x)",
|
||||
videoOut, gamma);
|
||||
|
||||
if (!gamma)
|
||||
{
|
||||
|
|
@ -275,9 +317,12 @@ error_code cellVideoOutGetGamma(u32 videoOut, vm::ptr<f32> gamma)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellAudioInGetAvailableDeviceInfo(u32 count, vm::ptr<CellAudioInDeviceInfo> device_info)
|
||||
error_code
|
||||
cellAudioInGetAvailableDeviceInfo(u32 count,
|
||||
vm::ptr<CellAudioInDeviceInfo> device_info)
|
||||
{
|
||||
cellAvconfExt.trace("cellAudioInGetAvailableDeviceInfo(count=%d, info=*0x%x)", count, device_info);
|
||||
cellAvconfExt.trace("cellAudioInGetAvailableDeviceInfo(count=%d, info=*0x%x)",
|
||||
count, device_info);
|
||||
|
||||
if (count > 16 || !device_info)
|
||||
{
|
||||
|
|
@ -306,9 +351,13 @@ error_code cellAudioInGetAvailableDeviceInfo(u32 count, vm::ptr<CellAudioInDevic
|
|||
return not_an_error(num_devices_returned);
|
||||
}
|
||||
|
||||
error_code cellAudioOutGetAvailableDeviceInfo(u32 count, vm::ptr<CellAudioOutDeviceInfo2> info)
|
||||
error_code
|
||||
cellAudioOutGetAvailableDeviceInfo(u32 count,
|
||||
vm::ptr<CellAudioOutDeviceInfo2> info)
|
||||
{
|
||||
cellAvconfExt.todo("cellAudioOutGetAvailableDeviceInfo(count=0x%x, info=*0x%x)", count, info);
|
||||
cellAvconfExt.todo(
|
||||
"cellAudioOutGetAvailableDeviceInfo(count=0x%x, info=*0x%x)", count,
|
||||
info);
|
||||
|
||||
if (count > 16 || !info)
|
||||
{
|
||||
|
|
@ -320,7 +369,8 @@ error_code cellAudioOutGetAvailableDeviceInfo(u32 count, vm::ptr<CellAudioOutDev
|
|||
|
||||
error_code cellVideoOutSetGamma(u32 videoOut, f32 gamma)
|
||||
{
|
||||
cellAvconfExt.trace("cellVideoOutSetGamma(videoOut=%d, gamma=%f)", videoOut, gamma);
|
||||
cellAvconfExt.trace("cellVideoOutSetGamma(videoOut=%d, gamma=%f)", videoOut,
|
||||
gamma);
|
||||
|
||||
if (gamma < 0.8f || gamma > 1.2f)
|
||||
{
|
||||
|
|
@ -338,9 +388,14 @@ error_code cellVideoOutSetGamma(u32 videoOut, f32 gamma)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellAudioOutRegisterDevice(u64 deviceType, vm::cptr<char> name, vm::ptr<CellAudioOutRegistrationOption> option, vm::ptr<CellAudioOutDeviceConfiguration> config)
|
||||
error_code
|
||||
cellAudioOutRegisterDevice(u64 deviceType, vm::cptr<char> name,
|
||||
vm::ptr<CellAudioOutRegistrationOption> option,
|
||||
vm::ptr<CellAudioOutDeviceConfiguration> config)
|
||||
{
|
||||
cellAvconfExt.todo("cellAudioOutRegisterDevice(deviceType=0x%llx, name=%s, option=*0x%x, config=*0x%x)", deviceType, name, option, config);
|
||||
cellAvconfExt.todo("cellAudioOutRegisterDevice(deviceType=0x%llx, name=%s, "
|
||||
"option=*0x%x, config=*0x%x)",
|
||||
deviceType, name, option, config);
|
||||
|
||||
if (option || !name)
|
||||
{
|
||||
|
|
@ -385,11 +440,17 @@ error_code cellAudioInSetDeviceMode(u32 deviceMode)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellAudioInRegisterDevice(u64 deviceType, vm::cptr<char> name, vm::ptr<CellAudioInRegistrationOption> option, vm::ptr<CellAudioInDeviceConfiguration> config)
|
||||
error_code
|
||||
cellAudioInRegisterDevice(u64 deviceType, vm::cptr<char> name,
|
||||
vm::ptr<CellAudioInRegistrationOption> option,
|
||||
vm::ptr<CellAudioInDeviceConfiguration> config)
|
||||
{
|
||||
cellAvconfExt.todo("cellAudioInRegisterDevice(deviceType=0x%llx, name=%s, option=*0x%x, config=*0x%x)", deviceType, name, option, config);
|
||||
cellAvconfExt.todo("cellAudioInRegisterDevice(deviceType=0x%llx, name=%s, "
|
||||
"option=*0x%x, config=*0x%x)",
|
||||
deviceType, name, option, config);
|
||||
|
||||
// option must be null, volume can be 1 (soft) to 5 (loud) (raises question about check for volume = 0)
|
||||
// option must be null, volume can be 1 (soft) to 5 (loud) (raises question
|
||||
// about check for volume = 0)
|
||||
if (option || !config || !name || config->volume > 5)
|
||||
{
|
||||
return CELL_AUDIO_IN_ERROR_ILLEGAL_PARAMETER;
|
||||
|
|
@ -414,7 +475,8 @@ error_code cellAudioInRegisterDevice(u64 deviceType, vm::cptr<char> name, vm::pt
|
|||
|
||||
error_code cellAudioInUnregisterDevice(u32 deviceNumber)
|
||||
{
|
||||
cellAvconfExt.todo("cellAudioInUnregisterDevice(deviceNumber=0x%x)", deviceNumber);
|
||||
cellAvconfExt.todo("cellAudioInUnregisterDevice(deviceNumber=0x%x)",
|
||||
deviceNumber);
|
||||
|
||||
auto& mic_thr = g_fxo->get<mic_thread>();
|
||||
const std::lock_guard lock(mic_thr.mutex);
|
||||
|
|
@ -425,7 +487,9 @@ error_code cellAudioInUnregisterDevice(u32 deviceNumber)
|
|||
|
||||
error_code cellVideoOutGetScreenSize(u32 videoOut, vm::ptr<f32> screenSize)
|
||||
{
|
||||
cellAvconfExt.warning("cellVideoOutGetScreenSize(videoOut=%d, screenSize=*0x%x)", videoOut, screenSize);
|
||||
cellAvconfExt.warning(
|
||||
"cellVideoOutGetScreenSize(videoOut=%d, screenSize=*0x%x)", videoOut,
|
||||
screenSize);
|
||||
|
||||
if (!screenSize)
|
||||
{
|
||||
|
|
@ -448,10 +512,13 @@ error_code cellVideoOutGetScreenSize(u32 videoOut, vm::ptr<f32> screenSize)
|
|||
// TODO: Use virtual screen size
|
||||
#ifdef _WIN32
|
||||
// HDC screen = GetDC(NULL);
|
||||
// float diagonal = roundf(sqrtf((powf(float(GetDeviceCaps(screen, HORZSIZE)), 2) + powf(float(GetDeviceCaps(screen, VERTSIZE)), 2))) * 0.0393f);
|
||||
// float diagonal = roundf(sqrtf((powf(float(GetDeviceCaps(screen,
|
||||
// HORZSIZE)), 2) + powf(float(GetDeviceCaps(screen, VERTSIZE)), 2))) *
|
||||
// 0.0393f);
|
||||
#else
|
||||
// TODO: Linux implementation, without using wx
|
||||
// float diagonal = roundf(sqrtf((powf(wxGetDisplaySizeMM().GetWidth(), 2) + powf(wxGetDisplaySizeMM().GetHeight(), 2))) * 0.0393f);
|
||||
// float diagonal = roundf(sqrtf((powf(wxGetDisplaySizeMM().GetWidth(), 2) +
|
||||
// powf(wxGetDisplaySizeMM().GetHeight(), 2))) * 0.0393f);
|
||||
#endif
|
||||
|
||||
return CELL_VIDEO_OUT_ERROR_VALUE_IS_NOT_SET;
|
||||
|
|
@ -459,7 +526,8 @@ error_code cellVideoOutGetScreenSize(u32 videoOut, vm::ptr<f32> screenSize)
|
|||
|
||||
error_code cellVideoOutSetCopyControl(u32 videoOut, u32 control)
|
||||
{
|
||||
cellAvconfExt.todo("cellVideoOutSetCopyControl(videoOut=%d, control=0x%x)", videoOut, control);
|
||||
cellAvconfExt.todo("cellVideoOutSetCopyControl(videoOut=%d, control=0x%x)",
|
||||
videoOut, control);
|
||||
|
||||
if (control > CELL_VIDEO_OUT_COPY_CONTROL_COPY_NEVER)
|
||||
{
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,12 +1,12 @@
|
|||
#include "stdafx.h"
|
||||
#include "Emu/Cell/PPUModule.h"
|
||||
#include "Utilities/LUrlParser.h"
|
||||
#include "stdafx.h"
|
||||
#include "util/LUrlParser.h"
|
||||
|
||||
#include "cellHttpUtil.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <codecvt>
|
||||
#include <windows.h>
|
||||
#ifdef _MSC_VER
|
||||
#pragma comment(lib, "Winhttp.lib")
|
||||
#endif
|
||||
|
|
@ -37,9 +37,13 @@ void fmt_class_string<CellHttpUtilError>::format(std::string& out, u64 arg)
|
|||
});
|
||||
}
|
||||
|
||||
error_code cellHttpUtilParseUri(vm::ptr<CellHttpUri> uri, vm::cptr<char> str, vm::ptr<void> pool, u32 size, vm::ptr<u32> required)
|
||||
error_code cellHttpUtilParseUri(vm::ptr<CellHttpUri> uri, vm::cptr<char> str,
|
||||
vm::ptr<void> pool, u32 size,
|
||||
vm::ptr<u32> required)
|
||||
{
|
||||
cellHttpUtil.trace("cellHttpUtilParseUri(uri=*0x%x, str=%s, pool=*0x%x, size=%d, required=*0x%x)", uri, str, pool, size, required);
|
||||
cellHttpUtil.trace("cellHttpUtilParseUri(uri=*0x%x, str=%s, pool=*0x%x, "
|
||||
"size=%d, required=*0x%x)",
|
||||
uri, str, pool, size, required);
|
||||
|
||||
if (!str)
|
||||
{
|
||||
|
|
@ -78,11 +82,16 @@ error_code cellHttpUtilParseUri(vm::ptr<CellHttpUri> uri, vm::cptr<char> str, vm
|
|||
}
|
||||
else
|
||||
{
|
||||
std::memcpy(vm::base(pool.addr() + schemeOffset), scheme.c_str(), scheme.length() + 1);
|
||||
std::memcpy(vm::base(pool.addr() + hostOffset), host.c_str(), host.length() + 1);
|
||||
std::memcpy(vm::base(pool.addr() + pathOffset), path.c_str(), path.length() + 1);
|
||||
std::memcpy(vm::base(pool.addr() + usernameOffset), username.c_str(), username.length() + 1);
|
||||
std::memcpy(vm::base(pool.addr() + passwordOffset), password.c_str(), password.length() + 1);
|
||||
std::memcpy(vm::base(pool.addr() + schemeOffset), scheme.c_str(),
|
||||
scheme.length() + 1);
|
||||
std::memcpy(vm::base(pool.addr() + hostOffset), host.c_str(),
|
||||
host.length() + 1);
|
||||
std::memcpy(vm::base(pool.addr() + pathOffset), path.c_str(),
|
||||
path.length() + 1);
|
||||
std::memcpy(vm::base(pool.addr() + usernameOffset), username.c_str(),
|
||||
username.length() + 1);
|
||||
std::memcpy(vm::base(pool.addr() + passwordOffset), password.c_str(),
|
||||
password.length() + 1);
|
||||
|
||||
uri->scheme.set(pool.addr() + schemeOffset);
|
||||
uri->hostname.set(pool.addr() + hostOffset);
|
||||
|
|
@ -132,7 +141,8 @@ error_code cellHttpUtilParseUri(vm::ptr<CellHttpUri> uri, vm::cptr<char> str, vm
|
|||
parseError = "Error, URI didn't contain a slash";
|
||||
break;
|
||||
default:
|
||||
parseError = "Error, unknown error #" + std::to_string(static_cast<int>(URL.m_ErrorCode));
|
||||
parseError = "Error, unknown error #" +
|
||||
std::to_string(static_cast<int>(URL.m_ErrorCode));
|
||||
break;
|
||||
}
|
||||
cellHttpUtil.error("%s, while parsing URI, %s.", parseError, str.get_ptr());
|
||||
|
|
@ -140,9 +150,13 @@ error_code cellHttpUtilParseUri(vm::ptr<CellHttpUri> uri, vm::cptr<char> str, vm
|
|||
}
|
||||
}
|
||||
|
||||
error_code cellHttpUtilParseUriPath(vm::ptr<CellHttpUriPath> path, vm::cptr<char> str, vm::ptr<void> pool, u32 size, vm::ptr<u32> required)
|
||||
error_code cellHttpUtilParseUriPath(vm::ptr<CellHttpUriPath> path,
|
||||
vm::cptr<char> str, vm::ptr<void> pool,
|
||||
u32 size, vm::ptr<u32> required)
|
||||
{
|
||||
cellHttpUtil.todo("cellHttpUtilParseUriPath(path=*0x%x, str=%s, pool=*0x%x, size=%d, required=*0x%x)", path, str, pool, size, required);
|
||||
cellHttpUtil.todo("cellHttpUtilParseUriPath(path=*0x%x, str=%s, pool=*0x%x, "
|
||||
"size=%d, required=*0x%x)",
|
||||
path, str, pool, size, required);
|
||||
|
||||
if (!str)
|
||||
{
|
||||
|
|
@ -160,9 +174,13 @@ error_code cellHttpUtilParseUriPath(vm::ptr<CellHttpUriPath> path, vm::cptr<char
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellHttpUtilParseProxy(vm::ptr<CellHttpUri> uri, vm::cptr<char> str, vm::ptr<void> pool, u32 size, vm::ptr<u32> required)
|
||||
error_code cellHttpUtilParseProxy(vm::ptr<CellHttpUri> uri, vm::cptr<char> str,
|
||||
vm::ptr<void> pool, u32 size,
|
||||
vm::ptr<u32> required)
|
||||
{
|
||||
cellHttpUtil.todo("cellHttpUtilParseProxy(uri=*0x%x, str=%s, pool=*0x%x, size=%d, required=*0x%x)", uri, str, pool, size, required);
|
||||
cellHttpUtil.todo("cellHttpUtilParseProxy(uri=*0x%x, str=%s, pool=*0x%x, "
|
||||
"size=%d, required=*0x%x)",
|
||||
uri, str, pool, size, required);
|
||||
|
||||
if (!str)
|
||||
{
|
||||
|
|
@ -180,9 +198,15 @@ error_code cellHttpUtilParseProxy(vm::ptr<CellHttpUri> uri, vm::cptr<char> str,
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellHttpUtilParseStatusLine(vm::ptr<CellHttpStatusLine> resp, vm::cptr<char> str, u32 len, vm::ptr<void> pool, u32 size, vm::ptr<u32> required, vm::ptr<u32> parsedLength)
|
||||
error_code cellHttpUtilParseStatusLine(vm::ptr<CellHttpStatusLine> resp,
|
||||
vm::cptr<char> str, u32 len,
|
||||
vm::ptr<void> pool, u32 size,
|
||||
vm::ptr<u32> required,
|
||||
vm::ptr<u32> parsedLength)
|
||||
{
|
||||
cellHttpUtil.todo("cellHttpUtilParseStatusLine(resp=*0x%x, str=%s, len=%d, pool=*0x%x, size=%d, required=*0x%x, parsedLength=*0x%x)", resp, str, len, pool, size, required, parsedLength);
|
||||
cellHttpUtil.todo("cellHttpUtilParseStatusLine(resp=*0x%x, str=%s, len=%d, "
|
||||
"pool=*0x%x, size=%d, required=*0x%x, parsedLength=*0x%x)",
|
||||
resp, str, len, pool, size, required, parsedLength);
|
||||
|
||||
if (!str)
|
||||
{
|
||||
|
|
@ -200,9 +224,15 @@ error_code cellHttpUtilParseStatusLine(vm::ptr<CellHttpStatusLine> resp, vm::cpt
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellHttpUtilParseHeader(vm::ptr<CellHttpHeader> header, vm::cptr<char> str, u32 len, vm::ptr<void> pool, u32 size, vm::ptr<u32> required, vm::ptr<u32> parsedLength)
|
||||
error_code cellHttpUtilParseHeader(vm::ptr<CellHttpHeader> header,
|
||||
vm::cptr<char> str, u32 len,
|
||||
vm::ptr<void> pool, u32 size,
|
||||
vm::ptr<u32> required,
|
||||
vm::ptr<u32> parsedLength)
|
||||
{
|
||||
cellHttpUtil.todo("cellHttpUtilParseHeader(header=*0x%x, str=%s, len=%d, pool=*0x%x, size=%d, required=*0x%x, parsedLength=*0x%x)", header, str, len, pool, size, required, parsedLength);
|
||||
cellHttpUtil.todo("cellHttpUtilParseHeader(header=*0x%x, str=%s, len=%d, "
|
||||
"pool=*0x%x, size=%d, required=*0x%x, parsedLength=*0x%x)",
|
||||
header, str, len, pool, size, required, parsedLength);
|
||||
|
||||
if (!str)
|
||||
{
|
||||
|
|
@ -220,9 +250,13 @@ error_code cellHttpUtilParseHeader(vm::ptr<CellHttpHeader> header, vm::cptr<char
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellHttpUtilBuildRequestLine(vm::cptr<CellHttpRequestLine> req, vm::ptr<char> buf, u32 len, vm::ptr<u32> required)
|
||||
error_code cellHttpUtilBuildRequestLine(vm::cptr<CellHttpRequestLine> req,
|
||||
vm::ptr<char> buf, u32 len,
|
||||
vm::ptr<u32> required)
|
||||
{
|
||||
cellHttpUtil.notice("cellHttpUtilBuildRequestLine(req=*0x%x, buf=*0x%x, len=%d, required=*0x%x)", req, buf, len, required);
|
||||
cellHttpUtil.notice("cellHttpUtilBuildRequestLine(req=*0x%x, buf=*0x%x, "
|
||||
"len=%d, required=*0x%x)",
|
||||
req, buf, len, required);
|
||||
|
||||
if (!req || !req->method || !req->path || !req->protocol)
|
||||
{
|
||||
|
|
@ -236,7 +270,9 @@ error_code cellHttpUtilBuildRequestLine(vm::cptr<CellHttpRequestLine> req, vm::p
|
|||
}
|
||||
|
||||
// TODO: are the numbers properly formatted ?
|
||||
const std::string result = fmt::format("%s %s %s/%d.%d\r\n", req->method, path, req->protocol, req->majorVersion, req->minorVersion);
|
||||
const std::string result =
|
||||
fmt::format("%s %s %s/%d.%d\r\n", req->method, path, req->protocol,
|
||||
req->majorVersion, req->minorVersion);
|
||||
|
||||
if (buf)
|
||||
{
|
||||
|
|
@ -256,16 +292,21 @@ error_code cellHttpUtilBuildRequestLine(vm::cptr<CellHttpRequestLine> req, vm::p
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellHttpUtilBuildHeader(vm::cptr<CellHttpHeader> header, vm::ptr<char> buf, u32 len, vm::ptr<u32> required)
|
||||
error_code cellHttpUtilBuildHeader(vm::cptr<CellHttpHeader> header,
|
||||
vm::ptr<char> buf, u32 len,
|
||||
vm::ptr<u32> required)
|
||||
{
|
||||
cellHttpUtil.notice("cellHttpUtilBuildHeader(header=*0x%x, buf=*0x%x, len=%d, required=*0x%x)", header, buf, len, required);
|
||||
cellHttpUtil.notice("cellHttpUtilBuildHeader(header=*0x%x, buf=*0x%x, "
|
||||
"len=%d, required=*0x%x)",
|
||||
header, buf, len, required);
|
||||
|
||||
if (!header || !header->name)
|
||||
{
|
||||
return CELL_HTTP_UTIL_ERROR_INVALID_HEADER;
|
||||
}
|
||||
|
||||
const std::string result = fmt::format("%s: %s\r\n", header->name, header->value);
|
||||
const std::string result =
|
||||
fmt::format("%s: %s\r\n", header->name, header->value);
|
||||
|
||||
if (buf)
|
||||
{
|
||||
|
|
@ -285,9 +326,12 @@ error_code cellHttpUtilBuildHeader(vm::cptr<CellHttpHeader> header, vm::ptr<char
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellHttpUtilBuildUri(vm::cptr<CellHttpUri> uri, vm::ptr<char> buf, u32 len, vm::ptr<u32> required, s32 flags)
|
||||
error_code cellHttpUtilBuildUri(vm::cptr<CellHttpUri> uri, vm::ptr<char> buf,
|
||||
u32 len, vm::ptr<u32> required, s32 flags)
|
||||
{
|
||||
cellHttpUtil.todo("cellHttpUtilBuildUri(uri=*0x%x, buf=*0x%x, len=%d, required=*0x%x, flags=%d)", uri, buf, len, required, flags);
|
||||
cellHttpUtil.todo("cellHttpUtilBuildUri(uri=*0x%x, buf=*0x%x, len=%d, "
|
||||
"required=*0x%x, flags=%d)",
|
||||
uri, buf, len, required, flags);
|
||||
|
||||
if (!uri || !uri->hostname)
|
||||
{
|
||||
|
|
@ -314,11 +358,13 @@ error_code cellHttpUtilBuildUri(vm::cptr<CellHttpUri> uri, vm::ptr<char> buf, u3
|
|||
fmt::append(result, "://");
|
||||
}
|
||||
|
||||
if (!(flags & CELL_HTTP_UTIL_URI_FLAG_NO_CREDENTIALS) && uri->username && uri->username[0])
|
||||
if (!(flags & CELL_HTTP_UTIL_URI_FLAG_NO_CREDENTIALS) && uri->username &&
|
||||
uri->username[0])
|
||||
{
|
||||
fmt::append(result, "%s", uri->username);
|
||||
|
||||
if (!(flags & CELL_HTTP_UTIL_URI_FLAG_NO_PASSWORD) && uri->password && uri->password[0])
|
||||
if (!(flags & CELL_HTTP_UTIL_URI_FLAG_NO_PASSWORD) && uri->password &&
|
||||
uri->password[0])
|
||||
{
|
||||
fmt::append(result, ":%s", uri->password);
|
||||
}
|
||||
|
|
@ -358,9 +404,13 @@ error_code cellHttpUtilBuildUri(vm::cptr<CellHttpUri> uri, vm::ptr<char> buf, u3
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellHttpUtilCopyUri(vm::ptr<CellHttpUri> dest, vm::cptr<CellHttpUri> src, vm::ptr<void> pool, u32 poolSize, vm::ptr<u32> required)
|
||||
error_code cellHttpUtilCopyUri(vm::ptr<CellHttpUri> dest,
|
||||
vm::cptr<CellHttpUri> src, vm::ptr<void> pool,
|
||||
u32 poolSize, vm::ptr<u32> required)
|
||||
{
|
||||
cellHttpUtil.todo("cellHttpUtilCopyUri(dest=*0x%x, src=*0x%x, pool=*0x%x, poolSize=%d, required=*0x%x)", dest, src, pool, poolSize, required);
|
||||
cellHttpUtil.todo("cellHttpUtilCopyUri(dest=*0x%x, src=*0x%x, pool=*0x%x, "
|
||||
"poolSize=%d, required=*0x%x)",
|
||||
dest, src, pool, poolSize, required);
|
||||
|
||||
if (!src)
|
||||
{
|
||||
|
|
@ -378,9 +428,14 @@ error_code cellHttpUtilCopyUri(vm::ptr<CellHttpUri> dest, vm::cptr<CellHttpUri>
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellHttpUtilMergeUriPath(vm::ptr<CellHttpUri> uri, vm::cptr<CellHttpUri> src, vm::cptr<char> path, vm::ptr<void> pool, u32 poolSize, vm::ptr<u32> required)
|
||||
error_code cellHttpUtilMergeUriPath(vm::ptr<CellHttpUri> uri,
|
||||
vm::cptr<CellHttpUri> src,
|
||||
vm::cptr<char> path, vm::ptr<void> pool,
|
||||
u32 poolSize, vm::ptr<u32> required)
|
||||
{
|
||||
cellHttpUtil.todo("cellHttpUtilMergeUriPath(uri=*0x%x, src=*0x%x, path=%s, pool=*0x%x, poolSize=%d, required=*0x%x)", uri, src, path, pool, poolSize, required);
|
||||
cellHttpUtil.todo("cellHttpUtilMergeUriPath(uri=*0x%x, src=*0x%x, path=%s, "
|
||||
"pool=*0x%x, poolSize=%d, required=*0x%x)",
|
||||
uri, src, path, pool, poolSize, required);
|
||||
|
||||
if (!path)
|
||||
{
|
||||
|
|
@ -403,9 +458,11 @@ error_code cellHttpUtilMergeUriPath(vm::ptr<CellHttpUri> uri, vm::cptr<CellHttpU
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellHttpUtilSweepPath(vm::ptr<char> dst, vm::cptr<char> src, u32 srcSize)
|
||||
error_code cellHttpUtilSweepPath(vm::ptr<char> dst, vm::cptr<char> src,
|
||||
u32 srcSize)
|
||||
{
|
||||
cellHttpUtil.todo("cellHttpUtilSweepPath(dst=*0x%x, src=%s, srcSize=%d)", dst, src, srcSize);
|
||||
cellHttpUtil.todo("cellHttpUtilSweepPath(dst=*0x%x, src=%s, srcSize=%d)", dst,
|
||||
src, srcSize);
|
||||
|
||||
if (!dst || !src)
|
||||
{
|
||||
|
|
@ -431,9 +488,14 @@ error_code cellHttpUtilSweepPath(vm::ptr<char> dst, vm::cptr<char> src, u32 srcS
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellHttpUtilCopyStatusLine(vm::ptr<CellHttpStatusLine> dest, vm::cptr<CellHttpStatusLine> src, vm::ptr<void> pool, u32 poolSize, vm::ptr<u32> required)
|
||||
error_code cellHttpUtilCopyStatusLine(vm::ptr<CellHttpStatusLine> dest,
|
||||
vm::cptr<CellHttpStatusLine> src,
|
||||
vm::ptr<void> pool, u32 poolSize,
|
||||
vm::ptr<u32> required)
|
||||
{
|
||||
cellHttpUtil.todo("cellHttpUtilCopyStatusLine(dest=*0x%x, src=*0x%x, pool=*0x%x, poolSize=%d, required=*0x%x)", dest, src, pool, poolSize, required);
|
||||
cellHttpUtil.todo("cellHttpUtilCopyStatusLine(dest=*0x%x, src=*0x%x, "
|
||||
"pool=*0x%x, poolSize=%d, required=*0x%x)",
|
||||
dest, src, pool, poolSize, required);
|
||||
|
||||
if (!src)
|
||||
{
|
||||
|
|
@ -451,9 +513,14 @@ error_code cellHttpUtilCopyStatusLine(vm::ptr<CellHttpStatusLine> dest, vm::cptr
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellHttpUtilCopyHeader(vm::ptr<CellHttpHeader> dest, vm::cptr<CellHttpHeader> src, vm::ptr<void> pool, u32 poolSize, vm::ptr<u32> required)
|
||||
error_code cellHttpUtilCopyHeader(vm::ptr<CellHttpHeader> dest,
|
||||
vm::cptr<CellHttpHeader> src,
|
||||
vm::ptr<void> pool, u32 poolSize,
|
||||
vm::ptr<u32> required)
|
||||
{
|
||||
cellHttpUtil.todo("cellHttpUtilCopyHeader(dest=*0x%x, src=*0x%x, pool=*0x%x, poolSize=%d, required=*0x%x)", dest, src, pool, poolSize, required);
|
||||
cellHttpUtil.todo("cellHttpUtilCopyHeader(dest=*0x%x, src=*0x%x, pool=*0x%x, "
|
||||
"poolSize=%d, required=*0x%x)",
|
||||
dest, src, pool, poolSize, required);
|
||||
|
||||
if (!src)
|
||||
{
|
||||
|
|
@ -471,9 +538,15 @@ error_code cellHttpUtilCopyHeader(vm::ptr<CellHttpHeader> dest, vm::cptr<CellHtt
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellHttpUtilAppendHeaderValue(vm::ptr<CellHttpHeader> dest, vm::cptr<CellHttpHeader> src, vm::cptr<char> value, vm::ptr<void> pool, u32 poolSize, vm::ptr<u32> required)
|
||||
error_code cellHttpUtilAppendHeaderValue(vm::ptr<CellHttpHeader> dest,
|
||||
vm::cptr<CellHttpHeader> src,
|
||||
vm::cptr<char> value,
|
||||
vm::ptr<void> pool, u32 poolSize,
|
||||
vm::ptr<u32> required)
|
||||
{
|
||||
cellHttpUtil.todo("cellHttpUtilAppendHeaderValue(dest=*0x%x, src=*0x%x, value=%s, pool=*0x%x, poolSize=%d, required=*0x%x)", dest, src, value, pool, poolSize, required);
|
||||
cellHttpUtil.todo("cellHttpUtilAppendHeaderValue(dest=*0x%x, src=*0x%x, "
|
||||
"value=%s, pool=*0x%x, poolSize=%d, required=*0x%x)",
|
||||
dest, src, value, pool, poolSize, required);
|
||||
|
||||
if (!src)
|
||||
{
|
||||
|
|
@ -491,9 +564,13 @@ error_code cellHttpUtilAppendHeaderValue(vm::ptr<CellHttpHeader> dest, vm::cptr<
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellHttpUtilEscapeUri(vm::ptr<char> out, u32 outSize, vm::cptr<u8> in, u32 inSize, vm::ptr<u32> required)
|
||||
error_code cellHttpUtilEscapeUri(vm::ptr<char> out, u32 outSize,
|
||||
vm::cptr<u8> in, u32 inSize,
|
||||
vm::ptr<u32> required)
|
||||
{
|
||||
cellHttpUtil.todo("cellHttpUtilEscapeUri(out=*0x%x, outSize=%d, in=*0x%x, inSize=%d, required=*0x%x)", out, outSize, in, inSize, required);
|
||||
cellHttpUtil.todo("cellHttpUtilEscapeUri(out=*0x%x, outSize=%d, in=*0x%x, "
|
||||
"inSize=%d, required=*0x%x)",
|
||||
out, outSize, in, inSize, required);
|
||||
|
||||
if (!in || !inSize)
|
||||
{
|
||||
|
|
@ -571,9 +648,12 @@ error_code cellHttpUtilEscapeUri(vm::ptr<char> out, u32 outSize, vm::cptr<u8> in
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellHttpUtilUnescapeUri(vm::ptr<u8> out, u32 size, vm::cptr<char> in, vm::ptr<u32> required)
|
||||
error_code cellHttpUtilUnescapeUri(vm::ptr<u8> out, u32 size, vm::cptr<char> in,
|
||||
vm::ptr<u32> required)
|
||||
{
|
||||
cellHttpUtil.todo("cellHttpUtilUnescapeUri(out=*0x%x, size=%d, in=*0x%x, required=*0x%x)", out, size, in, required);
|
||||
cellHttpUtil.todo(
|
||||
"cellHttpUtilUnescapeUri(out=*0x%x, size=%d, in=*0x%x, required=*0x%x)",
|
||||
out, size, in, required);
|
||||
|
||||
if (!in)
|
||||
{
|
||||
|
|
@ -593,9 +673,13 @@ error_code cellHttpUtilUnescapeUri(vm::ptr<u8> out, u32 size, vm::cptr<char> in,
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellHttpUtilFormUrlEncode(vm::ptr<char> out, u32 outSize, vm::cptr<u8> in, u32 inSize, vm::ptr<u32> required)
|
||||
error_code cellHttpUtilFormUrlEncode(vm::ptr<char> out, u32 outSize,
|
||||
vm::cptr<u8> in, u32 inSize,
|
||||
vm::ptr<u32> required)
|
||||
{
|
||||
cellHttpUtil.todo("cellHttpUtilFormUrlEncode(out=*0x%x, outSize=%d, in=*0x%x, inSize=%d, required=*0x%x)", out, outSize, in, inSize, required);
|
||||
cellHttpUtil.todo("cellHttpUtilFormUrlEncode(out=*0x%x, outSize=%d, "
|
||||
"in=*0x%x, inSize=%d, required=*0x%x)",
|
||||
out, outSize, in, inSize, required);
|
||||
|
||||
if (!in || !inSize)
|
||||
{
|
||||
|
|
@ -687,9 +771,12 @@ error_code cellHttpUtilFormUrlEncode(vm::ptr<char> out, u32 outSize, vm::cptr<u8
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellHttpUtilFormUrlDecode(vm::ptr<u8> out, u32 size, vm::cptr<char> in, vm::ptr<u32> required)
|
||||
error_code cellHttpUtilFormUrlDecode(vm::ptr<u8> out, u32 size,
|
||||
vm::cptr<char> in, vm::ptr<u32> required)
|
||||
{
|
||||
cellHttpUtil.todo("cellHttpUtilFormUrlDecode(out=*0x%x, size=%d, in=%s, required=*0x%x)", out, size, in, required);
|
||||
cellHttpUtil.todo(
|
||||
"cellHttpUtilFormUrlDecode(out=*0x%x, size=%d, in=%s, required=*0x%x)",
|
||||
out, size, in, required);
|
||||
|
||||
if (!in)
|
||||
{
|
||||
|
|
@ -758,7 +845,8 @@ error_code cellHttpUtilFormUrlDecode(vm::ptr<u8> out, u32 size, vm::cptr<char> i
|
|||
|
||||
if (out)
|
||||
{
|
||||
out[out_pos++] = static_cast<char>((tmp1 & 0xffffffff) << 4) + static_cast<char>(tmp2);
|
||||
out[out_pos++] = static_cast<char>((tmp1 & 0xffffffff) << 4) +
|
||||
static_cast<char>(tmp2);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -788,9 +876,11 @@ error_code cellHttpUtilFormUrlDecode(vm::ptr<u8> out, u32 size, vm::cptr<char> i
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellHttpUtilBase64Encoder(vm::ptr<char> out, vm::cptr<void> input, u32 len)
|
||||
error_code cellHttpUtilBase64Encoder(vm::ptr<char> out, vm::cptr<void> input,
|
||||
u32 len)
|
||||
{
|
||||
cellHttpUtil.todo("cellHttpUtilBase64Encoder(out=*0x%x, input=*0x%x, len=%d)", out, input, len);
|
||||
cellHttpUtil.todo("cellHttpUtilBase64Encoder(out=*0x%x, input=*0x%x, len=%d)",
|
||||
out, input, len);
|
||||
|
||||
if (!input || !len)
|
||||
{
|
||||
|
|
@ -805,9 +895,11 @@ error_code cellHttpUtilBase64Encoder(vm::ptr<char> out, vm::cptr<void> input, u3
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellHttpUtilBase64Decoder(vm::ptr<char> output, vm::cptr<void> in, u32 len)
|
||||
error_code cellHttpUtilBase64Decoder(vm::ptr<char> output, vm::cptr<void> in,
|
||||
u32 len)
|
||||
{
|
||||
cellHttpUtil.todo("cellHttpUtilBase64Decoder(output=*0x%x, in=*0x%x, len=%d)", output, in, len);
|
||||
cellHttpUtil.todo("cellHttpUtilBase64Decoder(output=*0x%x, in=*0x%x, len=%d)",
|
||||
output, in, len);
|
||||
|
||||
if (!in)
|
||||
{
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
#include "stdafx.h"
|
||||
#include "Emu/system_config.h"
|
||||
#include "Emu/Cell/PPUModule.h"
|
||||
#include "Utilities/StrUtil.h"
|
||||
#include "Emu/system_config.h"
|
||||
#include "stdafx.h"
|
||||
#include "util/StrUtil.h"
|
||||
|
||||
#include "cellMic.h"
|
||||
#include <Emu/IdManager.h>
|
||||
#include <Emu/Cell/lv2/sys_event.h>
|
||||
#include <Emu/IdManager.h>
|
||||
|
||||
#include <numeric>
|
||||
#include <cmath>
|
||||
#include <numeric>
|
||||
|
||||
#ifndef WITHOUT_OPENAL
|
||||
#include "3rdparty/OpenAL/openal-soft/include/AL/alext.h"
|
||||
|
|
@ -110,7 +110,9 @@ void mic_context::operator()()
|
|||
|
||||
std::lock_guard lock(mutex);
|
||||
|
||||
if (std::none_of(mic_list.begin(), mic_list.end(), [](const microphone_device& dev)
|
||||
if (std::none_of(
|
||||
mic_list.begin(), mic_list.end(),
|
||||
[](const microphone_device& dev)
|
||||
{
|
||||
return dev.is_registered();
|
||||
}))
|
||||
|
|
@ -120,7 +122,11 @@ void mic_context::operator()()
|
|||
}
|
||||
else
|
||||
{
|
||||
timeout = TIMESTEP - (std::chrono::duration_cast<std::chrono::microseconds>(steady_clock::now().time_since_epoch()).count() % TIMESTEP);
|
||||
timeout =
|
||||
TIMESTEP - (std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
steady_clock::now().time_since_epoch())
|
||||
.count() %
|
||||
TIMESTEP);
|
||||
}
|
||||
|
||||
for (auto& mic_entry : mic_list)
|
||||
|
|
@ -160,11 +166,13 @@ void mic_context::load_config_and_init()
|
|||
{
|
||||
mic_list = {};
|
||||
|
||||
const std::vector<std::string> device_list = fmt::split(g_cfg.audio.microphone_devices.to_string(), {"@@@"});
|
||||
const std::vector<std::string> device_list =
|
||||
fmt::split(g_cfg.audio.microphone_devices.to_string(), {"@@@"});
|
||||
|
||||
if (!device_list.empty())
|
||||
{
|
||||
// We only register the first device. The rest is registered with cellAudioInRegisterDevice.
|
||||
// We only register the first device. The rest is registered with
|
||||
// cellAudioInRegisterDevice.
|
||||
if (g_cfg.audio.microphone_type == microphone_handler::singstar)
|
||||
{
|
||||
microphone_device& device = ::at32(mic_list, 0);
|
||||
|
|
@ -208,7 +216,8 @@ u32 mic_context::register_device(const std::string& device_name)
|
|||
}
|
||||
|
||||
// TODO: Check max mics properly
|
||||
ensure(index < mic_list.size(), "cellMic max mics exceeded during registration");
|
||||
ensure(index < mic_list.size(),
|
||||
"cellMic max mics exceeded during registration");
|
||||
|
||||
switch (g_cfg.audio.microphone_type)
|
||||
{
|
||||
|
|
@ -280,16 +289,20 @@ inline void microphone_device::variable_byteswap(const void* src, void* dst)
|
|||
}
|
||||
else
|
||||
{
|
||||
fmt::throw_exception("variable_byteswap with bytesize %d unimplemented", bytesize);
|
||||
fmt::throw_exception("variable_byteswap with bytesize %d unimplemented",
|
||||
bytesize);
|
||||
}
|
||||
}
|
||||
|
||||
inline u32 microphone_device::convert_16_bit_pcm_to_float(const std::vector<u8>& buffer, u32 num_bytes)
|
||||
inline u32
|
||||
microphone_device::convert_16_bit_pcm_to_float(const std::vector<u8>& buffer,
|
||||
u32 num_bytes)
|
||||
{
|
||||
static_assert((float_buf_size % sizeof(f32)) == 0);
|
||||
|
||||
float_buf.resize(float_buf_size, 0);
|
||||
const u32 bytes_to_write = static_cast<u32>(num_bytes * (sizeof(f32) / sizeof(s16)));
|
||||
const u32 bytes_to_write =
|
||||
static_cast<u32>(num_bytes * (sizeof(f32) / sizeof(s16)));
|
||||
ensure(bytes_to_write <= float_buf.size());
|
||||
|
||||
const be_t<s16>* src = utils::bless<const be_t<s16>>(buffer.data());
|
||||
|
|
@ -299,7 +312,9 @@ inline u32 microphone_device::convert_16_bit_pcm_to_float(const std::vector<u8>&
|
|||
{
|
||||
const be_t<s16> sample = *src++;
|
||||
|
||||
const be_t<f32> normalized_sample_be = std::clamp(static_cast<f32>(sample) / std::numeric_limits<s16>::max(), -1.0f, 1.0f);
|
||||
const be_t<f32> normalized_sample_be =
|
||||
std::clamp(static_cast<f32>(sample) / std::numeric_limits<s16>::max(),
|
||||
-1.0f, 1.0f);
|
||||
|
||||
*dst++ = normalized_sample_be;
|
||||
}
|
||||
|
|
@ -316,11 +331,12 @@ microphone_device::microphone_device(microphone_handler type)
|
|||
|
||||
void microphone_device::add_device(const std::string& name)
|
||||
{
|
||||
devices.push_back(mic_device{
|
||||
.name = name});
|
||||
devices.push_back(mic_device{.name = name});
|
||||
}
|
||||
|
||||
error_code microphone_device::open_microphone(const u8 type, const u32 dsp_r, const u32 raw_r, const u8 channels)
|
||||
error_code microphone_device::open_microphone(const u8 type, const u32 dsp_r,
|
||||
const u32 raw_r,
|
||||
const u8 channels)
|
||||
{
|
||||
signal_types = type;
|
||||
dsp_samplingrate = dsp_r;
|
||||
|
|
@ -335,11 +351,14 @@ error_code microphone_device::open_microphone(const u8 type, const u32 dsp_r, co
|
|||
break;
|
||||
case microphone_handler::singstar:
|
||||
case microphone_handler::real_singstar:
|
||||
// SingStar mic has always 2 channels, each channel represent a physical microphone
|
||||
// SingStar mic has always 2 channels, each channel represent a physical
|
||||
// microphone
|
||||
ensure(num_channels >= 2);
|
||||
if (num_channels > 2)
|
||||
{
|
||||
cellMic.error("Tried to open a SingStar-type device with num_channels = %d", num_channels);
|
||||
cellMic.error(
|
||||
"Tried to open a SingStar-type device with num_channels = %d",
|
||||
num_channels);
|
||||
num_channels = 2;
|
||||
}
|
||||
break;
|
||||
|
|
@ -369,13 +388,16 @@ error_code microphone_device::open_microphone(const u8 type, const u32 dsp_r, co
|
|||
num_al_channels = AL_FORMAT_QUAD16;
|
||||
break;
|
||||
default:
|
||||
cellMic.warning("Requested an invalid number of %d channels. Defaulting to 4 channels instead.", num_channels);
|
||||
cellMic.warning("Requested an invalid number of %d channels. Defaulting to "
|
||||
"4 channels instead.",
|
||||
num_channels);
|
||||
num_al_channels = AL_FORMAT_QUAD16;
|
||||
num_channels = 4;
|
||||
break;
|
||||
}
|
||||
|
||||
// Real firmware tries 4, 2 and then 1 channels if the channel count is not supported
|
||||
// Real firmware tries 4, 2 and then 1 channels if the channel count is not
|
||||
// supported
|
||||
// TODO: The used channel count may vary for Sony's camera devices
|
||||
for (bool found_valid_channels = false; !found_valid_channels;)
|
||||
{
|
||||
|
|
@ -388,7 +410,8 @@ error_code microphone_device::open_microphone(const u8 type, const u32 dsp_r, co
|
|||
break;
|
||||
}
|
||||
|
||||
cellMic.warning("Requested 4 channels but AL_EXT_MCFORMATS not available, trying 2 channels next");
|
||||
cellMic.warning("Requested 4 channels but AL_EXT_MCFORMATS not "
|
||||
"available, trying 2 channels next");
|
||||
num_al_channels = AL_FORMAT_STEREO16;
|
||||
num_channels = 2;
|
||||
break;
|
||||
|
|
@ -399,7 +422,8 @@ error_code microphone_device::open_microphone(const u8 type, const u32 dsp_r, co
|
|||
break;
|
||||
}
|
||||
|
||||
cellMic.warning("Requested 2 channels but extension is not available, trying 1 channel next");
|
||||
cellMic.warning("Requested 2 channels but extension is not available, "
|
||||
"trying 1 channel next");
|
||||
num_al_channels = AL_FORMAT_MONO16;
|
||||
num_channels = 1;
|
||||
break;
|
||||
|
|
@ -416,13 +440,15 @@ error_code microphone_device::open_microphone(const u8 type, const u32 dsp_r, co
|
|||
switch (num_al_channels)
|
||||
{
|
||||
case AL_FORMAT_QUAD16:
|
||||
ensure(num_channels == 4 && device_type != microphone_handler::singstar && device_type != microphone_handler::real_singstar);
|
||||
ensure(num_channels == 4 && device_type != microphone_handler::singstar &&
|
||||
device_type != microphone_handler::real_singstar);
|
||||
break;
|
||||
case AL_FORMAT_STEREO16:
|
||||
ensure(num_channels == 2 && device_type != microphone_handler::singstar);
|
||||
break;
|
||||
case AL_FORMAT_MONO16:
|
||||
ensure(num_channels == 1 || (num_channels == 2 && device_type == microphone_handler::singstar));
|
||||
ensure(num_channels == 1 ||
|
||||
(num_channels == 2 && device_type == microphone_handler::singstar));
|
||||
break;
|
||||
default:
|
||||
ensure(false);
|
||||
|
|
@ -433,12 +459,14 @@ error_code microphone_device::open_microphone(const u8 type, const u32 dsp_r, co
|
|||
const auto fixup_samplingrate = [this](u32& rate) -> bool
|
||||
{
|
||||
// TODO: The used sample rate may vary for Sony's camera devices
|
||||
const std::array<u32, 7> samplingrates = {rate, 48000u, 32000u, 24000u, 16000u, 12000u, 8000u};
|
||||
const std::array<u32, 7> samplingrates = {rate, 48000u, 32000u, 24000u,
|
||||
16000u, 12000u, 8000u};
|
||||
|
||||
const auto test_samplingrate = [&samplingrates](const u32& rate)
|
||||
{
|
||||
// TODO: actually check if device supports sampling rates
|
||||
return std::any_of(samplingrates.cbegin() + 1, samplingrates.cend(), [&rate](const u32& r)
|
||||
return std::any_of(samplingrates.cbegin() + 1, samplingrates.cend(),
|
||||
[&rate](const u32& r)
|
||||
{
|
||||
return r == rate;
|
||||
});
|
||||
|
|
@ -454,7 +482,9 @@ error_code microphone_device::open_microphone(const u8 type, const u32 dsp_r, co
|
|||
return true;
|
||||
}
|
||||
|
||||
cellMic.warning("Requested sampling rate %d, but we do not support it. Trying next sampling rate...", samplingrate);
|
||||
cellMic.warning("Requested sampling rate %d, but we do not support it. "
|
||||
"Trying next sampling rate...",
|
||||
samplingrate);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
@ -469,13 +499,16 @@ error_code microphone_device::open_microphone(const u8 type, const u32 dsp_r, co
|
|||
|
||||
ensure(!devices.empty());
|
||||
|
||||
ALCdevice* device = alcCaptureOpenDevice(devices[0].name.c_str(), raw_samplingrate, num_al_channels, inbuf_size);
|
||||
ALCdevice* device = alcCaptureOpenDevice(
|
||||
devices[0].name.c_str(), raw_samplingrate, num_al_channels, inbuf_size);
|
||||
|
||||
if (ALCenum err = alcGetError(device); err != ALC_NO_ERROR || !device)
|
||||
{
|
||||
cellMic.error("Error opening capture device %s (error=%s, device=*0x%x)", devices[0].name, fmt::alc_error{device, err}, device);
|
||||
cellMic.error("Error opening capture device %s (error=%s, device=*0x%x)",
|
||||
devices[0].name, fmt::alc_error{device, err}, device);
|
||||
#ifdef _WIN32
|
||||
cellMic.error("Make sure microphone use is authorized under \"Microphone privacy settings\" in windows configuration");
|
||||
cellMic.error("Make sure microphone use is authorized under \"Microphone "
|
||||
"privacy settings\" in windows configuration");
|
||||
#endif
|
||||
return CELL_MICIN_ERROR_DEVICE_NOT_SUPPORT;
|
||||
}
|
||||
|
|
@ -486,12 +519,15 @@ error_code microphone_device::open_microphone(const u8 type, const u32 dsp_r, co
|
|||
if (device_type == microphone_handler::singstar && devices.size() >= 2)
|
||||
{
|
||||
// Open a 2nd microphone into the same device
|
||||
device = alcCaptureOpenDevice(devices[1].name.c_str(), raw_samplingrate, AL_FORMAT_MONO16, inbuf_size);
|
||||
device = alcCaptureOpenDevice(devices[1].name.c_str(), raw_samplingrate,
|
||||
AL_FORMAT_MONO16, inbuf_size);
|
||||
|
||||
if (ALCenum err = alcGetError(device); err != ALC_NO_ERROR || !device)
|
||||
{
|
||||
// Ignore it and move on
|
||||
cellMic.error("Error opening 2nd SingStar capture device %s (error=%s, device=*0x%x)", devices[1].name, fmt::alc_error{device, err}, device);
|
||||
cellMic.error("Error opening 2nd SingStar capture device %s (error=%s, "
|
||||
"device=*0x%x)",
|
||||
devices[1].name, fmt::alc_error{device, err}, device);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -548,7 +584,8 @@ error_code microphone_device::start_microphone()
|
|||
alcCaptureStart(micdevice.device);
|
||||
if (ALCenum err = alcGetError(micdevice.device); err != ALC_NO_ERROR)
|
||||
{
|
||||
cellMic.error("Error starting capture of device %s (error=%s)", micdevice.name, fmt::alc_error{micdevice.device, err});
|
||||
cellMic.error("Error starting capture of device %s (error=%s)",
|
||||
micdevice.name, fmt::alc_error{micdevice.device, err});
|
||||
stop_microphone();
|
||||
return CELL_MICIN_ERROR_FATAL;
|
||||
}
|
||||
|
|
@ -567,7 +604,8 @@ error_code microphone_device::stop_microphone()
|
|||
alcCaptureStop(micdevice.device);
|
||||
if (ALCenum err = alcGetError(micdevice.device); err != ALC_NO_ERROR)
|
||||
{
|
||||
cellMic.error("Error stopping capture of device %s (error=%s)", micdevice.name, fmt::alc_error{micdevice.device, err});
|
||||
cellMic.error("Error stopping capture of device %s (error=%s)",
|
||||
micdevice.name, fmt::alc_error{micdevice.device, err});
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -607,7 +645,8 @@ void microphone_device::update_audio()
|
|||
|
||||
bool microphone_device::has_data() const
|
||||
{
|
||||
return mic_registered && mic_opened && mic_started && (rbuf_raw.has_data() || rbuf_dsp.has_data());
|
||||
return mic_registered && mic_opened && mic_started &&
|
||||
(rbuf_raw.has_data() || rbuf_dsp.has_data());
|
||||
}
|
||||
|
||||
f32 microphone_device::calculate_energy_level()
|
||||
|
|
@ -620,7 +659,8 @@ f32 microphone_device::calculate_energy_level()
|
|||
for (usz i = 0; i < num_samples; i++)
|
||||
{
|
||||
const be_t<s16> sample = read_from_ptr<be_t<s16>>(buffer, i * sizeof(s16));
|
||||
const f64 normalized_sample = static_cast<f64>(sample) / -std::numeric_limits<s16>::min();
|
||||
const f64 normalized_sample =
|
||||
static_cast<f64>(sample) / -std::numeric_limits<s16>::min();
|
||||
sum_squares += normalized_sample * normalized_sample;
|
||||
}
|
||||
|
||||
|
|
@ -646,7 +686,9 @@ u32 microphone_device::capture_audio()
|
|||
|
||||
if (ALCenum err = alcGetError(micdevice.device); err != ALC_NO_ERROR)
|
||||
{
|
||||
cellMic.error("Error getting number of captured samples of device %s (error=%s)", micdevice.name, fmt::alc_error{micdevice.device, err});
|
||||
cellMic.error(
|
||||
"Error getting number of captured samples of device %s (error=%s)",
|
||||
micdevice.name, fmt::alc_error{micdevice.device, err});
|
||||
return CELL_MICIN_ERROR_FATAL;
|
||||
}
|
||||
|
||||
|
|
@ -664,7 +706,8 @@ u32 microphone_device::capture_audio()
|
|||
|
||||
if (ALCenum err = alcGetError(micdevice.device); err != ALC_NO_ERROR)
|
||||
{
|
||||
cellMic.error("Error capturing samples of device %s (error=%s)", micdevice.name, fmt::alc_error{micdevice.device, err});
|
||||
cellMic.error("Error capturing samples of device %s (error=%s)",
|
||||
micdevice.name, fmt::alc_error{micdevice.device, err});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -704,7 +747,8 @@ void microphone_device::get_data(const u32 num_samples)
|
|||
// BE Translation
|
||||
for (u32 index = 0; index < bufsize; index += channel_size)
|
||||
{
|
||||
microphone_device::variable_byteswap<channel_size>(buf.data() + index, tmp_ptr + index);
|
||||
microphone_device::variable_byteswap<channel_size>(buf.data() + index,
|
||||
tmp_ptr + index);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -789,7 +833,8 @@ void microphone_device::get_dsp(const u32 num_samples)
|
|||
}
|
||||
else
|
||||
{
|
||||
// The same as device RAW stream format, except that the data byte is always big-endian
|
||||
// The same as device RAW stream format, except that the data byte is always
|
||||
// big-endian
|
||||
rbuf_dsp.write_bytes(buf.data(), bufsize);
|
||||
}
|
||||
}
|
||||
|
|
@ -830,10 +875,13 @@ error_code cellMicEnd()
|
|||
|
||||
/// Open/Close Microphone Functions
|
||||
|
||||
error_code cellMicOpenEx(s32 dev_num, s32 rawSampleRate, s32 rawChannel, s32 DSPSampleRate, s32 bufferSizeMS, u8 signalType)
|
||||
error_code cellMicOpenEx(s32 dev_num, s32 rawSampleRate, s32 rawChannel,
|
||||
s32 DSPSampleRate, s32 bufferSizeMS, u8 signalType)
|
||||
{
|
||||
cellMic.notice("cellMicOpenEx(dev_num=%d, rawSampleRate=%d, rawChannel=%d, DSPSampleRate=%d, bufferSizeMS=%d, signalType=0x%x)",
|
||||
dev_num, rawSampleRate, rawChannel, DSPSampleRate, bufferSizeMS, signalType);
|
||||
cellMic.notice("cellMicOpenEx(dev_num=%d, rawSampleRate=%d, rawChannel=%d, "
|
||||
"DSPSampleRate=%d, bufferSizeMS=%d, signalType=0x%x)",
|
||||
dev_num, rawSampleRate, rawChannel, DSPSampleRate,
|
||||
bufferSizeMS, signalType);
|
||||
|
||||
auto& mic_thr = g_fxo->get<mic_thread>();
|
||||
const std::lock_guard lock(mic_thr.mutex);
|
||||
|
|
@ -850,21 +898,25 @@ error_code cellMicOpenEx(s32 dev_num, s32 rawSampleRate, s32 rawChannel, s32 DSP
|
|||
|
||||
// TODO: bufferSizeMS
|
||||
|
||||
return device.open_microphone(signalType, DSPSampleRate, rawSampleRate, rawChannel);
|
||||
return device.open_microphone(signalType, DSPSampleRate, rawSampleRate,
|
||||
rawChannel);
|
||||
}
|
||||
|
||||
error_code cellMicOpen(s32 dev_num, s32 sampleRate)
|
||||
{
|
||||
cellMic.trace("cellMicOpen(dev_num=%d sampleRate=%d)", dev_num, sampleRate);
|
||||
|
||||
return cellMicOpenEx(dev_num, sampleRate, 1, sampleRate, 0x80, CELLMIC_SIGTYPE_DSP);
|
||||
return cellMicOpenEx(dev_num, sampleRate, 1, sampleRate, 0x80,
|
||||
CELLMIC_SIGTYPE_DSP);
|
||||
}
|
||||
|
||||
error_code cellMicOpenRaw(s32 dev_num, s32 sampleRate, s32 maxChannels)
|
||||
{
|
||||
cellMic.trace("cellMicOpenRaw(dev_num=%d, sampleRate=%d, maxChannels=%d)", dev_num, sampleRate, maxChannels);
|
||||
cellMic.trace("cellMicOpenRaw(dev_num=%d, sampleRate=%d, maxChannels=%d)",
|
||||
dev_num, sampleRate, maxChannels);
|
||||
|
||||
return cellMicOpenEx(dev_num, sampleRate, maxChannels, sampleRate, 0x80, CELLMIC_SIGTYPE_RAW);
|
||||
return cellMicOpenEx(dev_num, sampleRate, maxChannels, sampleRate, 0x80,
|
||||
CELLMIC_SIGTYPE_RAW);
|
||||
}
|
||||
|
||||
s32 cellMicIsOpen(s32 dev_num)
|
||||
|
|
@ -973,9 +1025,12 @@ error_code cellMicStop(s32 dev_num)
|
|||
|
||||
/// Microphone Attributes/States Functions
|
||||
|
||||
error_code cellMicGetDeviceAttr(s32 dev_num, CellMicDeviceAttr deviceAttributes, vm::ptr<s32> arg1, vm::ptr<s32> arg2)
|
||||
error_code cellMicGetDeviceAttr(s32 dev_num, CellMicDeviceAttr deviceAttributes,
|
||||
vm::ptr<s32> arg1, vm::ptr<s32> arg2)
|
||||
{
|
||||
cellMic.trace("cellMicGetDeviceAttr(dev_num=%d, deviceAttribute=%d, arg1=*0x%x, arg2=*0x%x)", dev_num, +deviceAttributes, arg1, arg2);
|
||||
cellMic.trace("cellMicGetDeviceAttr(dev_num=%d, deviceAttribute=%d, "
|
||||
"arg1=*0x%x, arg2=*0x%x)",
|
||||
dev_num, +deviceAttributes, arg1, arg2);
|
||||
|
||||
auto& mic_thr = g_fxo->get<mic_thread>();
|
||||
const std::lock_guard lock(mic_thr.mutex);
|
||||
|
|
@ -1001,7 +1056,9 @@ error_code cellMicGetDeviceAttr(s32 dev_num, CellMicDeviceAttr deviceAttributes,
|
|||
if (*arg1 == 0)
|
||||
{
|
||||
// Calculate average volume of the channels
|
||||
*arg2 = std::accumulate(device.attr_chanvol.begin(), device.attr_chanvol.end(), 0u) / ::size32(device.attr_chanvol);
|
||||
*arg2 = std::accumulate(device.attr_chanvol.begin(),
|
||||
device.attr_chanvol.end(), 0u) /
|
||||
::size32(device.attr_chanvol);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1009,21 +1066,35 @@ error_code cellMicGetDeviceAttr(s32 dev_num, CellMicDeviceAttr deviceAttributes,
|
|||
}
|
||||
|
||||
break;
|
||||
case CELLMIC_DEVATTR_LED: *arg1 = device.attr_led; break;
|
||||
case CELLMIC_DEVATTR_GAIN: *arg1 = device.attr_gain; break;
|
||||
case CELLMIC_DEVATTR_VOLUME: *arg1 = device.attr_volume; break;
|
||||
case CELLMIC_DEVATTR_AGC: *arg1 = device.attr_agc; break;
|
||||
case CELLMIC_DEVATTR_DSPTYPE: *arg1 = device.attr_dsptype; break;
|
||||
default: return CELL_MICIN_ERROR_PARAM;
|
||||
case CELLMIC_DEVATTR_LED:
|
||||
*arg1 = device.attr_led;
|
||||
break;
|
||||
case CELLMIC_DEVATTR_GAIN:
|
||||
*arg1 = device.attr_gain;
|
||||
break;
|
||||
case CELLMIC_DEVATTR_VOLUME:
|
||||
*arg1 = device.attr_volume;
|
||||
break;
|
||||
case CELLMIC_DEVATTR_AGC:
|
||||
*arg1 = device.attr_agc;
|
||||
break;
|
||||
case CELLMIC_DEVATTR_DSPTYPE:
|
||||
*arg1 = device.attr_dsptype;
|
||||
break;
|
||||
default:
|
||||
return CELL_MICIN_ERROR_PARAM;
|
||||
}
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellMicSetDeviceAttr(s32 dev_num, CellMicDeviceAttr deviceAttributes, u32 arg1, u32 arg2)
|
||||
error_code cellMicSetDeviceAttr(s32 dev_num, CellMicDeviceAttr deviceAttributes,
|
||||
u32 arg1, u32 arg2)
|
||||
{
|
||||
cellMic.trace("cellMicSetDeviceAttr(dev_num=%d, deviceAttributes=%d, arg1=%d, arg2=%d)", dev_num, +deviceAttributes, arg1, arg2);
|
||||
cellMic.trace(
|
||||
"cellMicSetDeviceAttr(dev_num=%d, deviceAttributes=%d, arg1=%d, arg2=%d)",
|
||||
dev_num, +deviceAttributes, arg1, arg2);
|
||||
|
||||
auto& mic_thr = g_fxo->get<mic_thread>();
|
||||
const std::lock_guard lock(mic_thr.mutex);
|
||||
|
|
@ -1052,20 +1123,33 @@ error_code cellMicSetDeviceAttr(s32 dev_num, CellMicDeviceAttr deviceAttributes,
|
|||
}
|
||||
|
||||
break;
|
||||
case CELLMIC_DEVATTR_LED: device.attr_led = arg1; break;
|
||||
case CELLMIC_DEVATTR_GAIN: device.attr_gain = arg1; break;
|
||||
case CELLMIC_DEVATTR_VOLUME: device.attr_volume = arg1; break;
|
||||
case CELLMIC_DEVATTR_AGC: device.attr_agc = arg1; break;
|
||||
case CELLMIC_DEVATTR_DSPTYPE: device.attr_dsptype = arg1; break;
|
||||
default: return CELL_MICIN_ERROR_PARAM;
|
||||
case CELLMIC_DEVATTR_LED:
|
||||
device.attr_led = arg1;
|
||||
break;
|
||||
case CELLMIC_DEVATTR_GAIN:
|
||||
device.attr_gain = arg1;
|
||||
break;
|
||||
case CELLMIC_DEVATTR_VOLUME:
|
||||
device.attr_volume = arg1;
|
||||
break;
|
||||
case CELLMIC_DEVATTR_AGC:
|
||||
device.attr_agc = arg1;
|
||||
break;
|
||||
case CELLMIC_DEVATTR_DSPTYPE:
|
||||
device.attr_dsptype = arg1;
|
||||
break;
|
||||
default:
|
||||
return CELL_MICIN_ERROR_PARAM;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellMicGetSignalAttr(s32 dev_num, CellMicSignalAttr sig_attrib, vm::ptr<void> value)
|
||||
error_code cellMicGetSignalAttr(s32 dev_num, CellMicSignalAttr sig_attrib,
|
||||
vm::ptr<void> value)
|
||||
{
|
||||
cellMic.todo("cellMicGetSignalAttr(dev_num=%d, sig_attrib=%d, value=*0x%x)", dev_num, +sig_attrib, value);
|
||||
cellMic.todo("cellMicGetSignalAttr(dev_num=%d, sig_attrib=%d, value=*0x%x)",
|
||||
dev_num, +sig_attrib, value);
|
||||
|
||||
if (!value)
|
||||
return CELL_MICIN_ERROR_PARAM;
|
||||
|
|
@ -1087,9 +1171,11 @@ error_code cellMicGetSignalAttr(s32 dev_num, CellMicSignalAttr sig_attrib, vm::p
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellMicSetSignalAttr(s32 dev_num, CellMicSignalAttr sig_attrib, vm::ptr<void> value)
|
||||
error_code cellMicSetSignalAttr(s32 dev_num, CellMicSignalAttr sig_attrib,
|
||||
vm::ptr<void> value)
|
||||
{
|
||||
cellMic.todo("cellMicSetSignalAttr(dev_num=%d, sig_attrib=%d, value=*0x%x)", dev_num, +sig_attrib, value);
|
||||
cellMic.todo("cellMicSetSignalAttr(dev_num=%d, sig_attrib=%d, value=*0x%x)",
|
||||
dev_num, +sig_attrib, value);
|
||||
|
||||
if (!value)
|
||||
return CELL_MICIN_ERROR_PARAM;
|
||||
|
|
@ -1111,9 +1197,11 @@ error_code cellMicSetSignalAttr(s32 dev_num, CellMicSignalAttr sig_attrib, vm::p
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellMicGetSignalState(s32 dev_num, CellMicSignalState sig_state, vm::ptr<void> value)
|
||||
error_code cellMicGetSignalState(s32 dev_num, CellMicSignalState sig_state,
|
||||
vm::ptr<void> value)
|
||||
{
|
||||
cellMic.trace("cellMicGetSignalState(dev_num=%d, sig_state=%d, value=*0x%x)", dev_num, +sig_state, value);
|
||||
cellMic.trace("cellMicGetSignalState(dev_num=%d, sig_state=%d, value=*0x%x)",
|
||||
dev_num, +sig_state, value);
|
||||
|
||||
if (!value)
|
||||
return CELL_MICIN_ERROR_PARAM;
|
||||
|
|
@ -1162,9 +1250,11 @@ error_code cellMicGetSignalState(s32 dev_num, CellMicSignalState sig_state, vm::
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellMicGetFormatEx(s32 dev_num, vm::ptr<CellMicInputFormatI> format, /*CellMicSignalType*/ u32 type)
|
||||
error_code cellMicGetFormatEx(s32 dev_num, vm::ptr<CellMicInputFormatI> format,
|
||||
/*CellMicSignalType*/ u32 type)
|
||||
{
|
||||
cellMic.trace("cellMicGetFormatEx(dev_num=%d, format=*0x%x, type=0x%x)", dev_num, format, type);
|
||||
cellMic.trace("cellMicGetFormatEx(dev_num=%d, format=*0x%x, type=0x%x)",
|
||||
dev_num, format, type);
|
||||
|
||||
if (!format)
|
||||
return CELL_MICIN_ERROR_PARAM;
|
||||
|
|
@ -1198,19 +1288,23 @@ error_code cellMicGetFormat(s32 dev_num, vm::ptr<CellMicInputFormatI> format)
|
|||
return cellMicGetFormatEx(dev_num, format, CELLMIC_SIGTYPE_DSP);
|
||||
}
|
||||
|
||||
error_code cellMicGetFormatRaw(s32 dev_num, vm::ptr<CellMicInputFormatI> format)
|
||||
error_code cellMicGetFormatRaw(s32 dev_num,
|
||||
vm::ptr<CellMicInputFormatI> format)
|
||||
{
|
||||
cellMic.trace("cellMicGetFormatRaw(dev_num=%d, format=0x%x)", dev_num, format);
|
||||
cellMic.trace("cellMicGetFormatRaw(dev_num=%d, format=0x%x)", dev_num,
|
||||
format);
|
||||
return cellMicGetFormatEx(dev_num, format, CELLMIC_SIGTYPE_RAW);
|
||||
}
|
||||
|
||||
error_code cellMicGetFormatAux(s32 dev_num, vm::ptr<CellMicInputFormatI> format)
|
||||
error_code cellMicGetFormatAux(s32 dev_num,
|
||||
vm::ptr<CellMicInputFormatI> format)
|
||||
{
|
||||
cellMic.todo("cellMicGetFormatAux(dev_num=%d, format=0x%x)", dev_num, format);
|
||||
return cellMicGetFormatEx(dev_num, format, CELLMIC_SIGTYPE_AUX);
|
||||
}
|
||||
|
||||
error_code cellMicGetFormatDsp(s32 dev_num, vm::ptr<CellMicInputFormatI> format)
|
||||
error_code cellMicGetFormatDsp(s32 dev_num,
|
||||
vm::ptr<CellMicInputFormatI> format)
|
||||
{
|
||||
cellMic.todo("cellMicGetFormatDsp(dev_num=%d, format=0x%x)", dev_num, format);
|
||||
return cellMicGetFormatEx(dev_num, format, CELLMIC_SIGTYPE_DSP);
|
||||
|
|
@ -1249,7 +1343,9 @@ error_code cellMicSetNotifyEventQueue(u64 key)
|
|||
|
||||
error_code cellMicSetNotifyEventQueue2(u64 key, u64 source, u64 flag)
|
||||
{
|
||||
cellMic.todo("cellMicSetNotifyEventQueue2(key=0x%llx, source=0x%llx, flag=0x%llx", key, source, flag);
|
||||
cellMic.todo(
|
||||
"cellMicSetNotifyEventQueue2(key=0x%llx, source=0x%llx, flag=0x%llx", key,
|
||||
source, flag);
|
||||
|
||||
auto& mic_thr = g_fxo->get<mic_thread>();
|
||||
const std::lock_guard lock(mic_thr.mutex);
|
||||
|
|
@ -1294,7 +1390,8 @@ error_code cellMicRemoveNotifyEventQueue(u64 key)
|
|||
|
||||
/// Reading Functions
|
||||
|
||||
error_code cell_mic_read(s32 dev_num, vm::ptr<void> data, s32 max_bytes, /*CellMicSignalType*/ u32 type)
|
||||
error_code cell_mic_read(s32 dev_num, vm::ptr<void> data, s32 max_bytes,
|
||||
/*CellMicSignalType*/ u32 type)
|
||||
{
|
||||
auto& mic_thr = g_fxo->get<mic_thread>();
|
||||
const std::lock_guard lock(mic_thr.mutex);
|
||||
|
|
@ -1314,9 +1411,12 @@ error_code cell_mic_read(s32 dev_num, vm::ptr<void> data, s32 max_bytes, /*CellM
|
|||
|
||||
switch (type)
|
||||
{
|
||||
case CELLMIC_SIGTYPE_DSP: return not_an_error(device.read_dsp(vm::_ptr<u8>(data.addr()), max_bytes));
|
||||
case CELLMIC_SIGTYPE_AUX: return not_an_error(0); // TODO
|
||||
case CELLMIC_SIGTYPE_RAW: return not_an_error(device.read_raw(vm::_ptr<u8>(data.addr()), max_bytes));
|
||||
case CELLMIC_SIGTYPE_DSP:
|
||||
return not_an_error(device.read_dsp(vm::_ptr<u8>(data.addr()), max_bytes));
|
||||
case CELLMIC_SIGTYPE_AUX:
|
||||
return not_an_error(0); // TODO
|
||||
case CELLMIC_SIGTYPE_RAW:
|
||||
return not_an_error(device.read_raw(vm::_ptr<u8>(data.addr()), max_bytes));
|
||||
default:
|
||||
fmt::throw_exception("Invalid CELLMIC_SIGTYPE %d", type);
|
||||
}
|
||||
|
|
@ -1326,25 +1426,29 @@ error_code cell_mic_read(s32 dev_num, vm::ptr<void> data, s32 max_bytes, /*CellM
|
|||
|
||||
error_code cellMicReadRaw(s32 dev_num, vm::ptr<void> data, s32 max_bytes)
|
||||
{
|
||||
cellMic.trace("cellMicReadRaw(dev_num=%d, data=0x%x, maxBytes=%d)", dev_num, data, max_bytes);
|
||||
cellMic.trace("cellMicReadRaw(dev_num=%d, data=0x%x, maxBytes=%d)", dev_num,
|
||||
data, max_bytes);
|
||||
return cell_mic_read(dev_num, data, max_bytes, CELLMIC_SIGTYPE_RAW);
|
||||
}
|
||||
|
||||
error_code cellMicRead(s32 dev_num, vm::ptr<void> data, u32 max_bytes)
|
||||
{
|
||||
cellMic.warning("cellMicRead(dev_num=%d, data=0x%x, maxBytes=0x%x)", dev_num, data, max_bytes);
|
||||
cellMic.warning("cellMicRead(dev_num=%d, data=0x%x, maxBytes=0x%x)", dev_num,
|
||||
data, max_bytes);
|
||||
return cell_mic_read(dev_num, data, max_bytes, CELLMIC_SIGTYPE_DSP);
|
||||
}
|
||||
|
||||
error_code cellMicReadAux(s32 dev_num, vm::ptr<void> data, s32 max_bytes)
|
||||
{
|
||||
cellMic.todo("cellMicReadAux(dev_num=%d, data=0x%x, max_bytes=0x%x)", dev_num, data, max_bytes);
|
||||
cellMic.todo("cellMicReadAux(dev_num=%d, data=0x%x, max_bytes=0x%x)", dev_num,
|
||||
data, max_bytes);
|
||||
return cell_mic_read(dev_num, data, max_bytes, CELLMIC_SIGTYPE_AUX);
|
||||
}
|
||||
|
||||
error_code cellMicReadDsp(s32 dev_num, vm::ptr<void> data, s32 max_bytes)
|
||||
{
|
||||
cellMic.warning("cellMicReadDsp(dev_num=%d, data=0x%x, max_bytes=0x%x)", dev_num, data, max_bytes);
|
||||
cellMic.warning("cellMicReadDsp(dev_num=%d, data=0x%x, max_bytes=0x%x)",
|
||||
dev_num, data, max_bytes);
|
||||
return cell_mic_read(dev_num, data, max_bytes, CELLMIC_SIGTYPE_DSP);
|
||||
}
|
||||
|
||||
|
|
@ -1374,7 +1478,8 @@ error_code cellMicReset(s32 dev_num)
|
|||
|
||||
error_code cellMicGetDeviceGUID(s32 dev_num, vm::ptr<u32> ptr_guid)
|
||||
{
|
||||
cellMic.todo("cellMicGetDeviceGUID(dev_num=%d ptr_guid=*0x%x)", dev_num, ptr_guid);
|
||||
cellMic.todo("cellMicGetDeviceGUID(dev_num=%d ptr_guid=*0x%x)", dev_num,
|
||||
ptr_guid);
|
||||
|
||||
if (!ptr_guid)
|
||||
return CELL_MICIN_ERROR_PARAM;
|
||||
|
|
@ -1393,7 +1498,8 @@ error_code cellMicGetDeviceGUID(s32 dev_num, vm::ptr<u32> ptr_guid)
|
|||
|
||||
error_code cellMicGetDeviceIdentifier(s32 dev_num, vm::ptr<u32> ptr_id)
|
||||
{
|
||||
cellMic.todo("cellMicGetDeviceIdentifier(dev_num=%d, ptr_id=*0x%x)", dev_num, ptr_id);
|
||||
cellMic.todo("cellMicGetDeviceIdentifier(dev_num=%d, ptr_id=*0x%x)", dev_num,
|
||||
ptr_id);
|
||||
|
||||
if (ptr_id)
|
||||
*ptr_id = 0x0;
|
||||
|
|
@ -1410,7 +1516,8 @@ error_code cellMicGetDeviceIdentifier(s32 dev_num, vm::ptr<u32> ptr_id)
|
|||
|
||||
error_code cellMicGetType(s32 dev_num, vm::ptr<s32> ptr_type)
|
||||
{
|
||||
cellMic.trace("cellMicGetType(dev_num=%d, ptr_type=*0x%x)", dev_num, ptr_type);
|
||||
cellMic.trace("cellMicGetType(dev_num=%d, ptr_type=*0x%x)", dev_num,
|
||||
ptr_type);
|
||||
|
||||
if (!ptr_type)
|
||||
return CELL_MICIN_ERROR_PARAM;
|
||||
|
|
@ -1421,7 +1528,8 @@ error_code cellMicGetType(s32 dev_num, vm::ptr<s32> ptr_type)
|
|||
return CELL_MICIN_ERROR_NOT_INIT;
|
||||
|
||||
// TODO: get proper type (log message is trace because of massive spam)
|
||||
*ptr_type = CELLMIC_TYPE_USBAUDIO; // Needed for Guitar Hero: Warriors of Rock (BLUS30487)
|
||||
*ptr_type = CELLMIC_TYPE_USBAUDIO; // Needed for Guitar Hero: Warriors of Rock
|
||||
// (BLUS30487)
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
#include "stdafx.h"
|
||||
#include "Emu/system_config.h"
|
||||
#include "Emu/Cell/PPUModule.h"
|
||||
#include "Emu/IdManager.h"
|
||||
#include "Emu/system_config.h"
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "cellGame.h"
|
||||
#include "cellSysutil.h"
|
||||
#include "cellNetCtl.h"
|
||||
#include "cellSysutil.h"
|
||||
|
||||
#include "Utilities/StrUtil.h"
|
||||
#include "util/StrUtil.h"
|
||||
|
||||
#include "Emu/NP/np_handler.h"
|
||||
#include "Emu/NP/np_helpers.h"
|
||||
|
|
@ -79,10 +79,14 @@ void fmt_class_string<CellNetCtlState>::format(std::string& out, u64 arg)
|
|||
{
|
||||
switch (value)
|
||||
{
|
||||
case CELL_NET_CTL_STATE_Disconnected: return "Disconnected";
|
||||
case CELL_NET_CTL_STATE_Connecting: return "Connecting";
|
||||
case CELL_NET_CTL_STATE_IPObtaining: return "Obtaining IP";
|
||||
case CELL_NET_CTL_STATE_IPObtained: return "IP Obtained";
|
||||
case CELL_NET_CTL_STATE_Disconnected:
|
||||
return "Disconnected";
|
||||
case CELL_NET_CTL_STATE_Connecting:
|
||||
return "Connecting";
|
||||
case CELL_NET_CTL_STATE_IPObtaining:
|
||||
return "Obtaining IP";
|
||||
case CELL_NET_CTL_STATE_IPObtained:
|
||||
return "IP Obtained";
|
||||
}
|
||||
|
||||
return unknown;
|
||||
|
|
@ -103,8 +107,10 @@ struct CellGameUpdateParam
|
|||
be_t<u32> cid;
|
||||
};
|
||||
|
||||
using CellGameUpdateCallback = void(s32 status, s32 error_code, vm::ptr<void> userdata);
|
||||
using CellGameUpdateCallbackEx = void(vm::ptr<CellGameUpdateResult> result, vm::ptr<void> userdata);
|
||||
using CellGameUpdateCallback = void(s32 status, s32 error_code,
|
||||
vm::ptr<void> userdata);
|
||||
using CellGameUpdateCallbackEx = void(vm::ptr<CellGameUpdateResult> result,
|
||||
vm::ptr<void> userdata);
|
||||
|
||||
error_code cellNetCtlInit()
|
||||
{
|
||||
|
|
@ -152,9 +158,11 @@ error_code cellNetCtlGetState(vm::ptr<s32> state)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellNetCtlAddHandler(vm::ptr<cellNetCtlHandler> handler, vm::ptr<void> arg, vm::ptr<s32> hid)
|
||||
error_code cellNetCtlAddHandler(vm::ptr<cellNetCtlHandler> handler,
|
||||
vm::ptr<void> arg, vm::ptr<s32> hid)
|
||||
{
|
||||
cellNetCtl.todo("cellNetCtlAddHandler(handler=*0x%x, arg=*0x%x, hid=*0x%x)", handler, arg, hid);
|
||||
cellNetCtl.todo("cellNetCtlAddHandler(handler=*0x%x, arg=*0x%x, hid=*0x%x)",
|
||||
handler, arg, hid);
|
||||
|
||||
auto& nph = g_fxo->get<named_thread<np::np_handler>>();
|
||||
|
||||
|
|
@ -192,7 +200,8 @@ error_code cellNetCtlDelHandler(s32 hid)
|
|||
|
||||
error_code cellNetCtlGetInfo(s32 code, vm::ptr<CellNetCtlInfo> info)
|
||||
{
|
||||
cellNetCtl.warning("cellNetCtlGetInfo(code=0x%x (%s), info=*0x%x)", code, InfoCodeToName(code), info);
|
||||
cellNetCtl.warning("cellNetCtlGetInfo(code=0x%x (%s), info=*0x%x)", code,
|
||||
InfoCodeToName(code), info);
|
||||
|
||||
auto& nph = g_fxo->get<named_thread<np::np_handler>>();
|
||||
|
||||
|
|
@ -219,32 +228,66 @@ error_code cellNetCtlGetInfo(s32 code, vm::ptr<CellNetCtlInfo> info)
|
|||
|
||||
switch (code)
|
||||
{
|
||||
case CELL_NET_CTL_INFO_DEVICE: info->device = CELL_NET_CTL_DEVICE_WIRED; break;
|
||||
case CELL_NET_CTL_INFO_MTU: info->mtu = 1500; break;
|
||||
case CELL_NET_CTL_INFO_LINK: info->link = CELL_NET_CTL_LINK_CONNECTED; break;
|
||||
case CELL_NET_CTL_INFO_LINK_TYPE: info->link_type = CELL_NET_CTL_LINK_TYPE_100BASE_FULL; break;
|
||||
case CELL_NET_CTL_INFO_DEVICE:
|
||||
info->device = CELL_NET_CTL_DEVICE_WIRED;
|
||||
break;
|
||||
case CELL_NET_CTL_INFO_MTU:
|
||||
info->mtu = 1500;
|
||||
break;
|
||||
case CELL_NET_CTL_INFO_LINK:
|
||||
info->link = CELL_NET_CTL_LINK_CONNECTED;
|
||||
break;
|
||||
case CELL_NET_CTL_INFO_LINK_TYPE:
|
||||
info->link_type = CELL_NET_CTL_LINK_TYPE_100BASE_FULL;
|
||||
break;
|
||||
// case CELL_NET_CTL_INFO_BSSID: break;
|
||||
// case CELL_NET_CTL_INFO_SSID: break;
|
||||
// case CELL_NET_CTL_INFO_WLAN_SECURITY: break;
|
||||
// case CELL_NET_CTL_INFO_8021X_TYPE: break;
|
||||
// case CELL_NET_CTL_INFO_8021X_AUTH_NAME: break;
|
||||
case CELL_NET_CTL_INFO_RSSI: info->rssi = 100; break; // wireless: value ranges from 0-100 indicating wireless connection strength
|
||||
case CELL_NET_CTL_INFO_CHANNEL: info->channel = 1; break; // wireless: channel used to connect to the AP?
|
||||
case CELL_NET_CTL_INFO_IP_CONFIG: info->ip_config = CELL_NET_CTL_IP_STATIC; break;
|
||||
case CELL_NET_CTL_INFO_DHCP_HOSTNAME: strcpy_trunc(info->dhcp_hostname, nph.get_hostname()); break;
|
||||
case CELL_NET_CTL_INFO_RSSI:
|
||||
info->rssi = 100;
|
||||
break; // wireless: value ranges from 0-100 indicating wireless connection
|
||||
// strength
|
||||
case CELL_NET_CTL_INFO_CHANNEL:
|
||||
info->channel = 1;
|
||||
break; // wireless: channel used to connect to the AP?
|
||||
case CELL_NET_CTL_INFO_IP_CONFIG:
|
||||
info->ip_config = CELL_NET_CTL_IP_STATIC;
|
||||
break;
|
||||
case CELL_NET_CTL_INFO_DHCP_HOSTNAME:
|
||||
strcpy_trunc(info->dhcp_hostname, nph.get_hostname());
|
||||
break;
|
||||
// case CELL_NET_CTL_INFO_PPPOE_AUTH_NAME: break;
|
||||
case CELL_NET_CTL_INFO_IP_ADDRESS: strcpy_trunc(info->ip_address, np::ip_to_string(nph.get_local_ip_addr())); break; // verified on HW
|
||||
case CELL_NET_CTL_INFO_NETMASK: strcpy_trunc(info->netmask, "255.255.255.0"); break;
|
||||
case CELL_NET_CTL_INFO_DEFAULT_ROUTE: strcpy_trunc(info->default_route, "192.168.1.1"); break;
|
||||
case CELL_NET_CTL_INFO_PRIMARY_DNS: strcpy_trunc(info->primary_dns, np::ip_to_string(nph.get_dns_ip())); break;
|
||||
case CELL_NET_CTL_INFO_SECONDARY_DNS: strcpy_trunc(info->secondary_dns, np::ip_to_string(nph.get_dns_ip())); break;
|
||||
case CELL_NET_CTL_INFO_HTTP_PROXY_CONFIG: info->http_proxy_config = 0; break;
|
||||
case CELL_NET_CTL_INFO_IP_ADDRESS:
|
||||
strcpy_trunc(info->ip_address, np::ip_to_string(nph.get_local_ip_addr()));
|
||||
break; // verified on HW
|
||||
case CELL_NET_CTL_INFO_NETMASK:
|
||||
strcpy_trunc(info->netmask, "255.255.255.0");
|
||||
break;
|
||||
case CELL_NET_CTL_INFO_DEFAULT_ROUTE:
|
||||
strcpy_trunc(info->default_route, "192.168.1.1");
|
||||
break;
|
||||
case CELL_NET_CTL_INFO_PRIMARY_DNS:
|
||||
strcpy_trunc(info->primary_dns, np::ip_to_string(nph.get_dns_ip()));
|
||||
break;
|
||||
case CELL_NET_CTL_INFO_SECONDARY_DNS:
|
||||
strcpy_trunc(info->secondary_dns, np::ip_to_string(nph.get_dns_ip()));
|
||||
break;
|
||||
case CELL_NET_CTL_INFO_HTTP_PROXY_CONFIG:
|
||||
info->http_proxy_config = 0;
|
||||
break;
|
||||
// case CELL_NET_CTL_INFO_HTTP_PROXY_SERVER: break;
|
||||
// case CELL_NET_CTL_INFO_HTTP_PROXY_PORT: break;
|
||||
case CELL_NET_CTL_INFO_UPNP_CONFIG: info->upnp_config = (nph.get_upnp_status() == SCE_NP_SIGNALING_NETINFO_UPNP_STATUS_VALID) ? CELL_NET_CTL_UPNP_ON : CELL_NET_CTL_UPNP_OFF; break;
|
||||
case CELL_NET_CTL_INFO_UPNP_CONFIG:
|
||||
info->upnp_config =
|
||||
(nph.get_upnp_status() == SCE_NP_SIGNALING_NETINFO_UPNP_STATUS_VALID) ? CELL_NET_CTL_UPNP_ON : CELL_NET_CTL_UPNP_OFF;
|
||||
break;
|
||||
// case CELL_NET_CTL_INFO_RESERVED1: break;
|
||||
// case CELL_NET_CTL_INFO_RESERVED2: break;
|
||||
default: cellNetCtl.error("Unsupported request: %s", InfoCodeToName(code)); break;
|
||||
default:
|
||||
cellNetCtl.error("Unsupported request: %s", InfoCodeToName(code));
|
||||
break;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
|
|
@ -263,7 +306,8 @@ struct netstart_hack
|
|||
}
|
||||
};
|
||||
|
||||
error_code cellNetCtlNetStartDialogLoadAsync(vm::cptr<CellNetCtlNetStartDialogParam> param)
|
||||
error_code cellNetCtlNetStartDialogLoadAsync(
|
||||
vm::cptr<CellNetCtlNetStartDialogParam> param)
|
||||
{
|
||||
cellNetCtl.warning("cellNetCtlNetStartDialogLoadAsync(param=*0x%x)", param);
|
||||
|
||||
|
|
@ -289,7 +333,8 @@ error_code cellNetCtlNetStartDialogLoadAsync(vm::cptr<CellNetCtlNetStartDialogPa
|
|||
return CELL_NET_CTL_ERROR_INVALID_SIZE;
|
||||
}
|
||||
|
||||
// This is a hack for Diva F 2nd that registers the sysutil callback after calling this function.
|
||||
// This is a hack for Diva F 2nd that registers the sysutil callback after
|
||||
// calling this function.
|
||||
g_fxo->get<named_thread<netstart_hack>>()(0);
|
||||
|
||||
return CELL_OK;
|
||||
|
|
@ -309,9 +354,11 @@ error_code cellNetCtlNetStartDialogAbortAsync()
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellNetCtlNetStartDialogUnloadAsync(vm::ptr<CellNetCtlNetStartDialogResult> result)
|
||||
error_code cellNetCtlNetStartDialogUnloadAsync(
|
||||
vm::ptr<CellNetCtlNetStartDialogResult> result)
|
||||
{
|
||||
cellNetCtl.warning("cellNetCtlNetStartDialogUnloadAsync(result=*0x%x)", result);
|
||||
cellNetCtl.warning("cellNetCtlNetStartDialogUnloadAsync(result=*0x%x)",
|
||||
result);
|
||||
|
||||
auto& nph = g_fxo->get<named_thread<np::np_handler>>();
|
||||
|
||||
|
|
@ -424,9 +471,14 @@ error_code cellGameUpdateTerm()
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellGameUpdateCheckStartAsync(vm::cptr<CellGameUpdateParam> param, vm::ptr<CellGameUpdateCallback> cb_func, vm::ptr<void> userdata)
|
||||
error_code
|
||||
cellGameUpdateCheckStartAsync(vm::cptr<CellGameUpdateParam> param,
|
||||
vm::ptr<CellGameUpdateCallback> cb_func,
|
||||
vm::ptr<void> userdata)
|
||||
{
|
||||
cellNetCtl.todo("cellGameUpdateCheckStartAsync(param=*0x%x, cb_func=*0x%x, userdata=*0x%x)", param, cb_func, userdata);
|
||||
cellNetCtl.todo("cellGameUpdateCheckStartAsync(param=*0x%x, cb_func=*0x%x, "
|
||||
"userdata=*0x%x)",
|
||||
param, cb_func, userdata);
|
||||
sysutil_register_cb([=](ppu_thread& ppu) -> s32
|
||||
{
|
||||
cb_func(ppu, CELL_GAMEUPDATE_RESULT_STATUS_NO_UPDATE, CELL_OK, userdata);
|
||||
|
|
@ -435,9 +487,13 @@ error_code cellGameUpdateCheckStartAsync(vm::cptr<CellGameUpdateParam> param, vm
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellGameUpdateCheckFinishAsync(vm::ptr<CellGameUpdateCallback> cb_func, vm::ptr<void> userdata)
|
||||
error_code
|
||||
cellGameUpdateCheckFinishAsync(vm::ptr<CellGameUpdateCallback> cb_func,
|
||||
vm::ptr<void> userdata)
|
||||
{
|
||||
cellNetCtl.todo("cellGameUpdateCheckFinishAsync(cb_func=*0x%x, userdata=*0x%x)", cb_func, userdata);
|
||||
cellNetCtl.todo(
|
||||
"cellGameUpdateCheckFinishAsync(cb_func=*0x%x, userdata=*0x%x)", cb_func,
|
||||
userdata);
|
||||
sysutil_register_cb([=](ppu_thread& ppu) -> s32
|
||||
{
|
||||
cb_func(ppu, CELL_GAMEUPDATE_RESULT_STATUS_FINISHED, CELL_OK, userdata);
|
||||
|
|
@ -446,9 +502,12 @@ error_code cellGameUpdateCheckFinishAsync(vm::ptr<CellGameUpdateCallback> cb_fun
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellGameUpdateCheckStartWithoutDialogAsync(vm::ptr<CellGameUpdateCallback> cb_func, vm::ptr<void> userdata)
|
||||
error_code cellGameUpdateCheckStartWithoutDialogAsync(
|
||||
vm::ptr<CellGameUpdateCallback> cb_func, vm::ptr<void> userdata)
|
||||
{
|
||||
cellNetCtl.todo("cellGameUpdateCheckStartWithoutDialogAsync(cb_func=*0x%x, userdata=*0x%x)", cb_func, userdata);
|
||||
cellNetCtl.todo("cellGameUpdateCheckStartWithoutDialogAsync(cb_func=*0x%x, "
|
||||
"userdata=*0x%x)",
|
||||
cb_func, userdata);
|
||||
sysutil_register_cb([=](ppu_thread& ppu) -> s32
|
||||
{
|
||||
cb_func(ppu, CELL_GAMEUPDATE_RESULT_STATUS_NO_UPDATE, CELL_OK, userdata);
|
||||
|
|
@ -463,34 +522,55 @@ error_code cellGameUpdateCheckAbort()
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellGameUpdateCheckStartAsyncEx(vm::cptr<CellGameUpdateParam> param, vm::ptr<CellGameUpdateCallbackEx> cb_func, vm::ptr<void> userdata)
|
||||
error_code
|
||||
cellGameUpdateCheckStartAsyncEx(vm::cptr<CellGameUpdateParam> param,
|
||||
vm::ptr<CellGameUpdateCallbackEx> cb_func,
|
||||
vm::ptr<void> userdata)
|
||||
{
|
||||
cellNetCtl.todo("cellGameUpdateCheckStartAsyncEx(param=*0x%x, cb_func=*0x%x, userdata=*0x%x)", param, cb_func, userdata);
|
||||
cellNetCtl.todo("cellGameUpdateCheckStartAsyncEx(param=*0x%x, cb_func=*0x%x, "
|
||||
"userdata=*0x%x)",
|
||||
param, cb_func, userdata);
|
||||
sysutil_register_cb([=](ppu_thread& ppu) -> s32
|
||||
{
|
||||
cb_func(ppu, vm::make_var(CellGameUpdateResult{CELL_GAMEUPDATE_RESULT_STATUS_NO_UPDATE, CELL_OK}), userdata);
|
||||
cb_func(ppu,
|
||||
vm::make_var(CellGameUpdateResult{
|
||||
CELL_GAMEUPDATE_RESULT_STATUS_NO_UPDATE, CELL_OK}),
|
||||
userdata);
|
||||
return CELL_OK;
|
||||
});
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellGameUpdateCheckFinishAsyncEx(vm::ptr<CellGameUpdateCallbackEx> cb_func, vm::ptr<void> userdata)
|
||||
error_code
|
||||
cellGameUpdateCheckFinishAsyncEx(vm::ptr<CellGameUpdateCallbackEx> cb_func,
|
||||
vm::ptr<void> userdata)
|
||||
{
|
||||
cellNetCtl.todo("cellGameUpdateCheckFinishAsyncEx(cb_func=*0x%x, userdata=*0x%x)", cb_func, userdata);
|
||||
cellNetCtl.todo(
|
||||
"cellGameUpdateCheckFinishAsyncEx(cb_func=*0x%x, userdata=*0x%x)",
|
||||
cb_func, userdata);
|
||||
sysutil_register_cb([=](ppu_thread& ppu) -> s32
|
||||
{
|
||||
cb_func(ppu, vm::make_var(CellGameUpdateResult{CELL_GAMEUPDATE_RESULT_STATUS_FINISHED, CELL_OK}), userdata);
|
||||
cb_func(ppu,
|
||||
vm::make_var(CellGameUpdateResult{
|
||||
CELL_GAMEUPDATE_RESULT_STATUS_FINISHED, CELL_OK}),
|
||||
userdata);
|
||||
return CELL_OK;
|
||||
});
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellGameUpdateCheckStartWithoutDialogAsyncEx(vm::ptr<CellGameUpdateCallbackEx> cb_func, vm::ptr<void> userdata)
|
||||
error_code cellGameUpdateCheckStartWithoutDialogAsyncEx(
|
||||
vm::ptr<CellGameUpdateCallbackEx> cb_func, vm::ptr<void> userdata)
|
||||
{
|
||||
cellNetCtl.todo("cellGameUpdateCheckStartWithoutDialogAsyncEx(cb_func=*0x%x, userdata=*0x%x)", cb_func, userdata);
|
||||
cellNetCtl.todo("cellGameUpdateCheckStartWithoutDialogAsyncEx(cb_func=*0x%x, "
|
||||
"userdata=*0x%x)",
|
||||
cb_func, userdata);
|
||||
sysutil_register_cb([=](ppu_thread& ppu) -> s32
|
||||
{
|
||||
cb_func(ppu, vm::make_var(CellGameUpdateResult{CELL_GAMEUPDATE_RESULT_STATUS_NO_UPDATE, CELL_OK}), userdata);
|
||||
cb_func(ppu,
|
||||
vm::make_var(CellGameUpdateResult{
|
||||
CELL_GAMEUPDATE_RESULT_STATUS_NO_UPDATE, CELL_OK}),
|
||||
userdata);
|
||||
return CELL_OK;
|
||||
});
|
||||
return CELL_OK;
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
#include "stdafx.h"
|
||||
#include "Emu/Cell/PPUModule.h"
|
||||
#include "Emu/IdManager.h"
|
||||
#include "Emu/Cell/lv2/sys_fs.h"
|
||||
#include "Emu/IdManager.h"
|
||||
#include "Emu/RSX/Overlays/overlay_media_list_dialog.h"
|
||||
#include "Emu/VFS.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Utilities/StrUtil.h"
|
||||
#include "Emu/VFS.h"
|
||||
#include "cellSysutil.h"
|
||||
#include "stdafx.h"
|
||||
#include "util/StrUtil.h"
|
||||
|
||||
LOG_CHANNEL(cellPhotoImportUtil, "cellPhotoImport");
|
||||
|
||||
|
|
@ -98,7 +98,9 @@ struct CellPhotoImportSetParam
|
|||
vm::bptr<void> reserved2;
|
||||
};
|
||||
|
||||
using CellPhotoImportFinishCallback = void(s32 result, vm::ptr<CellPhotoImportFileData> filedata, vm::ptr<void> userdata);
|
||||
using CellPhotoImportFinishCallback =
|
||||
void(s32 result, vm::ptr<CellPhotoImportFileData> filedata,
|
||||
vm::ptr<void> userdata);
|
||||
|
||||
struct photo_import
|
||||
{
|
||||
|
|
@ -122,9 +124,11 @@ error_code select_photo(std::string dst_dir)
|
|||
return CELL_PHOTO_IMPORT_ERROR_PARAM;
|
||||
}
|
||||
|
||||
if (!dst_dir.starts_with("/dev_hdd0"sv) && !dst_dir.starts_with("/dev_hdd1"sv))
|
||||
if (!dst_dir.starts_with("/dev_hdd0"sv) &&
|
||||
!dst_dir.starts_with("/dev_hdd1"sv))
|
||||
{
|
||||
cellPhotoImportUtil.error("Destination '%s' is not inside dev_hdd0 or dev_hdd1", dst_dir);
|
||||
cellPhotoImportUtil.error(
|
||||
"Destination '%s' is not inside dev_hdd0 or dev_hdd1", dst_dir);
|
||||
return CELL_PHOTO_IMPORT_ERROR_ACCESS_ERROR; // TODO: is this correct?
|
||||
}
|
||||
|
||||
|
|
@ -140,12 +144,15 @@ error_code select_photo(std::string dst_dir)
|
|||
pi_manager.is_busy = true;
|
||||
|
||||
const std::string vfs_dir_path = vfs::get("/dev_hdd0/photo");
|
||||
const std::string title = get_localized_string(localized_string_id::RSX_OVERLAYS_MEDIA_DIALOG_TITLE_PHOTO_IMPORT);
|
||||
const std::string title = get_localized_string(
|
||||
localized_string_id::RSX_OVERLAYS_MEDIA_DIALOG_TITLE_PHOTO_IMPORT);
|
||||
|
||||
error_code error = rsx::overlays::show_media_list_dialog(rsx::overlays::media_list_dialog::media_type::photo, vfs_dir_path, title,
|
||||
error_code error = rsx::overlays::show_media_list_dialog(
|
||||
rsx::overlays::media_list_dialog::media_type::photo, vfs_dir_path, title,
|
||||
[&pi_manager, dst_dir](s32 status, utils::media_info info)
|
||||
{
|
||||
sysutil_register_cb([&pi_manager, dst_dir, info, status](ppu_thread& ppu) -> s32
|
||||
sysutil_register_cb([&pi_manager, dst_dir, info,
|
||||
status](ppu_thread& ppu) -> s32
|
||||
{
|
||||
*g_filedata_sub = {};
|
||||
*g_filedata = {};
|
||||
|
|
@ -158,23 +165,30 @@ error_code select_photo(std::string dst_dir)
|
|||
|
||||
if (!fs::get_stat(info.path, f_info) || f_info.is_directory)
|
||||
{
|
||||
cellPhotoImportUtil.error("Path does not belong to a valid file: '%s'", info.path);
|
||||
result = CELL_PHOTO_IMPORT_ERROR_ACCESS_ERROR; // TODO: is this correct ?
|
||||
cellPhotoImportUtil.error(
|
||||
"Path does not belong to a valid file: '%s'", info.path);
|
||||
result = CELL_PHOTO_IMPORT_ERROR_ACCESS_ERROR; // TODO: is this
|
||||
// correct ?
|
||||
pi_manager.is_busy = false;
|
||||
pi_manager.func_finish(ppu, result, g_filedata, pi_manager.userdata);
|
||||
pi_manager.func_finish(ppu, result, g_filedata,
|
||||
pi_manager.userdata);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
if (f_info.size > pi_manager.param.fileSizeMax)
|
||||
{
|
||||
cellPhotoImportUtil.error("File size is too large: %d (fileSizeMax=%d)", f_info.size, pi_manager.param.fileSizeMax);
|
||||
cellPhotoImportUtil.error(
|
||||
"File size is too large: %d (fileSizeMax=%d)", f_info.size,
|
||||
pi_manager.param.fileSizeMax);
|
||||
result = CELL_PHOTO_IMPORT_ERROR_COPY; // TODO: is this correct ?
|
||||
pi_manager.is_busy = false;
|
||||
pi_manager.func_finish(ppu, result, g_filedata, pi_manager.userdata);
|
||||
pi_manager.func_finish(ppu, result, g_filedata,
|
||||
pi_manager.userdata);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
const std::string filename = info.path.substr(info.path.find_last_of(fs::delim) + 1);
|
||||
const std::string filename =
|
||||
info.path.substr(info.path.find_last_of(fs::delim) + 1);
|
||||
const std::string title = info.get_metadata("title", filename);
|
||||
const std::string dst_path = dst_dir + "/" + filename;
|
||||
std::string sub_type = info.sub_type;
|
||||
|
|
@ -188,8 +202,11 @@ error_code select_photo(std::string dst_dir)
|
|||
g_filedata->data_sub->width = info.width;
|
||||
g_filedata->data_sub->height = info.height;
|
||||
|
||||
cellPhotoImportUtil.notice("Raw image data: filename='%s', title='%s', game='%s', sub_type='%s', width=%d, height=%d, orientation=%d ",
|
||||
filename, title, Emu.GetTitle(), sub_type, info.width, info.height, info.orientation);
|
||||
cellPhotoImportUtil.notice(
|
||||
"Raw image data: filename='%s', title='%s', game='%s', "
|
||||
"sub_type='%s', width=%d, height=%d, orientation=%d ",
|
||||
filename, title, Emu.GetTitle(), sub_type, info.width,
|
||||
info.height, info.orientation);
|
||||
|
||||
// Fallback to extension if necessary
|
||||
if (sub_type.empty())
|
||||
|
|
@ -249,16 +266,26 @@ error_code select_photo(std::string dst_dir)
|
|||
break;
|
||||
}
|
||||
|
||||
cellPhotoImportUtil.notice("Media list dialog: Copying '%s' to '%s'...", info.path, dst_path);
|
||||
cellPhotoImportUtil.notice(
|
||||
"Media list dialog: Copying '%s' to '%s'...", info.path,
|
||||
dst_path);
|
||||
|
||||
if (!fs::copy_file(info.path, dst_path, false))
|
||||
{
|
||||
cellPhotoImportUtil.error("Failed to copy '%s' to '%s'. Error = '%s'", info.path, dst_path, fs::g_tls_error);
|
||||
cellPhotoImportUtil.error(
|
||||
"Failed to copy '%s' to '%s'. Error = '%s'", info.path,
|
||||
dst_path, fs::g_tls_error);
|
||||
result = CELL_PHOTO_IMPORT_ERROR_COPY;
|
||||
}
|
||||
|
||||
cellPhotoImportUtil.notice("Cell image data: dstFileName='%s', photo_title='%s', game_title='%s', format=%d, width=%d, height=%d, rotate=%d ",
|
||||
g_filedata->dstFileName, g_filedata->photo_title, g_filedata->game_title, static_cast<s32>(g_filedata->data_sub->format), g_filedata->data_sub->width, g_filedata->data_sub->height, static_cast<s32>(g_filedata->data_sub->rotate));
|
||||
cellPhotoImportUtil.notice(
|
||||
"Cell image data: dstFileName='%s', photo_title='%s', "
|
||||
"game_title='%s', format=%d, width=%d, height=%d, rotate=%d ",
|
||||
g_filedata->dstFileName, g_filedata->photo_title,
|
||||
g_filedata->game_title,
|
||||
static_cast<s32>(g_filedata->data_sub->format),
|
||||
g_filedata->data_sub->width, g_filedata->data_sub->height,
|
||||
static_cast<s32>(g_filedata->data_sub->rotate));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -279,11 +306,19 @@ error_code select_photo(std::string dst_dir)
|
|||
return error;
|
||||
}
|
||||
|
||||
error_code cellPhotoImport(u32 version, vm::cptr<char> dstHddPath, vm::ptr<CellPhotoImportSetParam> param, u32 container, vm::ptr<CellPhotoImportFinishCallback> funcFinish, vm::ptr<void> userdata)
|
||||
error_code cellPhotoImport(u32 version, vm::cptr<char> dstHddPath,
|
||||
vm::ptr<CellPhotoImportSetParam> param,
|
||||
u32 container,
|
||||
vm::ptr<CellPhotoImportFinishCallback> funcFinish,
|
||||
vm::ptr<void> userdata)
|
||||
{
|
||||
cellPhotoImportUtil.todo("cellPhotoImport(version=0x%x, dstHddPath=%s, param=*0x%x, container=0x%x, funcFinish=*0x%x, userdata=*0x%x)", version, dstHddPath, param, container, funcFinish, userdata);
|
||||
cellPhotoImportUtil.todo(
|
||||
"cellPhotoImport(version=0x%x, dstHddPath=%s, param=*0x%x, "
|
||||
"container=0x%x, funcFinish=*0x%x, userdata=*0x%x)",
|
||||
version, dstHddPath, param, container, funcFinish, userdata);
|
||||
|
||||
if (version != CELL_PHOTO_IMPORT_VERSION_CURRENT || !funcFinish || !param || !dstHddPath)
|
||||
if (version != CELL_PHOTO_IMPORT_VERSION_CURRENT || !funcFinish || !param ||
|
||||
!dstHddPath)
|
||||
{
|
||||
return CELL_PHOTO_IMPORT_ERROR_PARAM;
|
||||
}
|
||||
|
|
@ -308,11 +343,17 @@ error_code cellPhotoImport(u32 version, vm::cptr<char> dstHddPath, vm::ptr<CellP
|
|||
return select_photo(dstHddPath.get_ptr());
|
||||
}
|
||||
|
||||
error_code cellPhotoImport2(u32 version, vm::cptr<char> dstHddPath, vm::ptr<CellPhotoImportSetParam> param, vm::ptr<CellPhotoImportFinishCallback> funcFinish, vm::ptr<void> userdata)
|
||||
error_code cellPhotoImport2(u32 version, vm::cptr<char> dstHddPath,
|
||||
vm::ptr<CellPhotoImportSetParam> param,
|
||||
vm::ptr<CellPhotoImportFinishCallback> funcFinish,
|
||||
vm::ptr<void> userdata)
|
||||
{
|
||||
cellPhotoImportUtil.todo("cellPhotoImport2(version=0x%x, dstHddPath=%s, param=*0x%x, funcFinish=*0x%x, userdata=*0x%x)", version, dstHddPath, param, funcFinish, userdata);
|
||||
cellPhotoImportUtil.todo("cellPhotoImport2(version=0x%x, dstHddPath=%s, "
|
||||
"param=*0x%x, funcFinish=*0x%x, userdata=*0x%x)",
|
||||
version, dstHddPath, param, funcFinish, userdata);
|
||||
|
||||
if (version != CELL_PHOTO_IMPORT_VERSION_CURRENT || !funcFinish || !param || !dstHddPath)
|
||||
if (version != CELL_PHOTO_IMPORT_VERSION_CURRENT || !funcFinish || !param ||
|
||||
!dstHddPath)
|
||||
{
|
||||
return CELL_PHOTO_IMPORT_ERROR_PARAM;
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -3,11 +3,11 @@
|
|||
#include <bitset>
|
||||
#include <string>
|
||||
|
||||
#include "cellSsl.h"
|
||||
#include "Emu/Cell/PPUModule.h"
|
||||
#include "Utilities/File.h"
|
||||
#include "Emu/VFS.h"
|
||||
#include "Emu/IdManager.h"
|
||||
#include "Emu/VFS.h"
|
||||
#include "cellSsl.h"
|
||||
#include "util/File.h"
|
||||
|
||||
#include "cellRtc.h"
|
||||
|
||||
|
|
@ -75,12 +75,14 @@ error_code cellSslGetMemoryInfo()
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
std::string getCert(const std::string& certPath, const int certID, const bool isNormalCert)
|
||||
std::string getCert(const std::string& certPath, const int certID,
|
||||
const bool isNormalCert)
|
||||
{
|
||||
int newID = certID;
|
||||
|
||||
// The 'normal' certs have some special rules for loading.
|
||||
if (isNormalCert && certID >= BaltimoreCert && certID <= GTECyberTrustGlobalCert)
|
||||
if (isNormalCert && certID >= BaltimoreCert &&
|
||||
certID <= GTECyberTrustGlobalCert)
|
||||
{
|
||||
if (certID == BaltimoreCert)
|
||||
newID = GTECyberTrustGlobalCert;
|
||||
|
|
@ -96,15 +98,20 @@ std::string getCert(const std::string& certPath, const int certID, const bool is
|
|||
|
||||
if (!fs::exists(filePath))
|
||||
{
|
||||
cellSsl.error("Can't find certificate file %s, do you have the PS3 firmware installed?", filePath);
|
||||
cellSsl.error("Can't find certificate file %s, do you have the PS3 "
|
||||
"firmware installed?",
|
||||
filePath);
|
||||
return "";
|
||||
}
|
||||
return fs::file(filePath).to_string();
|
||||
}
|
||||
|
||||
error_code cellSslCertificateLoader(u64 flag, vm::ptr<char> buffer, u32 size, vm::ptr<u32> required)
|
||||
error_code cellSslCertificateLoader(u64 flag, vm::ptr<char> buffer, u32 size,
|
||||
vm::ptr<u32> required)
|
||||
{
|
||||
cellSsl.trace("cellSslCertificateLoader(flag=%llu, buffer=*0x%x, size=%zu, required=*0x%x)", flag, buffer, size, required);
|
||||
cellSsl.trace("cellSslCertificateLoader(flag=%llu, buffer=*0x%x, size=%zu, "
|
||||
"required=*0x%x)",
|
||||
flag, buffer, size, required);
|
||||
|
||||
const std::bitset<58> flagBits(flag);
|
||||
const std::string certPath = vfs::get("/dev_flash/data/cert/");
|
||||
|
|
@ -116,7 +123,8 @@ error_code cellSslCertificateLoader(u64 flag, vm::ptr<char> buffer, u32 size, vm
|
|||
{
|
||||
if (!flagBits[i - 1])
|
||||
continue;
|
||||
// If we're loading cert 6 (the baltimore cert), then we need set that we're loading the 'normal' set of certs.
|
||||
// If we're loading cert 6 (the baltimore cert), then we need set that
|
||||
// we're loading the 'normal' set of certs.
|
||||
*required += ::size32(getCert(certPath, i, flagBits[BaltimoreCert - 1]));
|
||||
}
|
||||
}
|
||||
|
|
@ -127,7 +135,8 @@ error_code cellSslCertificateLoader(u64 flag, vm::ptr<char> buffer, u32 size, vm
|
|||
{
|
||||
if (!flagBits[i - 1])
|
||||
continue;
|
||||
// If we're loading cert 6 (the baltimore cert), then we need set that we're loading the 'normal' set of certs.
|
||||
// If we're loading cert 6 (the baltimore cert), then we need set that
|
||||
// we're loading the 'normal' set of certs.
|
||||
final.append(getCert(certPath, i, flagBits[BaltimoreCert - 1]));
|
||||
}
|
||||
|
||||
|
|
@ -138,9 +147,13 @@ error_code cellSslCertificateLoader(u64 flag, vm::ptr<char> buffer, u32 size, vm
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSslCertGetSerialNumber(vm::cptr<void> sslCert, vm::cpptr<u8> sboData, vm::ptr<u64> sboLength)
|
||||
error_code cellSslCertGetSerialNumber(vm::cptr<void> sslCert,
|
||||
vm::cpptr<u8> sboData,
|
||||
vm::ptr<u64> sboLength)
|
||||
{
|
||||
cellSsl.todo("cellSslCertGetSerialNumber(sslCert=*0x%x, sboData=**0x%x, sboLength=*0x%x)", sslCert, sboData, sboLength);
|
||||
cellSsl.todo("cellSslCertGetSerialNumber(sslCert=*0x%x, sboData=**0x%x, "
|
||||
"sboLength=*0x%x)",
|
||||
sslCert, sboData, sboLength);
|
||||
|
||||
if (!g_fxo->get<ssl_manager>().is_init)
|
||||
return CELL_SSL_ERROR_NOT_INITIALIZED;
|
||||
|
|
@ -154,9 +167,13 @@ error_code cellSslCertGetSerialNumber(vm::cptr<void> sslCert, vm::cpptr<u8> sboD
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSslCertGetPublicKey(vm::cptr<void> sslCert, vm::cpptr<u8> sboData, vm::ptr<u64> sboLength)
|
||||
error_code cellSslCertGetPublicKey(vm::cptr<void> sslCert,
|
||||
vm::cpptr<u8> sboData,
|
||||
vm::ptr<u64> sboLength)
|
||||
{
|
||||
cellSsl.todo("cellSslCertGetPublicKey(sslCert=*0x%x, sboData=**0x%x, sboLength=*0x%x)", sslCert, sboData, sboLength);
|
||||
cellSsl.todo(
|
||||
"cellSslCertGetPublicKey(sslCert=*0x%x, sboData=**0x%x, sboLength=*0x%x)",
|
||||
sslCert, sboData, sboLength);
|
||||
|
||||
if (!g_fxo->get<ssl_manager>().is_init)
|
||||
return CELL_SSL_ERROR_NOT_INITIALIZED;
|
||||
|
|
@ -170,9 +187,13 @@ error_code cellSslCertGetPublicKey(vm::cptr<void> sslCert, vm::cpptr<u8> sboData
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSslCertGetRsaPublicKeyModulus(vm::cptr<void> sslCert, vm::cpptr<u8> sboData, vm::ptr<u64> sboLength)
|
||||
error_code cellSslCertGetRsaPublicKeyModulus(vm::cptr<void> sslCert,
|
||||
vm::cpptr<u8> sboData,
|
||||
vm::ptr<u64> sboLength)
|
||||
{
|
||||
cellSsl.todo("cellSslCertGetRsaPublicKeyModulus(sslCert=*0x%x, sboData=**0x%x, sboLength=*0x%x)", sslCert, sboData, sboLength);
|
||||
cellSsl.todo("cellSslCertGetRsaPublicKeyModulus(sslCert=*0x%x, "
|
||||
"sboData=**0x%x, sboLength=*0x%x)",
|
||||
sslCert, sboData, sboLength);
|
||||
|
||||
if (!g_fxo->get<ssl_manager>().is_init)
|
||||
return CELL_SSL_ERROR_NOT_INITIALIZED;
|
||||
|
|
@ -186,9 +207,13 @@ error_code cellSslCertGetRsaPublicKeyModulus(vm::cptr<void> sslCert, vm::cpptr<u
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSslCertGetRsaPublicKeyExponent(vm::cptr<void> sslCert, vm::cpptr<u8> sboData, vm::ptr<u64> sboLength)
|
||||
error_code cellSslCertGetRsaPublicKeyExponent(vm::cptr<void> sslCert,
|
||||
vm::cpptr<u8> sboData,
|
||||
vm::ptr<u64> sboLength)
|
||||
{
|
||||
cellSsl.todo("cellSslCertGetRsaPublicKeyExponent(sslCert=*0x%x, sboData=**0x%x, sboLength=*0x%x)", sslCert, sboData, sboLength);
|
||||
cellSsl.todo("cellSslCertGetRsaPublicKeyExponent(sslCert=*0x%x, "
|
||||
"sboData=**0x%x, sboLength=*0x%x)",
|
||||
sslCert, sboData, sboLength);
|
||||
|
||||
if (!g_fxo->get<ssl_manager>().is_init)
|
||||
return CELL_SSL_ERROR_NOT_INITIALIZED;
|
||||
|
|
@ -202,9 +227,11 @@ error_code cellSslCertGetRsaPublicKeyExponent(vm::cptr<void> sslCert, vm::cpptr<
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSslCertGetNotBefore(vm::cptr<void> sslCert, vm::ptr<CellRtcTick> begin)
|
||||
error_code cellSslCertGetNotBefore(vm::cptr<void> sslCert,
|
||||
vm::ptr<CellRtcTick> begin)
|
||||
{
|
||||
cellSsl.todo("cellSslCertGetNotBefore(sslCert=*0x%x, begin=*0x%x)", sslCert, begin);
|
||||
cellSsl.todo("cellSslCertGetNotBefore(sslCert=*0x%x, begin=*0x%x)", sslCert,
|
||||
begin);
|
||||
|
||||
if (!g_fxo->get<ssl_manager>().is_init)
|
||||
return CELL_SSL_ERROR_NOT_INITIALIZED;
|
||||
|
|
@ -218,9 +245,11 @@ error_code cellSslCertGetNotBefore(vm::cptr<void> sslCert, vm::ptr<CellRtcTick>
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSslCertGetNotAfter(vm::cptr<void> sslCert, vm::ptr<CellRtcTick> limit)
|
||||
error_code cellSslCertGetNotAfter(vm::cptr<void> sslCert,
|
||||
vm::ptr<CellRtcTick> limit)
|
||||
{
|
||||
cellSsl.todo("cellSslCertGetNotAfter(sslCert=*0x%x, limit=*0x%x)", sslCert, limit);
|
||||
cellSsl.todo("cellSslCertGetNotAfter(sslCert=*0x%x, limit=*0x%x)", sslCert,
|
||||
limit);
|
||||
|
||||
if (!g_fxo->get<ssl_manager>().is_init)
|
||||
return CELL_SSL_ERROR_NOT_INITIALIZED;
|
||||
|
|
@ -234,9 +263,11 @@ error_code cellSslCertGetNotAfter(vm::cptr<void> sslCert, vm::ptr<CellRtcTick> l
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSslCertGetSubjectName(vm::cptr<void> sslCert, vm::cpptr<void> certName)
|
||||
error_code cellSslCertGetSubjectName(vm::cptr<void> sslCert,
|
||||
vm::cpptr<void> certName)
|
||||
{
|
||||
cellSsl.todo("cellSslCertGetSubjectName(sslCert=*0x%x, certName=**0x%x)", sslCert, certName);
|
||||
cellSsl.todo("cellSslCertGetSubjectName(sslCert=*0x%x, certName=**0x%x)",
|
||||
sslCert, certName);
|
||||
|
||||
if (!g_fxo->get<ssl_manager>().is_init)
|
||||
return CELL_SSL_ERROR_NOT_INITIALIZED;
|
||||
|
|
@ -250,9 +281,11 @@ error_code cellSslCertGetSubjectName(vm::cptr<void> sslCert, vm::cpptr<void> cer
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSslCertGetIssuerName(vm::cptr<void> sslCert, vm::cpptr<void> certName)
|
||||
error_code cellSslCertGetIssuerName(vm::cptr<void> sslCert,
|
||||
vm::cpptr<void> certName)
|
||||
{
|
||||
cellSsl.todo("cellSslCertGetIssuerName(sslCert=*0x%x, certName=**0x%x)", sslCert, certName);
|
||||
cellSsl.todo("cellSslCertGetIssuerName(sslCert=*0x%x, certName=**0x%x)",
|
||||
sslCert, certName);
|
||||
|
||||
if (!g_fxo->get<ssl_manager>().is_init)
|
||||
return CELL_SSL_ERROR_NOT_INITIALIZED;
|
||||
|
|
@ -266,9 +299,11 @@ error_code cellSslCertGetIssuerName(vm::cptr<void> sslCert, vm::cpptr<void> cert
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSslCertGetNameEntryCount(vm::cptr<void> certName, vm::ptr<u32> entryCount)
|
||||
error_code cellSslCertGetNameEntryCount(vm::cptr<void> certName,
|
||||
vm::ptr<u32> entryCount)
|
||||
{
|
||||
cellSsl.todo("cellSslCertGetNameEntryCount(certName=*0x%x, entryCount=*0x%x)", certName, entryCount);
|
||||
cellSsl.todo("cellSslCertGetNameEntryCount(certName=*0x%x, entryCount=*0x%x)",
|
||||
certName, entryCount);
|
||||
|
||||
if (!g_fxo->get<ssl_manager>().is_init)
|
||||
return CELL_SSL_ERROR_NOT_INITIALIZED;
|
||||
|
|
@ -282,9 +317,14 @@ error_code cellSslCertGetNameEntryCount(vm::cptr<void> certName, vm::ptr<u32> en
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSslCertGetNameEntryInfo(vm::cptr<void> certName, u32 entryNum, vm::cpptr<char> oidName, vm::cpptr<u8> value, vm::ptr<u64> valueLength, s32 flag)
|
||||
error_code cellSslCertGetNameEntryInfo(vm::cptr<void> certName, u32 entryNum,
|
||||
vm::cpptr<char> oidName,
|
||||
vm::cpptr<u8> value,
|
||||
vm::ptr<u64> valueLength, s32 flag)
|
||||
{
|
||||
cellSsl.todo("cellSslCertGetNameEntryInfo(certName=*0x%x, entryNum=%d, oidName=**0x%x, value=**0x%x, valueLength=*0x%x, flag=0x%x)", certName, entryNum, oidName, value, valueLength, flag);
|
||||
cellSsl.todo("cellSslCertGetNameEntryInfo(certName=*0x%x, entryNum=%d, "
|
||||
"oidName=**0x%x, value=**0x%x, valueLength=*0x%x, flag=0x%x)",
|
||||
certName, entryNum, oidName, value, valueLength, flag);
|
||||
|
||||
if (!g_fxo->get<ssl_manager>().is_init)
|
||||
return CELL_SSL_ERROR_NOT_INITIALIZED;
|
||||
|
|
@ -298,9 +338,12 @@ error_code cellSslCertGetNameEntryInfo(vm::cptr<void> certName, u32 entryNum, vm
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSslCertGetMd5Fingerprint(vm::cptr<void> sslCert, vm::cptr<u8> buf, vm::cptr<u32> plen)
|
||||
error_code cellSslCertGetMd5Fingerprint(vm::cptr<void> sslCert,
|
||||
vm::cptr<u8> buf, vm::cptr<u32> plen)
|
||||
{
|
||||
cellSsl.todo("cellSslCertGetMd5Fingerprint(sslCert=*0x%x, buf=*0x%x, plen=*0x%x)", sslCert, buf, plen);
|
||||
cellSsl.todo(
|
||||
"cellSslCertGetMd5Fingerprint(sslCert=*0x%x, buf=*0x%x, plen=*0x%x)",
|
||||
sslCert, buf, plen);
|
||||
|
||||
if (!g_fxo->get<ssl_manager>().is_init)
|
||||
return CELL_SSL_ERROR_NOT_INITIALIZED;
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
#include "stdafx.h"
|
||||
#include "Emu/Cell/PPUModule.h"
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "cellSync2.h"
|
||||
|
||||
#include "Utilities/StrUtil.h"
|
||||
#include "util/StrUtil.h"
|
||||
|
||||
LOG_CHANNEL(cellSync2);
|
||||
|
||||
|
|
@ -39,17 +39,22 @@ void fmt_class_string<CellSync2Error>::format(std::string& out, u64 arg)
|
|||
});
|
||||
}
|
||||
|
||||
error_code _cellSync2MutexAttributeInitialize(vm::ptr<CellSync2MutexAttribute> attr, u32 sdkVersion)
|
||||
error_code
|
||||
_cellSync2MutexAttributeInitialize(vm::ptr<CellSync2MutexAttribute> attr,
|
||||
u32 sdkVersion)
|
||||
{
|
||||
cellSync2.warning("_cellSync2MutexAttributeInitialize(attr=*0x%x, sdkVersion=0x%x)", attr, sdkVersion);
|
||||
cellSync2.warning(
|
||||
"_cellSync2MutexAttributeInitialize(attr=*0x%x, sdkVersion=0x%x)", attr,
|
||||
sdkVersion);
|
||||
|
||||
if (!attr)
|
||||
return CELL_SYNC2_ERROR_NULL_POINTER;
|
||||
|
||||
attr->sdkVersion = sdkVersion;
|
||||
attr->threadTypes = CELL_SYNC2_THREAD_TYPE_PPU_THREAD | CELL_SYNC2_THREAD_TYPE_PPU_FIBER |
|
||||
CELL_SYNC2_THREAD_TYPE_SPURS_TASK | CELL_SYNC2_THREAD_TYPE_SPURS_JOB |
|
||||
CELL_SYNC2_THREAD_TYPE_SPURS_JOBQUEUE_JOB;
|
||||
attr->threadTypes =
|
||||
CELL_SYNC2_THREAD_TYPE_PPU_THREAD | CELL_SYNC2_THREAD_TYPE_PPU_FIBER |
|
||||
CELL_SYNC2_THREAD_TYPE_SPURS_TASK | CELL_SYNC2_THREAD_TYPE_SPURS_JOB |
|
||||
CELL_SYNC2_THREAD_TYPE_SPURS_JOBQUEUE_JOB;
|
||||
attr->maxWaiters = 15;
|
||||
attr->recursive = false;
|
||||
strcpy_trunc(attr->name, "CellSync2Mutex");
|
||||
|
|
@ -57,9 +62,13 @@ error_code _cellSync2MutexAttributeInitialize(vm::ptr<CellSync2MutexAttribute> a
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSync2MutexEstimateBufferSize(vm::cptr<CellSync2MutexAttribute> attr, vm::ptr<u32> bufferSize)
|
||||
error_code
|
||||
cellSync2MutexEstimateBufferSize(vm::cptr<CellSync2MutexAttribute> attr,
|
||||
vm::ptr<u32> bufferSize)
|
||||
{
|
||||
cellSync2.todo("cellSync2MutexEstimateBufferSize(attr=*0x%x, bufferSize=*0x%x)", attr, bufferSize);
|
||||
cellSync2.todo(
|
||||
"cellSync2MutexEstimateBufferSize(attr=*0x%x, bufferSize=*0x%x)", attr,
|
||||
bufferSize);
|
||||
|
||||
if (!attr || !bufferSize)
|
||||
return CELL_SYNC2_ERROR_NULL_POINTER;
|
||||
|
|
@ -70,9 +79,13 @@ error_code cellSync2MutexEstimateBufferSize(vm::cptr<CellSync2MutexAttribute> at
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSync2MutexInitialize(vm::ptr<CellSync2Mutex> mutex, vm::ptr<void> buffer, vm::cptr<CellSync2MutexAttribute> attr)
|
||||
error_code cellSync2MutexInitialize(vm::ptr<CellSync2Mutex> mutex,
|
||||
vm::ptr<void> buffer,
|
||||
vm::cptr<CellSync2MutexAttribute> attr)
|
||||
{
|
||||
cellSync2.todo("cellSync2MutexInitialize(mutex=*0x%x, buffer=*0x%x, attr=*0x%x)", mutex, buffer, attr);
|
||||
cellSync2.todo(
|
||||
"cellSync2MutexInitialize(mutex=*0x%x, buffer=*0x%x, attr=*0x%x)", mutex,
|
||||
buffer, attr);
|
||||
|
||||
if (!mutex || !attr)
|
||||
return CELL_SYNC2_ERROR_NULL_POINTER;
|
||||
|
|
@ -96,9 +109,11 @@ error_code cellSync2MutexFinalize(vm::ptr<CellSync2Mutex> mutex)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSync2MutexLock(vm::ptr<CellSync2Mutex> mutex, vm::cptr<CellSync2ThreadConfig> config)
|
||||
error_code cellSync2MutexLock(vm::ptr<CellSync2Mutex> mutex,
|
||||
vm::cptr<CellSync2ThreadConfig> config)
|
||||
{
|
||||
cellSync2.todo("cellSync2MutexLock(mutex=*0x%x, config=*0x%x)", mutex, config);
|
||||
cellSync2.todo("cellSync2MutexLock(mutex=*0x%x, config=*0x%x)", mutex,
|
||||
config);
|
||||
|
||||
if (!mutex)
|
||||
return CELL_SYNC2_ERROR_NULL_POINTER;
|
||||
|
|
@ -106,9 +121,11 @@ error_code cellSync2MutexLock(vm::ptr<CellSync2Mutex> mutex, vm::cptr<CellSync2T
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSync2MutexTryLock(vm::ptr<CellSync2Mutex> mutex, vm::cptr<CellSync2ThreadConfig> config)
|
||||
error_code cellSync2MutexTryLock(vm::ptr<CellSync2Mutex> mutex,
|
||||
vm::cptr<CellSync2ThreadConfig> config)
|
||||
{
|
||||
cellSync2.todo("cellSync2MutexTryLock(mutex=*0x%x, config=*0x%x)", mutex, config);
|
||||
cellSync2.todo("cellSync2MutexTryLock(mutex=*0x%x, config=*0x%x)", mutex,
|
||||
config);
|
||||
|
||||
if (!mutex)
|
||||
return CELL_SYNC2_ERROR_NULL_POINTER;
|
||||
|
|
@ -116,9 +133,11 @@ error_code cellSync2MutexTryLock(vm::ptr<CellSync2Mutex> mutex, vm::cptr<CellSyn
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSync2MutexUnlock(vm::ptr<CellSync2Mutex> mutex, vm::cptr<CellSync2ThreadConfig> config)
|
||||
error_code cellSync2MutexUnlock(vm::ptr<CellSync2Mutex> mutex,
|
||||
vm::cptr<CellSync2ThreadConfig> config)
|
||||
{
|
||||
cellSync2.todo("cellSync2MutexUnlock(mutex=*0x%x, config=*0x%x)", mutex, config);
|
||||
cellSync2.todo("cellSync2MutexUnlock(mutex=*0x%x, config=*0x%x)", mutex,
|
||||
config);
|
||||
|
||||
if (!mutex)
|
||||
return CELL_SYNC2_ERROR_NULL_POINTER;
|
||||
|
|
@ -126,9 +145,13 @@ error_code cellSync2MutexUnlock(vm::ptr<CellSync2Mutex> mutex, vm::cptr<CellSync
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code _cellSync2CondAttributeInitialize(vm::ptr<CellSync2CondAttribute> attr, u32 sdkVersion)
|
||||
error_code
|
||||
_cellSync2CondAttributeInitialize(vm::ptr<CellSync2CondAttribute> attr,
|
||||
u32 sdkVersion)
|
||||
{
|
||||
cellSync2.warning("_cellSync2CondAttributeInitialize(attr=*0x%x, sdkVersion=0x%x)", attr, sdkVersion);
|
||||
cellSync2.warning(
|
||||
"_cellSync2CondAttributeInitialize(attr=*0x%x, sdkVersion=0x%x)", attr,
|
||||
sdkVersion);
|
||||
|
||||
if (!attr)
|
||||
return CELL_SYNC2_ERROR_NULL_POINTER;
|
||||
|
|
@ -140,9 +163,13 @@ error_code _cellSync2CondAttributeInitialize(vm::ptr<CellSync2CondAttribute> att
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSync2CondEstimateBufferSize(vm::cptr<CellSync2CondAttribute> attr, vm::ptr<u32> bufferSize)
|
||||
error_code
|
||||
cellSync2CondEstimateBufferSize(vm::cptr<CellSync2CondAttribute> attr,
|
||||
vm::ptr<u32> bufferSize)
|
||||
{
|
||||
cellSync2.todo("cellSync2CondEstimateBufferSize(attr=*0x%x, bufferSize=*0x%x)", attr, bufferSize);
|
||||
cellSync2.todo(
|
||||
"cellSync2CondEstimateBufferSize(attr=*0x%x, bufferSize=*0x%x)", attr,
|
||||
bufferSize);
|
||||
|
||||
if (!attr || !bufferSize)
|
||||
return CELL_SYNC2_ERROR_NULL_POINTER;
|
||||
|
|
@ -153,9 +180,14 @@ error_code cellSync2CondEstimateBufferSize(vm::cptr<CellSync2CondAttribute> attr
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSync2CondInitialize(vm::ptr<CellSync2Cond> cond, vm::ptr<CellSync2Mutex> mutex, vm::ptr<void> buffer, vm::cptr<CellSync2CondAttribute> attr)
|
||||
error_code cellSync2CondInitialize(vm::ptr<CellSync2Cond> cond,
|
||||
vm::ptr<CellSync2Mutex> mutex,
|
||||
vm::ptr<void> buffer,
|
||||
vm::cptr<CellSync2CondAttribute> attr)
|
||||
{
|
||||
cellSync2.todo("cellSync2CondInitialize(cond=*0x%x, mutex=*0x%x, buffer=*0x%x, attr=*0x%x)", cond, mutex, buffer, attr);
|
||||
cellSync2.todo("cellSync2CondInitialize(cond=*0x%x, mutex=*0x%x, "
|
||||
"buffer=*0x%x, attr=*0x%x)",
|
||||
cond, mutex, buffer, attr);
|
||||
|
||||
if (!cond || !mutex || !buffer || !attr)
|
||||
return CELL_SYNC2_ERROR_NULL_POINTER;
|
||||
|
|
@ -176,7 +208,8 @@ error_code cellSync2CondFinalize(vm::ptr<CellSync2Cond> cond)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSync2CondWait(vm::ptr<CellSync2Cond> cond, vm::cptr<CellSync2ThreadConfig> config)
|
||||
error_code cellSync2CondWait(vm::ptr<CellSync2Cond> cond,
|
||||
vm::cptr<CellSync2ThreadConfig> config)
|
||||
{
|
||||
cellSync2.todo("cellSync2CondWait(cond=*0x%x, config=*0x%x)", cond, config);
|
||||
|
||||
|
|
@ -186,7 +219,8 @@ error_code cellSync2CondWait(vm::ptr<CellSync2Cond> cond, vm::cptr<CellSync2Thre
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSync2CondSignal(vm::ptr<CellSync2Cond> cond, vm::cptr<CellSync2ThreadConfig> config)
|
||||
error_code cellSync2CondSignal(vm::ptr<CellSync2Cond> cond,
|
||||
vm::cptr<CellSync2ThreadConfig> config)
|
||||
{
|
||||
cellSync2.todo("cellSync2CondSignal(cond=*0x%x, config=*0x%x)", cond, config);
|
||||
|
||||
|
|
@ -196,9 +230,11 @@ error_code cellSync2CondSignal(vm::ptr<CellSync2Cond> cond, vm::cptr<CellSync2Th
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSync2CondSignalAll(vm::ptr<CellSync2Cond> cond, vm::cptr<CellSync2ThreadConfig> config)
|
||||
error_code cellSync2CondSignalAll(vm::ptr<CellSync2Cond> cond,
|
||||
vm::cptr<CellSync2ThreadConfig> config)
|
||||
{
|
||||
cellSync2.todo("cellSync2CondSignalAll(cond=*0x%x, config=*0x%x)", cond, config);
|
||||
cellSync2.todo("cellSync2CondSignalAll(cond=*0x%x, config=*0x%x)", cond,
|
||||
config);
|
||||
|
||||
if (!cond)
|
||||
return CELL_SYNC2_ERROR_NULL_POINTER;
|
||||
|
|
@ -206,26 +242,34 @@ error_code cellSync2CondSignalAll(vm::ptr<CellSync2Cond> cond, vm::cptr<CellSync
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code _cellSync2SemaphoreAttributeInitialize(vm::ptr<CellSync2SemaphoreAttribute> attr, u32 sdkVersion)
|
||||
error_code _cellSync2SemaphoreAttributeInitialize(
|
||||
vm::ptr<CellSync2SemaphoreAttribute> attr, u32 sdkVersion)
|
||||
{
|
||||
cellSync2.warning("_cellSync2SemaphoreAttributeInitialize(attr=*0x%x, sdkVersion=0x%x)", attr, sdkVersion);
|
||||
cellSync2.warning(
|
||||
"_cellSync2SemaphoreAttributeInitialize(attr=*0x%x, sdkVersion=0x%x)",
|
||||
attr, sdkVersion);
|
||||
|
||||
if (!attr)
|
||||
return CELL_SYNC2_ERROR_NULL_POINTER;
|
||||
|
||||
attr->sdkVersion = sdkVersion;
|
||||
attr->threadTypes = CELL_SYNC2_THREAD_TYPE_PPU_THREAD | CELL_SYNC2_THREAD_TYPE_PPU_FIBER |
|
||||
CELL_SYNC2_THREAD_TYPE_SPURS_TASK | CELL_SYNC2_THREAD_TYPE_SPURS_JOB |
|
||||
CELL_SYNC2_THREAD_TYPE_SPURS_JOBQUEUE_JOB;
|
||||
attr->threadTypes =
|
||||
CELL_SYNC2_THREAD_TYPE_PPU_THREAD | CELL_SYNC2_THREAD_TYPE_PPU_FIBER |
|
||||
CELL_SYNC2_THREAD_TYPE_SPURS_TASK | CELL_SYNC2_THREAD_TYPE_SPURS_JOB |
|
||||
CELL_SYNC2_THREAD_TYPE_SPURS_JOBQUEUE_JOB;
|
||||
attr->maxWaiters = 1;
|
||||
strcpy_trunc(attr->name, "CellSync2Semaphore");
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSync2SemaphoreEstimateBufferSize(vm::cptr<CellSync2SemaphoreAttribute> attr, vm::ptr<u32> bufferSize)
|
||||
error_code
|
||||
cellSync2SemaphoreEstimateBufferSize(vm::cptr<CellSync2SemaphoreAttribute> attr,
|
||||
vm::ptr<u32> bufferSize)
|
||||
{
|
||||
cellSync2.todo("cellSync2SemaphoreEstimateBufferSize(attr=*0x%x, bufferSize=*0x%x)", attr, bufferSize);
|
||||
cellSync2.todo(
|
||||
"cellSync2SemaphoreEstimateBufferSize(attr=*0x%x, bufferSize=*0x%x)",
|
||||
attr, bufferSize);
|
||||
|
||||
if (!attr || !bufferSize)
|
||||
return CELL_SYNC2_ERROR_NULL_POINTER;
|
||||
|
|
@ -236,14 +280,20 @@ error_code cellSync2SemaphoreEstimateBufferSize(vm::cptr<CellSync2SemaphoreAttri
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSync2SemaphoreInitialize(vm::ptr<CellSync2Semaphore> semaphore, vm::ptr<void> buffer, s32 initialValue, vm::cptr<CellSync2SemaphoreAttribute> attr)
|
||||
error_code
|
||||
cellSync2SemaphoreInitialize(vm::ptr<CellSync2Semaphore> semaphore,
|
||||
vm::ptr<void> buffer, s32 initialValue,
|
||||
vm::cptr<CellSync2SemaphoreAttribute> attr)
|
||||
{
|
||||
cellSync2.todo("cellSync2SemaphoreInitialize(semaphore=*0x%x, buffer=*0x%x, initialValue=0x%x, attr=*0x%x)", semaphore, buffer, initialValue, attr);
|
||||
cellSync2.todo("cellSync2SemaphoreInitialize(semaphore=*0x%x, buffer=*0x%x, "
|
||||
"initialValue=0x%x, attr=*0x%x)",
|
||||
semaphore, buffer, initialValue, attr);
|
||||
|
||||
if (!semaphore || !attr || ((attr->maxWaiters >= 2) && !buffer))
|
||||
return CELL_SYNC2_ERROR_NULL_POINTER;
|
||||
|
||||
if ((initialValue > s32{0x7FFFFF}) || (initialValue < s32{-0x800000}) || (attr->maxWaiters == 0) || ((attr->maxWaiters == 1) && buffer))
|
||||
if ((initialValue > s32{0x7FFFFF}) || (initialValue < s32{-0x800000}) ||
|
||||
(attr->maxWaiters == 0) || ((attr->maxWaiters == 1) && buffer))
|
||||
return CELL_SYNC2_ERROR_INVAL;
|
||||
|
||||
return CELL_OK;
|
||||
|
|
@ -259,9 +309,13 @@ error_code cellSync2SemaphoreFinalize(vm::ptr<CellSync2Semaphore> semaphore)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSync2SemaphoreAcquire(vm::ptr<CellSync2Semaphore> semaphore, u32 count, vm::cptr<CellSync2ThreadConfig> config)
|
||||
error_code cellSync2SemaphoreAcquire(vm::ptr<CellSync2Semaphore> semaphore,
|
||||
u32 count,
|
||||
vm::cptr<CellSync2ThreadConfig> config)
|
||||
{
|
||||
cellSync2.todo("cellSync2SemaphoreAcquire(semaphore=*0x%x, count=0x%x, config=*0x%x)", semaphore, count, config);
|
||||
cellSync2.todo(
|
||||
"cellSync2SemaphoreAcquire(semaphore=*0x%x, count=0x%x, config=*0x%x)",
|
||||
semaphore, count, config);
|
||||
|
||||
if (!semaphore)
|
||||
return CELL_SYNC2_ERROR_NULL_POINTER;
|
||||
|
|
@ -272,9 +326,13 @@ error_code cellSync2SemaphoreAcquire(vm::ptr<CellSync2Semaphore> semaphore, u32
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSync2SemaphoreTryAcquire(vm::ptr<CellSync2Semaphore> semaphore, u32 count, vm::cptr<CellSync2ThreadConfig> config)
|
||||
error_code
|
||||
cellSync2SemaphoreTryAcquire(vm::ptr<CellSync2Semaphore> semaphore, u32 count,
|
||||
vm::cptr<CellSync2ThreadConfig> config)
|
||||
{
|
||||
cellSync2.todo("cellSync2SemaphoreTryAcquire(semaphore=*0x%x, count=0x%x, config=*0x%x)", semaphore, count, config);
|
||||
cellSync2.todo(
|
||||
"cellSync2SemaphoreTryAcquire(semaphore=*0x%x, count=0x%x, config=*0x%x)",
|
||||
semaphore, count, config);
|
||||
|
||||
if (!semaphore)
|
||||
return CELL_SYNC2_ERROR_NULL_POINTER;
|
||||
|
|
@ -285,9 +343,13 @@ error_code cellSync2SemaphoreTryAcquire(vm::ptr<CellSync2Semaphore> semaphore, u
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSync2SemaphoreRelease(vm::ptr<CellSync2Semaphore> semaphore, u32 count, vm::cptr<CellSync2ThreadConfig> config)
|
||||
error_code cellSync2SemaphoreRelease(vm::ptr<CellSync2Semaphore> semaphore,
|
||||
u32 count,
|
||||
vm::cptr<CellSync2ThreadConfig> config)
|
||||
{
|
||||
cellSync2.todo("cellSync2SemaphoreRelease(semaphore=*0x%x, count=0x%x, config=*0x%x)", semaphore, count, config);
|
||||
cellSync2.todo(
|
||||
"cellSync2SemaphoreRelease(semaphore=*0x%x, count=0x%x, config=*0x%x)",
|
||||
semaphore, count, config);
|
||||
|
||||
if (!semaphore)
|
||||
return CELL_SYNC2_ERROR_NULL_POINTER;
|
||||
|
|
@ -298,9 +360,11 @@ error_code cellSync2SemaphoreRelease(vm::ptr<CellSync2Semaphore> semaphore, u32
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSync2SemaphoreGetCount(vm::ptr<CellSync2Semaphore> semaphore, vm::ptr<s32> count)
|
||||
error_code cellSync2SemaphoreGetCount(vm::ptr<CellSync2Semaphore> semaphore,
|
||||
vm::ptr<s32> count)
|
||||
{
|
||||
cellSync2.todo("cellSync2SemaphoreGetCount(semaphore=*0x%x, count=*0x%x)", semaphore, count);
|
||||
cellSync2.todo("cellSync2SemaphoreGetCount(semaphore=*0x%x, count=*0x%x)",
|
||||
semaphore, count);
|
||||
|
||||
if (!semaphore || !count)
|
||||
return CELL_SYNC2_ERROR_NULL_POINTER;
|
||||
|
|
@ -308,17 +372,22 @@ error_code cellSync2SemaphoreGetCount(vm::ptr<CellSync2Semaphore> semaphore, vm:
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code _cellSync2QueueAttributeInitialize(vm::ptr<CellSync2QueueAttribute> attr, u32 sdkVersion)
|
||||
error_code
|
||||
_cellSync2QueueAttributeInitialize(vm::ptr<CellSync2QueueAttribute> attr,
|
||||
u32 sdkVersion)
|
||||
{
|
||||
cellSync2.warning("_cellSync2QueueAttributeInitialize(attr=*0x%x, sdkVersion=0x%x)", attr, sdkVersion);
|
||||
cellSync2.warning(
|
||||
"_cellSync2QueueAttributeInitialize(attr=*0x%x, sdkVersion=0x%x)", attr,
|
||||
sdkVersion);
|
||||
|
||||
if (!attr)
|
||||
return CELL_SYNC2_ERROR_NULL_POINTER;
|
||||
|
||||
attr->sdkVersion = sdkVersion;
|
||||
attr->threadTypes = CELL_SYNC2_THREAD_TYPE_PPU_THREAD | CELL_SYNC2_THREAD_TYPE_PPU_FIBER |
|
||||
CELL_SYNC2_THREAD_TYPE_SPURS_TASK | CELL_SYNC2_THREAD_TYPE_SPURS_JOB |
|
||||
CELL_SYNC2_THREAD_TYPE_SPURS_JOBQUEUE_JOB;
|
||||
attr->threadTypes =
|
||||
CELL_SYNC2_THREAD_TYPE_PPU_THREAD | CELL_SYNC2_THREAD_TYPE_PPU_FIBER |
|
||||
CELL_SYNC2_THREAD_TYPE_SPURS_TASK | CELL_SYNC2_THREAD_TYPE_SPURS_JOB |
|
||||
CELL_SYNC2_THREAD_TYPE_SPURS_JOBQUEUE_JOB;
|
||||
attr->elementSize = 16;
|
||||
attr->depth = 1024;
|
||||
attr->maxPushWaiters = 15;
|
||||
|
|
@ -328,29 +397,41 @@ error_code _cellSync2QueueAttributeInitialize(vm::ptr<CellSync2QueueAttribute> a
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSync2QueueEstimateBufferSize(vm::cptr<CellSync2QueueAttribute> attr, vm::ptr<u32> bufferSize)
|
||||
error_code
|
||||
cellSync2QueueEstimateBufferSize(vm::cptr<CellSync2QueueAttribute> attr,
|
||||
vm::ptr<u32> bufferSize)
|
||||
{
|
||||
cellSync2.todo("cellSync2QueueEstimateBufferSize(attr=*0x%x, bufferSize=*0x%x)", attr, bufferSize);
|
||||
cellSync2.todo(
|
||||
"cellSync2QueueEstimateBufferSize(attr=*0x%x, bufferSize=*0x%x)", attr,
|
||||
bufferSize);
|
||||
|
||||
if (!attr || !bufferSize)
|
||||
return CELL_SYNC2_ERROR_NULL_POINTER;
|
||||
|
||||
if (attr->elementSize == 0u || attr->elementSize > 0x4000u || attr->elementSize % 16u || attr->depth == 0u || attr->depth > 0xFFFFFFFCu ||
|
||||
attr->maxPushWaiters > 0x8000u || attr->maxPopWaiters > 0x8000u)
|
||||
if (attr->elementSize == 0u || attr->elementSize > 0x4000u ||
|
||||
attr->elementSize % 16u || attr->depth == 0u ||
|
||||
attr->depth > 0xFFFFFFFCu || attr->maxPushWaiters > 0x8000u ||
|
||||
attr->maxPopWaiters > 0x8000u)
|
||||
return CELL_SYNC2_ERROR_INVAL;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSync2QueueInitialize(vm::ptr<CellSync2Queue> queue, vm::ptr<void> buffer, vm::cptr<CellSync2QueueAttribute> attr)
|
||||
error_code cellSync2QueueInitialize(vm::ptr<CellSync2Queue> queue,
|
||||
vm::ptr<void> buffer,
|
||||
vm::cptr<CellSync2QueueAttribute> attr)
|
||||
{
|
||||
cellSync2.todo("cellSync2QueueInitialize(queue=*0x%x, buffer=*0x%x, attr=*0x%x)", queue, buffer, attr);
|
||||
cellSync2.todo(
|
||||
"cellSync2QueueInitialize(queue=*0x%x, buffer=*0x%x, attr=*0x%x)", queue,
|
||||
buffer, attr);
|
||||
|
||||
if (!queue || !buffer || !attr)
|
||||
return CELL_SYNC2_ERROR_NULL_POINTER;
|
||||
|
||||
if (attr->elementSize == 0u || attr->elementSize > 0x4000u || attr->elementSize % 16u || attr->depth == 0u || attr->depth > 0xFFFFFFFCu ||
|
||||
attr->maxPushWaiters > 0x8000u || attr->maxPopWaiters > 0x8000u)
|
||||
if (attr->elementSize == 0u || attr->elementSize > 0x4000u ||
|
||||
attr->elementSize % 16u || attr->depth == 0u ||
|
||||
attr->depth > 0xFFFFFFFCu || attr->maxPushWaiters > 0x8000u ||
|
||||
attr->maxPopWaiters > 0x8000u)
|
||||
return CELL_SYNC2_ERROR_INVAL;
|
||||
|
||||
return CELL_OK;
|
||||
|
|
@ -366,9 +447,12 @@ error_code cellSync2QueueFinalize(vm::ptr<CellSync2Queue> queue)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSync2QueuePush(vm::ptr<CellSync2Queue> queue, vm::cptr<void> data, vm::cptr<CellSync2ThreadConfig> config)
|
||||
error_code cellSync2QueuePush(vm::ptr<CellSync2Queue> queue,
|
||||
vm::cptr<void> data,
|
||||
vm::cptr<CellSync2ThreadConfig> config)
|
||||
{
|
||||
cellSync2.todo("cellSync2QueuePush(queue=*0x%x, data=*0x%x, config=*0x%x)", queue, data, config);
|
||||
cellSync2.todo("cellSync2QueuePush(queue=*0x%x, data=*0x%x, config=*0x%x)",
|
||||
queue, data, config);
|
||||
|
||||
if (!queue || !data)
|
||||
return CELL_SYNC2_ERROR_NULL_POINTER;
|
||||
|
|
@ -376,9 +460,13 @@ error_code cellSync2QueuePush(vm::ptr<CellSync2Queue> queue, vm::cptr<void> data
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSync2QueueTryPush(vm::ptr<CellSync2Queue> queue, vm::cpptr<void> data, u32 numData, vm::cptr<CellSync2ThreadConfig> config)
|
||||
error_code cellSync2QueueTryPush(vm::ptr<CellSync2Queue> queue,
|
||||
vm::cpptr<void> data, u32 numData,
|
||||
vm::cptr<CellSync2ThreadConfig> config)
|
||||
{
|
||||
cellSync2.todo("cellSync2QueueTryPush(queue=*0x%x, data=**0x%x, numData=0x%x, config=*0x%x)", queue, data, numData, config);
|
||||
cellSync2.todo("cellSync2QueueTryPush(queue=*0x%x, data=**0x%x, "
|
||||
"numData=0x%x, config=*0x%x)",
|
||||
queue, data, numData, config);
|
||||
|
||||
if (!queue || !data)
|
||||
return CELL_SYNC2_ERROR_NULL_POINTER;
|
||||
|
|
@ -386,9 +474,12 @@ error_code cellSync2QueueTryPush(vm::ptr<CellSync2Queue> queue, vm::cpptr<void>
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSync2QueuePop(vm::ptr<CellSync2Queue> queue, vm::ptr<void> buffer, vm::cptr<CellSync2ThreadConfig> config)
|
||||
error_code cellSync2QueuePop(vm::ptr<CellSync2Queue> queue,
|
||||
vm::ptr<void> buffer,
|
||||
vm::cptr<CellSync2ThreadConfig> config)
|
||||
{
|
||||
cellSync2.todo("cellSync2QueuePop(queue=*0x%x, buffer=*0x%x, config=*0x%x)", queue, buffer, config);
|
||||
cellSync2.todo("cellSync2QueuePop(queue=*0x%x, buffer=*0x%x, config=*0x%x)",
|
||||
queue, buffer, config);
|
||||
|
||||
if (!queue || !buffer)
|
||||
return CELL_SYNC2_ERROR_NULL_POINTER;
|
||||
|
|
@ -396,9 +487,13 @@ error_code cellSync2QueuePop(vm::ptr<CellSync2Queue> queue, vm::ptr<void> buffer
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSync2QueueTryPop(vm::ptr<CellSync2Queue> queue, vm::ptr<void> buffer, vm::cptr<CellSync2ThreadConfig> config)
|
||||
error_code cellSync2QueueTryPop(vm::ptr<CellSync2Queue> queue,
|
||||
vm::ptr<void> buffer,
|
||||
vm::cptr<CellSync2ThreadConfig> config)
|
||||
{
|
||||
cellSync2.todo("cellSync2QueueTryPop(queue=*0x%x, buffer=*0x%x, config=*0x%x)", queue, buffer, config);
|
||||
cellSync2.todo(
|
||||
"cellSync2QueueTryPop(queue=*0x%x, buffer=*0x%x, config=*0x%x)", queue,
|
||||
buffer, config);
|
||||
|
||||
if (!queue || !buffer)
|
||||
return CELL_SYNC2_ERROR_NULL_POINTER;
|
||||
|
|
@ -406,7 +501,8 @@ error_code cellSync2QueueTryPop(vm::ptr<CellSync2Queue> queue, vm::ptr<void> buf
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSync2QueueGetSize(vm::ptr<CellSync2Queue> queue, vm::ptr<u32> size)
|
||||
error_code cellSync2QueueGetSize(vm::ptr<CellSync2Queue> queue,
|
||||
vm::ptr<u32> size)
|
||||
{
|
||||
cellSync2.todo("cellSync2QueueGetSize(queue=*0x%x, size=*0x%x)", queue, size);
|
||||
|
||||
|
|
@ -416,9 +512,11 @@ error_code cellSync2QueueGetSize(vm::ptr<CellSync2Queue> queue, vm::ptr<u32> siz
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSync2QueueGetDepth(vm::ptr<CellSync2Queue> queue, vm::ptr<u32> depth)
|
||||
error_code cellSync2QueueGetDepth(vm::ptr<CellSync2Queue> queue,
|
||||
vm::ptr<u32> depth)
|
||||
{
|
||||
cellSync2.todo("cellSync2QueueGetDepth(queue=*0x%x, depth=*0x%x)", queue, depth);
|
||||
cellSync2.todo("cellSync2QueueGetDepth(queue=*0x%x, depth=*0x%x)", queue,
|
||||
depth);
|
||||
|
||||
if (!queue || !depth)
|
||||
return CELL_SYNC2_ERROR_NULL_POINTER;
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
#include "stdafx.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/system_utils.hpp"
|
||||
#include "Emu/VFS.h"
|
||||
#include "Emu/IdManager.h"
|
||||
#include "Emu/Cell/PPUModule.h"
|
||||
#include "Emu/IdManager.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/VFS.h"
|
||||
#include "Emu/system_utils.hpp"
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "Emu/Cell/lv2/sys_fs.h"
|
||||
#include "cellSysutil.h"
|
||||
#include "util/StrUtil.h"
|
||||
#include "util/init_mutex.hpp"
|
||||
#include "Utilities/StrUtil.h"
|
||||
|
||||
LOG_CHANNEL(cellSysutil);
|
||||
|
||||
|
|
@ -31,7 +31,8 @@ void fmt_class_string<CellSysCacheError>::format(std::string& out, u64 arg)
|
|||
|
||||
extern lv2_fs_mount_point g_mp_sys_dev_hdd1;
|
||||
|
||||
extern std::string get_syscache_state_corruption_indicator_file_path(std::string_view dir_path);
|
||||
extern std::string
|
||||
get_syscache_state_corruption_indicator_file_path(std::string_view dir_path);
|
||||
|
||||
struct syscache_info
|
||||
{
|
||||
|
|
@ -56,9 +57,14 @@ struct syscache_info
|
|||
id = id.substr(id.find_last_of(fs::delim) + 1);
|
||||
cache_id = std::string{id};
|
||||
|
||||
if (!Emu.DeserialManager() && !fs::write_file<true>(get_syscache_state_corruption_indicator_file_path(Emu.hdd1), fs::write_new))
|
||||
if (!Emu.DeserialManager() &&
|
||||
!fs::write_file<true>(
|
||||
get_syscache_state_corruption_indicator_file_path(Emu.hdd1),
|
||||
fs::write_new))
|
||||
{
|
||||
fmt::throw_exception("Failed to create HDD1 corruption indicator file! (path='%s', reason='%s')", Emu.hdd1, fs::g_tls_error);
|
||||
fmt::throw_exception("Failed to create HDD1 corruption indicator file! "
|
||||
"(path='%s', reason='%s')",
|
||||
Emu.hdd1, fs::g_tls_error);
|
||||
}
|
||||
|
||||
cellSysutil.success("Retained cache from parent process: %s", Emu.hdd1);
|
||||
|
|
@ -74,7 +80,8 @@ struct syscache_info
|
|||
{
|
||||
cache_id = vfs::unescape(entry.name);
|
||||
|
||||
if (fs::is_file(get_syscache_state_corruption_indicator_file_path(cache_root + '/' + cache_id)))
|
||||
if (fs::is_file(get_syscache_state_corruption_indicator_file_path(
|
||||
cache_root + '/' + cache_id)))
|
||||
{
|
||||
// State is not complete
|
||||
clear(true);
|
||||
|
|
@ -82,7 +89,8 @@ struct syscache_info
|
|||
continue;
|
||||
}
|
||||
|
||||
cellSysutil.notice("Retained cache from past data: %s", cache_root + '/' + cache_id);
|
||||
cellSysutil.notice("Retained cache from past data: %s",
|
||||
cache_root + '/' + cache_id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -91,9 +99,12 @@ struct syscache_info
|
|||
void clear(bool remove_root, bool lock = false) const noexcept
|
||||
{
|
||||
// Clear cache
|
||||
if (!vfs::host::remove_all(cache_root + cache_id, cache_root, &g_mp_sys_dev_hdd1, remove_root, lock))
|
||||
if (!vfs::host::remove_all(cache_root + cache_id, cache_root,
|
||||
&g_mp_sys_dev_hdd1, remove_root, lock))
|
||||
{
|
||||
cellSysutil.fatal("cellSysCache: failed to clear cache directory '%s%s' (%s)", cache_root, cache_id, fs::g_tls_error);
|
||||
cellSysutil.fatal(
|
||||
"cellSysCache: failed to clear cache directory '%s%s' (%s)",
|
||||
cache_root, cache_id, fs::g_tls_error);
|
||||
}
|
||||
|
||||
// Poison opened files in /dev_hdd1 to return CELL_EIO on access
|
||||
|
|
@ -118,30 +129,37 @@ struct syscache_info
|
|||
|
||||
if (!retain_caches)
|
||||
{
|
||||
vfs::host::remove_all(cache_root + cache_id, cache_root, &g_mp_sys_dev_hdd1, true, false, true);
|
||||
vfs::host::remove_all(cache_root + cache_id, cache_root,
|
||||
&g_mp_sys_dev_hdd1, true, false, true);
|
||||
return;
|
||||
}
|
||||
|
||||
idm::select<lv2_fs_object, lv2_file>([](u32 /*id*/, lv2_file& file)
|
||||
{
|
||||
if (file.file && file.mp->flags & lv2_mp_flag::cache && file.flags & CELL_FS_O_ACCMODE)
|
||||
if (file.file && file.mp->flags & lv2_mp_flag::cache &&
|
||||
file.flags & CELL_FS_O_ACCMODE)
|
||||
{
|
||||
file.file.sync();
|
||||
}
|
||||
});
|
||||
|
||||
fs::remove_file(get_syscache_state_corruption_indicator_file_path(cache_root + cache_id));
|
||||
fs::remove_file(get_syscache_state_corruption_indicator_file_path(
|
||||
cache_root + cache_id));
|
||||
}
|
||||
};
|
||||
|
||||
extern std::string get_syscache_state_corruption_indicator_file_path(std::string_view dir_path)
|
||||
extern std::string
|
||||
get_syscache_state_corruption_indicator_file_path(std::string_view dir_path)
|
||||
{
|
||||
constexpr std::u8string_view append_path = u8"/$hdd0_temp_state_indicator";
|
||||
const std::string_view filename = reinterpret_cast<const char*>(append_path.data());
|
||||
const std::string_view filename =
|
||||
reinterpret_cast<const char*>(append_path.data());
|
||||
|
||||
if (dir_path.empty())
|
||||
{
|
||||
return rpcs3::utils::get_hdd1_dir() + "/caches/" + ensure(g_fxo->try_get<syscache_info>())->cache_id + "/" + filename.data();
|
||||
return rpcs3::utils::get_hdd1_dir() + "/caches/" +
|
||||
ensure(g_fxo->try_get<syscache_info>())->cache_id + "/" +
|
||||
filename.data();
|
||||
}
|
||||
|
||||
return std::string{dir_path} + filename.data();
|
||||
|
|
@ -177,7 +195,8 @@ error_code cellSysCacheClear()
|
|||
|
||||
error_code cellSysCacheMount(vm::ptr<CellSysCacheParam> param)
|
||||
{
|
||||
cellSysutil.notice("cellSysCacheMount(param=*0x%x ('%s'))", param, param.ptr(&CellSysCacheParam::cacheId));
|
||||
cellSysutil.notice("cellSysCacheMount(param=*0x%x ('%s'))", param,
|
||||
param.ptr(&CellSysCacheParam::cacheId));
|
||||
|
||||
auto& cache = g_fxo->get<syscache_info>();
|
||||
|
||||
|
|
@ -188,9 +207,13 @@ error_code cellSysCacheMount(vm::ptr<CellSysCacheParam> param)
|
|||
|
||||
std::string cache_name;
|
||||
|
||||
ensure(vm::read_string(param.ptr(&CellSysCacheParam::cacheId).addr(), sizeof(param->cacheId), cache_name), "Access violation");
|
||||
ensure(vm::read_string(param.ptr(&CellSysCacheParam::cacheId).addr(),
|
||||
sizeof(param->cacheId), cache_name),
|
||||
"Access violation");
|
||||
|
||||
if (!cache_name.empty() && sysutil_check_name_string(cache_name.data(), 1, CELL_SYSCACHE_ID_SIZE) != 0)
|
||||
if (!cache_name.empty() &&
|
||||
sysutil_check_name_string(cache_name.data(), 1, CELL_SYSCACHE_ID_SIZE) !=
|
||||
0)
|
||||
{
|
||||
return CELL_SYSCACHE_ERROR_PARAM;
|
||||
}
|
||||
|
|
@ -209,7 +232,8 @@ error_code cellSysCacheMount(vm::ptr<CellSysCacheParam> param)
|
|||
|
||||
std::lock_guard lock0(g_mp_sys_dev_hdd1.mutex);
|
||||
|
||||
// Check if can reuse existing cache (won't if cache id is an empty string or cache is damaged/incomplete)
|
||||
// Check if can reuse existing cache (won't if cache id is an empty string or
|
||||
// cache is damaged/incomplete)
|
||||
if (!cache_name.empty() && cache_id == cache.cache_id)
|
||||
{
|
||||
// Isn't mounted yet on first call to cellSysCacheMount
|
||||
|
|
@ -239,7 +263,9 @@ error_code cellSysCacheMount(vm::ptr<CellSysCacheParam> param)
|
|||
{
|
||||
if (fs::g_tls_error != fs::error::exist)
|
||||
{
|
||||
fmt::throw_exception("Failed to create HDD1 cache! (path='%s', reason='%s')", new_path, fs::g_tls_error);
|
||||
fmt::throw_exception(
|
||||
"Failed to create HDD1 cache! (path='%s', reason='%s')", new_path,
|
||||
fs::g_tls_error);
|
||||
}
|
||||
|
||||
// Clear new cache
|
||||
|
|
@ -247,9 +273,13 @@ error_code cellSysCacheMount(vm::ptr<CellSysCacheParam> param)
|
|||
}
|
||||
}
|
||||
|
||||
if (!fs::write_file<true>(get_syscache_state_corruption_indicator_file_path(new_path), fs::write_new))
|
||||
if (!fs::write_file<true>(
|
||||
get_syscache_state_corruption_indicator_file_path(new_path),
|
||||
fs::write_new))
|
||||
{
|
||||
fmt::throw_exception("Failed to create HDD1 corruption indicator file! (path='%s', reason='%s')", new_path, fs::g_tls_error);
|
||||
fmt::throw_exception("Failed to create HDD1 corruption indicator file! "
|
||||
"(path='%s', reason='%s')",
|
||||
new_path, fs::g_tls_error);
|
||||
}
|
||||
|
||||
if (vfs::mount("/dev_hdd1", new_path))
|
||||
|
|
@ -1,20 +1,20 @@
|
|||
#include "stdafx.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/system_config.h"
|
||||
#include "Emu/IdManager.h"
|
||||
#include "Emu/VFS.h"
|
||||
#include "cellGame.h"
|
||||
#include "Emu/Cell/PPUModule.h"
|
||||
#include "Emu/Cell/Modules/cellGame.h"
|
||||
#include "Emu/IdManager.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/VFS.h"
|
||||
#include "Emu/system_config.h"
|
||||
|
||||
#include "Emu/Cell/lv2/sys_game.h"
|
||||
#include "Emu/Cell/lv2/sys_process.h"
|
||||
#include "cellSysutil.h"
|
||||
|
||||
#include "Utilities/StrUtil.h"
|
||||
#include "Utilities/lockless.h"
|
||||
#include "util/StrUtil.h"
|
||||
#include "util/lockless.h"
|
||||
|
||||
#include <span>
|
||||
#include <deque>
|
||||
#include <span>
|
||||
|
||||
LOG_CHANNEL(cellSysutil);
|
||||
|
||||
|
|
@ -87,9 +87,11 @@ struct sysutil_cb_manager
|
|||
std::shared_ptr<atomic_t<bool>> call_active;
|
||||
};
|
||||
|
||||
std::deque<lf_queue<std::shared_ptr<atomic_t<bool>>>> registered_callbacks_abort_handles = []()
|
||||
std::deque<lf_queue<std::shared_ptr<atomic_t<bool>>>>
|
||||
registered_callbacks_abort_handles = []()
|
||||
{
|
||||
// Do resize for deque (cheap container which can store all non-movable value types)
|
||||
// Do resize for deque (cheap container which can store all non-movable
|
||||
// value types)
|
||||
std::deque<lf_queue<std::shared_ptr<atomic_t<bool>>>> result;
|
||||
|
||||
for (usz i = 0; i < g_sysutil_callback_id_assigner; i++)
|
||||
|
|
@ -121,7 +123,8 @@ struct sysutil_cb_manager
|
|||
}
|
||||
};
|
||||
|
||||
void sysutil_register_cb_with_id_internal(std::function<s32(ppu_thread&)>&& cb, usz call_id)
|
||||
void sysutil_register_cb_with_id_internal(std::function<s32(ppu_thread&)>&& cb,
|
||||
usz call_id)
|
||||
{
|
||||
auto& cbm = *ensure(g_fxo->try_get<sysutil_cb_manager>());
|
||||
|
||||
|
|
@ -130,7 +133,8 @@ void sysutil_register_cb_with_id_internal(std::function<s32(ppu_thread&)>&& cb,
|
|||
if (call_id != umax)
|
||||
{
|
||||
info.call_active = std::make_shared<atomic_t<bool>>(true);
|
||||
::at32(cbm.registered_callbacks_abort_handles, call_id).push(info.call_active);
|
||||
::at32(cbm.registered_callbacks_abort_handles, call_id)
|
||||
.push(info.call_active);
|
||||
}
|
||||
|
||||
cbm.registered.push(std::move(info));
|
||||
|
|
@ -145,7 +149,8 @@ extern void sysutil_unregister_cb_with_id_internal(usz call_id)
|
|||
return;
|
||||
}
|
||||
|
||||
for (auto&& abort_handle : ::at32(cbm->registered_callbacks_abort_handles, call_id).pop_all())
|
||||
for (auto&& abort_handle :
|
||||
::at32(cbm->registered_callbacks_abort_handles, call_id).pop_all())
|
||||
{
|
||||
// Deactivate the existing event once
|
||||
abort_handle->store(false);
|
||||
|
|
@ -167,7 +172,8 @@ extern s32 sysutil_send_system_cmd(u64 status, u64 param)
|
|||
{
|
||||
if (cbm->draw_cb_started.exchange(true))
|
||||
{
|
||||
cellSysutil.error("Tried to enqueue a second or more DRAWING_BEGIN callback!");
|
||||
cellSysutil.error(
|
||||
"Tried to enqueue a second or more DRAWING_BEGIN callback!");
|
||||
return CELL_SYSUTIL_ERROR_BUSY;
|
||||
}
|
||||
}
|
||||
|
|
@ -175,7 +181,8 @@ extern s32 sysutil_send_system_cmd(u64 status, u64 param)
|
|||
{
|
||||
if (!cbm->draw_cb_started.exchange(false))
|
||||
{
|
||||
cellSysutil.error("Tried to enqueue a DRAWING_END callback without a BEGIN callback!");
|
||||
cellSysutil.error("Tried to enqueue a DRAWING_END callback without a "
|
||||
"BEGIN callback!");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
@ -188,12 +195,14 @@ extern s32 sysutil_send_system_cmd(u64 status, u64 param)
|
|||
{
|
||||
if (cb.callback)
|
||||
{
|
||||
cbm->registered.push(sysutil_cb_manager::dispatcher_cb{[=](ppu_thread& ppu) -> s32
|
||||
{
|
||||
// TODO: check it and find the source of the return value (void isn't equal to CELL_OK)
|
||||
cb.callback(ppu, status, param, cb.user_data);
|
||||
return CELL_OK;
|
||||
}});
|
||||
cbm->registered.push(
|
||||
sysutil_cb_manager::dispatcher_cb{[=](ppu_thread& ppu) -> s32
|
||||
{
|
||||
// TODO: check it and find the source of the return value (void
|
||||
// isn't equal to CELL_OK)
|
||||
cb.callback(ppu, status, param, cb.user_data);
|
||||
return CELL_OK;
|
||||
}});
|
||||
|
||||
count++;
|
||||
}
|
||||
|
|
@ -258,26 +267,46 @@ void fmt_class_string<CellSysutilLang>::format(std::string& out, u64 arg)
|
|||
{
|
||||
switch (value)
|
||||
{
|
||||
case CELL_SYSUTIL_LANG_JAPANESE: return "Japanese";
|
||||
case CELL_SYSUTIL_LANG_ENGLISH_US: return "English (US)";
|
||||
case CELL_SYSUTIL_LANG_FRENCH: return "French";
|
||||
case CELL_SYSUTIL_LANG_SPANISH: return "Spanish";
|
||||
case CELL_SYSUTIL_LANG_GERMAN: return "German";
|
||||
case CELL_SYSUTIL_LANG_ITALIAN: return "Italian";
|
||||
case CELL_SYSUTIL_LANG_DUTCH: return "Dutch";
|
||||
case CELL_SYSUTIL_LANG_PORTUGUESE_PT: return "Portuguese (Portugal)";
|
||||
case CELL_SYSUTIL_LANG_RUSSIAN: return "Russian";
|
||||
case CELL_SYSUTIL_LANG_KOREAN: return "Korean";
|
||||
case CELL_SYSUTIL_LANG_CHINESE_T: return "Chinese (Traditional)";
|
||||
case CELL_SYSUTIL_LANG_CHINESE_S: return "Chinese (Simplified)";
|
||||
case CELL_SYSUTIL_LANG_FINNISH: return "Finnish";
|
||||
case CELL_SYSUTIL_LANG_SWEDISH: return "Swedish";
|
||||
case CELL_SYSUTIL_LANG_DANISH: return "Danish";
|
||||
case CELL_SYSUTIL_LANG_NORWEGIAN: return "Norwegian";
|
||||
case CELL_SYSUTIL_LANG_POLISH: return "Polish";
|
||||
case CELL_SYSUTIL_LANG_ENGLISH_GB: return "English (UK)";
|
||||
case CELL_SYSUTIL_LANG_PORTUGUESE_BR: return "Portuguese (Brazil)";
|
||||
case CELL_SYSUTIL_LANG_TURKISH: return "Turkish";
|
||||
case CELL_SYSUTIL_LANG_JAPANESE:
|
||||
return "Japanese";
|
||||
case CELL_SYSUTIL_LANG_ENGLISH_US:
|
||||
return "English (US)";
|
||||
case CELL_SYSUTIL_LANG_FRENCH:
|
||||
return "French";
|
||||
case CELL_SYSUTIL_LANG_SPANISH:
|
||||
return "Spanish";
|
||||
case CELL_SYSUTIL_LANG_GERMAN:
|
||||
return "German";
|
||||
case CELL_SYSUTIL_LANG_ITALIAN:
|
||||
return "Italian";
|
||||
case CELL_SYSUTIL_LANG_DUTCH:
|
||||
return "Dutch";
|
||||
case CELL_SYSUTIL_LANG_PORTUGUESE_PT:
|
||||
return "Portuguese (Portugal)";
|
||||
case CELL_SYSUTIL_LANG_RUSSIAN:
|
||||
return "Russian";
|
||||
case CELL_SYSUTIL_LANG_KOREAN:
|
||||
return "Korean";
|
||||
case CELL_SYSUTIL_LANG_CHINESE_T:
|
||||
return "Chinese (Traditional)";
|
||||
case CELL_SYSUTIL_LANG_CHINESE_S:
|
||||
return "Chinese (Simplified)";
|
||||
case CELL_SYSUTIL_LANG_FINNISH:
|
||||
return "Finnish";
|
||||
case CELL_SYSUTIL_LANG_SWEDISH:
|
||||
return "Swedish";
|
||||
case CELL_SYSUTIL_LANG_DANISH:
|
||||
return "Danish";
|
||||
case CELL_SYSUTIL_LANG_NORWEGIAN:
|
||||
return "Norwegian";
|
||||
case CELL_SYSUTIL_LANG_POLISH:
|
||||
return "Polish";
|
||||
case CELL_SYSUTIL_LANG_ENGLISH_GB:
|
||||
return "English (UK)";
|
||||
case CELL_SYSUTIL_LANG_PORTUGUESE_BR:
|
||||
return "Portuguese (Brazil)";
|
||||
case CELL_SYSUTIL_LANG_TURKISH:
|
||||
return "Turkish";
|
||||
}
|
||||
|
||||
return unknown;
|
||||
|
|
@ -285,19 +314,27 @@ void fmt_class_string<CellSysutilLang>::format(std::string& out, u64 arg)
|
|||
}
|
||||
|
||||
template <>
|
||||
void fmt_class_string<CellSysutilLicenseArea>::format(std::string& out, u64 arg)
|
||||
void fmt_class_string<CellSysutilLicenseArea>::format(std::string& out,
|
||||
u64 arg)
|
||||
{
|
||||
format_enum(out, arg, [](CellSysutilLicenseArea value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case CELL_SYSUTIL_LICENSE_AREA_J: return "SCEJ";
|
||||
case CELL_SYSUTIL_LICENSE_AREA_A: return "SCEA";
|
||||
case CELL_SYSUTIL_LICENSE_AREA_E: return "SCEE";
|
||||
case CELL_SYSUTIL_LICENSE_AREA_H: return "SCEH";
|
||||
case CELL_SYSUTIL_LICENSE_AREA_K: return "SCEK";
|
||||
case CELL_SYSUTIL_LICENSE_AREA_C: return "SCH";
|
||||
case CELL_SYSUTIL_LICENSE_AREA_OTHER: return "Other";
|
||||
case CELL_SYSUTIL_LICENSE_AREA_J:
|
||||
return "SCEJ";
|
||||
case CELL_SYSUTIL_LICENSE_AREA_A:
|
||||
return "SCEA";
|
||||
case CELL_SYSUTIL_LICENSE_AREA_E:
|
||||
return "SCEE";
|
||||
case CELL_SYSUTIL_LICENSE_AREA_H:
|
||||
return "SCEH";
|
||||
case CELL_SYSUTIL_LICENSE_AREA_K:
|
||||
return "SCEK";
|
||||
case CELL_SYSUTIL_LICENSE_AREA_C:
|
||||
return "SCH";
|
||||
case CELL_SYSUTIL_LICENSE_AREA_OTHER:
|
||||
return "Other";
|
||||
}
|
||||
|
||||
return unknown;
|
||||
|
|
@ -311,29 +348,52 @@ void fmt_class_string<CellSysutilParamId>::format(std::string& out, u64 arg)
|
|||
{
|
||||
switch (value)
|
||||
{
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_LANG: return "ID_LANG";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_ENTER_BUTTON_ASSIGN: return "ID_ENTER_BUTTON_ASSIGN";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_DATE_FORMAT: return "ID_DATE_FORMAT";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_TIME_FORMAT: return "ID_TIME_FORMAT";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE: return "ID_TIMEZONE";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_SUMMERTIME: return "ID_SUMMERTIME";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL: return "ID_GAME_PARENTAL_LEVEL";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_LICENSE_AREA: return "ID_LICENSE_AREA";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL0_RESTRICT: return "ID_GAME_PARENTAL_LEVEL0_RESTRICT";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USER_HAS_NP_ACCOUNT: return "ID_CURRENT_USER_HAS_NP_ACCOUNT";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_CAMERA_PLFREQ: return "ID_CAMERA_PLFREQ";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_RUMBLE: return "ID_PAD_RUMBLE";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_KEYBOARD_TYPE: return "ID_KEYBOARD_TYPE";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_JAPANESE_KEYBOARD_ENTRY_METHOD: return "ID_JAPANESE_KEYBOARD_ENTRY_METHOD";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_CHINESE_KEYBOARD_ENTRY_METHOD: return "ID_CHINESE_KEYBOARD_ENTRY_METHOD";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_AUTOOFF: return "ID_PAD_AUTOOFF";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_MAGNETOMETER: return "ID_MAGNETOMETER";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_NICKNAME: return "ID_NICKNAME";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USERNAME: return "ID_CURRENT_USERNAME";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_x1008: return "ID_x1008";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_x1011: return "ID_x1011";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_x1012: return "ID_x1012";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_x1024: return "ID_x1024";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_LANG:
|
||||
return "ID_LANG";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_ENTER_BUTTON_ASSIGN:
|
||||
return "ID_ENTER_BUTTON_ASSIGN";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_DATE_FORMAT:
|
||||
return "ID_DATE_FORMAT";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_TIME_FORMAT:
|
||||
return "ID_TIME_FORMAT";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE:
|
||||
return "ID_TIMEZONE";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_SUMMERTIME:
|
||||
return "ID_SUMMERTIME";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL:
|
||||
return "ID_GAME_PARENTAL_LEVEL";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_LICENSE_AREA:
|
||||
return "ID_LICENSE_AREA";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL0_RESTRICT:
|
||||
return "ID_GAME_PARENTAL_LEVEL0_RESTRICT";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USER_HAS_NP_ACCOUNT:
|
||||
return "ID_CURRENT_USER_HAS_NP_ACCOUNT";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_CAMERA_PLFREQ:
|
||||
return "ID_CAMERA_PLFREQ";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_RUMBLE:
|
||||
return "ID_PAD_RUMBLE";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_KEYBOARD_TYPE:
|
||||
return "ID_KEYBOARD_TYPE";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_JAPANESE_KEYBOARD_ENTRY_METHOD:
|
||||
return "ID_JAPANESE_KEYBOARD_ENTRY_METHOD";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_CHINESE_KEYBOARD_ENTRY_METHOD:
|
||||
return "ID_CHINESE_KEYBOARD_ENTRY_METHOD";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_AUTOOFF:
|
||||
return "ID_PAD_AUTOOFF";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_MAGNETOMETER:
|
||||
return "ID_MAGNETOMETER";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_NICKNAME:
|
||||
return "ID_NICKNAME";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USERNAME:
|
||||
return "ID_CURRENT_USERNAME";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_x1008:
|
||||
return "ID_x1008";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_x1011:
|
||||
return "ID_x1011";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_x1012:
|
||||
return "ID_x1012";
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_x1024:
|
||||
return "ID_x1024";
|
||||
}
|
||||
|
||||
return unknown;
|
||||
|
|
@ -404,9 +464,11 @@ error_code _cellSysutilGetSystemParamInt()
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSysutilGetSystemParamInt(CellSysutilParamId id, vm::ptr<s32> value)
|
||||
error_code cellSysutilGetSystemParamInt(CellSysutilParamId id,
|
||||
vm::ptr<s32> value)
|
||||
{
|
||||
cellSysutil.warning("cellSysutilGetSystemParamInt(id=0x%x(%s), value=*0x%x)", id, id, value);
|
||||
cellSysutil.warning("cellSysutilGetSystemParamInt(id=0x%x(%s), value=*0x%x)",
|
||||
id, id, value);
|
||||
|
||||
if (!value)
|
||||
{
|
||||
|
|
@ -503,9 +565,12 @@ error_code cellSysutilGetSystemParamInt(CellSysutilParamId id, vm::ptr<s32> valu
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSysutilGetSystemParamString(CellSysutilParamId id, vm::ptr<char> buf, u32 bufsize)
|
||||
error_code cellSysutilGetSystemParamString(CellSysutilParamId id,
|
||||
vm::ptr<char> buf, u32 bufsize)
|
||||
{
|
||||
cellSysutil.trace("cellSysutilGetSystemParamString(id=0x%x(%s), buf=*0x%x, bufsize=%d)", id, id, buf, bufsize);
|
||||
cellSysutil.trace(
|
||||
"cellSysutilGetSystemParamString(id=0x%x(%s), buf=*0x%x, bufsize=%d)", id,
|
||||
id, buf, bufsize);
|
||||
|
||||
if (!buf)
|
||||
{
|
||||
|
|
@ -527,11 +592,14 @@ error_code cellSysutilGetSystemParamString(CellSysutilParamId id, vm::ptr<char>
|
|||
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USERNAME:
|
||||
{
|
||||
const fs::file username(vfs::get(fmt::format("/dev_hdd0/home/%08u/localusername", Emu.GetUsrId())));
|
||||
const fs::file username(vfs::get(
|
||||
fmt::format("/dev_hdd0/home/%08u/localusername", Emu.GetUsrId())));
|
||||
|
||||
if (!username)
|
||||
{
|
||||
cellSysutil.error("cellSysutilGetSystemParamString(): Username for user %08u doesn't exist. Did you delete the username file?", Emu.GetUsrId());
|
||||
cellSysutil.error("cellSysutilGetSystemParamString(): Username for user "
|
||||
"%08u doesn't exist. Did you delete the username file?",
|
||||
Emu.GetUsrId());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -569,7 +637,8 @@ error_code cellSysutilGetSystemParamString(CellSysutilParamId id, vm::ptr<char>
|
|||
|
||||
if (report_use)
|
||||
{
|
||||
cellSysutil.error("cellSysutilGetSystemParamString: Unknown ParamId 0x%x", id);
|
||||
cellSysutil.error("cellSysutilGetSystemParamString: Unknown ParamId 0x%x",
|
||||
id);
|
||||
}
|
||||
|
||||
std::span dst(buf.get_ptr(), copy_size);
|
||||
|
|
@ -578,11 +647,15 @@ error_code cellSysutilGetSystemParamString(CellSysutilParamId id, vm::ptr<char>
|
|||
}
|
||||
|
||||
// Note: the way we do things here is inaccurate(but maybe sufficient)
|
||||
// The real function goes over a table of 0x20 entries[ event_code:u32 callback_addr:u32 ]
|
||||
// Those callbacks are registered through cellSysutilRegisterCallbackDispatcher(u32 event_code, vm::ptr<void> func_addr)
|
||||
// The function goes through all the callback looking for one callback associated with event 0x100, if any is found it is called with parameters r3=0x101 r4=0
|
||||
// This particular CB seems to be associated with sysutil itself
|
||||
// Then it checks for events on an event_queue associated with sysutil, checks if any cb is associated with that event and calls them with parameters that come from the event
|
||||
// The real function goes over a table of 0x20 entries[ event_code:u32
|
||||
// callback_addr:u32 ] Those callbacks are registered through
|
||||
// cellSysutilRegisterCallbackDispatcher(u32 event_code, vm::ptr<void>
|
||||
// func_addr) The function goes through all the callback looking for one
|
||||
// callback associated with event 0x100, if any is found it is called with
|
||||
// parameters r3=0x101 r4=0 This particular CB seems to be associated with
|
||||
// sysutil itself Then it checks for events on an event_queue associated with
|
||||
// sysutil, checks if any cb is associated with that event and calls them with
|
||||
// parameters that come from the event
|
||||
error_code cellSysutilCheckCallback(ppu_thread& ppu)
|
||||
{
|
||||
cellSysutil.trace("cellSysutilCheckCallback()");
|
||||
|
|
@ -620,9 +693,13 @@ error_code cellSysutilCheckCallback(ppu_thread& ppu)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSysutilRegisterCallback(u32 slot, vm::ptr<CellSysutilCallback> func, vm::ptr<void> userdata)
|
||||
error_code cellSysutilRegisterCallback(u32 slot,
|
||||
vm::ptr<CellSysutilCallback> func,
|
||||
vm::ptr<void> userdata)
|
||||
{
|
||||
cellSysutil.warning("cellSysutilRegisterCallback(slot=%d, func=*0x%x, userdata=*0x%x)", slot, func, userdata);
|
||||
cellSysutil.warning(
|
||||
"cellSysutilRegisterCallback(slot=%d, func=*0x%x, userdata=*0x%x)", slot,
|
||||
func, userdata);
|
||||
|
||||
if (slot >= 4)
|
||||
{
|
||||
|
|
@ -676,15 +753,20 @@ error_code cellSysutilEnableBgmPlayback()
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSysutilEnableBgmPlaybackEx(vm::ptr<CellSysutilBgmPlaybackExtraParam> param)
|
||||
error_code cellSysutilEnableBgmPlaybackEx(
|
||||
vm::ptr<CellSysutilBgmPlaybackExtraParam> param)
|
||||
{
|
||||
cellSysutil.warning("cellSysutilEnableBgmPlaybackEx(param=*0x%x)", param);
|
||||
|
||||
if (!param ||
|
||||
param->systemBgmFadeInTime < CELL_SYSUTIL_BGMPLAYBACK_FADE_INVALID || param->systemBgmFadeInTime > 60000 ||
|
||||
param->systemBgmFadeOutTime < CELL_SYSUTIL_BGMPLAYBACK_FADE_INVALID || param->systemBgmFadeOutTime > 60000 ||
|
||||
param->gameBgmFadeInTime < CELL_SYSUTIL_BGMPLAYBACK_FADE_INVALID || param->gameBgmFadeInTime > 60000 ||
|
||||
param->gameBgmFadeOutTime < CELL_SYSUTIL_BGMPLAYBACK_FADE_INVALID || param->gameBgmFadeOutTime > 60000)
|
||||
param->systemBgmFadeInTime < CELL_SYSUTIL_BGMPLAYBACK_FADE_INVALID ||
|
||||
param->systemBgmFadeInTime > 60000 ||
|
||||
param->systemBgmFadeOutTime < CELL_SYSUTIL_BGMPLAYBACK_FADE_INVALID ||
|
||||
param->systemBgmFadeOutTime > 60000 ||
|
||||
param->gameBgmFadeInTime < CELL_SYSUTIL_BGMPLAYBACK_FADE_INVALID ||
|
||||
param->gameBgmFadeInTime > 60000 ||
|
||||
param->gameBgmFadeOutTime < CELL_SYSUTIL_BGMPLAYBACK_FADE_INVALID ||
|
||||
param->gameBgmFadeOutTime > 60000)
|
||||
{
|
||||
return CELL_SYSUTIL_BGMPLAYBACK_EX_ERROR_PARAM;
|
||||
}
|
||||
|
|
@ -713,15 +795,20 @@ error_code cellSysutilDisableBgmPlayback()
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSysutilDisableBgmPlaybackEx(vm::ptr<CellSysutilBgmPlaybackExtraParam> param)
|
||||
error_code cellSysutilDisableBgmPlaybackEx(
|
||||
vm::ptr<CellSysutilBgmPlaybackExtraParam> param)
|
||||
{
|
||||
cellSysutil.warning("cellSysutilDisableBgmPlaybackEx(param=*0x%x)", param);
|
||||
|
||||
if (!param ||
|
||||
param->systemBgmFadeInTime < CELL_SYSUTIL_BGMPLAYBACK_FADE_INVALID || param->systemBgmFadeInTime > 60000 ||
|
||||
param->systemBgmFadeOutTime < CELL_SYSUTIL_BGMPLAYBACK_FADE_INVALID || param->systemBgmFadeOutTime > 60000 ||
|
||||
param->gameBgmFadeInTime < CELL_SYSUTIL_BGMPLAYBACK_FADE_INVALID || param->gameBgmFadeInTime > 60000 ||
|
||||
param->gameBgmFadeOutTime < CELL_SYSUTIL_BGMPLAYBACK_FADE_INVALID || param->gameBgmFadeOutTime > 60000)
|
||||
param->systemBgmFadeInTime < CELL_SYSUTIL_BGMPLAYBACK_FADE_INVALID ||
|
||||
param->systemBgmFadeInTime > 60000 ||
|
||||
param->systemBgmFadeOutTime < CELL_SYSUTIL_BGMPLAYBACK_FADE_INVALID ||
|
||||
param->systemBgmFadeOutTime > 60000 ||
|
||||
param->gameBgmFadeInTime < CELL_SYSUTIL_BGMPLAYBACK_FADE_INVALID ||
|
||||
param->gameBgmFadeInTime > 60000 ||
|
||||
param->gameBgmFadeOutTime < CELL_SYSUTIL_BGMPLAYBACK_FADE_INVALID ||
|
||||
param->gameBgmFadeOutTime > 60000)
|
||||
{
|
||||
return CELL_SYSUTIL_BGMPLAYBACK_EX_ERROR_PARAM;
|
||||
}
|
||||
|
|
@ -739,7 +826,8 @@ error_code cellSysutilDisableBgmPlaybackEx(vm::ptr<CellSysutilBgmPlaybackExtraPa
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSysutilGetBgmPlaybackStatus(vm::ptr<CellSysutilBgmPlaybackStatus> status)
|
||||
error_code
|
||||
cellSysutilGetBgmPlaybackStatus(vm::ptr<CellSysutilBgmPlaybackStatus> status)
|
||||
{
|
||||
cellSysutil.trace("cellSysutilGetBgmPlaybackStatus(status=*0x%x)", status);
|
||||
|
||||
|
|
@ -755,7 +843,8 @@ error_code cellSysutilGetBgmPlaybackStatus(vm::ptr<CellSysutilBgmPlaybackStatus>
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSysutilGetBgmPlaybackStatus2(vm::ptr<CellSysutilBgmPlaybackStatus2> status2)
|
||||
error_code cellSysutilGetBgmPlaybackStatus2(
|
||||
vm::ptr<CellSysutilBgmPlaybackStatus2> status2)
|
||||
{
|
||||
cellSysutil.trace("cellSysutilGetBgmPlaybackStatus2(status2=*0x%x)", status2);
|
||||
|
||||
|
|
@ -772,15 +861,21 @@ error_code cellSysutilGetBgmPlaybackStatus2(vm::ptr<CellSysutilBgmPlaybackStatus
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSysutilSetBgmPlaybackExtraParam(vm::ptr<CellSysutilBgmPlaybackExtraParam> param)
|
||||
error_code cellSysutilSetBgmPlaybackExtraParam(
|
||||
vm::ptr<CellSysutilBgmPlaybackExtraParam> param)
|
||||
{
|
||||
cellSysutil.warning("cellSysutilSetBgmPlaybackExtraParam(param=*0x%x)", param);
|
||||
cellSysutil.warning("cellSysutilSetBgmPlaybackExtraParam(param=*0x%x)",
|
||||
param);
|
||||
|
||||
if (!param ||
|
||||
param->systemBgmFadeInTime < CELL_SYSUTIL_BGMPLAYBACK_FADE_INVALID || param->systemBgmFadeInTime > 60000 ||
|
||||
param->systemBgmFadeOutTime < CELL_SYSUTIL_BGMPLAYBACK_FADE_INVALID || param->systemBgmFadeOutTime > 60000 ||
|
||||
param->gameBgmFadeInTime < CELL_SYSUTIL_BGMPLAYBACK_FADE_INVALID || param->gameBgmFadeInTime > 60000 ||
|
||||
param->gameBgmFadeOutTime < CELL_SYSUTIL_BGMPLAYBACK_FADE_INVALID || param->gameBgmFadeOutTime > 60000)
|
||||
param->systemBgmFadeInTime < CELL_SYSUTIL_BGMPLAYBACK_FADE_INVALID ||
|
||||
param->systemBgmFadeInTime > 60000 ||
|
||||
param->systemBgmFadeOutTime < CELL_SYSUTIL_BGMPLAYBACK_FADE_INVALID ||
|
||||
param->systemBgmFadeOutTime > 60000 ||
|
||||
param->gameBgmFadeInTime < CELL_SYSUTIL_BGMPLAYBACK_FADE_INVALID ||
|
||||
param->gameBgmFadeInTime > 60000 ||
|
||||
param->gameBgmFadeOutTime < CELL_SYSUTIL_BGMPLAYBACK_FADE_INVALID ||
|
||||
param->gameBgmFadeOutTime > 60000)
|
||||
{
|
||||
return CELL_SYSUTIL_BGMPLAYBACK_EX_ERROR_PARAM;
|
||||
}
|
||||
|
|
@ -792,20 +887,25 @@ error_code cellSysutilSetBgmPlaybackExtraParam(vm::ptr<CellSysutilBgmPlaybackExt
|
|||
bgm.param.gameBgmFadeInTime = param->gameBgmFadeInTime;
|
||||
bgm.param.gameBgmFadeOutTime = param->gameBgmFadeOutTime;
|
||||
|
||||
// TODO: apparently you are only able to set this only once and while bgm is enabled
|
||||
// TODO: apparently you are only able to set this only once and while bgm is
|
||||
// enabled
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellSysutilRegisterCallbackDispatcher(u32 event_code, u32 func_addr)
|
||||
error_code cellSysutilRegisterCallbackDispatcher(u32 event_code,
|
||||
u32 func_addr)
|
||||
{
|
||||
cellSysutil.warning("cellSysutilRegisterCallbackDispatcher(event_code=0x%x, func_addr=0x%x)", event_code, func_addr);
|
||||
cellSysutil.warning(
|
||||
"cellSysutilRegisterCallbackDispatcher(event_code=0x%x, func_addr=0x%x)",
|
||||
event_code, func_addr);
|
||||
|
||||
auto& cbm = g_fxo->get<sysutil_cb_manager>();
|
||||
|
||||
for (u32 i = 0; i < cbm.dispatchers.size(); i++)
|
||||
{
|
||||
if (cbm.dispatchers[i].atomic_op([&](sysutil_cb_manager::registered_dispatcher& dispatcher)
|
||||
if (cbm.dispatchers[i].atomic_op(
|
||||
[&](sysutil_cb_manager::registered_dispatcher& dispatcher)
|
||||
{
|
||||
if (dispatcher.event_code == 0)
|
||||
{
|
||||
|
|
@ -825,13 +925,15 @@ error_code cellSysutilRegisterCallbackDispatcher(u32 event_code, u32 func_addr)
|
|||
|
||||
error_code cellSysutilUnregisterCallbackDispatcher(u32 event_code)
|
||||
{
|
||||
cellSysutil.warning("cellSysutilUnregisterCallbackDispatcher(event_code=0x%x)", event_code);
|
||||
cellSysutil.warning(
|
||||
"cellSysutilUnregisterCallbackDispatcher(event_code=0x%x)", event_code);
|
||||
|
||||
auto& cbm = g_fxo->get<sysutil_cb_manager>();
|
||||
|
||||
for (u32 i = 0; i < cbm.dispatchers.size(); i++)
|
||||
{
|
||||
if (cbm.dispatchers[i].atomic_op([&](sysutil_cb_manager::registered_dispatcher& dispatcher)
|
||||
if (cbm.dispatchers[i].atomic_op(
|
||||
[&](sysutil_cb_manager::registered_dispatcher& dispatcher)
|
||||
{
|
||||
if (dispatcher.event_code == event_code)
|
||||
{
|
||||
|
|
@ -1095,7 +1197,8 @@ error_code _ZN16sysutil_cxmlutil11FixedMemory5BeginEi()
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code _ZN16sysutil_cxmlutil11FixedMemory8AllocateEN4cxml14AllocationTypeEPvS3_jPS3_Pj()
|
||||
error_code
|
||||
_ZN16sysutil_cxmlutil11FixedMemory8AllocateEN4cxml14AllocationTypeEPvS3_jPS3_Pj()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSysutil);
|
||||
return CELL_OK;
|
||||
|
|
@ -1207,14 +1310,18 @@ DECLARE(ppu_module_manager::cellSysutil)("cellSysutil", []()
|
|||
REG_FUNC(cellSysutil, _ZN8cxmlutil9GetStringERKN4cxml7ElementEPKcPS5_Pj);
|
||||
REG_FUNC(cellSysutil, _ZN8cxmlutil9SetStringERKN4cxml7ElementEPKcS5_);
|
||||
REG_FUNC(cellSysutil, _ZN8cxmlutil16CheckElementNameERKN4cxml7ElementEPKc);
|
||||
REG_FUNC(cellSysutil, _ZN8cxmlutil16FindChildElementERKN4cxml7ElementEPKcS5_S5_);
|
||||
REG_FUNC(cellSysutil,
|
||||
_ZN8cxmlutil16FindChildElementERKN4cxml7ElementEPKcS5_S5_);
|
||||
REG_FUNC(cellSysutil, _ZN8cxmlutil7GetFileERKN4cxml7ElementEPKcPNS0_4FileE);
|
||||
|
||||
REG_FUNC(cellSysutil, _ZN16sysutil_cxmlutil11FixedMemory3EndEi);
|
||||
REG_FUNC(cellSysutil, _ZN16sysutil_cxmlutil11FixedMemory5BeginEi);
|
||||
REG_FUNC(cellSysutil, _ZN16sysutil_cxmlutil11FixedMemory8AllocateEN4cxml14AllocationTypeEPvS3_jPS3_Pj);
|
||||
REG_FUNC(
|
||||
cellSysutil,
|
||||
_ZN16sysutil_cxmlutil11FixedMemory8AllocateEN4cxml14AllocationTypeEPvS3_jPS3_Pj);
|
||||
REG_FUNC(cellSysutil, _ZN16sysutil_cxmlutil12PacketWriter5WriteEPKvjPv);
|
||||
REG_FUNC(cellSysutil, _ZN16sysutil_cxmlutil12PacketWriterC1EiiRN4cxml8DocumentE);
|
||||
REG_FUNC(cellSysutil,
|
||||
_ZN16sysutil_cxmlutil12PacketWriterC1EiiRN4cxml8DocumentE);
|
||||
|
||||
REG_FNID(cellSysutil, 0xE1EC7B6A, cellSysutil_E1EC7B6A);
|
||||
});
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#include "stdafx.h"
|
||||
#include "Emu/Cell/PPUModule.h"
|
||||
#include "Emu/Cell/Modules/cellSysutilAvc.h"
|
||||
#include "Emu/Cell/Modules/cellSysutil.h"
|
||||
#include "cellSysutilAvc.h"
|
||||
#include "cellSysutil.h"
|
||||
#include "Emu/IdManager.h"
|
||||
|
||||
LOG_CHANNEL(cellSysutil);
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#include "stdafx.h"
|
||||
#include "Emu/Cell/PPUModule.h"
|
||||
#include "Emu/Cell/Modules/cellSysutilAvc.h"
|
||||
#include "cellSysutilAvc.h"
|
||||
|
||||
LOG_CHANNEL(cellSysutilAvcExt);
|
||||
|
||||
|
|
@ -1,17 +1,17 @@
|
|||
#include "stdafx.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/system_utils.hpp"
|
||||
#include "Emu/VFS.h"
|
||||
#include "Emu/IdManager.h"
|
||||
#include "Emu/Cell/PPUModule.h"
|
||||
#include "Emu/IdManager.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/VFS.h"
|
||||
#include "Emu/system_utils.hpp"
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "Emu/RSX/Overlays/overlay_manager.h"
|
||||
#include "Emu/RSX/Overlays/overlay_user_list_dialog.h"
|
||||
|
||||
#include "cellUserInfo.h"
|
||||
|
||||
#include "Utilities/StrUtil.h"
|
||||
#include "cellSysutil.h"
|
||||
#include "util/StrUtil.h"
|
||||
|
||||
LOG_CHANNEL(cellUserInfo);
|
||||
|
||||
|
|
@ -25,7 +25,8 @@ std::string get_username(const u32 user_id)
|
|||
{
|
||||
std::string username;
|
||||
|
||||
if (const fs::file file{rpcs3::utils::get_hdd0_dir() + fmt::format("home/%08d/localusername", user_id)})
|
||||
if (const fs::file file{rpcs3::utils::get_hdd0_dir() +
|
||||
fmt::format("home/%08d/localusername", user_id)})
|
||||
{
|
||||
username = file.to_string();
|
||||
username.resize(CELL_USERINFO_USERNAME_SIZE); // TODO: investigate
|
||||
|
|
@ -52,7 +53,8 @@ void fmt_class_string<CellUserInfoError>::format(std::string& out, u64 arg)
|
|||
}
|
||||
|
||||
template <>
|
||||
void fmt_class_string<cell_user_callback_result>::format(std::string& out, u64 arg)
|
||||
void fmt_class_string<cell_user_callback_result>::format(std::string& out,
|
||||
u64 arg)
|
||||
{
|
||||
format_enum(out, arg, [](auto error)
|
||||
{
|
||||
|
|
@ -86,7 +88,9 @@ error_code cellUserInfoGetStat(u32 id, vm::ptr<CellUserInfoUserStat> stat)
|
|||
|
||||
if (!fs::is_dir(path))
|
||||
{
|
||||
cellUserInfo.error("cellUserInfoGetStat(): CELL_USERINFO_ERROR_NOUSER. User %d doesn't exist. Did you delete the user folder?", id);
|
||||
cellUserInfo.error("cellUserInfoGetStat(): CELL_USERINFO_ERROR_NOUSER. "
|
||||
"User %d doesn't exist. Did you delete the user folder?",
|
||||
id);
|
||||
return CELL_USERINFO_ERROR_NOUSER;
|
||||
}
|
||||
|
||||
|
|
@ -94,7 +98,10 @@ error_code cellUserInfoGetStat(u32 id, vm::ptr<CellUserInfoUserStat> stat)
|
|||
|
||||
if (!f)
|
||||
{
|
||||
cellUserInfo.error("cellUserInfoGetStat(): CELL_USERINFO_ERROR_INTERNAL. Username for user %08u doesn't exist. Did you delete the username file?", id);
|
||||
cellUserInfo.error(
|
||||
"cellUserInfoGetStat(): CELL_USERINFO_ERROR_INTERNAL. Username for "
|
||||
"user %08u doesn't exist. Did you delete the username file?",
|
||||
id);
|
||||
return CELL_USERINFO_ERROR_INTERNAL;
|
||||
}
|
||||
|
||||
|
|
@ -107,9 +114,14 @@ error_code cellUserInfoGetStat(u32 id, vm::ptr<CellUserInfoUserStat> stat)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellUserInfoSelectUser_ListType(vm::ptr<CellUserInfoTypeSet> listType, vm::ptr<CellUserInfoFinishCallback> funcSelect, u32 container, vm::ptr<void> userdata)
|
||||
error_code
|
||||
cellUserInfoSelectUser_ListType(vm::ptr<CellUserInfoTypeSet> listType,
|
||||
vm::ptr<CellUserInfoFinishCallback> funcSelect,
|
||||
u32 container, vm::ptr<void> userdata)
|
||||
{
|
||||
cellUserInfo.warning("cellUserInfoSelectUser_ListType(listType=*0x%x, funcSelect=*0x%x, container=0x%x, userdata=*0x%x)", listType, funcSelect, container, userdata);
|
||||
cellUserInfo.warning("cellUserInfoSelectUser_ListType(listType=*0x%x, "
|
||||
"funcSelect=*0x%x, container=0x%x, userdata=*0x%x)",
|
||||
listType, funcSelect, container, userdata);
|
||||
|
||||
if (!listType || !funcSelect) // TODO: confirm
|
||||
{
|
||||
|
|
@ -146,7 +158,8 @@ error_code cellUserInfoSelectUser_ListType(vm::ptr<CellUserInfoTypeSet> listType
|
|||
}
|
||||
|
||||
// TODO: maybe also restrict this to CELL_USERINFO_USER_MAX
|
||||
if (listType->type != CELL_USERINFO_LISTTYPE_NOCURRENT || user_id != Emu.GetUsrId())
|
||||
if (listType->type != CELL_USERINFO_LISTTYPE_NOCURRENT ||
|
||||
user_id != Emu.GetUsrId())
|
||||
{
|
||||
user_ids.push_back(user_id);
|
||||
}
|
||||
|
|
@ -159,7 +172,8 @@ error_code cellUserInfoSelectUser_ListType(vm::ptr<CellUserInfoTypeSet> listType
|
|||
return CELL_USERINFO_ERROR_BUSY;
|
||||
}
|
||||
|
||||
if (s32 ret = sysutil_send_system_cmd(CELL_SYSUTIL_DRAWING_BEGIN, 0); ret < 0)
|
||||
if (s32 ret = sysutil_send_system_cmd(CELL_SYSUTIL_DRAWING_BEGIN, 0);
|
||||
ret < 0)
|
||||
{
|
||||
g_fxo->get<user_info_manager>().dialog_opened = false;
|
||||
return CELL_USERINFO_ERROR_BUSY;
|
||||
|
|
@ -168,45 +182,55 @@ error_code cellUserInfoSelectUser_ListType(vm::ptr<CellUserInfoTypeSet> listType
|
|||
const std::string title = listType->title.get_ptr();
|
||||
const u32 focused = listType->focus;
|
||||
|
||||
cellUserInfo.warning("cellUserInfoSelectUser_ListType: opening user_list_dialog with: title='%s', focused=%d", title, focused);
|
||||
cellUserInfo.warning("cellUserInfoSelectUser_ListType: opening "
|
||||
"user_list_dialog with: title='%s', focused=%d",
|
||||
title, focused);
|
||||
|
||||
const bool enable_overlay = g_fxo->get<user_info_manager>().enable_overlay;
|
||||
const error_code result = manager->create<rsx::overlays::user_list_dialog>()->show(title, focused, user_ids, enable_overlay, [funcSelect, userdata](s32 status)
|
||||
{
|
||||
s32 callback_result = CELL_USERINFO_RET_CANCEL;
|
||||
u32 selected_user_id = 0;
|
||||
std::string selected_username;
|
||||
|
||||
if (status >= 0)
|
||||
const error_code result =
|
||||
manager->create<rsx::overlays::user_list_dialog>()->show(
|
||||
title, focused, user_ids, enable_overlay,
|
||||
[funcSelect, userdata](s32 status)
|
||||
{
|
||||
callback_result = CELL_USERINFO_RET_OK;
|
||||
selected_user_id = static_cast<u32>(status);
|
||||
selected_username = get_username(selected_user_id);
|
||||
}
|
||||
s32 callback_result = CELL_USERINFO_RET_CANCEL;
|
||||
u32 selected_user_id = 0;
|
||||
std::string selected_username;
|
||||
|
||||
cellUserInfo.warning("cellUserInfoSelectUser_ListType: callback_result=%s, selected_user_id=%d, selected_username='%s'", callback_result, selected_user_id, selected_username);
|
||||
|
||||
g_fxo->get<user_info_manager>().dialog_opened = false;
|
||||
|
||||
sysutil_send_system_cmd(CELL_SYSUTIL_DRAWING_END, 0);
|
||||
|
||||
sysutil_register_cb([=](ppu_thread& ppu) -> s32
|
||||
if (status >= 0)
|
||||
{
|
||||
vm::var<CellUserInfoUserStat> selectUser;
|
||||
if (status >= 0)
|
||||
callback_result = CELL_USERINFO_RET_OK;
|
||||
selected_user_id = static_cast<u32>(status);
|
||||
selected_username = get_username(selected_user_id);
|
||||
}
|
||||
|
||||
cellUserInfo.warning(
|
||||
"cellUserInfoSelectUser_ListType: callback_result=%s, "
|
||||
"selected_user_id=%d, selected_username='%s'",
|
||||
callback_result, selected_user_id, selected_username);
|
||||
|
||||
g_fxo->get<user_info_manager>().dialog_opened = false;
|
||||
|
||||
sysutil_send_system_cmd(CELL_SYSUTIL_DRAWING_END, 0);
|
||||
|
||||
sysutil_register_cb([=](ppu_thread& ppu) -> s32
|
||||
{
|
||||
selectUser->id = selected_user_id;
|
||||
strcpy_trunc(selectUser->name, selected_username);
|
||||
}
|
||||
funcSelect(ppu, callback_result, selectUser, userdata);
|
||||
return CELL_OK;
|
||||
});
|
||||
});
|
||||
vm::var<CellUserInfoUserStat> selectUser;
|
||||
if (status >= 0)
|
||||
{
|
||||
selectUser->id = selected_user_id;
|
||||
strcpy_trunc(selectUser->name, selected_username);
|
||||
}
|
||||
funcSelect(ppu, callback_result, selectUser, userdata);
|
||||
return CELL_OK;
|
||||
});
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
cellUserInfo.error("User selection is only possible when the native user interface is enabled in the settings. The currently active user will be selected as a fallback.");
|
||||
cellUserInfo.error("User selection is only possible when the native user "
|
||||
"interface is enabled in the settings. The currently "
|
||||
"active user will be selected as a fallback.");
|
||||
|
||||
sysutil_register_cb([=](ppu_thread& ppu) -> s32
|
||||
{
|
||||
|
|
@ -220,9 +244,14 @@ error_code cellUserInfoSelectUser_ListType(vm::ptr<CellUserInfoTypeSet> listType
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellUserInfoSelectUser_SetList(vm::ptr<CellUserInfoListSet> setList, vm::ptr<CellUserInfoFinishCallback> funcSelect, u32 container, vm::ptr<void> userdata)
|
||||
error_code
|
||||
cellUserInfoSelectUser_SetList(vm::ptr<CellUserInfoListSet> setList,
|
||||
vm::ptr<CellUserInfoFinishCallback> funcSelect,
|
||||
u32 container, vm::ptr<void> userdata)
|
||||
{
|
||||
cellUserInfo.warning("cellUserInfoSelectUser_SetList(setList=*0x%x, funcSelect=*0x%x, container=0x%x, userdata=*0x%x)", setList, funcSelect, container, userdata);
|
||||
cellUserInfo.warning("cellUserInfoSelectUser_SetList(setList=*0x%x, "
|
||||
"funcSelect=*0x%x, container=0x%x, userdata=*0x%x)",
|
||||
setList, funcSelect, container, userdata);
|
||||
|
||||
if (!setList || !funcSelect) // TODO: confirm
|
||||
{
|
||||
|
|
@ -236,7 +265,8 @@ error_code cellUserInfoSelectUser_SetList(vm::ptr<CellUserInfoListSet> setList,
|
|||
|
||||
std::vector<u32> user_ids;
|
||||
|
||||
for (usz i = 0; i < CELL_USERINFO_USER_MAX && i < setList->fixedListNum; i++)
|
||||
for (usz i = 0; i < CELL_USERINFO_USER_MAX && i < setList->fixedListNum;
|
||||
i++)
|
||||
{
|
||||
if (const u32 id = setList->fixedList->userId[i])
|
||||
{
|
||||
|
|
@ -246,8 +276,10 @@ error_code cellUserInfoSelectUser_SetList(vm::ptr<CellUserInfoListSet> setList,
|
|||
|
||||
if (user_ids.empty())
|
||||
{
|
||||
// TODO: Confirm. Also check if this is possible in cellUserInfoSelectUser_ListType.
|
||||
cellUserInfo.error("cellUserInfoSelectUser_SetList: callback_result=%s", CELL_USERINFO_ERROR_NOUSER);
|
||||
// TODO: Confirm. Also check if this is possible in
|
||||
// cellUserInfoSelectUser_ListType.
|
||||
cellUserInfo.error("cellUserInfoSelectUser_SetList: callback_result=%s",
|
||||
CELL_USERINFO_ERROR_NOUSER);
|
||||
|
||||
sysutil_register_cb([=](ppu_thread& ppu) -> s32
|
||||
{
|
||||
|
|
@ -259,7 +291,8 @@ error_code cellUserInfoSelectUser_SetList(vm::ptr<CellUserInfoListSet> setList,
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
// TODO: does this function return an error if any (user_id > 0 && not_found) ?
|
||||
// TODO: does this function return an error if any (user_id > 0 && not_found)
|
||||
// ?
|
||||
|
||||
if (auto manager = g_fxo->try_get<rsx::overlays::display_manager>())
|
||||
{
|
||||
|
|
@ -268,7 +301,8 @@ error_code cellUserInfoSelectUser_SetList(vm::ptr<CellUserInfoListSet> setList,
|
|||
return CELL_USERINFO_ERROR_BUSY;
|
||||
}
|
||||
|
||||
if (s32 ret = sysutil_send_system_cmd(CELL_SYSUTIL_DRAWING_BEGIN, 0); ret < 0)
|
||||
if (s32 ret = sysutil_send_system_cmd(CELL_SYSUTIL_DRAWING_BEGIN, 0);
|
||||
ret < 0)
|
||||
{
|
||||
g_fxo->get<user_info_manager>().dialog_opened = false;
|
||||
return CELL_USERINFO_ERROR_BUSY;
|
||||
|
|
@ -277,45 +311,55 @@ error_code cellUserInfoSelectUser_SetList(vm::ptr<CellUserInfoListSet> setList,
|
|||
const std::string title = setList->title.get_ptr();
|
||||
const u32 focused = setList->focus;
|
||||
|
||||
cellUserInfo.warning("cellUserInfoSelectUser_SetList: opening user_list_dialog with: title='%s', focused=%d", title, focused);
|
||||
cellUserInfo.warning("cellUserInfoSelectUser_SetList: opening "
|
||||
"user_list_dialog with: title='%s', focused=%d",
|
||||
title, focused);
|
||||
|
||||
const bool enable_overlay = g_fxo->get<user_info_manager>().enable_overlay;
|
||||
const error_code result = manager->create<rsx::overlays::user_list_dialog>()->show(title, focused, user_ids, enable_overlay, [funcSelect, userdata](s32 status)
|
||||
{
|
||||
s32 callback_result = CELL_USERINFO_RET_CANCEL;
|
||||
u32 selected_user_id = 0;
|
||||
std::string selected_username;
|
||||
|
||||
if (status >= 0)
|
||||
const error_code result =
|
||||
manager->create<rsx::overlays::user_list_dialog>()->show(
|
||||
title, focused, user_ids, enable_overlay,
|
||||
[funcSelect, userdata](s32 status)
|
||||
{
|
||||
callback_result = CELL_USERINFO_RET_OK;
|
||||
selected_user_id = static_cast<u32>(status);
|
||||
selected_username = get_username(selected_user_id);
|
||||
}
|
||||
s32 callback_result = CELL_USERINFO_RET_CANCEL;
|
||||
u32 selected_user_id = 0;
|
||||
std::string selected_username;
|
||||
|
||||
cellUserInfo.warning("cellUserInfoSelectUser_SetList: callback_result=%s, selected_user_id=%d, selected_username='%s'", callback_result, selected_user_id, selected_username);
|
||||
|
||||
g_fxo->get<user_info_manager>().dialog_opened = false;
|
||||
|
||||
sysutil_send_system_cmd(CELL_SYSUTIL_DRAWING_END, 0);
|
||||
|
||||
sysutil_register_cb([=](ppu_thread& ppu) -> s32
|
||||
if (status >= 0)
|
||||
{
|
||||
vm::var<CellUserInfoUserStat> selectUser;
|
||||
if (status >= 0)
|
||||
callback_result = CELL_USERINFO_RET_OK;
|
||||
selected_user_id = static_cast<u32>(status);
|
||||
selected_username = get_username(selected_user_id);
|
||||
}
|
||||
|
||||
cellUserInfo.warning(
|
||||
"cellUserInfoSelectUser_SetList: callback_result=%s, "
|
||||
"selected_user_id=%d, selected_username='%s'",
|
||||
callback_result, selected_user_id, selected_username);
|
||||
|
||||
g_fxo->get<user_info_manager>().dialog_opened = false;
|
||||
|
||||
sysutil_send_system_cmd(CELL_SYSUTIL_DRAWING_END, 0);
|
||||
|
||||
sysutil_register_cb([=](ppu_thread& ppu) -> s32
|
||||
{
|
||||
selectUser->id = selected_user_id;
|
||||
strcpy_trunc(selectUser->name, selected_username);
|
||||
}
|
||||
funcSelect(ppu, callback_result, selectUser, userdata);
|
||||
return CELL_OK;
|
||||
});
|
||||
});
|
||||
vm::var<CellUserInfoUserStat> selectUser;
|
||||
if (status >= 0)
|
||||
{
|
||||
selectUser->id = selected_user_id;
|
||||
strcpy_trunc(selectUser->name, selected_username);
|
||||
}
|
||||
funcSelect(ppu, callback_result, selectUser, userdata);
|
||||
return CELL_OK;
|
||||
});
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
cellUserInfo.error("User selection is only possible when the native user interface is enabled in the settings. The currently active user will be selected as a fallback.");
|
||||
cellUserInfo.error("User selection is only possible when the native user "
|
||||
"interface is enabled in the settings. The currently "
|
||||
"active user will be selected as a fallback.");
|
||||
|
||||
sysutil_register_cb([=](ppu_thread& ppu) -> s32
|
||||
{
|
||||
|
|
@ -336,9 +380,13 @@ void cellUserInfoEnableOverlay(s32 enable)
|
|||
manager.enable_overlay = enable != 0;
|
||||
}
|
||||
|
||||
error_code cellUserInfoGetList(vm::ptr<u32> listNum, vm::ptr<CellUserInfoUserList> listBuf, vm::ptr<u32> currentUserId)
|
||||
error_code cellUserInfoGetList(vm::ptr<u32> listNum,
|
||||
vm::ptr<CellUserInfoUserList> listBuf,
|
||||
vm::ptr<u32> currentUserId)
|
||||
{
|
||||
cellUserInfo.warning("cellUserInfoGetList(listNum=*0x%x, listBuf=*0x%x, currentUserId=*0x%x)", listNum, listBuf, currentUserId);
|
||||
cellUserInfo.warning(
|
||||
"cellUserInfoGetList(listNum=*0x%x, listBuf=*0x%x, currentUserId=*0x%x)",
|
||||
listNum, listBuf, currentUserId);
|
||||
|
||||
// If only listNum is NULL, an error will be returned
|
||||
if (!listNum)
|
||||
|
|
@ -379,7 +427,9 @@ error_code cellUserInfoGetList(vm::ptr<u32> listNum, vm::ptr<CellUserInfoUserLis
|
|||
}
|
||||
else
|
||||
{
|
||||
cellUserInfo.warning("cellUserInfoGetList: Cannot add user %s. Too many users.", user_folder.name);
|
||||
cellUserInfo.warning(
|
||||
"cellUserInfoGetList: Cannot add user %s. Too many users.",
|
||||
user_folder.name);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load diff
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue