#include "stdafx.h" #include "Emu/Cell/PPUModule.h" #include "Emu/Cell/lv2/sys_fs.h" #include "cellSysutil.h" LOG_CHANNEL(cellPhotoImportUtil); // Return Codes enum { CELL_PHOTO_IMPORT_ERROR_BUSY = 0x8002c701, CELL_PHOTO_IMPORT_ERROR_INTERNAL = 0x8002c702, CELL_PHOTO_IMPORT_ERROR_PARAM = 0x8002c703, CELL_PHOTO_IMPORT_ERROR_ACCESS_ERROR = 0x8002c704, CELL_PHOTO_IMPORT_ERROR_COPY = 0x8002c705, CELL_PHOTO_IMPORT_ERROR_INITIALIZE = 0x8002c706, }; enum { CELL_PHOTO_IMPORT_HDD_PATH_MAX = 1055, CELL_PHOTO_IMPORT_PHOTO_TITLE_MAX_LENGTH = 64, CELL_PHOTO_IMPORT_GAME_TITLE_MAX_SIZE = 128, CELL_PHOTO_IMPORT_GAME_COMMENT_MAX_SIZE = 1024 }; enum CellPhotoImportFormatType { CELL_PHOTO_IMPORT_FT_UNKNOWN = 0, CELL_PHOTO_IMPORT_FT_JPEG, CELL_PHOTO_IMPORT_FT_PNG, CELL_PHOTO_IMPORT_FT_GIF, CELL_PHOTO_IMPORT_FT_BMP, CELL_PHOTO_IMPORT_FT_TIFF, CELL_PHOTO_IMPORT_FT_MPO, }; enum CellPhotoImportTexRot { CELL_PHOTO_IMPORT_TEX_ROT_0 = 0, CELL_PHOTO_IMPORT_TEX_ROT_90, CELL_PHOTO_IMPORT_TEX_ROT_180, CELL_PHOTO_IMPORT_TEX_ROT_270, }; struct CellPhotoImportFileDataSub { be_t width; be_t height; be_t format; be_t rotate; }; struct CellPhotoImportFileData { char dstFileName[CELL_FS_MAX_FS_FILE_NAME_LENGTH]; char photo_title[CELL_PHOTO_IMPORT_PHOTO_TITLE_MAX_LENGTH * 3]; char game_title[CELL_PHOTO_IMPORT_GAME_TITLE_MAX_SIZE]; char game_comment[CELL_PHOTO_IMPORT_GAME_COMMENT_MAX_SIZE]; char padding; vm::bptr data_sub; vm::bptr reserved; }; struct CellPhotoImportSetParam { be_t fileSizeMax; vm::bptr reserved1; vm::bptr reserved2; }; using CellPhotoImportFinishCallback = void(s32 result, vm::ptr filedata, vm::ptr userdata); error_code cellPhotoImport(u32 version, vm::cptr dstHddPath, vm::ptr param, u32 container, vm::ptr funcFinish, vm::ptr 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); sysutil_register_cb([=](ppu_thread& ppu) -> s32 { vm::var filedata; vm::var sub; filedata->data_sub = sub; funcFinish(ppu, CELL_OK, filedata, userdata); return CELL_OK; }); return CELL_OK; } error_code cellPhotoImport2(u32 version, vm::cptr dstHddPath, vm::ptr param, vm::ptr funcFinish, vm::ptr userdata) { cellPhotoImportUtil.todo("cellPhotoImport2(version=0x%x, dstHddPath=%s, param=*0x%x, funcFinish=*0x%x, userdata=*0x%x)", version, dstHddPath, param, funcFinish, userdata); sysutil_register_cb([=](ppu_thread& ppu) -> s32 { vm::var filedata; vm::var sub; filedata->data_sub = sub; funcFinish(ppu, CELL_OK, filedata, userdata); return CELL_OK; }); return CELL_OK; } DECLARE(ppu_module_manager::cellPhotoImportUtil)("cellPhotoImportUtil", []() { REG_FUNC(cellPhotoImportUtil, cellPhotoImport); REG_FUNC(cellPhotoImportUtil, cellPhotoImport2); });