(PS3) Initial WIP exitspawn loading of external executables -

will flesh this out in subsequent ports
This commit is contained in:
TwinAphex51224 2012-02-25 20:11:57 +01:00
parent cacf15a065
commit 248f5efbd6
8 changed files with 82 additions and 4 deletions

View File

@ -50,7 +50,7 @@ else
GL_LIBS := -lPSGL -lPSGLcgc
endif
LIBS = -ldbgfont $(GL_LIBS) -lcgc -lgcm_cmd -lgcm_sys_stub -lsnes -lresc_stub -lm -lio_stub -lfs_stub -lsysutil_stub -lsysutil_game_stub -lsysutil_screenshot_stub -lpngdec_stub -ljpgdec_stub -lsysmodule_stub -laudio_stub -lnet_stub -lpthread
LIBS = -ldbgfont $(GL_LIBS) -lcgc -lgcm_cmd -lgcm_sys_stub -lsnes -lresc_stub -lm -lio_stub -lfs_stub -lsysutil_stub -lsysutil_game_stub -lsysutil_screenshot_stub -lsysutil_np_stub -lpngdec_stub -ljpgdec_stub -lsysmodule_stub -laudio_stub -lnet_stub -lpthread
DEFINES += -DSSNES_CONSOLE -DHAVE_OPENGL=1 -DHAVE_CG=1 -DHAVE_FBO=1 -D__CELLOS_LV2__ -DHAVE_CONFIGFILE=1 -DHAVE_NETPLAY=1 -DHAVE_SOCKET_LEGACY=1 -DPACKAGE_VERSION=\"0.9.4.1\" -DHAVE_SCREENSHOTS_BUILTIN=1 -Dmain=ssnes_main
@ -85,6 +85,7 @@ ifeq ($(DOWNLOAD_SHADERS),1)
git clone git://github.com/twinaphex/common-shaders.git ps3/pkg/USRDIR/shaders
endif
$(MAKE_FSELF_NPDRM) $(PPU_TARGET) ps3/pkg/USRDIR/EBOOT.BIN
$(MAKE_FSELF_NPDRM) $(PPU_TARGET) ps3/pkg/USRDIR/CORE.SELF
$(MAKE_PACKAGE_NPDRM) ps3/pkg/package.conf ps3/pkg
clean:

View File

@ -15,10 +15,11 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <string.h>
#include "rom_ext.h"
#include "../boolean.h"
#include "../libsnes.hpp"
#include <string.h>
const char *ssnes_console_get_rom_ext(void)
{
@ -45,4 +46,3 @@ const char *ssnes_console_get_rom_ext(void)
return NULL;
}

View File

@ -23,5 +23,8 @@
// Returns NULL if library doesn't have any preferences in particular.
const char *ssnes_console_get_rom_ext(void);
#ifdef __CELLOS_LV2__
void ssnes_exitspawn(const char * filepath);
#endif
#endif

View File

@ -26,11 +26,18 @@
#include <sysutil/sysutil_screenshot.h>
#include <sysutil/sysutil_common.h>
#include <sysutil/sysutil_gamecontent.h>
#include <sys/spu_initialize.h>
#include <cell/sysmodule.h>
#include <sysutil/sysutil_common.h>
#include <sys/process.h>
#include <netex/net.h>
#include <np.h>
#include <np/drm.h>
#include "ps3_input.h"
#include "ps3_video_psgl.h"
#include "../console/rom_ext.h"
#include "../console/main_wrap.h"
#include "../conf/config_file.h"
#include "../conf/config_file_macros.h"
@ -45,6 +52,9 @@
#define EMULATOR_CONTENT_DIR "SSNE10000"
#define NP_POOL_SIZE (128*1024)
static uint8_t np_pool[NP_POOL_SIZE];
char contentInfoPath[MAX_PATH_LENGTH];
char usrDirPath[MAX_PATH_LENGTH];
char DEFAULT_PRESET_FILE[MAX_PATH_LENGTH];
@ -387,6 +397,12 @@ int main(int argc, char *argv[])
cellSysmoduleLoadModule(CELL_SYSMODULE_AVCONF_EXT);
cellSysmoduleLoadModule(CELL_SYSMODULE_PNGDEC);
cellSysmoduleLoadModule(CELL_SYSMODULE_JPGDEC);
cellSysmoduleLoadModule(CELL_SYSMODULE_NET);
cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_NP);
sys_net_initialize_network();
sceNpInit(NP_POOL_SIZE, np_pool);
get_environment_settings(argc);
@ -462,9 +478,33 @@ begin_shutdown:
if(g_console.return_to_launcher)
{
/* for multiman - need to refactor this
sys_spu_initialize(6, 0);
sys_game_process_exitspawn2((char*)MULTIMAN_EXECUTABLE, NULL, NULL, NULL, 0, 2048,
SYS_PROCESS_PRIMARY_STACK_SIZE_1M);
*/
char self_path[1024];
snprintf(self_path, sizeof(self_path), "%s/CORE.SELF", usrDirPath);
char spawn_data[256];
for(unsigned int i = 0; i < sizeof(spawn_data); ++i)
spawn_data[i] = i & 0xff;
char spawn_data_size[16];
sprintf(spawn_data_size, "%d", 256);
const char * const spawn_argv[] = {
spawn_data_size,
"test argv for",
"sceNpDrmProcessExitSpawn2()",
NULL
};
SceNpDrmKey * k_licensee = NULL;
int ret = sceNpDrmProcessExitSpawn2(k_licensee, self_path, (const char** const)spawn_argv, NULL, (sys_addr_t)spawn_data, 256, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M);
printf("ret: %x\n", ret);
sceNpTerm();
cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_NP);
cellSysmoduleUnloadModule(CELL_SYSMODULE_NET);
}
return 1;
}

