s32 L10nConvertStr(s32 src_code, vm::cptr<void> src, vm::ptr<s32> src_len, s32 dst_code, vm::ptr<void> dst, vm::ptr<s32> dst_len) { cellL10n.error("L10nConvertStr(src_code=%d, src=*0x%x, src_len=*0x%x, dst_code=%d, dst=*0x%x, dst_len=*0x%x)", src_code, src, src_len, dst_code, dst, dst_len); return _L10nConvertStr(src_code, src, src_len, dst_code, dst, dst_len); }
s32 cellSslInit(vm::ptr<void> pool, u32 poolSize) { cellSsl.todo("cellSslInit(pool=0x%x, poolSize=%d)", pool, poolSize); return CELL_OK; }
s32 cellCameraIsOpen(s32 dev_num) { cellCamera.todo("cellCameraIsOpen(dev_num=%d)", dev_num); return CELL_OK; }
s32 cellSailPlayerIsPaused(vm::ptr<CellSailPlayer> pSelf) { cellSail.warning("cellSailPlayerIsPaused(pSelf=*0x%x)", pSelf); return pSelf->paused; }
s32 cellFontSetFontsetOpenMode(u32 openMode) { cellFont.todo("cellFontSetFontsetOpenMode(openMode=0x%x)", openMode); return CELL_OK; }
s32 cellSailFutureGet(vm::ptr<CellSailFuture> pSelf, u64 timeout, vm::ptr<s32> pResult) { cellSail.todo("cellSailFutureGet(pSelf=*0x%x, timeout=%lld, result=*0x%x)", pSelf, timeout, pResult); return CELL_OK; }
s32 cellSailPlayerGetDescriptorCount(vm::ptr<CellSailPlayer> pSelf) { cellSail.warning("cellSailPlayerGetDescriptorCount(pSelf=*0x%x)", pSelf); return pSelf->descriptors; }
s32 cellAtracSetLoopNum(vm::ptr<CellAtracHandle> pHandle, s32 iLoopNum) { cellAtrac.warning("cellAtracSetLoopNum(pHandle=*0x%x, iLoopNum=%d)", pHandle, iLoopNum); return CELL_OK; }
s32 cellAtracResetPlayPosition(vm::ptr<CellAtracHandle> pHandle, u32 uiSample, u32 uiWriteByte) { cellAtrac.warning("cellAtracResetPlayPosition(pHandle=*0x%x, uiSample=0x%x, uiWriteByte=0x%x)", pHandle, uiSample, uiWriteByte); return CELL_OK; }
s32 sceNpTusTerm() { sceNpTus.warning("sceNpTusTerm()"); return CELL_OK; }
s32 sceNpTusInit() { sceNpTus.warning("sceNpTusInit()"); return CELL_OK; }
error_code sys_fs_chmod(vm::cptr<char> path, s32 mode) { sys_fs.todo("sys_fs_chmod(path=%s, mode=%#o) -> CELL_OK", path, mode); return CELL_OK; }
error_code sys_fs_open(vm::cptr<char> path, s32 flags, vm::ptr<u32> fd, s32 mode, vm::cptr<void> arg, u64 size) { sys_fs.warning("sys_fs_open(path=%s, flags=%#o, fd=*0x%x, mode=%#o, arg=*0x%x, size=0x%llx)", path, flags, fd, mode, arg, size); if (!path[0]) { sys_fs.error("sys_fs_open(%s) failed: path is invalid", path); return CELL_EINVAL; } const std::string& local_path = vfs::get(path.get_ptr()); if (local_path.empty()) { sys_fs.error("sys_fs_open(%s) failed: device not mounted", path); return CELL_ENOTMOUNTED; } // TODO: other checks for path if (fs::is_dir(local_path)) { sys_fs.error("sys_fs_open(%s) failed: path is a directory", path); return CELL_EISDIR; } bs_t<fs::open_mode> open_mode{}; switch (flags & CELL_FS_O_ACCMODE) { case CELL_FS_O_RDONLY: open_mode += fs::read; break; case CELL_FS_O_WRONLY: open_mode += fs::write; break; case CELL_FS_O_RDWR: open_mode += fs::read + fs::write; break; } if (flags & CELL_FS_O_CREAT) { open_mode += fs::create; } if (flags & CELL_FS_O_TRUNC) { open_mode += fs::trunc; } if (flags & CELL_FS_O_APPEND) { open_mode += fs::append; } if (flags & CELL_FS_O_EXCL) { if (flags & CELL_FS_O_CREAT) { open_mode += fs::excl; } else { open_mode = {}; // error } } if (flags & ~(CELL_FS_O_ACCMODE | CELL_FS_O_CREAT | CELL_FS_O_TRUNC | CELL_FS_O_APPEND | CELL_FS_O_EXCL)) { open_mode = {}; // error } if ((flags & CELL_FS_O_ACCMODE) == CELL_FS_O_ACCMODE) { open_mode = {}; // error } if (!test(open_mode)) { fmt::throw_exception("sys_fs_open(%s): Invalid or unimplemented flags: %#o" HERE, path, flags); } const char *path_ptr = path.get_ptr(); if (strstr(path.get_ptr(), "/dev_hdd0") && strncmp(path.get_ptr(), "/dev_hdd0", 9)) { path_ptr = strstr(path_ptr, "/dev_hdd0"); LOG_ERROR(HLE, "Path contains device root path but not at the start!"); LOG_ERROR(HLE, "Path given is (%s), modified to (%s)", path.get_ptr(), path_ptr); } fs::file file(local_path, open_mode); if (!file) { sys_fs.error("sys_fs_open(%s): failed to open file (flags=%#o, mode=%#o)", path, flags, mode); if (test(open_mode & fs::excl)) { return CELL_EEXIST; // approximation } return CELL_ENOENT; } const auto _file = idm::make_ptr<lv2_file>(path.get_ptr(), std::move(file), mode, flags); if (!_file) { // out of file descriptors return CELL_EMFILE; } *fd = _file->id; return CELL_OK; }
error_code sys_fs_test(u32 arg1, u32 arg2, vm::ptr<u32> arg3, u32 arg4, vm::ptr<char> arg5, u32 arg6) { sys_fs.todo("sys_fs_test(arg1=0x%x, arg2=0x%x, arg3=*0x%x, arg4=0x%x, arg5=*0x%x, arg6=0x%x) -> CELL_OK", arg1, arg2, arg3, arg4, arg5, arg6); return CELL_OK; }
s32 cellSailFutureReset(vm::ptr<CellSailFuture> pSelf, b8 wait) { cellSail.todo("cellSailFutureReset(pSelf=*0x%x, wait=%d)", pSelf, wait); return CELL_OK; }
s32 cellAtracDeleteDecoder(vm::ptr<CellAtracHandle> pHandle) { cellAtrac.warning("cellAtracDeleteDecoder(pHandle=*0x%x)", pHandle); return CELL_OK; }
s32 cellSailFutureSet(vm::ptr<CellSailFuture> pSelf, s32 result) { cellSail.todo("cellSailFutureSet(pSelf=*0x%x, result=%d)", pSelf, result); return CELL_OK; }
s32 cellAtracAddStreamData(vm::ptr<CellAtracHandle> pHandle, u32 uiAddByte) { cellAtrac.warning("cellAtracAddStreamData(pHandle=*0x%x, uiAddByte=0x%x)", pHandle, uiAddByte); return CELL_OK; }
s32 cellSailFutureIsDone(vm::ptr<CellSailFuture> pSelf, vm::ptr<s32> pResult) { cellSail.todo("cellSailFutureIsDone(pSelf=*0x%x, result=*0x%x)", pSelf, pResult); return CELL_OK; }
s32 cellAtracIsSecondBufferNeeded(vm::ptr<CellAtracHandle> pHandle) { cellAtrac.warning("cellAtracIsSecondBufferNeeded(pHandle=*0x%x)", pHandle); return 0; }
s32 cellSailPlayerSetPaused(vm::ptr<CellSailPlayer> pSelf, b8 paused) { cellSail.todo("cellSailPlayerSetPaused(pSelf=*0x%x, paused=%d)", pSelf, paused); return CELL_OK; }
s32 cellAtracSetSecondBuffer(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u8> pucSecondBufferAddr, u32 uiSecondBufferByte) { cellAtrac.warning("cellAtracSetSecondBuffer(pHandle=*0x%x, pucSecondBufferAddr=*0x%x, uiSecondBufferByte=0x%x)", pHandle, pucSecondBufferAddr, uiSecondBufferByte); return CELL_OK; }
s32 cellFontEnd() { cellFont.warning("cellFontEnd()"); return CELL_OK; }
s32 cellSailGraphicsAdapterGetFrame(vm::ptr<CellSailGraphicsAdapter> pSelf, vm::ptr<CellSailGraphicsFrameInfo> pInfo) { cellSail.todo("cellSailGraphicsAdapterGetFrame(pSelf=*0x%x, pInfo=*0x%x)", pSelf, pInfo); return CELL_OK; }
s32 cellFontOpenFontset(ppu_thread& ppu, vm::ptr<CellFontLibrary> library, vm::ptr<CellFontType> fontType, vm::ptr<CellFont> font) { cellFont.warning("cellFontOpenFontset(library=*0x%x, fontType=*0x%x, font=*0x%x)", library, fontType, font); if (fontType->map != CELL_FONT_MAP_UNICODE) { cellFont.warning("cellFontOpenFontset: Only Unicode is supported"); } std::string file; switch((u32)fontType->type) { case CELL_FONT_TYPE_RODIN_SANS_SERIF_LATIN: file = "/dev_flash/data/font/SCE-PS3-RD-R-LATIN.TTF"; break; case CELL_FONT_TYPE_RODIN_SANS_SERIF_LIGHT_LATIN: file = "/dev_flash/data/font/SCE-PS3-RD-L-LATIN.TTF"; break; case CELL_FONT_TYPE_RODIN_SANS_SERIF_BOLD_LATIN: file = "/dev_flash/data/font/SCE-PS3-RD-B-LATIN.TTF"; break; case CELL_FONT_TYPE_RODIN_SANS_SERIF_LATIN2: file = "/dev_flash/data/font/SCE-PS3-RD-R-LATIN2.TTF"; break; case CELL_FONT_TYPE_RODIN_SANS_SERIF_LIGHT_LATIN2: file = "/dev_flash/data/font/SCE-PS3-RD-L-LATIN2.TTF"; break; case CELL_FONT_TYPE_RODIN_SANS_SERIF_BOLD_LATIN2: file = "/dev_flash/data/font/SCE-PS3-RD-B-LATIN2.TTF"; break; case CELL_FONT_TYPE_MATISSE_SERIF_LATIN: file = "/dev_flash/data/font/SCE-PS3-MT-R-LATIN.TTF"; break; case CELL_FONT_TYPE_NEWRODIN_GOTHIC_JAPANESE: file = "/dev_flash/data/font/SCE-PS3-NR-R-JPN.TTF"; break; case CELL_FONT_TYPE_NEWRODIN_GOTHIC_LIGHT_JAPANESE: file = "/dev_flash/data/font/SCE-PS3-NR-L-JPN.TTF"; break; case CELL_FONT_TYPE_NEWRODIN_GOTHIC_BOLD_JAPANESE: file = "/dev_flash/data/font/SCE-PS3-NR-B-JPN.TTF"; break; case CELL_FONT_TYPE_YD_GOTHIC_KOREAN: file = "/dev_flash/data/font/SCE-PS3-YG-R-KOR.TTF"; break; case CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_LATIN: file = "/dev_flash/data/font/SCE-PS3-SR-R-LATIN.TTF"; break; case CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_LATIN2: file = "/dev_flash/data/font/SCE-PS3-SR-R-LATIN2.TTF"; break; case CELL_FONT_TYPE_VAGR_SANS_SERIF_ROUND: file = "/dev_flash/data/font/SCE-PS3-VR-R-LATIN.TTF"; break; case CELL_FONT_TYPE_VAGR_SANS_SERIF_ROUND_LATIN2: file = "/dev_flash/data/font/SCE-PS3-VR-R-LATIN2.TTF"; break; case CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_JAPANESE: file = "/dev_flash/data/font/SCE-PS3-SR-R-JPN.TTF"; break; case CELL_FONT_TYPE_NEWRODIN_GOTHIC_JP_SET: case CELL_FONT_TYPE_NEWRODIN_GOTHIC_LATIN_SET: case CELL_FONT_TYPE_NEWRODIN_GOTHIC_RODIN_SET: case CELL_FONT_TYPE_NEWRODIN_GOTHIC_RODIN2_SET: case CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_RODIN2_SET: case CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_DFHEI5_SET: case CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_DFHEI5_RODIN_SET: case CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_DFHEI5_RODIN2_SET: case CELL_FONT_TYPE_DFHEI5_GOTHIC_YG_NEWRODIN_TCH_SET: case CELL_FONT_TYPE_DFHEI5_GOTHIC_YG_NEWRODIN_RODIN_TCH_SET: case CELL_FONT_TYPE_DFHEI5_GOTHIC_YG_NEWRODIN_RODIN2_TCH_SET: case CELL_FONT_TYPE_DFHEI5_GOTHIC_YG_NEWRODIN_SCH_SET: case CELL_FONT_TYPE_DFHEI5_GOTHIC_YG_NEWRODIN_RODIN_SCH_SET: case CELL_FONT_TYPE_DFHEI5_GOTHIC_YG_NEWRODIN_RODIN2_SCH_SET: case CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_RSANS_SET: case CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_RSANS_SET: case CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_JP_SET: case CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_YG_DFHEI5_RSANS_SET: case CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_YG_DFHEI5_RSANS_SET: case CELL_FONT_TYPE_VAGR_SEURAT_CAPIE_MARU_GOTHIC_RSANS_SET: case CELL_FONT_TYPE_VAGR_SEURAT_CAPIE_MARU_GOTHIC_YG_DFHEI5_RSANS_SET: case CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_LIGHT_SET: case CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_RODIN_LIGHT_SET: case CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_RODIN2_LIGHT_SET: case CELL_FONT_TYPE_NEWRODIN_GOTHIC_RODIN_LIGHT_SET: case CELL_FONT_TYPE_NEWRODIN_GOTHIC_RODIN2_LIGHT_SET: case CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_BOLD_SET: case CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_RODIN_BOLD_SET: case CELL_FONT_TYPE_NEWRODIN_GOTHIC_YG_RODIN2_BOLD_SET: case CELL_FONT_TYPE_NEWRODIN_GOTHIC_RODIN_BOLD_SET: case CELL_FONT_TYPE_NEWRODIN_GOTHIC_RODIN2_BOLD_SET: case CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_RSANS2_SET: case CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_RSANS2_SET: case CELL_FONT_TYPE_SEURAT_MARU_GOTHIC_YG_DFHEI5_RSANS2_SET: case CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_YG_DFHEI5_RSANS2_SET: case CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_YG_DFHEI5_VAGR2_SET: case CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_VAGR2_SET: cellFont.warning("cellFontOpenFontset: fontType->type = %d not supported yet. RD-R-LATIN.TTF will be used instead.", fontType->type); file = "/dev_flash/data/font/SCE-PS3-RD-R-LATIN.TTF"; break; default: cellFont.warning("cellFontOpenFontset: fontType->type = %d not supported.", fontType->type); return CELL_FONT_ERROR_NO_SUPPORT_FONTSET; } s32 ret = cellFontOpenFontFile(library, vm::make_str(file), 0, 0, font); //TODO: Find the correct values of subNum, uniqueId font->origin = CELL_FONT_OPEN_FONTSET; return ret; }
s32 cellSailGraphicsAdapterGetFrame2(vm::ptr<CellSailGraphicsAdapter> pSelf, vm::ptr<CellSailGraphicsFrameInfo> pInfo, vm::ptr<CellSailGraphicsFrameInfo> pPrevInfo, vm::ptr<u64> pFlipTime, u64 flags) { cellSail.todo("cellSailGraphicsAdapterGetFrame2(pSelf=*0x%x, pInfo=*0x%x, pPrevInfo=*0x%x, flipTime=*0x%x, flags=0x%llx)", pSelf, pInfo, pPrevInfo, pFlipTime, flags); return CELL_OK; }
s32 cellCameraIsAvailable(s32 dev_num) { cellCamera.todo("cellCameraIsAvailable(dev_num=%d)", dev_num); return CELL_OK; }
s32 cellSailFutureFinalize(vm::ptr<CellSailFuture> pSelf) { cellSail.todo("cellSailFutureFinalize(pSelf=*0x%x)", pSelf); return CELL_OK; }
s32 cellCameraIsStarted(s32 dev_num) { cellCamera.todo("cellCameraIsStarted(dev_num=%d)", dev_num); return CELL_OK; }
s32 UCS2toSJIS(u16 ch, vm::ptr<void> dst) { cellL10n.warning("UCS2toSJIS(ch=%d, dst=*0x%x)", ch, dst); return _L10nConvertCharNoResult(L10N_UTF8, &ch, sizeof(ch), L10N_CODEPAGE_932, dst); }