static void frontend_ps3_exitspawn(char *core_path, size_t core_path_size) { #ifdef HAVE_RARCH_EXEC bool should_load_game = false; #ifndef IS_SALAMANDER bool *verbose = retro_main_verbosity(); bool original_verbose = *verbose; *verbose = true; if (ps3_fork_mode == FRONTEND_FORK_NONE) { frontend_ctx_driver_t *frontend = frontend_get_ptr(); if (frontend) frontend->shutdown = frontend_ps3_shutdown; return; } switch (ps3_fork_mode) { case FRONTEND_FORK_CORE_WITH_ARGS: should_load_game = true; break; case FRONTEND_FORK_NONE: default: break; } #endif frontend_ps3_exec(core_path, should_load_game); #ifdef IS_SALAMANDER cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_GAME); cellSysmoduleLoadModule(CELL_SYSMODULE_FS); cellSysmoduleLoadModule(CELL_SYSMODULE_IO); #endif #ifndef IS_SALAMANDER *verbose = original_verbose; #endif #endif }
static void init_audioport(void) { static int init_count = 0; if (init_count == 0) { cellSysmoduleLoadModule(CELL_SYSMODULE_AUDIO); cellAudioInit(); init_count++; } }
void LibESPlatform::Initialize () { sys_spu_initialize(6, 1); cellSysutilRegisterCallback(0, (CellSysutilCallback)sysutil_callback, NULL); while(true) { CellVideoOutState videoState; cellVideoOutGetState(CELL_VIDEO_OUT_PRIMARY, 0, &videoState); if(videoState.state == CELL_VIDEO_OUT_OUTPUT_STATE_ENABLED) { break; } } cellSysmoduleLoadModule(CELL_SYSMODULE_FS); cellSysmoduleLoadModule(CELL_SYSMODULE_NET); }
static void frontend_ps3_exitspawn(char *core_path, size_t core_path_size) { #ifdef HAVE_RARCH_EXEC bool should_load_game = false; #ifndef IS_SALAMANDER bool *verbose = retro_main_verbosity(); bool original_verbose = *verbose; *verbose = true; should_load_game = exitspawn_start_game; if (!exit_spawn) { frontend_ctx_driver_t *frontend = frontend_get_ptr(); if (frontend) frontend->shutdown = frontend_ps3_shutdown; return; } #endif frontend_ps3_exec(core_path, should_load_game); #ifdef IS_SALAMANDER cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_GAME); cellSysmoduleLoadModule(CELL_SYSMODULE_FS); cellSysmoduleLoadModule(CELL_SYSMODULE_IO); #endif #ifndef IS_SALAMANDER *verbose = original_verbose; #endif #endif }
static void frontend_ps3_exitspawn(char *core_path, size_t core_path_size) { #ifdef HAVE_RARCH_EXEC bool should_load_game = false; #ifndef IS_SALAMANDER bool original_verbose = g_extern.verbosity; g_extern.verbosity = true; #ifdef HAVE_MULTIMAN if (g_extern.lifecycle_state & (1ULL << MODE_EXITSPAWN_MULTIMAN)) { RARCH_LOG("Boot Multiman: %s.\n", MULTIMAN_SELF_FILE); strlcpy(core_path, MULTIMAN_SELF_FILE, core_path_size); } else #endif if (g_extern.lifecycle_state & (1ULL << MODE_EXITSPAWN_START_GAME)) should_load_game = true; #endif frontend_ps3_exec(core_path, should_load_game); #ifdef IS_SALAMANDER cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_GAME); cellSysmoduleLoadModule(CELL_SYSMODULE_FS); cellSysmoduleLoadModule(CELL_SYSMODULE_IO); #else #endif #ifndef IS_SALAMANDER g_extern.verbosity = original_verbose; #endif #endif }
static void rmenu_ctx_ps3_screenshot_enable(bool enable) { #if(CELL_SDK_VERSION > 0x340000) if(enable) { cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT); CellScreenShotSetParam screenshot_param = {0, 0, 0, 0}; screenshot_param.photo_title = "RetroArch PS3"; screenshot_param.game_title = "RetroArch PS3"; cellScreenShotSetParameter (&screenshot_param); cellScreenShotEnable(); } else { cellScreenShotDisable(); cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT); } #endif }
// Platform specific socket library init. bool netplay_init_network(void) { static bool inited = false; if (inited) return true; #if defined(_WIN32) WSADATA wsaData; if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) { WSACleanup(); return false; } #elif defined(__CELLOS_LV2__) && !defined(__PSL1GHT__) cellSysmoduleLoadModule(CELL_SYSMODULE_NET); sys_net_initialize_network(); #else signal(SIGPIPE, SIG_IGN); // Do not like SIGPIPE killing our app :( #endif inited = true; return true; }
static void system_deinit(void) { #ifndef IS_SALAMANDER #if defined(HAVE_LOGGER) || defined(HAVE_FILE_LOGGER) inl_logger_deinit(); #endif #if defined(HAVE_SYSMODULES) #ifdef HAVE_FREETYPE /* Freetype font PRX */ cellSysmoduleLoadModule(CELL_SYSMODULE_FONTFT); cellSysmoduleUnloadModule(CELL_SYSMODULE_FREETYPE); cellSysmoduleUnloadModule(CELL_SYSMODULE_FONT); #endif #ifndef __PSL1GHT__ /* screenshot PRX */ if (g_extern.lifecycle_mode_state & (1ULL << MODE_VIDEO_SCREENSHOTS_ENABLE)) cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT); #endif cellSysmoduleUnloadModule(CELL_SYSMODULE_JPGDEC); cellSysmoduleUnloadModule(CELL_SYSMODULE_PNGDEC); #ifndef __PSL1GHT__ /* system game utility PRX */ cellSysmoduleUnloadModule(CELL_SYSMODULE_AVCONF_EXT); cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_GAME); #endif #endif #endif }
static void frontend_ps3_init(void *data) { (void)data; #ifdef HAVE_SYSUTILS RARCH_LOG("Registering system utility callback...\n"); cellSysutilRegisterCallback(0, callback_sysutil_exit, NULL); #endif #ifdef HAVE_SYSMODULES #ifdef HAVE_FREETYPE cellSysmoduleLoadModule(CELL_SYSMODULE_FONT); cellSysmoduleLoadModule(CELL_SYSMODULE_FREETYPE); cellSysmoduleLoadModule(CELL_SYSMODULE_FONTFT); #endif cellSysmoduleLoadModule(CELL_SYSMODULE_IO); cellSysmoduleLoadModule(CELL_SYSMODULE_FS); #ifndef __PSL1GHT__ cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_GAME); #endif #ifndef IS_SALAMANDER #ifndef __PSL1GHT__ cellSysmoduleLoadModule(CELL_SYSMODULE_AVCONF_EXT); #endif cellSysmoduleLoadModule(CELL_SYSMODULE_PNGDEC); cellSysmoduleLoadModule(CELL_SYSMODULE_JPGDEC); #endif cellSysmoduleLoadModule(CELL_SYSMODULE_NET); cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_NP); #endif #ifndef __PSL1GHT__ sys_net_initialize_network(); sceNpInit(NP_POOL_SIZE, np_pool); #endif #ifndef IS_SALAMANDER #if (CELL_SDK_VERSION > 0x340000) && !defined(__PSL1GHT__) #ifdef HAVE_SYSMODULES cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT); #endif #ifdef HAVE_SYSUTILS CellScreenShotSetParam screenshot_param = {0, 0, 0, 0}; screenshot_param.photo_title = "RetroArch PS3"; screenshot_param.game_title = "RetroArch PS3"; cellScreenShotSetParameter (&screenshot_param); cellScreenShotEnable(); #endif #endif #endif }
/** * network_init: * * Platform specific socket library initialization. * * Returns: true (1) if successful, otherwise false (0). **/ bool network_init(void) { #ifdef _WIN32 WSADATA wsaData; #endif static bool inited = false; if (inited) return true; #if defined(_WIN32) if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) { network_deinit(); return false; } #elif defined(__CELLOS_LV2__) && !defined(__PSL1GHT__) int timeout_count = 10; cellSysmoduleLoadModule(CELL_SYSMODULE_NET); sys_net_initialize_network(); if (cellNetCtlInit() < 0) return false; for (;;) { int state; if (cellNetCtlGetState(&state) < 0) return false; if (state == CELL_NET_CTL_STATE_IPObtained) break; retro_sleep(500); timeout_count--; if (timeout_count < 0) return 0; } #elif defined(VITA) SceNetInitParam initparam; if (sceNetShowNetstat() == SCE_NET_ERROR_ENOTINIT) { _net_compat_net_memory = malloc(COMPAT_NET_INIT_SIZE); initparam.memory = _net_compat_net_memory; initparam.size = COMPAT_NET_INIT_SIZE; initparam.flags = 0; sceNetInit(&initparam); sceNetCtlInit(); } retro_epoll_fd = sceNetEpollCreate("epoll", 0); #elif defined(GEKKO) char t[16]; if (if_config(t, NULL, NULL, TRUE, 10) < 0) return false; #elif defined(WIIU) socket_lib_init(); #elif defined(_3DS) _net_compat_net_memory = (u32*)memalign(SOC_ALIGN, SOC_BUFFERSIZE); if (_net_compat_net_memory == NULL) return false; Result ret = socInit(_net_compat_net_memory, SOC_BUFFERSIZE);//WIFI init if (ret != 0) return false; #else signal(SIGPIPE, SIG_IGN); /* Do not like SIGPIPE killing our app. */ #endif inited = true; return true; }
static void system_init(void) { #ifdef HAVE_SYSUTILS RARCH_LOG("Registering system utility callback...\n"); cellSysutilRegisterCallback(0, callback_sysutil_exit, NULL); #endif #ifdef HAVE_SYSMODULES #ifdef HAVE_FREETYPE cellSysmoduleLoadModule(CELL_SYSMODULE_FONT); cellSysmoduleLoadModule(CELL_SYSMODULE_FREETYPE); cellSysmoduleLoadModule(CELL_SYSMODULE_FONTFT); #endif cellSysmoduleLoadModule(CELL_SYSMODULE_IO); cellSysmoduleLoadModule(CELL_SYSMODULE_FS); #ifndef __PSL1GHT__ cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_GAME); #endif #ifndef IS_SALAMANDER #ifndef __PSL1GHT__ cellSysmoduleLoadModule(CELL_SYSMODULE_AVCONF_EXT); #endif cellSysmoduleLoadModule(CELL_SYSMODULE_PNGDEC); cellSysmoduleLoadModule(CELL_SYSMODULE_JPGDEC); #endif cellSysmoduleLoadModule(CELL_SYSMODULE_NET); cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_NP); #endif #ifndef __PSL1GHT__ sys_net_initialize_network(); #endif #if defined(HAVE_LOGGER) || defined(HAVE_FILE_LOGGER) inl_logger_init(); #endif #ifndef __PSL1GHT__ sceNpInit(NP_POOL_SIZE, np_pool); #endif }
int main(int argc, char *argv[]) { #ifdef HAVE_SYSUTILS RARCH_LOG("Registering system utility callback...\n"); cellSysutilRegisterCallback(0, callback_sysutil_exit, NULL); #endif #ifdef HAVE_SYSMODULES cellSysmoduleLoadModule(CELL_SYSMODULE_IO); cellSysmoduleLoadModule(CELL_SYSMODULE_FS); cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_GAME); cellSysmoduleLoadModule(CELL_SYSMODULE_AVCONF_EXT); cellSysmoduleLoadModule(CELL_SYSMODULE_PNGDEC); cellSysmoduleLoadModule(CELL_SYSMODULE_JPGDEC); cellSysmoduleLoadModule(CELL_SYSMODULE_NET); cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_NP); #endif sys_net_initialize_network(); #ifdef HAVE_LOGGER logger_init(); #endif sceNpInit(NP_POOL_SIZE, np_pool); rarch_main_clear_state(); get_environment_settings(argc, argv); config_set_defaults(); input_ps3.init(); char tmp_path[PATH_MAX]; snprintf(tmp_path, sizeof(tmp_path), "%s/", default_paths.core_dir); rarch_configure_libretro(&input_ps3, tmp_path, default_paths.executable_extension); #if(CELL_SDK_VERSION > 0x340000) if (g_console.screenshots_enable) { #ifdef HAVE_SYSMODULES cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT); #endif #ifdef HAVE_SYSUTILS CellScreenShotSetParam screenshot_param = {0, 0, 0, 0}; screenshot_param.photo_title = "RetroArch PS3"; screenshot_param.game_title = "RetroArch PS3"; cellScreenShotSetParameter (&screenshot_param); cellScreenShotEnable(); #endif } #ifdef HAVE_SYSUTILS if (g_console.custom_bgm_enable) cellSysutilEnableBgmPlayback(); #endif #endif video_gl.start(); #ifdef HAVE_OSKUTIL oskutil_init(&g_console.oskutil_handle, 0); #endif rarch_input_set_default_keybind_names_for_emulator(); menu_init(); switch(g_console.external_launcher_support) { case EXTERN_LAUNCHER_SALAMANDER: g_console.mode_switch = MODE_MENU; break; #ifdef HAVE_MULTIMAN case EXTERN_LAUNCHER_MULTIMAN: RARCH_LOG("Started from multiMAN, will auto-start game.\n"); strlcpy(g_console.rom_path, argv[1], sizeof(g_console.rom_path)); rarch_settings_change(S_START_RARCH); rarch_startup(default_paths.config_file); break; #endif default: break; } begin_loop: if(g_console.mode_switch == MODE_EMULATION) { bool repeat = false; input_ps3.poll(NULL); rarch_set_auto_viewport(g_extern.frame_cache.width, g_extern.frame_cache.height); do{ repeat = rarch_main_iterate(); }while(repeat && !g_console.frame_advance_enable); } else if(g_console.mode_switch == MODE_MENU) { menu_loop(); rarch_startup(default_paths.config_file); } else goto begin_shutdown; goto begin_loop; begin_shutdown: if(path_file_exists(default_paths.config_file)) rarch_config_save(default_paths.config_file); if(g_console.emulator_initialized) rarch_main_deinit(); input_ps3.free(NULL); video_gl.stop(); menu_free(); #ifdef HAVE_OSKUTIL if(g_console.oskutil_handle.is_running) oskutil_unload(&g_console.oskutil_handle); #endif #ifdef HAVE_LOGGER logger_shutdown(); #endif #ifdef HAVE_SYSMODULES if(g_console.screenshots_enable) cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT); cellSysmoduleUnloadModule(CELL_SYSMODULE_JPGDEC); cellSysmoduleUnloadModule(CELL_SYSMODULE_PNGDEC); cellSysmoduleUnloadModule(CELL_SYSMODULE_AVCONF_EXT); cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_GAME); #endif #ifdef HAVE_HDD_CACHE_PARTITION int ret = cellSysCacheClear(); if(ret != CELL_SYSCACHE_RET_OK_CLEARED) { RARCH_ERR("System cache partition could not be cleared on exit.\n"); } #endif rarch_exec(); return 1; }
bool CapApp::onInit(int argc, char* argv[]) { (void)argc; (void)argv; // ---------------------------------------------- // FTP cellSysmoduleLoadModule(CELL_SYSMODULE_NET); cellNetCtlInit(); cellSysmoduleLoadModule(CELL_SYSMODULE_HTTP); sys_net_initialize_network(); ftp_on(); // Load settings... if(!iniRead()) { iniWrite(); // create settings file... } cellSysmoduleLoadModule(CELL_SYSMODULE_FS); cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT); cellScreenShotEnable(); InputInit(); while(!videoOutIsReady()) { // ... } PSGLinitOptions options = { enable: PSGL_INIT_MAX_SPUS | PSGL_INIT_INITIALIZE_SPUS, maxSPUs: 1, initializeSPUs: GL_FALSE, persistentMemorySize: 0, transientMemorySize: 0, errorConsole: 0, fifoSize: 0, hostMemorySize: 128* 1024*1024, // 128 mbs for host memory }; #if CELL_SDK_VERSION < 0x340000 options.enable |= PSGL_INIT_HOST_MEMORY_SIZE; #endif // Initialize 6 SPUs but reserve 1 SPU as a raw SPU for PSGL sys_spu_initialize(6, 1); psglInit(&options); const unsigned int resolutions[] = { CELL_VIDEO_OUT_RESOLUTION_1080, CELL_VIDEO_OUT_RESOLUTION_960x1080, CELL_VIDEO_OUT_RESOLUTION_720, CELL_VIDEO_OUT_RESOLUTION_480 }; const int numResolutions = sizeof(resolutions) / sizeof(resolutions[0]); int bestResolution = chooseBestResolution(resolutions,numResolutions); getResolutionWidthHeight(bestResolution, deviceWidth, deviceHeight); if(bestResolution) { PSGLdeviceParameters params; params.enable = PSGL_DEVICE_PARAMETERS_COLOR_FORMAT | PSGL_DEVICE_PARAMETERS_DEPTH_FORMAT | PSGL_DEVICE_PARAMETERS_MULTISAMPLING_MODE; params.colorFormat = GL_ARGB_SCE; params.depthFormat = GL_NONE; params.multisamplingMode = GL_MULTISAMPLING_NONE_SCE; params.enable |= PSGL_DEVICE_PARAMETERS_WIDTH_HEIGHT; params.width = deviceWidth; params.height = deviceHeight; device = psglCreateDeviceExtended(¶ms); context = psglCreateContext(); psglMakeCurrent(context, device); psglResetCurrentContext(); initGraphics(); if( cellSysutilRegisterCallback( 0, callback_sysutil_exit, NULL ) < 0 ) { //... } dbgFontInit(); fbaRL = new c_fbaRL(); while(bRun) { onRender(); onUpdate(); cellSysutilCheckCallback(); } } else { // resolution error... } ftp_off(); onShutdown(); return false; } void CapApp::onRender() { if(fbaRL) { fbaRL->DlgDisplayFrame(); } // get render target buffer dimensions and set viewport psglGetRenderBufferDimensions(device,&app.renderWidth,&app.renderHeight); glViewport(0, 0, app.renderWidth, app.renderHeight); glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); if(fbaRL) { fbaRL->RenderBackground(); } if(fbaRL) { fbaRL->nFrameStep = 0; fbaRL->DisplayFrame(); } if(fbaRL) { fbaRL->nFrameStep = 1; fbaRL->DisplayFrame(); } dbgFontDraw(); psglSwap(); } bool CapApp::onUpdate() { if(!mFrame) mFrame = 0; mFrame++; InputFrameStart(); if(fbaRL) fbaRL->InputFrame(); InputFrameEnd(); return true; } void CapApp::onShutdown() { iniWrite(); // save settings if(context) psglDestroyContext(context); if(device) psglDestroyDevice(device); InputExit(); psglExit(); }
int main(void) { int ret; int k; int fd; char temp[128]; ntfs_md *mounts; ret = cellSysmoduleLoadModule(CELL_SYSMODULE_FS); if (ret != CELL_OK) return ret; ret = cellFsOpen("/dev_hdd0/libntfs_sample_log.txt", CELL_FS_O_RDWR|CELL_FS_O_CREAT, &LOG, NULL, 0); if(ret) return ret; log_printf("*** LOG ***\n"); log_printf("\n*** PS3_NTFS_IsInserted ***\n\n"); for(k = 0; k < 8; k++) { if(PS3_NTFS_IsInserted(k)) log_printf("- PS3_NTFS_IsInserted(%d) = true\n", k); else log_printf("- PS3_NTFS_IsInserted(%d) = false\n", k); } log_printf("\n*** ntfsFindPartitions ***\n"); sec_t *partitions = NULL; int partition_number = ntfsFindPartitions(disc_ntfs[0], &partitions); log_printf("- ntfsFindPartitions = %d\n", partition_number); log_printf("\n*** ntfsMount ***\n"); if(ntfsMount("ntfs0", disc_ntfs[0], partitions[0], CACHE_DEFAULT_PAGE_COUNT, CACHE_DEFAULT_PAGE_SIZE, NTFS_DEFAULT | NTFS_RECOVER)) log_printf("- ntfsMount = true\n"); else log_printf("- ntfsMount = false\n"); if(partitions) free(partitions); log_printf("\n*** ntfsUnmount ***\n"); ntfsUnmount("ntfs0", 1); log_printf("\n*** ntfsMountDevice ***\n"); ret = ntfsMountDevice(disc_ntfs[0], &mounts, NTFS_DEFAULT | NTFS_RECOVER); log_printf("- ntfsMountDevice = %d\n", ret); log_printf("- mount->name = %s\n", mounts->name); log_printf("\n*** ntfsUnmount ***\n"); ntfsUnmount(mounts->name, 1); log_printf("\n*** ntfsMountAll ***\n"); int mountCount = ntfsMountAll(&mounts, NTFS_DEFAULT | NTFS_RECOVER ); log_printf("- ntfsMountAll = %d\n", mountCount); log_printf("- mount[0].name = %s\n", mounts[0].name); log_printf("\n*** ntfsGetVolumeName ***\n"); const char *OldName = ntfsGetVolumeName(mounts[0].name); if(OldName) log_printf("- Old name : '%s'\n", OldName); else log_printf("- Error %d\n", ps3ntfs_errno()); /* need to re-mount the device after SetVolumeName to 'update' the value of GetVolumeName log_printf("\n*** ntfsSetVolumeName ***\n"); if(ntfsSetVolumeName(mounts[0].name, "NTFS_VOLUME")) log_printf("- ntfsSetVolumeName = true\n"); else log_printf("- ntfsSetVolumeName = false - %d \n", ps3ntfs_errno()); const char *NewName = ntfsGetVolumeName(mounts[0].name); if(NewName) log_printf("- New name : '%s'\n", NewName); else log_printf("- Error %d\n", ps3ntfs_errno()); */ log_printf("\n*** ps3ntfs_mkdir ***\n"); sprintf(temp, "%s:/viper6", mounts[0].name); if(ps3ntfs_mkdir(temp, 0777) == 0) log_printf("- ps3ntfs_mkdir = true\n"); else log_printf("- ps3ntfs_mkdir = false\n"); log_printf("\n*** ps3ntfs_open ***\n"); strcat(temp, (char*) "/ntfs.txt"); for(k=0; k<5000; k++) { // force fd = ps3ntfs_open(temp, O_CREAT | O_WRONLY | O_TRUNC, 0777); if(fd>0) break; } if(fd > 0) { log_printf("- ps3ntfs_open = success\n"); log_printf("\n*** ps3ntfs_write ***\n"); ret = ps3ntfs_write(fd, message, strlen(message)); log_printf("- ps3ntfs_write = %d\n", ret); if(ret != (int) strlen(message)) log_printf("- Error writing the file!\n"); log_printf("\n*** ps3ntfs_close ***\n"); ret = ps3ntfs_close(fd); log_printf("- ps3ntfs_close = %d\n", ret); } else log_printf("- ps3ntfs_open = failed - %s\n", temp); struct stat st; log_printf("\n*** ps3ntfs_stat ***\n"); ret = ps3ntfs_stat(temp, &st); log_printf("- ps3ntfs_stat = %d\n", ret); log_printf("- SIZE = %d\n", st.st_size); log_printf("- last_access_time = %d\n", st.st_atime); log_printf("- last_mft_change_time = %d\n", st.st_ctime); log_printf("- last_data_change_time = %d\n", st.st_mtime); log_printf("- st_dev (id) = %d\n", st.st_dev); log_printf("- st uid = %d\n", st.st_uid); log_printf("- st gid = %d\n", st.st_gid); log_printf("- st ino = %d\n", st.st_ino); log_printf("\n*** ps3ntfs_open ***\n"); for(k=0; k<5000; k++) { // force fd = ps3ntfs_open(temp, O_RDONLY, 0); if(fd > 0) break; } log_printf("- ps3ntfs_open = %d\n", fd); if(fd > 0) { log_printf("- ps3ntfs_open = success\n"); log_printf("\n*** ps3ntfs_fstat ***\n"); ret = ps3ntfs_fstat(fd, &st); log_printf("- ps3ntfs_fstat = %d\n", ret); log_printf("- SIZE = %d\n", st.st_size); log_printf("- last_access_time = %d\n", st.st_atime); log_printf("- last_mft_change_time = %d\n", st.st_ctime); log_printf("- last_data_change_time = %d\n", st.st_mtime); log_printf("- st_dev (id) = %d\n", st.st_dev); log_printf("- st uid = %d\n", st.st_uid); log_printf("- st gid = %d\n", st.st_gid); log_printf("- st ino = %d\n", st.st_ino); log_printf("\n*** ps3ntfs_seek ***\n"); int size = ps3ntfs_seek(fd, 0, SEEK_END); log_printf("- ps3ntfs_seek - size = %d\n", size); ps3ntfs_seek(fd, 0, SEEK_SET); log_printf("\n*** ps3ntfs_read ***\n"); ret = ps3ntfs_read(fd, buffer, size); log_printf("- ps3ntfs_read : '%s'\n", buffer); if(ret != size) log_printf("Error reading the file!\n"); log_printf("\n*** ps3ntfs_close ***\n"); ret = ps3ntfs_close(fd); log_printf("- ps3ntfs_close = %d\n", ret); } else log_printf("- ps3ntfs_open = failed - %s\n", temp); sprintf(buffer, "%s:/viper6/ntfs_newname.txt", mounts[0].name); log_printf("\n*** ps3ntfs_rename ***\n"); for(k=0; k<5000; k++) { // force ret = ps3ntfs_rename(temp, buffer); if(ret==0) break; } if(ret==0) log_printf("- ps3ntfs_rename = %d\n", ret); else log_printf("- ps3ntfs_rename = %d - %s > %s\n", ret, temp, buffer); DIR_ITER *pdir; char filename[255]; log_printf("\n*** ps3ntfs_diropen ***\n"); sprintf(temp, "%s:/viper6", mounts[0].name); for(k=0; k<5000; k++) { // force pdir = ps3ntfs_diropen(temp); if (pdir) break; } if (pdir) { log_printf("- ps3ntfs_diropen = success\n"); log_printf("\n*** ps3ntfs_dirnext ***\n"); while (ps3ntfs_dirnext(pdir, filename, &st) == 0) { if ((strcmp(filename, ".") == 0) || (strcmp(filename, "..") == 0)) continue; log_printf("- ps3ntfs_dirnext = File : %s/\n", filename); log_printf("- last_access_time = %d\n", st.st_atime); log_printf("- last_mft_change_time = %d\n", st.st_ctime); log_printf("- last_data_change_time = %d\n", st.st_mtime); } log_printf("\n*** ps3ntfs_dirreset ***\n"); ret = ps3ntfs_dirreset(pdir); log_printf("- ps3ntfs_dirreset = %d\n", ret); log_printf("\n*** ps3ntfs_dirclose ***\n"); ret = ps3ntfs_dirclose(pdir); log_printf("- ps3ntfs_dirclose = %d\n", ret); } else log_printf("- ps3ntfs_diropen = failed\n"); log_printf("\n*** ps3ntfs_open ***\n"); strcat(temp, (char*)"/unlink.txt"); for(k=0; k<5000; k++) { // force fd = ps3ntfs_open(temp, O_CREAT | O_WRONLY | O_TRUNC, 0777); if(fd > 0) break; } if(fd > 0) { log_printf("- ps3ntfs_open = success\n"); log_printf("\n*** ps3ntfs_close ***\n"); ret = ps3ntfs_close(fd); log_printf("- ps3ntfs_close = %d\n", ret); } else log_printf("- ps3ntfs_open = failed\n"); log_printf("\n*** ps3ntfs_unlink ***\n"); for(k=0; k<5000; k++) { // force ret = ps3ntfs_unlink(temp); if(ret==0) break; } log_printf("- ps3ntfs_unlink = %d\n", ret); log_printf("\n*** ntfsUnmount ***\n"); for (k = 0; k < mountCount; k++) ntfsUnmount(mounts[k].name, 1); log_printf("\n*** PS3_NTFS_Shutdown ***\n\n"); for(k = 0; k < 8; k++) { if(PS3_NTFS_Shutdown(k)) log_printf("- PS3_NTFS_Shutdown(%d) = true\n", k); else log_printf("- PS3_NTFS_Shutdown(%d) = false\n", k); } /* // Debugging for time related functions in ntfstime.h struct timespec { time_t tv_sec; long tv_nsec; } ; struct timespec now; typedef uint64_t u64; typedef u64 sle64; typedef sle64 ntfs_time; //sys_time_sec_t time_s; //sys_time_nsec_t time_n_s; //sys_time_get_current_time(&time_s, &time_n_s); //now.tv_sec = time_s; //now.tv_nsec = time_n_s; now.tv_sec = time((time_t*)NULL); now.tv_nsec = 0; log_printf("- test now.tv_sec = %d\n", now.tv_sec); log_printf("- test now.tv_nsec = %d\n", now.tv_nsec); ntfs_time ntfstime; struct timespec unixtime; #define NTFS_TIME_OFFSET ((s64)(369 * 365 + 89) * 24 * 3600 * 10000000) s64 units; units = (s64)now.tv_sec * 10000000 + NTFS_TIME_OFFSET + now.tv_nsec/100; ntfstime = (cpu_to_sle64(units)); log_printf("- timespec2ntfs = %d\n", ntfstime); struct timespec spec; s64 cputime; cputime = sle64_to_cpu(ntfstime); spec.tv_sec = (cputime - (NTFS_TIME_OFFSET)) / 10000000; spec.tv_nsec = (cputime - (NTFS_TIME_OFFSET) - (s64)spec.tv_sec*10000000)*100; //force zero nsec for overflowing dates if ((spec.tv_nsec < 0) || (spec.tv_nsec > 999999999)) spec.tv_nsec = 0; unixtime = spec; log_printf("- ntfs2timespec = %d\n", unixtime); */ // End debugging /* TODO int ps3ntfs_file_to_sectors(const char *path, uint32_t *sec_out, uint32_t *size_out, int max, int phys); int ps3ntfs_get_fd_from_FILE(FILE *fp); s64 ps3ntfs_seek64(int fd, s64 pos, int dir); int ps3ntfs_link(const char *existing, const char *newLink); int ps3ntfs_statvfs(const char *path, struct statvfs *buf); int ps3ntfs_ftruncate(int fd, off_t len); int ps3ntfs_fsync(int fd); void NTFS_init_system_io(void); void NTFS_deinit_system_io(void); Standard functions supported: open_r -> for stdio.h fopen()... close_r -> for stdio.h fclose()... read_r -> for stdio.h fread()... write_r -> for stdio.h fwrite()... lseek_r -> for stdio.h fseek()... lseek64_r -> for using with large files (see ps3_example_stdio for this) fstat_r -> for stat.h fstat() stat_r -> for stat.h stat() ftruncate_r -> for unistd.h ftruncate() truncate_r -> for unistd.h truncate() fsync_r -> for stdio.h fflush() link_r -> for unistd.h link() unlink_r -> for unistd.h unlink() rename_r -> for stdio.h rename() mkdir_r -> for stat.h mkdir() rmdir_r -> for unistd.h rmdir() */ cellFsClose(LOG); return 0; }
int main(int argc, char *argv[]) { int ret; #if defined(_XBOX) XINPUT_STATE state; get_environment_settings(); XInputGetState(0, &state); if(state.Gamepad.wButtons & XINPUT_GAMEPAD_Y) { //override path, boot first executable in cores directory RARCH_LOG("Fallback - Will boot first executable in RetroArch cores directory.\n"); find_and_set_first_file(); } else { //normal executable loading path init_settings(); } XLaunchNewImage(libretro_path, NULL); RARCH_LOG("Launch libretro core: [%s] (return code: %x]).\n", libretro_path, ret); #elif defined(__CELLOS_LV2__) CellPadData pad_data; char spawn_data[256], spawn_data_size[16]; SceNpDrmKey * k_licensee = NULL; cellSysutilRegisterCallback(0, callback_sysutil_exit, NULL); cellSysmoduleLoadModule(CELL_SYSMODULE_IO); cellSysmoduleLoadModule(CELL_SYSMODULE_FS); cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_GAME); cellSysmoduleLoadModule(CELL_SYSMODULE_NET); cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_NP); sys_net_initialize_network(); #ifdef HAVE_LOGGER logger_init(); #endif sceNpInit(NP_POOL_SIZE, np_pool); get_environment_settings(); cellPadInit(7); cellPadGetData(0, &pad_data); if(pad_data.button[CELL_PAD_BTN_OFFSET_DIGITAL2] & CELL_PAD_CTRL_TRIANGLE) { //override path, boot first executable in cores directory RARCH_LOG("Fallback - Will boot first executable in RetroArch cores/ directory.\n"); find_and_set_first_file(); } else { //normal executable loading path init_settings(); } cellPadEnd(); #ifdef HAVE_LOGGER logger_shutdown(); #endif for(unsigned int i = 0; i < sizeof(spawn_data); ++i) spawn_data[i] = i & 0xff; snprintf(spawn_data_size, sizeof(spawn_data_size), "%d", 256); const char * const spawn_argv[] = { spawn_data_size, "test argv for", "sceNpDrmProcessExitSpawn2()", NULL }; ret = sceNpDrmProcessExitSpawn2(k_licensee, libretro_path, (const char** const)spawn_argv, NULL, (sys_addr_t)spawn_data, 256, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); RARCH_LOG("Launch libretro core: [%s] (return code: %x]).\n", libretro_path, ret); if(ret < 0) { RARCH_LOG("Executable file is not of NPDRM type, trying another approach to boot it...\n"); sys_game_process_exitspawn2(libretro_path, NULL, NULL, NULL, 0, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } sceNpTerm(); sys_net_finalize_network(); cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_NP); cellSysmoduleUnloadModule(CELL_SYSMODULE_NET); cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_GAME); cellSysmoduleLoadModule(CELL_SYSMODULE_FS); cellSysmoduleLoadModule(CELL_SYSMODULE_IO); #endif return 1; }
int main() { struct stat st; sys_spu_initialize(6, 1); cellSysmoduleLoadModule(CELL_SYSMODULE_FS); cellSysmoduleLoadModule(CELL_SYSMODULE_IO); cellSysutilRegisterCallback(0, sysutil_exit_callback, NULL); LOG_INIT(); LOG_DBG("LOG INIT\n"); mode_switch = MODE_MENU; Graphics = new PS3Graphics(); LOG_DBG("Graphics->Init()\n"); Graphics->Init(); CellInput = new CellInputFacade(); LOG_DBG("CellInput->Init()\n"); CellInput->Init(); oskutil = new OSKUtil(); // FIXME: Is this necessary? if (Graphics->InitCg() != CELL_OK) { LOG_DBG("Failed to InitCg: %d\n", __LINE__); exit(0); } LOG_DBG("Graphics->InitDbgFont()\n"); Graphics->InitDbgFont(); Emulator_ToggleSound(); emulation_running = true; /* if (ini_parse("/dev_hdd0/game/GENP00001/USRDIR/GenesisConf.ini", handler, &Iniconfig) < 0) { gl_dprintf(0.09f,0.05f,Emulator_GetFontSize(),"Could not load /dev_hdd0/game/GENP00001/GenesisConf.ini\n"); sys_timer_sleep(5); gl_dprintf(0.09f,0.05f,Emulator_GetFontSize(),"Now exiting to XMB...\n"); sys_timer_sleep(5); sys_process_exit(0); } */ //REPLACEMENT if (load_settings) { Emulator_InitSettings(); load_settings = false; } /* //main path - Check if not present - create all folders and exit if(stat(Iniconfig.rompath,&st) != 0) { gl_dprintf(0.09f,0.05f,Emulator_GetFontSize(),"Creating generic folder tree for Genesisplus...\n"); sys_timer_sleep(5); CreateFolder(Iniconfig.rompath); CreateFolder(Iniconfig.savpath); CreateFolder(Iniconfig.cartpath); CreateFolder(Iniconfig.sram_path); CreateFolder(Iniconfig.biospath); gl_dprintf(0.09f,0.05f,Emulator_GetFontSize(),"Generic folder tree done! Will now exit to XMB...\nPlease put all your ROMs inside %s\n",Iniconfig.rompath); sys_timer_sleep(5); sys_process_exit(0); } */ ////Set Bios //sprintf(Iniconfig.biospath,"%s/bios.bin",Iniconfig.biospath); while(1) { switch(mode_switch) { case MODE_MENU: MenuMainLoop(); break; case MODE_EMULATION: Emulator_Start(); CellAudio->pause(); break; case MODE_EXIT: Emulator_Shutdown(); } } return 0; }