View File

@ -44,6 +44,21 @@ static item items_generalsettings[MAX_NO_OF_CONTROLS_SETTINGS] =
0.09f,
0.83f,
},
{
SETTING_BORDER,
"Selected border",
"",
0.0f,
0.0f,
YELLOW,
"INFO - Select an image file as the background border for 'border shaders'.\nNOTE: The image has to be in PNG format.",
WHITE,
0.91f,
0.09f,
0.83f,
0,
1
},
{
SETTING_SHADER,
"Selected shader #1",

View File

@ -394,6 +394,8 @@ static void set_setting_label(menu * menu_obj, int currentsetting)
snprintf(menu_obj->items[currentsetting].setting_text, sizeof(menu_obj->items[currentsetting].setting_text), fname);
}
break;
case SETTING_BORDER:
break;
case SETTING_SHADER:
{
char fname[MAX_PATH_LENGTH];
@ -1062,6 +1064,8 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue)
strlcpy(g_console.cgp_path, "", sizeof(g_console.cgp_path));
}
break;
case SETTING_BORDER:
break;
case SETTING_SHADER:
if(CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state) || CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state) || CTRL_CROSS(state))
{
@ -1947,10 +1951,20 @@ static void ingame_menu(uint32_t menu_id)
}
strcpy(comment, "Press 'CROSS' to return to the ROM Browser menu.");
break;
case MENU_ITEM_CHANGE_LIBSNES:
if(CTRL_CROSS(state))
{
g_console.return_to_launcher = true;
g_console.menu_enable = false;
g_console.mode_switch = MODE_EXIT;
}
strcpy(comment, "Press 'CROSS' to choose a different emulator core.");
break;
#ifdef MULTIMAN_SUPPORT
case MENU_ITEM_RETURN_TO_MULTIMAN:
if(CTRL_CROSS(state))
{
g_console.return_to_launcher = true;
g_console.menu_enable = false;
g_console.mode_switch = MODE_EXIT;
}
@ -2048,6 +2062,9 @@ static void ingame_menu(uint32_t menu_id)
cellDbgFontPuts(x_position, (ypos+(ypos_increment*MENU_ITEM_RETURN_TO_MENU)), font_size, MENU_ITEM_SELECTED(MENU_ITEM_RETURN_TO_MENU), "Return to Menu");
cellDbgFontDraw();
cellDbgFontPuts(x_position, (ypos+(ypos_increment*MENU_ITEM_CHANGE_LIBSNES)), font_size, MENU_ITEM_SELECTED(MENU_ITEM_CHANGE_LIBSNES), "Change libsnes core");
cellDbgFontDraw();
#ifdef MULTIMAN_SUPPORT
cellDbgFontPuts(x_position, (ypos+(ypos_increment*MENU_ITEM_RETURN_TO_MULTIMAN)), font_size, MENU_ITEM_SELECTED(MENU_ITEM_RETURN_TO_MULTIMAN), "Return to multiMAN");
#endif

View File

@ -75,6 +75,7 @@ enum
{
SETTING_CHANGE_RESOLUTION,
SETTING_SHADER_PRESETS,
SETTING_BORDER,
SETTING_SHADER,
SETTING_SHADER_2,
SETTING_FONT_SIZE,

View File

@ -63,6 +63,7 @@ enum {
MENU_ITEM_RESET,
MENU_ITEM_RETURN_TO_GAME,
MENU_ITEM_RETURN_TO_MENU,
MENU_ITEM_CHANGE_LIBSNES,
#ifdef MULTIMAN_SUPPORT
MENU_ITEM_RETURN_TO_MULTIMAN,
#endif