code
stringlengths
1
2.06M
language
stringclasses
1 value
#include "mm.h" #include "hvcall.h" // This is mainly adapted from graf's code int mm_insert_htab_entry(u64 va_addr, u64 lpar_addr, u64 prot, u64 * index) { u64 hpte_group, hpte_index = 0, hpte_v, hpte_r, hpte_evicted_v, hpte_evicted_r; hpte_group = (((va_addr >> 28) ^ ((va_addr & 0xFFFFFFFULL) >> 12)) & 0x7FF) << 3; hpte_v = ((va_addr >> 23) << 7) | HPTE_V_VALID; hpte_r = lpar_addr | 0x38 | (prot & HPTE_R_PROT_MASK); int result = lv1_insert_htab_entry(0, hpte_group, hpte_v, hpte_r, HPTE_V_BOLTED, 0, &hpte_index, &hpte_evicted_v, &hpte_evicted_r); if ((result == 0) && (index != 0)) *index = hpte_index; return (int)result; } int mm_map_lpar_memory_region(u64 lpar_start_addr, u64 ea_start_addr, u64 size, u64 page_shift, u64 prot) { int result; u64 i; for (i = 0; i < size >> page_shift; i++) { result = mm_insert_htab_entry(MM_EA2VA(ea_start_addr), lpar_start_addr, prot, 0); if (result != 0) return result; lpar_start_addr += (1 << page_shift); ea_start_addr += (1 << page_shift); } return 0; }
C++
#include <cell/error.h> #include <cell/sysmodule.h> #include <sysutil/sysutil_sysparam.h> #include <stdio.h> #include <string.h> #include <math.h> #include <sys/timer.h> #include <cell/cell_fs.h> #include <cell/gcm.h> #include <cell/control_console.h> #include <sysutil/sysutil_sysparam.h> #include <netex/libnetctl.h> #include "graphics.h" #define ROUNDUP(x, a) (((x)+((a)-1))&(~((a)-1))) CellDbgFontConsoleId consoleID = CELL_DBGFONT_STDOUT_ID; extern u32 frame_index; extern int V_WIDTH; extern int V_HEIGHT; extern float overscan; extern int cover_mode; extern bool key_repeat; extern int xmb_slide_y; extern bool th_device_list; extern bool th_device_separator; extern u16 th_device_separator_y; extern bool th_legend; extern u16 th_legend_y; extern bool th_drive_icon; extern u16 th_drive_icon_x; extern u16 th_drive_icon_y; extern bool use_depth; extern u8 hide_bd; typedef struct { float x, y, z; u32 color; } vtx_color; typedef struct { float x, y, z; float tx, ty; } vtx_texture; u32 screen_width; u32 screen_height; float screen_aspect; u32 color_pitch; u32 depth_pitch; u32 color_offset[2]; u32 depth_offset; extern u32 _binary_vpshader_vpo_start; extern u32 _binary_vpshader_vpo_end; extern u32 _binary_fpshader_fpo_start; extern u32 _binary_fpshader_fpo_end; extern u32 video_buffer; static unsigned char *vertex_program_ptr = (unsigned char *)&_binary_vpshader_vpo_start; static unsigned char *fragment_program_ptr = (unsigned char *)&_binary_fpshader_fpo_start; static CGprogram vertex_program; static CGprogram fragment_program; extern struct _CGprogram _binary_vpshader2_vpo_start; extern struct _CGprogram _binary_fpshader2_fpo_start; extern void *color_base_addr; extern void put_label(uint8_t *buffer, uint32_t width, uint32_t height, char *str1p, char *str2p, char *str3p, uint32_t color); extern void put_texture( uint8_t *buffer_to, uint8_t *buffer_from, uint32_t width, uint32_t height, int from_width, int x, int y, int border, uint32_t border_color); extern void print_label(float x, float y, float scale, uint32_t color, char *str1p); extern void print_label_ex(float x, float y, float scale, uint32_t color, char *str1p, float weight, float slant, int font, float hscale, float vscale, int centered); extern void flush_ttf(uint8_t *buffer, uint32_t _V_WIDTH, uint32_t _V_HEIGHT); extern void draw_box( uint8_t *buffer_to, uint32_t width, uint32_t height, int x, int y, uint32_t border_color); extern void put_texture_Galpha( uint8_t *buffer_to, uint32_t Twidth, uint32_t Theight, uint8_t *buffer_from, uint32_t _width, uint32_t _height, int from_width, int x, int y, int border, uint32_t border_color); extern void put_texture_with_alpha( uint8_t *buffer_to, uint8_t *buffer_from, uint32_t _width, uint32_t _height, int from_width, int x, int y, int border, uint32_t border_color); extern int max_ttf_label; extern u8 *text_bmp; extern u8 *text_USB; extern u8 *text_HDD; extern u8 *text_BLU_1; extern u8 *text_legend; extern u8 *text_FONT; extern int legend_y, legend_h; extern int last_selected; extern int b_box_opaq; extern int b_box_step; extern int draw_legend; static void *vertex_program_ucode; static void *fragment_program_ucode; static u32 fragment_offset; static void *text_vertex_prg_ucode; static void *text_fragment_prg_ucode; static u32 text_fragment_offset; static u32 vertex_offset[2]; static u32 color_index; static u32 position_index; static vtx_color *vertex_color; extern int vert_indx; extern int vert_texture_indx; static u32 text_width; static u32 text_height; static u32 text_colorp; static u32 text_depthp; static vtx_texture *vertex_text; static u32 vertex_text_offset; static u32 text_obj_coord_indx; static u32 text_tex_coord_indx; static CGresource tindex; static CGprogram vertex_prg; static CGprogram fragment_prg; static CellGcmTexture text_param; static u32 local_heap = 0; static void *localAlloc(const u32 size) { u32 align = (size + 1023) & (~1023); u32 base = local_heap; local_heap += align; return (void*)base; } static void *localAllocAlign(const u32 alignment, const u32 size) { local_heap = (local_heap + alignment-1) & (~(alignment-1)); return (void*)localAlloc(size); } void put_vertex(float x, float y, float z, u32 color) { vertex_color[vert_indx].x = x; vertex_color[vert_indx].y = y; vertex_color[vert_indx].z = z; vertex_color[vert_indx].color=color; vert_indx++; } void setRenderTarget(void) { CellGcmSurface surface; surface.colorFormat = CELL_GCM_SURFACE_A8R8G8B8; surface.colorTarget = CELL_GCM_SURFACE_TARGET_0; surface.colorLocation[0] = CELL_GCM_LOCATION_LOCAL; surface.colorOffset[0] = color_offset[frame_index]; surface.colorPitch[0] = color_pitch; surface.colorLocation[1] = CELL_GCM_LOCATION_LOCAL; surface.colorLocation[2] = CELL_GCM_LOCATION_LOCAL; surface.colorLocation[3] = CELL_GCM_LOCATION_LOCAL; surface.colorOffset[1] = 0; surface.colorOffset[2] = 0; surface.colorOffset[3] = 0; surface.colorPitch[1] = 64; surface.colorPitch[2] = 64; surface.colorPitch[3] = 64; surface.depthFormat = CELL_GCM_SURFACE_Z24S8; surface.depthLocation = CELL_GCM_LOCATION_LOCAL; surface.depthOffset = depth_offset; surface.depthPitch = depth_pitch; surface.type = CELL_GCM_SURFACE_PITCH; surface.antialias = CELL_GCM_SURFACE_CENTER_1;//CELL_GCM_SURFACE_SQUARE_ROTATED_4;// surface.width = screen_width; surface.height = screen_height; surface.x = 0; surface.y = 0; cellGcmSetSurface(gCellGcmCurrentContext, &surface); } void initShader(void) { vertex_program = (CGprogram)vertex_program_ptr; fragment_program = (CGprogram)fragment_program_ptr; cellGcmCgInitProgram(vertex_program); cellGcmCgInitProgram(fragment_program); u32 ucode_size; void *ucode; cellGcmCgGetUCode(fragment_program, &ucode, &ucode_size); void *ret = localAllocAlign(64, ucode_size); fragment_program_ucode = ret; memcpy(fragment_program_ucode, ucode, ucode_size); cellGcmCgGetUCode(vertex_program, &ucode, &ucode_size); vertex_program_ucode = ucode; } int text_create( u32 xsize, u32 ysize ); int initDisplay(void) { int ret, i; u32 color_size, depth_size, color_depth= 4, z_depth= 4; // void *color_base_addr, *depth_base_addr, *color_addr[2]; color_base_addr=NULL; void *depth_base_addr, *color_addr[2]; CellVideoOutResolution resolution; CellVideoOutState videoState; //cellVideoOutGetState(CELL_VIDEO_OUT_PRIMARY, 0, &videoState); ret = cellVideoOutGetState(CELL_VIDEO_OUT_PRIMARY, 0, &videoState); if (ret != CELL_OK) return -1; cellVideoOutGetResolution(videoState.displayMode.resolutionId, &resolution); screen_width = resolution.width; screen_height = resolution.height; V_WIDTH = screen_width; V_HEIGHT = screen_height; color_pitch = screen_width*color_depth; depth_pitch = screen_width*z_depth; color_size = color_pitch*screen_height; depth_size = depth_pitch*screen_height; switch (videoState.displayMode.aspect) { case CELL_VIDEO_OUT_ASPECT_4_3: screen_aspect=4.0f/3.0f; break; case CELL_VIDEO_OUT_ASPECT_16_9: screen_aspect=16.0f/9.0f; break; default: screen_aspect=16.0f/9.0f; } CellVideoOutConfiguration videocfg; memset(&videocfg, 0, sizeof(CellVideoOutConfiguration)); videocfg.resolutionId = videoState.displayMode.resolutionId; videocfg.format = CELL_VIDEO_OUT_BUFFER_COLOR_FORMAT_X8R8G8B8; videocfg.pitch = color_pitch; ret = cellVideoOutConfigure(CELL_VIDEO_OUT_PRIMARY, &videocfg, NULL, 0); if (ret != CELL_OK) return -1; // cellGcmSetFlipMode(CELL_GCM_DISPLAY_VSYNC); cellGcmSetFlipMode(CELL_GCM_DISPLAY_HSYNC); // cellGcmSetFlipMode(CELL_GCM_DISPLAY_HSYNC_WITH_NOISE); CellGcmConfig config; cellGcmGetConfiguration(&config); local_heap = (u32) config.localAddress; color_base_addr = localAllocAlign(16, 2*color_size); video_buffer=color_size; for (i = 0; i < 2; i++) { color_addr[i]= (void *)((u32)color_base_addr+ (i*color_size)); ret = cellGcmAddressToOffset(color_addr[i], &color_offset[i]); if(ret != CELL_OK) return -1; ret = cellGcmSetDisplayBuffer(i, color_offset[i], color_pitch, screen_width, screen_height); if(ret != CELL_OK) return -1; } depth_base_addr = localAllocAlign(16, depth_size); ret = cellGcmAddressToOffset(depth_base_addr, &depth_offset); if(ret != CELL_OK) return -1; text_create( 512, 512 ); return 0; } void setDrawEnv(void) { u16 x,y,w,h; float min, max; float scale[4],offset[4]; w = (u16)((float)screen_width*(1.f-overscan/2.f)); h = (u16)((float)screen_height*(1.f-overscan/2.f)); x = (u16)((float)screen_width*overscan/2.f); y = 0; min = 0.0f; max = 1.0f; scale[0] = w * 0.5f * (1.f-overscan/2.f); scale[1] = h * -0.5f * (1.f-overscan/2.f); scale[2] = (max - min) * 0.5f; scale[3] = 0.0f; offset[0] = x + scale[0]; offset[1] = h - y + scale[1]; offset[2] = (max + min) * 0.5f; offset[3] = 0.0f; cellGcmSetColorMask(gCellGcmCurrentContext, CELL_GCM_COLOR_MASK_B | CELL_GCM_COLOR_MASK_G | CELL_GCM_COLOR_MASK_R | CELL_GCM_COLOR_MASK_A); cellGcmSetColorMaskMrt(gCellGcmCurrentContext, 0); //CELL_GCM_COLOR_MASK_B | CELL_GCM_COLOR_MASK_G | CELL_GCM_COLOR_MASK_R | CELL_GCM_COLOR_MASK_A cellGcmSetViewport(gCellGcmCurrentContext, x, y, w, h, min, max, scale, offset); cellGcmSetClearColor(gCellGcmCurrentContext, 0xff000000); cellGcmSetDepthTestEnable(gCellGcmCurrentContext, CELL_GCM_TRUE); cellGcmSetDepthFunc(gCellGcmCurrentContext, CELL_GCM_LESS); cellGcmSetBlendFunc(gCellGcmCurrentContext,CELL_GCM_SRC_ALPHA, CELL_GCM_ONE_MINUS_SRC_ALPHA,CELL_GCM_SRC_ALPHA, CELL_GCM_ONE_MINUS_SRC_ALPHA); cellGcmSetBlendEquation(gCellGcmCurrentContext,CELL_GCM_FUNC_ADD, CELL_GCM_FUNC_ADD); cellGcmSetBlendEnable(gCellGcmCurrentContext,CELL_GCM_TRUE); cellGcmSetShadeMode(gCellGcmCurrentContext, CELL_GCM_SMOOTH); cellGcmSetAlphaFunc(gCellGcmCurrentContext, CELL_GCM_GREATER, 0x01); //cellGcmSetAntiAliasingControl(gCellGcmCurrentContext, CELL_GCM_TRUE, CELL_GCM_FALSE, CELL_GCM_FALSE, 0x41ff); } void setRenderColor(void) { cellGcmSetVertexProgram(gCellGcmCurrentContext, vertex_program, vertex_program_ucode); cellGcmSetVertexDataArray(gCellGcmCurrentContext, position_index, 0, sizeof(vtx_color), 3, CELL_GCM_VERTEX_F, CELL_GCM_LOCATION_LOCAL, (u32)vertex_offset[0]); cellGcmSetVertexDataArray(gCellGcmCurrentContext, color_index, 0, sizeof(vtx_color), 4, CELL_GCM_VERTEX_UB, CELL_GCM_LOCATION_LOCAL, (u32)vertex_offset[1]); cellGcmSetFragmentProgram(gCellGcmCurrentContext, fragment_program, fragment_offset); } int setRenderObject(void) { vertex_color = (vtx_color*) localAllocAlign(131072/*128*1024*/, 1536*sizeof(vtx_color)); // 384 quad polygons/textures (384x4 vertices) CGparameter position = cellGcmCgGetNamedParameter(vertex_program, "position"); CGparameter color = cellGcmCgGetNamedParameter(vertex_program, "color"); position_index = cellGcmCgGetParameterResource(vertex_program, position) - CG_ATTR0; color_index = cellGcmCgGetParameterResource(vertex_program, color) - CG_ATTR0; if(cellGcmAddressToOffset(fragment_program_ucode, &fragment_offset) != CELL_OK) return -1; if (cellGcmAddressToOffset(&vertex_color->x, &vertex_offset[0]) != CELL_OK) return -1; if (cellGcmAddressToOffset(&vertex_color->color, &vertex_offset[1]) != CELL_OK) return -1; return 0; } int initFont() { CellDbgFontConfigGcm config; int size = CELL_DBGFONT_FRAGMENT_SIZE + CELL_DBGFONT_VERTEX_SIZE * CONSOLE_WIDTH * CONSOLE_HEIGHT + CELL_DBGFONT_TEXTURE_SIZE; int ret = 0; void*localmem = localAllocAlign(128, size); if( localmem == NULL ) return -1; memset(&config, 0, sizeof(CellDbgFontConfigGcm)); config.localBufAddr = (sys_addr_t)localmem; config.localBufSize = size; config.mainBufAddr = NULL; config.mainBufSize = 0; config.option = CELL_DBGFONT_VERTEX_LOCAL; config.option |= CELL_DBGFONT_TEXTURE_LOCAL; config.option |= CELL_DBGFONT_SYNC_ON; ret = cellDbgFontInitGcm(&config); if(ret < 0) return ret; return 0; } int initConsole() { CellDbgFontConsoleConfig config; config.posLeft = 0.086f; config.posTop = 0.16f; config.cnsWidth = CONSOLE_WIDTH; config.cnsHeight = CONSOLE_HEIGHT; config.scale = 0.72f; config.color = 0xffA0A0A0; consoleID = cellDbgFontConsoleOpen(&config); if (consoleID < 0) return -1; return 0; } void DbgEnable() { cellDbgFontConsoleEnable(consoleID); } void DbgDisable() { cellDbgFontConsoleDisable(consoleID); } int termConsole() { int ret; ret = cellDbgFontConsoleClose(consoleID); if(ret) return -1; consoleID = CELL_DBGFONT_STDOUT_ID; return ret; } int termFont() { int ret; ret = cellDbgFontExitGcm(); if(ret) return -1; return ret; } int DPrintf( const char *string, ... ) { int ret=0; va_list argp; va_start(argp, string); if(consoleID != CELL_DBGFONT_STDOUT_ID) ret = cellDbgFontConsoleVprintf(consoleID, string, argp); va_end(argp); return ret; } void utf8_to_ansi(char *utf8, char *ansi, int len) { u8 *ch= (u8 *) utf8; u8 c; while(*ch!=0 && len>0){ // 3, 4 bytes utf-8 code if(((*ch & 0xF1)==0xF0 || (*ch & 0xF0)==0xe0) && (*(ch+1) & 0xc0)==0x80){ *ansi++=' '; // ignore len--; ch+=2+1*((*ch & 0xF1)==0xF0); } else // 2 bytes utf-8 code if((*ch & 0xE0)==0xc0 && (*(ch+1) & 0xc0)==0x80){ c= (((*ch & 3)<<6) | (*(ch+1) & 63)); if(c>=0xC0 && c<=0xC5) c='A'; else if(c==0xc7) c='C'; else if(c>=0xc8 && c<=0xcb) c='E'; else if(c>=0xcc && c<=0xcf) c='I'; else if(c==0xd1) c='N'; else if(c>=0xd2 && c<=0xd6) c='O'; else if(c>=0xd9 && c<=0xdc) c='U'; else if(c==0xdd) c='Y'; else if(c>=0xe0 && c<=0xe5) c='a'; else if(c==0xe7) c='c'; else if(c>=0xe8 && c<=0xeb) c='e'; else if(c>=0xec && c<=0xef) c='i'; else if(c==0xf1) c='n'; else if(c>=0xf2 && c<=0xf6) c='o'; else if(c>=0xf9 && c<=0xfc) c='u'; else if(c==0xfd || c==0xff) c='y'; else if(c>127) c=*(++ch+1); //' '; if(c=='%') c='#'; *ansi++=c; len--; ch++; } else { if(*ch<32) *ch=32; if(*ch=='%') *ch='#'; *ansi++=*ch; len--; } ch++; } while(len>0) { *ansi++=0; len--; } } void draw_text_stroke(float x, float y, float size, u32 color, const char *str) { // print_label(x, y, size, color, (char*)str); return; /* cellDbgFontPrintf( x-.001f, y+.001f, size, 0xc0000000, str); cellDbgFontPrintf( x-.001f, y-.001f, size, 0xc0000000, str); cellDbgFontPrintf( x+.001f, y+.001f, size, 0xc0000000, str); cellDbgFontPrintf( x+.001f, y-.001f, size, 0xc0000000, str); cellDbgFontPrintf( x+.0015f, y+.0015f, size, 0x90202020, str); */ cellDbgFontPrintf( x-.0015f, y-0.0015, size+0.0030f, 0xE0101010, str); cellDbgFontPrintf( x-.0015f, y+0.0015, size+0.0030f, 0xD0101010, str); cellDbgFontPrintf( x, y, size, color, str); } void draw_device_list(u32 flags, int _cover_mode, int opaq, char *content) { (void)_cover_mode; if(cover_mode==5 || opaq<0x30 || cover_mode==8) return; // float y = 0.15f + 0.05f*15.0f; float y = (float)th_device_separator_y/1080.0f + 0.015; char str[256]; union CellNetCtlInfo net_info; int n,ok=0; float len; float x=0.08; char sizer[255]; char path[255]; if( (cover_mode<3 || cover_mode==6 || cover_mode==7 || cover_mode==4) ) goto just_legend; for(n=0;n<16;n++) { if(th_device_list==0) break; if(n==11 && hide_bd==1) continue; str[0]=0; ok=0; if((flags>>n) & 1) ok=1; if(ok || n==12) { switch(n) { case 0: sprintf(str, "%s", " HDD "); sprintf(path, "/dev_hdd0/"); break; case 7: sprintf(str, "USB#%i", n-5); sprintf(path, "/dev_usb00%d/", n-1); break; case 11: sprintf(str, "%s", "Game disc"); if(strstr(content,"AVCHD")!=NULL) sprintf(str, "%s", "AVCHD disc"); else if(strstr(content,"BDMV")!=NULL) sprintf(str, "%s", "Movie disc"); else if(strstr(content,"PS2")!=NULL) sprintf(str, "%s", "PS2 disc"); else if(strstr(content,"DVD")!=NULL) sprintf(str, "%s", "DVD disc"); sprintf(path, "/dev_bdvd/"); break; case 12: sprintf(str, "PS3 IP"); sprintf(path, "/ftp_service"); break; case 13: sprintf(str, " USB "); sprintf(path, "/pvd_usb000"); break; case 14: sprintf(str, "SDHC"); sprintf(path, "/dev_sd"); break; case 15: sprintf(str, " MS "); sprintf(path, "/dev_ms"); break; default: sprintf(str, "USB#%i", n); sprintf(path, "/dev_usb00%d/", n-1); break; } len=0.025f*(float)(strlen(str)); if(n!=12){ draw_square((x-0.5f)*2.0f-0.02f, (0.5f-y+0.01)*2.0f, len+0.04f, 0.095f, -0.9f, ((flags>>(n+16)) & 1) ? 0x0080ffc0 : 0x101010c0); if(n!=11 && n!=13) { if(str[0]) { cellFsGetFreeSize(path, &blockSize, &freeSize); freeSpace = (uint64_t)(blockSize * freeSize); //last_refreshD=time(NULL); //dev_free_space[n].freespace=freeSpace; } else { //freeSpace = dev_free_space[n].freespace; freeSpace = 0; } sprintf(sizer, "%.2fGB", (double) (freeSpace / 1073741824.00f)); draw_text_stroke( (x+(len+0.024f)/4.0f)-(float)((0.009f*(float)(strlen(sizer)))/2), y+0.045f, 0.70f, COL_LEGEND, sizer); // draw_text_stroke( x+overscan, y+0.045-overscan, 0.70f-overscan,((flags>>(n+16)) & 1) ? 0xd0c0c0c0 : 0xc0c0c0a0, sizer); } if(n==13) {sprintf(sizer, "PFS Drive"); draw_text_stroke( (x+(len+0.024f)/4.0f)-(float)((0.009f*(float)(strlen(sizer)))/2), y+0.045f, 0.70f, COL_LEGEND, sizer);} draw_text_stroke( x, y-0.005, 1.0f, ((flags>>(n+16)) & 1) ? 0xd0c0c0c0 : COL_LEGEND, str); } else { if(cellNetCtlGetInfo(16, &net_info) < 0) str[0]=0; else { sprintf(sizer, "%s", net_info.ip_address); draw_square((x-0.5f)*2.0f-0.02f, (0.5f-y+0.01)*2.0f, len+0.04f, 0.095f, -0.9f, 0x101060c0); draw_text_stroke( (x+(len+0.02f)/4.0f)-(float)((0.009f*(float)(strlen(sizer)))/2), y+0.045, 0.65f,((flags>>(n+16)) & 1) ? 0xc0c0c0ff : COL_LEGEND, sizer); draw_text_stroke( x, y-0.005, 1.0f, ((flags>>(n+16)) & 1) ? 0xc0c0c0ff : COL_LEGEND, str); } } len=0.025f*(float)(strlen(str)); x+=len; } } just_legend: if( (cover_mode==4 && th_legend==1) ) { // float legend_font=0.9f; // if(overscan>0.05) legend_font=(float)(legend_font-(legend_font*overscan)); // draw_text_stroke( 0.08f+(overscan/4.0f), (((float)th_legend_y/1080.f)+0.02f)-overscan, legend_font, COL_LEGEND, "X - Load [] - Game settings [R1] - Next mode\nO - Exit /\\ - System menu [L1] - Prev mode" ); set_texture( text_legend, 1665, 96); display_img(127, th_legend_y+15, 1665, 96, 1665, 96, -0.5f, 1665, 96); } if( (cover_mode<3 || cover_mode==6 || cover_mode==7) && draw_legend ) { if(th_legend==1) { if( cover_mode==1 || cover_mode==6 || cover_mode==7) put_texture_with_alpha( text_bmp, text_legend, 1665, 96, 1665, 127, th_legend_y, 0, 0); else put_texture_with_alpha( text_bmp, text_legend, 1665, 96, 1665, 127, th_legend_y+15, 0, 0); } if(th_device_separator==1) draw_box( text_bmp, 1920, 2, 0, th_device_separator_y, 0x80808080); u32 info_color=0xffc0c0c0; u32 info_color2=0xff808080; if(th_device_list==1) { x=0.1f; max_ttf_label=0; for(n=0;n<16;n++) { str[0]=0; ok=0; if(n==11 && hide_bd==1) continue; if((flags>>n) & 1) ok=1; if(ok || n==12) { switch(n) { case 0: sprintf(str, "%s", " HDD "); sprintf(path, "/dev_hdd0/"); break; case 7: sprintf(str, "USB#%i", n-5); sprintf(path, "/dev_usb00%d/", n-1); break; case 11: sprintf(str, "%s", "Game disc"); if(strstr(content,"AVCHD")!=NULL) sprintf(str, "%s", "AVCHD disc"); else if(strstr(content,"BDMV")!=NULL) sprintf(str, "%s", "Movie disc"); else if(strstr(content,"PS2")!=NULL) sprintf(str, "%s", "PS2 disc"); else if(strstr(content,"DVD")!=NULL) sprintf(str, "%s", "DVD disc"); sprintf(path, "/dev_bdvd/"); break; case 12: sprintf(str, "PS3 IP"); sprintf(path, "/ftp_service"); break; case 13: sprintf(str, " USB "); sprintf(path, "/pvd_usb000"); break; case 14: sprintf(str, "SDHC"); sprintf(path, "/dev_sd"); break; case 15: sprintf(str, " MS "); sprintf(path, "/dev_ms"); break; default: sprintf(str, "USB#%i", n); sprintf(path, "/dev_usb00%d/", n-1); break; } len=0.025f*(float)(strlen(str)); sizer[0]=0; if(n!=12){ if(n!=11 && n!=13) { if(str[0]) { cellFsGetFreeSize(path, &blockSize, &freeSize); freeSpace = (uint64_t)(blockSize * freeSize); } else { freeSpace = 0; } sprintf(sizer, "%.2fGB", (double) (freeSpace / 1073741824.00f)); //draw_text_stroke( (x+overscan+(len+0.024f)/4.0f)-(float)((0.009f*(float)(strlen(sizer)))/2), y+0.045f-overscan, 0.70f-overscan, COL_LEGEND, sizer); } if(n==13) { sprintf(sizer, "PFS Drive"); //draw_text_stroke( (x+overscan+(len+0.024f)/4.0f)-(float)((0.009f*(float)(strlen(sizer)))/2), y+0.045f-overscan, 0.70f-overscan, COL_LEGEND, sizer); } //draw_text_stroke( x+overscan, y-0.005-overscan, 1.0f-overscan, ((flags>>(n+16)) & 1) ? 0xd0c0c0c0 : COL_LEGEND, str); print_label_ex( x, (((float)(th_device_separator_y+15))/1080.f), 1.5f, info_color, str, 1.04f, 0.00f, 15, 0.6f, 0.6f, 1); print_label_ex( x, (((float)(th_device_separator_y+44))/1080.f), 1.5f, info_color2, sizer, 1.00f, 0.00f, 15, 0.5f, 0.5f, 1); } else { if(cellNetCtlGetInfo(16, &net_info) < 0) str[0]=0; else { sprintf(sizer, "%s", net_info.ip_address); //draw_square((x+overscan-0.5f)*2.0f-0.02f, (0.5f-y+0.01+overscan)*2.0f, len+0.04f, 0.095f, -0.9f, 0x101060c0); //draw_text_stroke( (x+overscan+(len+0.02f)/4.0f)-(float)((0.009f*(float)(strlen(sizer)))/2), y+0.045-overscan, 0.65f-overscan,((flags>>(n+16)) & 1) ? 0xc0c0c0ff : COL_LEGEND, sizer); //draw_text_stroke( x+overscan, y-0.005-overscan, 1.0f-overscan, ((flags>>(n+16)) & 1) ? 0xc0c0c0ff : COL_LEGEND, str); print_label_ex( x, (((float)(th_device_separator_y+15))/1080.f), 1.5f, info_color, str, 1.04f, 0.00f, 15, 0.6f, 0.6f, 1); print_label_ex( x, (((float)(th_device_separator_y+44))/1080.f), 1.5f, info_color2, sizer, 1.00f, 0.00f, 15, 0.5f, 0.5f, 1); } } len=0.11f; x+=len; } } flush_ttf(text_bmp, 1920, 1080); } draw_legend=0; } } void draw_list( t_menu_list *menu, int menu_size, int selected, int dir_mode, int display_mode, int _cover_mode, int game_sel_last, int opaq ) { (void)_cover_mode; if(cover_mode==5 || cover_mode==0 || cover_mode==8) return; float y = 0.1f; int i = 0, c=0; char str[256]; char ansi[256]; float len=0; u32 color, color2; game_sel_last+=0; int flagb= selected & 0x10000; int max_entries=14; if(cover_mode==1) max_entries=8; if(cover_mode==7) max_entries=32; selected&= 0xffff; if(cover_mode==4 || cover_mode==1 || cover_mode==6 || cover_mode==7) { int grey=(menu[selected].title[0]=='_' || menu[selected].split); if(grey && menu[selected].title[0]=='_') {utf8_to_ansi(menu[selected].title+1, ansi, 60);} else {utf8_to_ansi(menu[selected].title, ansi, 60);} ansi[60]=0; color= (flagb && selected==0)? COL_PS3DISC : ((grey==0) ? COL_PS3 : COL_SPLIT); if(strstr(menu[selected].content,"AVCHD")!=NULL) color=COL_AVCHD; if(strstr(menu[selected].content,"BDMV")!=NULL) color=COL_BDMV; if(strstr(menu[selected].content,"PS2")!=NULL) color=COL_PS2; if(strstr(menu[selected].content,"DVD")!=NULL) color=COL_DVD; if(grey) sprintf(str, "%s (Split)", ansi); else sprintf(str, "%s", ansi); len=(0.023f*(float)(strlen(str)))/2; sprintf(str, "%i of %i", selected+1, menu_size); if(cover_mode==4) // draw_text_stroke( 0.5f-(float)(len/2), 0.71f, 0.88f, color, str); // else { // draw_text_stroke( 0.5f-(float)(len/2), 0.6f, 0.88f, color, str); /*if(selected!=last_selected) { last_selected=selected; int tmp_legend_y=legend_y; legend_y=0; memset(text_bmp, 0, 737280); if(dir_mode==1) put_label(text_bmp, 1920, 1080, (char*)menu[selected].title, (char*)str, (char*)menu[selected].path, color); else put_label(text_bmp, 1920, 1080, (char*)menu[selected].title, (char*)str, (char*)menu[selected].title_id, color); legend_y=tmp_legend_y; } */ set_texture( text_bmp, 1920, legend_h); display_img(0, 728, 1920, legend_h, 1920, legend_h, -0.5f, 1920, legend_h); } // len=(0.023f*(float)(strlen(str)))/2; // bottom device icon if(cover_mode==1 || cover_mode==6 || cover_mode==7) { // draw_text_stroke( 0.5f-(float)(len/2), 0.75f, 0.88f, color, str); if(selected!=last_selected) { last_selected=selected; memcpy(text_bmp + (1920*4*legend_y), text_FONT, (1920*4*legend_h)); if(dir_mode==1) put_label(text_bmp, 1920, 1080, (char*)menu[selected].title, (char*)str, (char*)menu[selected].path, color); else put_label(text_bmp, 1920, 1080, (char*)menu[selected].title, (char*)str, (char*)menu[selected].title_id, color); if(th_drive_icon==1) { if(strstr(menu[selected].path, "/dev_usb")!=NULL || strstr(menu[selected].path, "/pvd_usb")!=NULL) { put_texture( text_bmp, text_USB, 96, 96, 320, th_drive_icon_x, th_drive_icon_y, 0, 0xff800080); } else if(strstr(menu[selected].path, "/dev_hdd")!=NULL) { put_texture( text_bmp, text_HDD, 96, 96, 320, th_drive_icon_x, th_drive_icon_y, 0, 0xff800080); } else if(strstr(menu[selected].path, "/dev_bdvd")!=NULL) { put_texture( text_bmp, text_BLU_1, 96, 96, 320, th_drive_icon_x, th_drive_icon_y, 0, 0xff800080); } } } if(cover_mode==6) return; float s_x, s_y, s_h, s_w, b_size; int game_rel=0, c_x=0, c_y=0, c_game=0, c_w=0, c_h=0; if(cover_mode==1) { game_rel=int(selected/8)*8; c_game= selected-(game_rel); if(c_game<4) { c_y=64; c_x= 150 + (433*c_game); } else { c_y=430; c_x= 150 + (433*(c_game-4)); } if(menu[selected].cover!=1) { c_y+=124; c_w=320; c_h=176; } else { c_x+=30; c_w=260; c_h=300; } } if(cover_mode==7) { game_rel=int(selected/32)*32; c_game= selected-(game_rel); if(c_game<8) { c_y=62; c_x= 118 + (int)(216.5f*c_game); } if(c_game>7 && c_game<16) { c_y=240; c_x= 118 + (int)(216.5f*(c_game-8)); } if(c_game>15 && c_game<24) { c_y=418; c_x= 118 + (int)(216.5f*(c_game-16)); } if(c_game>23 && c_game<32) { c_y=596; c_x= 118 + (int)(216.5f*(c_game-24)); } if(menu[selected].cover!=1) { c_y+=62; c_w=160; c_h=88; c_x+=7; } else { c_x+=15; c_w=130; c_h=150; } } b_size = 0.008f; s_x=(float) c_x/1920.0f-b_size; s_y=(float) c_y/1080.0f-b_size; s_h=(float) c_h/1080.0f+2.0f*b_size; s_w=(float) c_w/1920.0f+2.0f*b_size; uint32_t b_color = 0x0080ff80; if(strstr(menu[selected].path, "/dev_usb")!=NULL || strstr(menu[selected].path, "/pvd_usb")!=NULL) b_color = 0xff800000; if(strstr(menu[selected].path, "/dev_bdvd")!=NULL) b_color = 0x39b3f900; if(strstr(menu[selected].title_id, "AVCHD")!=NULL) b_color = 0xeeeb1a00; if(menu[selected].title[0]=='_' || menu[selected].split) b_color = 0xff000000; b_box_opaq+=b_box_step; if(b_box_opaq>0xfb) b_box_step=-4; if(b_box_opaq<0x20) b_box_step= 8; b_color = (b_color & 0xffffff00) | b_box_opaq; draw_square((s_x-0.5f)*2.0f, (0.5f-s_y)*2.0f , s_w*2.0f, b_size, -0.9f, b_color); draw_square((s_x-0.5f)*2.0f, (0.5f-s_y-s_h)*2.0f+b_size , s_w*2.0f, b_size, -0.9f, b_color); draw_square((s_x-0.5f)*2.0f, (0.5f-s_y)*2.0f , b_size, s_h*2.0f, -0.9f, b_color); draw_square((s_x+s_w-0.5f)*2.0f-b_size, (0.5f-s_y)*2.0f , b_size, s_h*2.0f, -0.9f, b_color); } // else // draw_text_stroke( 0.5f-(float)(len/2), 0.63f, 0.88f, color, str); } else { while( (c<max_entries && i < menu_size) ) { if( (display_mode==1 && strstr(menu[i].content,"AVCHD")!=NULL) || (display_mode==2 && strstr(menu[i].content,"PS3")!=NULL) ) { i++; continue;} if( (i >= (int) (selected / max_entries)*max_entries) ) { int grey=0; if(i<menu_size) { grey=(menu[i].title[0]=='_' || menu[i].split); if(grey && menu[i].title[0]=='_') { utf8_to_ansi(menu[i].title+1, ansi, 128); } else { utf8_to_ansi(menu[i].title, ansi, 128); } if(dir_mode==0 && (cover_mode==0 || cover_mode==2)) { ansi[40]=0; } if(dir_mode==1 && (cover_mode==0 || cover_mode==2)) { ansi[55]=0; } if(dir_mode==0 && cover_mode==3) { ansi[47]=0; } if(dir_mode==1 && cover_mode==3) { ansi[62]=0; } if( (cover_mode==1 || cover_mode==4 || cover_mode==7)) { ansi[128]=0; } if(grey) sprintf(str, "%s (Split)", ansi); else sprintf(str, "%s", ansi); } else { sprintf(str, " "); } color= 0xff606060; if(i==selected) color= (flagb && i==0) ? COL_PS3DISCSEL : ((grey==0) ? COL_SEL : 0xff008080); else { color= (flagb && i==0)? COL_PS3DISC : ((grey==0) ? COL_PS3 : COL_SPLIT); if(strstr(menu[i].content,"AVCHD")!=NULL) color=COL_AVCHD; if(strstr(menu[i].content,"BDMV")!=NULL) color=COL_BDMV; if(strstr(menu[i].content,"PS2")!=NULL) color=COL_PS2; if(strstr(menu[i].content,"DVD")!=NULL) color=COL_DVD; } color2=( (color & 0x00ffffff) | (opaq<<24)); if(dir_mode==1) { len=0.023f*(float)(strlen(str)+2); if(i==selected) // && cover_mode==3 draw_text_stroke( 0.08f, y-0.005f, 0.88f, color, str); else if(opaq>0xFD) draw_text_stroke( 0.08f, y-0.005f, 0.88f, color2, str); else cellDbgFontPrintf( 0.08f, y-0.005f, 0.88f, color2, str); } else { len=0.03f*(float)(strlen(str)); if(dir_mode==0){ if(i==selected) draw_text_stroke( 0.08f, y-0.005f, 1.2f, color, str); else if(opaq>0xFD) draw_text_stroke( 0.08f, y-0.005f, 1.2f, color2, str); else cellDbgFontPrintf( 0.08f, y-0.005f, 1.2f, color2, str); } else //dir2 { len=0.023f*(float)(strlen(str)+2); if(i==selected) // && cover_mode==3 draw_text_stroke( 0.08f, y+0.001f, 0.88f, color, str); else if(opaq>0xFD) draw_text_stroke( 0.08f, y+0.001f, 0.88f, color2, str); else cellDbgFontPrintf( 0.08f, y+0.001f, 0.88f, color2, str); } } if(strlen(str)>1 && dir_mode==1) { sprintf(str, "%s", menu[i].path); if(strstr(menu[i].content,"AVCHD")!=NULL || strstr(menu[i].content,"BDMV")!=NULL) sprintf(str, "(%s) %s", menu[i].entry, menu[i].details); str[102]=0; if(0.01125f*(float)(strlen(str))>len) len=0.01125f*(float)(strlen(str)); if(i==selected) cellDbgFontPrintf( 0.08f, (y+0.022f), 0.45f, color, str); else cellDbgFontPrintf( 0.08f, (y+0.022f), 0.45f, color2, str); } if(i==selected) { u32 b_color=0x0080ffd0; b_box_opaq+=b_box_step; if(b_box_opaq>0xd0) b_box_step=-2; if(b_box_opaq<0x30) b_box_step= 1; b_color = (b_color & 0xffffff00) | (b_box_opaq-20); draw_square((0.08f-0.5f)*2.0f-0.02f, (0.5f-y+0.01)*2.0f , len+0.04f, 0.1f, -0.9f, b_color); } y += 0.05f; c++; } i++; } } // cover_mode==4 return; } static void init_text_shader( void ) { void *ucode; u32 ucode_size; vertex_prg = &_binary_vpshader2_vpo_start; fragment_prg = &_binary_fpshader2_fpo_start; cellGcmCgInitProgram( vertex_prg ); cellGcmCgInitProgram( fragment_prg ); cellGcmCgGetUCode( fragment_prg, &ucode, &ucode_size ); text_fragment_prg_ucode = localAllocAlign(64, ucode_size ); cellGcmAddressToOffset( text_fragment_prg_ucode, &text_fragment_offset ); memcpy( text_fragment_prg_ucode, ucode, ucode_size ); cellGcmCgGetUCode( vertex_prg, &text_vertex_prg_ucode, &ucode_size ); } int text_create( u32 xsize, u32 ysize ) { u32 color_size; u32 color_limit; u32 depth_size; u32 depth_limit; u32 buffer_width; text_width = xsize; text_height =ysize; buffer_width = ROUNDUP( text_width, 64 ); text_colorp = cellGcmGetTiledPitchSize( buffer_width*4 ); if( text_colorp == 0 ) return -1; text_depthp = cellGcmGetTiledPitchSize( buffer_width*4 ); if( text_depthp == 0 ) return -1; color_size = text_colorp*ROUNDUP( text_height, 64 ); color_limit = ROUNDUP( 2*color_size, 0x10000 ); depth_size = text_depthp*ROUNDUP( text_height, 64 ); depth_limit = ROUNDUP( depth_size, 0x10000 ); init_text_shader(); vertex_text = (vtx_texture*) localAllocAlign(128*1024, 1024*sizeof(vtx_texture)); cellGcmAddressToOffset( (void*)vertex_text, &vertex_text_offset ); text_param.format = CELL_GCM_TEXTURE_A8R8G8B8; text_param.format |= CELL_GCM_TEXTURE_LN; text_param.remap = CELL_GCM_TEXTURE_REMAP_REMAP << 14 | CELL_GCM_TEXTURE_REMAP_REMAP << 12 | CELL_GCM_TEXTURE_REMAP_REMAP << 10 | CELL_GCM_TEXTURE_REMAP_REMAP << 8 | CELL_GCM_TEXTURE_REMAP_FROM_G << 6 | CELL_GCM_TEXTURE_REMAP_FROM_R << 4 | CELL_GCM_TEXTURE_REMAP_FROM_A << 2 | CELL_GCM_TEXTURE_REMAP_FROM_B; text_param.mipmap = 1; text_param.cubemap = CELL_GCM_FALSE; text_param.dimension = CELL_GCM_TEXTURE_DIMENSION_2; CGparameter objCoord = cellGcmCgGetNamedParameter( vertex_prg, "a2v.objCoord" ); if( objCoord == 0 ) return -1; CGparameter texCoord = cellGcmCgGetNamedParameter( vertex_prg, "a2v.texCoord" ); if( texCoord == 0) return -1; CGparameter texture = cellGcmCgGetNamedParameter( fragment_prg, "texture" ); if( texture == 0 ) return -1; text_obj_coord_indx = cellGcmCgGetParameterResource( vertex_prg, objCoord) - CG_ATTR0; text_tex_coord_indx = cellGcmCgGetParameterResource( vertex_prg, texCoord) - CG_ATTR0; tindex = (CGresource) (cellGcmCgGetParameterResource( fragment_prg, texture ) - CG_TEXUNIT0 ); return 0; } int set_texture( u8 *buffer, u32 x_size, u32 y_size ) { int ret; u32 buf_offs; ret = cellGcmAddressToOffset( buffer, &buf_offs ); if( CELL_OK != ret ) return ret; text_param.depth = 1; text_param.width = x_size; text_param.height = y_size; text_param.pitch = x_size*4; text_param.offset = buf_offs; text_param.location = CELL_GCM_LOCATION_MAIN; cellGcmSetTexture( gCellGcmCurrentContext, tindex, &text_param ); cellGcmSetTextureControl( gCellGcmCurrentContext, tindex, 1, 0, 15, CELL_GCM_TEXTURE_MAX_ANISO_1 ); cellGcmSetTextureAddress( gCellGcmCurrentContext, tindex, CELL_GCM_TEXTURE_CLAMP_TO_EDGE, CELL_GCM_TEXTURE_CLAMP_TO_EDGE, CELL_GCM_TEXTURE_CLAMP_TO_EDGE, CELL_GCM_TEXTURE_UNSIGNED_REMAP_NORMAL, CELL_GCM_TEXTURE_ZFUNC_LESS, 0 ); // cellGcmSetTextureFilter( gCellGcmCurrentContext, tindex, 0, CELL_GCM_TEXTURE_LINEAR_LINEAR, CELL_GCM_TEXTURE_LINEAR, CELL_GCM_TEXTURE_CONVOLUTION_QUINCUNX ); if(V_WIDTH<1280) cellGcmSetTextureFilter( gCellGcmCurrentContext, tindex, 0, CELL_GCM_TEXTURE_CONVOLUTION_MIN, CELL_GCM_TEXTURE_LINEAR, CELL_GCM_TEXTURE_CONVOLUTION_GAUSSIAN ); else cellGcmSetTextureFilter( gCellGcmCurrentContext, tindex, 0, CELL_GCM_TEXTURE_LINEAR_LINEAR, CELL_GCM_TEXTURE_LINEAR, CELL_GCM_TEXTURE_CONVOLUTION_QUINCUNX ); cellGcmSetVertexProgram( gCellGcmCurrentContext, vertex_prg, text_vertex_prg_ucode ); cellGcmSetFragmentProgram( gCellGcmCurrentContext, fragment_prg, text_fragment_offset); cellGcmSetInvalidateTextureCache( gCellGcmCurrentContext, CELL_GCM_INVALIDATE_TEXTURE ); cellGcmSetVertexDataArray( gCellGcmCurrentContext, text_obj_coord_indx, 0, sizeof(vtx_texture), 3, CELL_GCM_VERTEX_F, CELL_GCM_LOCATION_LOCAL, vertex_text_offset ); cellGcmSetVertexDataArray( gCellGcmCurrentContext, text_tex_coord_indx, 0, sizeof(vtx_texture), 2, CELL_GCM_VERTEX_F, CELL_GCM_LOCATION_LOCAL, ( vertex_text_offset + sizeof(float)*3 ) ); return ret; } void display_img_persp(int x, int y, int width, int height, int tx, int ty, float z, int Dtx, int Dty, int keystoneL, int keystoneR) { vertex_text[vert_texture_indx].x= ((float) ((x)*2))/((float) 1920)-1.0f; vertex_text[vert_texture_indx].y= ((float) ((y-keystoneL)*-2))/((float) 1080)+1.0f; vertex_text[vert_texture_indx].z= z; vertex_text[vert_texture_indx].tx= 0.0f; vertex_text[vert_texture_indx].ty= 0.0f; vertex_text[vert_texture_indx+1].x= ((float) ((x+width)*2))/((float) 1920)-1.0f; vertex_text[vert_texture_indx+1].y= ((float) ((y-keystoneR)*-2))/((float) 1080)+1.0f; vertex_text[vert_texture_indx+1].z= z; vertex_text[vert_texture_indx+1].tx= ((float) tx)/Dtx; vertex_text[vert_texture_indx+1].ty= 0.0f; vertex_text[vert_texture_indx+2].x= ((float) ((x+width)*2))/((float) 1920)-1.0f; vertex_text[vert_texture_indx+2].y= ((float) ((y+height+keystoneR)*-2))/((float) 1080)+1.0f; vertex_text[vert_texture_indx+2].z= z; vertex_text[vert_texture_indx+2].tx= ((float) tx)/Dtx; vertex_text[vert_texture_indx+2].ty=((float) ty)/Dty; vertex_text[vert_texture_indx+3].x= ((float) ((x)*2))/((float) 1920)-1.0f; vertex_text[vert_texture_indx+3].y= ((float) ((y+height+keystoneL)*-2))/((float) 1080)+1.0f; vertex_text[vert_texture_indx+3].z= z; vertex_text[vert_texture_indx+3].tx= 0.0f; vertex_text[vert_texture_indx+3].ty= ((float) ty)/Dty; cellGcmSetDrawArrays( gCellGcmCurrentContext, CELL_GCM_PRIMITIVE_QUADS, vert_texture_indx, 4 ); //CELL_GCM_PRIMITIVE_TRIANGLE_STRIP vert_texture_indx+=4; } void display_img(int x, int y, int width, int height, int tx, int ty, float z, int Dtx, int Dty) { if((cover_mode==8) && V_WIDTH==720) { x-=(int)((float)width*0.04f); y-=(int)((float)height*0.06f); width+=(int)((float)width*0.08f); height+=(int)((float)height*0.12f); } vertex_text[vert_texture_indx].x= ((float) ((x)*2))/((float) 1920)-1.0f; vertex_text[vert_texture_indx].y= ((float) ((y)*-2))/((float) 1080)+1.0f; vertex_text[vert_texture_indx].z= z; vertex_text[vert_texture_indx].tx= 0.0f; vertex_text[vert_texture_indx].ty= 0.0f; vertex_text[vert_texture_indx+1].x= ((float) ((x+width)*2))/((float) 1920)-1.0f; vertex_text[vert_texture_indx+1].y= ((float) ((y)*-2))/((float) 1080)+1.0f; vertex_text[vert_texture_indx+1].z= z; vertex_text[vert_texture_indx+1].tx= ((float) tx)/Dtx; vertex_text[vert_texture_indx+1].ty= 0.0f; vertex_text[vert_texture_indx+2].x= ((float) ((x+width)*2))/((float) 1920)-1.0f; vertex_text[vert_texture_indx+2].y= ((float) ((y+height)*-2))/((float) 1080)+1.0f; vertex_text[vert_texture_indx+2].z= z; vertex_text[vert_texture_indx+2].tx= ((float) tx)/Dtx; vertex_text[vert_texture_indx+2].ty=((float) ty)/Dty; vertex_text[vert_texture_indx+3].x= ((float) ((x)*2))/((float) 1920)-1.0f; vertex_text[vert_texture_indx+3].y= ((float) ((y+height)*-2))/((float) 1080)+1.0f; vertex_text[vert_texture_indx+3].z= z; vertex_text[vert_texture_indx+3].tx= 0.0f; vertex_text[vert_texture_indx+3].ty= ((float) ty)/Dty; cellGcmSetDrawArrays( gCellGcmCurrentContext, CELL_GCM_PRIMITIVE_QUADS, vert_texture_indx, 4 ); //CELL_GCM_PRIMITIVE_TRIANGLE_STRIP vert_texture_indx+=4; } void display_img_nr(int x, int y, int width, int height, int tx, int ty, float z, int Dtx, int Dty) { vertex_text[vert_texture_indx].x= ((float) ((x)*2))/((float) V_WIDTH)-1.0f; vertex_text[vert_texture_indx].y= ((float) ((y)*-2))/((float) V_HEIGHT)+1.0f; vertex_text[vert_texture_indx].z= z; vertex_text[vert_texture_indx].tx= 0.0f; vertex_text[vert_texture_indx].ty= 0.0f; vertex_text[vert_texture_indx+1].x= ((float) ((x+width)*2))/((float) V_WIDTH)-1.0f; vertex_text[vert_texture_indx+1].y= ((float) ((y)*-2))/((float) V_HEIGHT)+1.0f; vertex_text[vert_texture_indx+1].z= z; vertex_text[vert_texture_indx+1].tx= ((float) tx)/Dtx; vertex_text[vert_texture_indx+1].ty= 0.0f; vertex_text[vert_texture_indx+2].x= ((float) ((x)*2))/((float) V_WIDTH)-1.0f; vertex_text[vert_texture_indx+2].y= ((float) ((y+height)*-2))/((float) V_HEIGHT)+1.0f; vertex_text[vert_texture_indx+2].z= z; vertex_text[vert_texture_indx+2].tx= 0.0f; vertex_text[vert_texture_indx+2].ty= ((float) ty)/Dty; vertex_text[vert_texture_indx+3].x= ((float) ((x+width)*2))/((float) V_WIDTH)-1.0f; vertex_text[vert_texture_indx+3].y= ((float) ((y+height)*-2))/((float) V_HEIGHT)+1.0f; vertex_text[vert_texture_indx+3].z= z; vertex_text[vert_texture_indx+3].tx= ((float) tx)/Dtx; vertex_text[vert_texture_indx+3].ty=((float) ty)/Dty; cellGcmSetDrawArrays( gCellGcmCurrentContext, CELL_GCM_PRIMITIVE_TRIANGLE_STRIP, vert_texture_indx, 4 ); //CELL_GCM_PRIMITIVE_TRIANGLE_STRIP vert_texture_indx+=4; } int angle_coord_x(int radius, float __angle) { float _angle=__angle; if(_angle>=360.f) _angle= __angle - 360.f; if(_angle<0.f) _angle=360.f+__angle; return (int) ((float) radius * cos((_angle/360.f * 6.283185307179586476925286766559f))); } int angle_coord_y(int radius, float __angle) { float _angle=__angle; if(_angle>=360.f) _angle= __angle - 360.f; if(_angle<0.f) _angle=360.f+__angle; return (int) ((float) radius * sin((_angle/360.f * 6.283185307179586476925286766559f))); } void display_img_angle(int x, int y, int width, int height, int tx, int ty, float z, int Dtx, int Dty, float _angle) { int _radius; if((cover_mode==8) && V_WIDTH==720) { x-=(int)((float)width*0.04f); y-=(int)((float)height*0.06f); width+=(int)((float)width*0.08f); height+=(int)((float)height*0.12f); } _radius = (int)(((float)width*sqrt(2.f))/2.f); // diagonal/2 -> works for square textures at the moment // center of rotation int xC= x+width/2; int yC= y+height/2; vertex_text[vert_texture_indx].x= ((float) ((xC+angle_coord_x(_radius, _angle))*2))/((float) 1920)-1.0f; vertex_text[vert_texture_indx].y= ((float) ((yC+angle_coord_y(_radius, _angle))*-2))/((float) 1080)+1.0f; vertex_text[vert_texture_indx].z= z; vertex_text[vert_texture_indx].tx= 0.0f; vertex_text[vert_texture_indx].ty= 0.0f; vertex_text[vert_texture_indx+1].x= ((float) ((xC+angle_coord_x(_radius, _angle+90.f))*2))/((float) 1920)-1.0f; vertex_text[vert_texture_indx+1].y= ((float) ((yC+angle_coord_y(_radius, _angle+90.f))*-2))/((float) 1080)+1.0f; vertex_text[vert_texture_indx+1].z= z; vertex_text[vert_texture_indx+1].tx= ((float) tx)/Dtx; vertex_text[vert_texture_indx+1].ty= 0.0f; vertex_text[vert_texture_indx+2].x= ((float) ((xC+angle_coord_x(_radius, _angle-90.f))*2))/((float) 1920)-1.0f; vertex_text[vert_texture_indx+2].y= ((float) ((yC+angle_coord_y(_radius, _angle-90.f))*-2))/((float) 1080)+1.0f; vertex_text[vert_texture_indx+2].z= z; vertex_text[vert_texture_indx+2].tx= 0.0f; vertex_text[vert_texture_indx+2].ty= ((float) ty)/Dty; vertex_text[vert_texture_indx+3].x= ((float) ((xC+angle_coord_x(_radius, _angle-180.f))*2))/((float) 1920)-1.0f; vertex_text[vert_texture_indx+3].y= ((float) ((yC+angle_coord_y(_radius, _angle-180.f))*-2))/((float) 1080)+1.0f; vertex_text[vert_texture_indx+3].z= z; vertex_text[vert_texture_indx+3].tx= ((float) tx)/Dtx; vertex_text[vert_texture_indx+3].ty=((float) ty)/Dty; cellGcmSetDrawArrays( gCellGcmCurrentContext, CELL_GCM_PRIMITIVE_TRIANGLE_STRIP, vert_texture_indx, 4 ); //CELL_GCM_PRIMITIVE_TRIANGLE_STRIP vert_texture_indx+=4; } void draw_square(float x, float y, float w, float h, float z, u32 color) { vertex_color[vert_indx].x = x; vertex_color[vert_indx].y = y; vertex_color[vert_indx].z = z; vertex_color[vert_indx].color=color; vertex_color[vert_indx+1].x = x+w; vertex_color[vert_indx+1].y = y; vertex_color[vert_indx+1].z = z; vertex_color[vert_indx+1].color=color; vertex_color[vert_indx+2].x = x+w; vertex_color[vert_indx+2].y = y-h; vertex_color[vert_indx+2].z = z; vertex_color[vert_indx+2].color=color; vertex_color[vert_indx+3].x = x; vertex_color[vert_indx+3].y = y-h; vertex_color[vert_indx+3].z = z; vertex_color[vert_indx+3].color=color; cellGcmSetDrawArrays( gCellGcmCurrentContext, CELL_GCM_PRIMITIVE_QUADS, vert_indx, 4); vert_indx+=4; } void draw_square_angle(float _x, float _y, float w, float h, float z, u32 color, float _angle) { int _radius; (void) w; (void) h; _radius = (int)(((float) 540.f * sqrt(2.f))/2.f); // diagonal/2 -> works for square textures at the moment float x=_x+(float)angle_coord_x(_radius, _angle)/1920.f; float y=_y+(float)angle_coord_y(_radius, _angle)/1080.f; vertex_color[vert_indx].x = x; vertex_color[vert_indx].y = y; vertex_color[vert_indx].z = z; vertex_color[vert_indx].color=color; vertex_color[vert_indx+1].x = x+w; vertex_color[vert_indx+1].y = y; vertex_color[vert_indx+1].z = z; vertex_color[vert_indx+1].color=color; vertex_color[vert_indx+2].x = x+w; vertex_color[vert_indx+2].y = y-h; vertex_color[vert_indx+2].z = z; vertex_color[vert_indx+2].color=color; vertex_color[vert_indx+3].x = x; vertex_color[vert_indx+3].y = y-h; vertex_color[vert_indx+3].z = z; vertex_color[vert_indx+3].color=color; cellGcmSetDrawArrays( gCellGcmCurrentContext, CELL_GCM_PRIMITIVE_QUADS, vert_indx, 4); vert_indx+=4; }
C++
#include "common.h" #include "peek_poke.h" #include "hvcall.h" #include "mm.h" #include <string.h> #include <psl1ght/lv2.h> u64 mmap_lpar_addr; extern unsigned char bdemu[0x1380]; int map_lv1() { int result = lv1_undocumented_function_114(HV_START_OFFSET, HV_PAGE_SIZE, HV_SIZE, &mmap_lpar_addr); if (result != 0) return 0; result = mm_map_lpar_memory_region(mmap_lpar_addr, HV_BASE, HV_SIZE, HV_PAGE_SIZE, 0); if (result) return 0; return 1; } void unmap_lv1() { if (mmap_lpar_addr != 0) lv1_undocumented_function_115(mmap_lpar_addr); } int lv2launch(u64 addr) { system_call_8(9, (u64) addr, 0,0,0,0,0,0,0); return_to_user_prog(int); } void hermes_payload_341(void) { if( Lv2Syscall1(6, 0x8000000000017CE0ULL) == 0x7C6903A64E800420ULL) return; int l, n; for(l = 0; l < 25; l++) { u8 * p = (u8 *) bdemu; for(n = 0; n < 3840; n += 8) { static u64 value; memcpy(&value, &p[n], 8); Lv2Syscall2(7, 0x80000000007e0000ULL + (u64) n, ~value); __asm__("sync"); value = Lv2Syscall1(6, 0x8000000000000000ULL); } // enable syscall9 Lv2Syscall2(7, 0x8000000000017CE0ULL , 0x7C6903A64E800420ULL); __asm__("sync"); } if(Lv2Syscall1(6, 0x8000000000017CE0ULL) == 0x7C6903A64E800420ULL) lv2launch(0x80000000007e0000ULL); __asm__("sync"); } void psgroove_main(int enable) { if( Lv2Syscall1(6, 0x8000000000346690ULL) == 0x80000000002BE570ULL ) return; install_new_poke(); if (!map_lv1()) { remove_new_poke(); return; } Lv2Syscall2(7, HV_BASE + HV_OFFSET + 0, 0x0000000000000001ULL); Lv2Syscall2(7, HV_BASE + HV_OFFSET + 8, 0xe0d251b556c59f05ULL); Lv2Syscall2(7, HV_BASE + HV_OFFSET + 16, 0xc232fcad552c80d7ULL); Lv2Syscall2(7, HV_BASE + HV_OFFSET + 24, 0x65140cd200000000ULL); unmap_lv1(); remove_new_poke(); if(enable==0) { int n=0; u64 val=0x0000000000000000ULL; u8 * p = (u8 *) bdemu; // 34 @ 2D8430 (110) for(n = 0; n < 0x110; n += 8) { memcpy(&val, &p[n+0xd8], 8); Lv2Syscall2(7, 0x80000000002D8430ULL + (u64) n, ~val); } // 27 @ 2BE4A0 (D8) for(n = 0; n < 0xd8; n += 8) { memcpy(&val, &p[n], 8); Lv2Syscall2(7, 0x80000000002BE4A0ULL + (u64) n, ~val); } Lv2Syscall2(7, 0x80000000002D8498ULL, 0x38A000064BD7623DULL ); // 06 symbols search /dev_b Lv2Syscall2(7, 0x80000000002D8504ULL, 0x38A000024BD761D1ULL ); // 0x002D7800 (/app_home) 2 search } Lv2Syscall2(7, 0x8000000000055EA0ULL, 0x63FF003D60000000ULL ); // fix 8001003D error Lv2Syscall2(7, 0x8000000000055F64ULL, 0x3FE080013BE00000ULL ); // fix 8001003E error Lv2Syscall2(7, 0x8000000000055F10ULL, 0x419E00D860000000ULL ); Lv2Syscall2(7, 0x8000000000055F18ULL, 0x2F84000448000098ULL ); Lv2Syscall2(7, 0x800000000007AF64ULL, 0x2F83000060000000ULL ); Lv2Syscall2(7, 0x800000000007AF78ULL, 0x2F83000060000000ULL ); if(enable==0) { Lv2Syscall2(7, 0x8000000000346690ULL, 0x80000000002BE570ULL ); // enable syscall36 Lv2Syscall2(7, 0x80000000002B3274ULL, 0x480251EC2BA30420ULL ); // hook open } } void hermes_payload_355(int enable) { if( Lv2Syscall1(6, 0x8000000000346690ULL) == 0x800000000000F010ULL ) return; install_new_poke(); if (!map_lv1()) { remove_new_poke(); return; } Lv2Syscall2(7, HV_BASE + HV_OFFSET + 0, 0x0000000000000001ULL); Lv2Syscall2(7, HV_BASE + HV_OFFSET + 8, 0xe0d251b556c59f05ULL); Lv2Syscall2(7, HV_BASE + HV_OFFSET + 16, 0xc232fcad552c80d7ULL); Lv2Syscall2(7, HV_BASE + HV_OFFSET + 24, 0x65140cd200000000ULL); unmap_lv1(); remove_new_poke(); if(enable==0) { int n=0; u64 val=0x0000000000000000ULL; u8 * p = (u8 *) bdemu; for(n = 0; n < 0x200; n += 8) { memcpy(&val, &p[n], 8); Lv2Syscall2(7, 0x800000000000EF48ULL + (u64) n, ~val); } for(n = 0; n < 0x200; n += 8) { memcpy(&val, &p[n+0x200], 8); Lv2Syscall2(7, 0x800000000000F1E8ULL + (u64) n, ~val); } } Lv2Syscall2(7, 0x8000000000055EA0ULL, 0x63FF003D60000000ULL ); // fix 8001003D error Lv2Syscall2(7, 0x8000000000055F64ULL, 0x3FE080013BE00000ULL ); // fix 8001003E error Lv2Syscall2(7, 0x8000000000055F10ULL, 0x419E00D860000000ULL ); Lv2Syscall2(7, 0x8000000000055F18ULL, 0x2F84000448000098ULL ); Lv2Syscall2(7, 0x800000000007AF64ULL, 0x2F83000060000000ULL ); Lv2Syscall2(7, 0x800000000007AF78ULL, 0x2F83000060000000ULL ); if(enable==0) { Lv2Syscall2(7, 0x8000000000346690ULL, 0x800000000000F010ULL ); // enable syscall36 Lv2Syscall2(7, 0x80000000003465B0ULL, 0x800000000000F2E0ULL ); // enable syscall8 Lv2Syscall2(7, 0x80000000002b3298ULL, 0x4bd5bda04bd9b411ULL ); // hook open() } }
C++
#include "peek_poke.h" int poke_syscall = 7; u64 lv2_peek(u64 address) { return Lv2Syscall1(6, address); } void lv2_poke(u64 address, u64 value) { Lv2Syscall2(poke_syscall, address, value); } void lv2_poke32(u64 address, u32 value) { u32 next = lv2_peek(address) & 0xffffffff; lv2_poke(address, (u64) value << 32 | next); } u64 lv1_peek(u64 address) { return Lv2Syscall1(6, HV_BASE + address); } void lv1_poke(u64 address, u64 value) { Lv2Syscall2(7, HV_BASE + address, value); } void install_new_poke() { // install poke with icbi instruction lv2_poke(NEW_POKE_SYSCALL_ADDR, 0xF88300007C001FACULL); lv2_poke(NEW_POKE_SYSCALL_ADDR + 8, 0x4C00012C4E800020ULL); poke_syscall = NEW_POKE_SYSCALL; } void remove_new_poke() { poke_syscall = 7; lv2_poke(NEW_POKE_SYSCALL_ADDR, 0xF821FF017C0802A6ULL); lv2_poke(NEW_POKE_SYSCALL_ADDR + 8, 0xFBC100F0FBE100F8ULL); }
C++
/* # Portions of code and idea for localization by: # (c) 2006 Eugene Plotnikov <e-plotnikov@operamail.com> # SMS Media Player for PS2 / PS2DEV Open Source Project # Used: SMS_Locale.h, SMS_Locale.c */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "language.h" static unsigned char s_pDebugMode [] = "Debug Mode"; static unsigned char s_pQuit0 [] = "Quit to XMB\xE2\x84\xA2"; static unsigned char s_pQuit1 [] = "Quit to XMB\xE2\x84\xA2 screen?"; static unsigned char s_pRestart0 [] = "Restart multiMAN?"; static unsigned char s_pWarnFTP [] = "There are active FTP connections!\n\nAre you sure you want to continue and abort FTP transfers?"; static unsigned char s_pWarnSNES [] = "To play SNES games you must install the latest version of SNEX9x for the PS3\xE2\x84\xA2"; static unsigned char s_pWarnGEN [] = "To play Genesis+ GX games you must install the latest version of GENESIS Emulator for the PS3\xE2\x84\xA2"; static unsigned char s_pWarnFCEU [] = "To play NES/FCE Ultra games you must install the latest version of FCEU Emulator for the PS3\xE2\x84\xA2"; static unsigned char s_pWarnVBA [] = "To play GameBoy/Advanced games you must install the latest version of VBA Emulator for the PS3\xE2\x84\xA2"; static unsigned char s_pWarnFBA [] = "To play FBA games you must install the latest version of FB Alpha/Next for the PS3\xE2\x84\xA2"; static unsigned char s_pCopy0 [] = "Copying %d files (%1.3f GB), please wait..."; static unsigned char s_pCopy1 [] = "Copying %d files, please wait..."; static unsigned char s_pCopy2 [] = "Creating links for %d files (%1.3f GB), please wait..."; static unsigned char s_pCopy3 [] = "Installing Game Files to HDD cache, please wait..."; static unsigned char s_pCopy4 [] = "Copying over %d+ files (%1.3f+ GB), please wait..."; static unsigned char s_pCopy5 [] = "Copying, please wait!"; static unsigned char s_pCopy6 [] = "Copying file, please wait..."; static unsigned char s_pCopy7 [] = "Do you want to create a shadow copy of the selected folder?\n\nSource: [%s]\n\nDestination: [/dev_hdd0/G/<special_pkg_id>"; static unsigned char s_pCopy8 [] = "Do you want to create a shadow copy of the selected folder?\n\nSource: [%s]\n\nDestination: [%s/%s]"; static unsigned char s_pCopy9 [] = "Do you want to copy the selected folders?\n\nSource: [%s]\n\nDestination: [%s]"; static unsigned char s_pCopy10 [] = "Do you want to enable BD-ROM GAME DISC mirror on external USB?\n\nSource: [%s]\n\nDestination: [Emulated BD-ROM on USB device]"; static unsigned char s_pCopy11 [] = "Do you want to copy the selected file?\n\nSource: [%s]\n\nDestination: [%s/%s]"; static unsigned char s_pCopy12 [] = "Do you want to copy selected %i files?\n\nSource: [%s]\n\nDestination: [%s]"; static unsigned char s_pNetCopy0 [] = "Copying network folder (%i files in %i folders) from [%s], please wait!"; static unsigned char s_pNetCopy1 [] = "Copying file to network host [%s], please wait!"; static unsigned char s_pNetCopy2 [] = "Copying network file from [%s], please wait!"; static unsigned char s_pNetCopy3 [] = "Copying local folder (%i files in %i folders) to network host [%s], please wait!"; static unsigned char s_pNetCopy4 [] = "Transferred %.2f of %.2f MB. Remaining: %imin %2.2isec"; static unsigned char s_pMove0 [] = "Do you want to move the selected folders?\n\nSource: [%s]\n\nDestination: [%s]"; static unsigned char s_pMove1 [] = "Do you want to move the selected file?\n\nSource: [%s]\n\nDestination: [%s/%s]"; static unsigned char s_pMove2 [] = "Do you want to move selected %i files?\n\nSource: [%s]\n\nDestination: [%s]"; static unsigned char s_pMove3 [] = "Moving, please wait!"; static unsigned char s_pMove4 [] = "Moving file, please wait..."; static unsigned char s_pWarnINET [] = "Internet connection is not available or an error has occured!"; static unsigned char s_pErrSRV0 [] = "Error occured while contacting the server!\n\nPlease try again later."; static unsigned char s_pErrUPD0 [] = "Error occured while downloading the update!\n\nPlease try again later."; static unsigned char s_pErrUPD1 [] = "Error occured while contacting the update server!\n\nPlease try again later."; static unsigned char s_pErrMNT [] = "Error occured while parsing device mount table!"; static unsigned char s_pErrMVGAME [] = "Error occured while moving game to new location!"; static unsigned char s_pErrMVAV [] = "Error (%08X) occured while setting active AVCHD folder.\n\nCannot rename [%s] to [%s]"; static unsigned char s_pDownUpdate [] = "Downloading update data, please wait!"; static unsigned char s_pDownCover [] = "Downloading cover, please wait!"; static unsigned char s_pDownFile [] = "Downloading file, please wait!"; static unsigned char s_pDownTheme [] = "Downloading theme, please wait!"; static unsigned char s_pDownMSG0 [] = "\nDownloaded %.1f of %.3f MB. Remaining: %imin %2.2isec (/\\ to cancel)\nSave path: %s"; static unsigned char s_pDownMSG1 [] = "Downloaded %1.2f of %1.2f KB. Remaining: %imin %2.2isec\n\nPress /\\ to cancel download"; static unsigned char s_pDownMSG2 [] = "Downloaded %1.2f of %1.2f KB. Remaining: %imin %2.2isec"; static unsigned char s_pParamVer [] = "Game requires PS3 firmware version %.2f.\n\nDo you want to change PARAM.SFO version to %.2f?"; static unsigned char s_pLastPlay [] = "Setting data for last played game, please wait..."; static unsigned char s_pSetAccess [] = "Setting access permissions, please wait..."; static unsigned char s_pSetAccess1 [] = "Setting access permissions, please wait!\n\nThis operation will be performed only once."; static unsigned char s_pPreProcess [] = "Pre-processing required for this title.\n\nDo you want to install required data to internal HDD?"; static unsigned char s_pNoSpace0 [] = "Not enough space to complete cache operation! (Available: %.2fMB)\n\nAdditional %.2fMB of free space required!"; static unsigned char s_pNoSpace1 [] = "Not enough space on destination drive! (Available: %.2fMB)\n\nAdditional %.2fMB of free space required!"; static unsigned char s_pErrNoMemWeb [] = "Not enough memory to launch web browser!\n\nPlease restart multiMAN and try again."; static unsigned char s_pErrNoMem [] = "Please restart multiMAN from PS3 XMB\xE2\x84\xA2"; //multiMAN Update static unsigned char s_pPleaseWait [] = "Please wait..."; static unsigned char s_pWhatsNew [] = "What's new in multiMAN %s:\n\n%s"; static unsigned char s_pNewVer [] = "New version found: %s\n\nYour current version: %s\n\nDo you want to download the update?"; static unsigned char s_pNewVerDL [] = "Download completed successfully!\n\nInstall the update from [* Install Package Files] XMB\xE2\x84\xA2 tab.\n\nUpdate file saved as: %s\n\n%s?"; static unsigned char s_pNewVerNN [] = "You already have the latest version: %s\n\n There is no need to update."; static unsigned char s_pNewVerUSB [] = "Please attach USB storage device to save update data and try again!"; //Game Update static unsigned char s_pGameUpdate1 [] = "%s\n\nVersion: %s (%i update)\nUpdate size: %.2fMB\n\nDownload update now?"; static unsigned char s_pGameUpdate2 [] = "%s\n\nVersions: %s - %s (%i updates)\nTotal update size: %.2fMB\n\nDownload updates now?"; static unsigned char s_pGameUpdate3 [] = "%s\n\nYou already have version %.2f installed.\n\nDo you want to download newer updates only?"; static unsigned char s_pGameUpdate5 [] = "Download completed successfully!\n\nUpdate files saved in: %s\n\n%s?"; static unsigned char s_pGameUpdate6 [] = "You already have the latest version of the game."; static unsigned char s_pGameUpdate7 [] = "Cannot find update information for this title!"; //Selection menus captions static unsigned char s_pSelTheme [] = "Select Theme"; static unsigned char s_pSelLang [] = "Select Language"; static unsigned char s_pDelGameC [] = "Delete Game Cache"; //File Manager top static unsigned char s_pFMGames [] = "Games"; static unsigned char s_pFMUpdate [] = "Update"; static unsigned char s_pFMAbout [] = "About"; static unsigned char s_pFMHelp [] = "Help"; static unsigned char s_pFMThemes [] = "Themes"; //File Manager Command menu static unsigned char s_pCMMulDir [] = "Multiple folders"; static unsigned char s_pCMMulFile [] = "Multiple files"; static unsigned char s_pCMCopy [] = "Copy"; static unsigned char s_pCMMove [] = "Move"; static unsigned char s_pCMRename [] = "Rename"; static unsigned char s_pCMDelete [] = "Delete"; static unsigned char s_pCMShortcut [] = "Create Shortcut"; static unsigned char s_pCMShadow [] = "Shadow for PKG game"; static unsigned char s_pCMBDMirror [] = "Activate BD-Mirror"; static unsigned char s_pCMNetHost [] = "Refresh Net Host"; static unsigned char s_pCMHexView [] = "Open in HEX Viewer"; static unsigned char s_pCMProps [] = "Properties"; static unsigned char s_pCMNewDir [] = "Create New Folder"; static unsigned char s_pApplyTheme [] = "Applying \x22%s\x22 theme, please wait..."; // system menu static unsigned char s_pMMUpdate [] = "Update"; static unsigned char s_pMMUpdateL1 [] = "Check for available program updates."; static unsigned char s_pMMUpdateL2 [] = "multiMAN is being updated constantly, so make sure"; static unsigned char s_pMMUpdateL3 [] = "to check for new versions regularly."; static unsigned char s_pMMUpdateL4 [] = "Internet connection required."; static unsigned char s_pMMRefresh [] = "Refresh List"; static unsigned char s_pMMRefreshL1 [] = "Re-scan internal and external hard disk drives."; static unsigned char s_pMMRefreshL2 [] = "Force multiMAN to refresh and re-detect content"; static unsigned char s_pMMRefreshL3 [] = "(games, video, other). Use this option if you"; static unsigned char s_pMMRefreshL4 [] = "transfer content via FTP. Shortcut is SELECT+L3."; static unsigned char s_pMMFileMan [] = "File Manager"; static unsigned char s_pMMFileManL1 [] = "Switch to File Manager mode. Shortcut is SELECT+START."; static unsigned char s_pMMFileManL2 [] = "Use file manager to manage your files and folders, to copy,"; static unsigned char s_pMMFileManL3 [] = "move or rename them, to view images and play music and video."; static unsigned char s_pMMFileManL4 [] = "SHOWTIME may be required to play some content."; static unsigned char s_pMMShowtimeST [] = "Launch Showtime"; static unsigned char s_pMMShowtimeSTL1 [] = "Quit multiMAN and launch Showtime Player."; static unsigned char s_pMMShowtimeSTL2 [] = "Showtime Media Player is a feature rich"; static unsigned char s_pMMShowtimeSTL3 [] = "application, which allows you to play"; static unsigned char s_pMMShowtimeSTL4 [] = "various video, audio and graphic formats."; static unsigned char s_pMMNTFS [] = "PFS / NTFS driver"; static unsigned char s_pMMNTFSL1 [] = "Switch between FAT32 and NTFS drivers."; static unsigned char s_pMMNTFSL2 [] = "To use this option you must connect external USB HDD,"; static unsigned char s_pMMNTFSL3 [] = "formatted with FAT32 or NTFS file system."; static unsigned char s_pMMNTFSL4 [] = "Proper USB.CFG required. Shortcut is START+TRIANGLE."; static unsigned char s_pMMShowtimeLK [] = "Link VIDEO to Showtime"; static unsigned char s_pMMShowtimeLKL1 [] = "Create links of your XMB\xE2\x84\xA2 video files to"; static unsigned char s_pMMShowtimeLKL2 [] = "a special folder for Showtime Media Player"; static unsigned char s_pMMShowtimeLKL3 [] = "to find them. When linking completes, multiMAN"; static unsigned char s_pMMShowtimeLKL4 [] = "will launch Showtime."; static unsigned char s_pMMScrShot [] = "Screenshot"; static unsigned char s_pMMScrShotL1 [] = "Take a screenshot of your game list."; static unsigned char s_pMMScrShotL2 [] = "Current screen will be saved as RGB raw file to /dev_hdd0"; static unsigned char s_pMMScrShotL3 [] = "or in the root folder of connected USB device."; static unsigned char s_pMMScrShotL4 [] = "Shortcut is START+R2."; static unsigned char s_pMMScrSave [] = "Screensaver"; static unsigned char s_pMMScrSaveL1 [] = "Turn on multiMAN's screensaver."; static unsigned char s_pMMScrSaveL2 [] = "A screen with falling 'stars' will appear on"; static unsigned char s_pMMScrSaveL3 [] = "your display. Press a button to quit"; static unsigned char s_pMMScrSaveL4 [] = "the screensaver mode."; static unsigned char s_pMMRestart [] = "Restart"; static unsigned char s_pMMRestartL1 [] = "Restart multiMAN. Shortcut is START+SELECT."; static unsigned char s_pMMRestartL2 [] = "You can remotely restart multiMAN by connecting to your"; static unsigned char s_pMMRestartL3 [] = "Playstation\xC2\xAE\x33 system via telnet to port 8080"; static unsigned char s_pMMRestartL4 [] = "and type 'restart'."; static unsigned char s_pMMSetup [] = "multiMAN Setup"; static unsigned char s_pMMSetupL1 [] = "Switch to XMMB Settings column."; static unsigned char s_pMMSetupL2 [] = "You can edit all multiMAN options in XMMB mode."; static unsigned char s_pMMSetupL3 [] = "If you select this option, the current display"; static unsigned char s_pMMSetupL4 [] = "mode will be changed."; static unsigned char s_pMMQuit [] = "Quit"; static unsigned char s_pMMQuitL1 [] = "Quit multiMAN and return to XMB\xE2\x84\xA2 home screen."; static unsigned char s_pMMQuitL2 [] = "You can remotely quit multiMAN by connecting to your"; static unsigned char s_pMMQuitL3 [] = "Playstation\xC2\xAE\x33 system via telnet to port 8080"; static unsigned char s_pMMQuitL4 [] = "and type 'quit'."; static unsigned char s_pMMHelp [] = "Help"; static unsigned char s_pMMHelpL1 [] = "Start the HELP application."; static unsigned char s_pMMHelpL2 [] = "This option will execute external"; static unsigned char s_pMMHelpL3 [] = "help.MME application and quit multiMAN."; static unsigned char s_pMMHelpL4 [] = "Avoid using it during FTP transfers."; static unsigned char s_pButNavigate [] = "Navigate"; static unsigned char s_pButSelect [] = "Select"; static unsigned char s_pButBack [] = "Back"; static unsigned char s_pButCancel [] = "Cancel"; static unsigned char s_pButApply [] = "Apply"; static unsigned char s_pButConfirm [] = "Confirm"; static unsigned char s_pButGenre [] = "Genre"; static unsigned char s_pButDownload [] = "Download"; static unsigned char s_pButLoad [] = "Load"; static unsigned char s_pButPrev [] = "Prev Title"; static unsigned char s_pButNext [] = "Next Title"; static unsigned char s_pButLast [] = "Last Title"; static unsigned char s_pButFirst [] = "First Title"; static unsigned char s_pSelGenre [] = "Select Genre"; static unsigned char s_pButDownTheme[] = "Download Theme"; // Game settings menu static unsigned char s_pGMCopy [] = "Copy"; static unsigned char s_pGMCopyL1 [] = "Create a backup copy of \x22%s\x22."; static unsigned char s_pGMCopyL2 [] = "To protect your Playstation\xC2\xAE\x33 Blu-ray\xE2\x84\xA2 game disc,"; static unsigned char s_pGMCopyL3 [] = "transfer its contents to internal or external hard disk drive."; static unsigned char s_pGMDelete [] = "Delete"; static unsigned char s_pGMDeleteL1 [] = "Permanently delete game files."; static unsigned char s_pGMDeleteL2 [] = "If you are running low on disk space, delete the game from your"; static unsigned char s_pGMDeleteL3 [] = "hard disk drive. Use this option with caution!"; static unsigned char s_pGMRename [] = "Rename"; static unsigned char s_pGMRenameL1 [] = "Pick a name of your choice for the game."; static unsigned char s_pGMRenameL2 [] = "You can use the on-screen keyboard or external USB keyboard"; static unsigned char s_pGMRenameL3 [] = "for input. Use (TM), (R) and (C) to enter \xE2\x84\xA2, \xC2\xAE and \xC2\xA9 symbols."; static unsigned char s_pGMUpdate [] = "Update"; static unsigned char s_pGMUpdateL1 [] = "Check for game updates."; static unsigned char s_pGMUpdateL2 [] = "This feature allows you to download all available updates"; static unsigned char s_pGMUpdateL3 [] = "or only the latest. Internet connection required."; static unsigned char s_pGMTest [] = "Test"; static unsigned char s_pGMTestL1 [] = "Verify all files and folders of the game."; static unsigned char s_pGMTestL2 [] = "Testing will report various data as Total Size, Number of files,"; static unsigned char s_pGMTestL3 [] = "Big files (over 4GB) and if game contains split (.666##) files."; static unsigned char s_pGMPerm [] = "Permissions"; static unsigned char s_pGMPermL1 [] = "Re-apply file and folder access permissions."; static unsigned char s_pGMPermL2 [] = "On rare occasions it may be required to perform resetting of"; static unsigned char s_pGMPermL3 [] = "ownership and execution flags of game contents."; static unsigned char s_pPOPGS [] = ": Game Settings"; static unsigned char s_pPOPChangeS [] = ": Change Setting"; static unsigned char s_pPOPSysInfo [] = ": View System Information"; static unsigned char s_pPOPLang [] = ": Change Display Language"; static unsigned char s_pPOPCache [] = ": Clear Cached Files"; static unsigned char s_pPOPPhoto [] = ": View Photo"; static unsigned char s_pPOPMusic [] = ": Play Music"; static unsigned char s_pPOPST [] = ": Launch Showtime"; static unsigned char s_pPOPVideo [] = ": Play Video"; static unsigned char s_pPOPRefGames [] = ": Refresh List"; static unsigned char s_pPOPRefRoms [] = ": Refresh ROMs"; static unsigned char s_pPOPRom [] = ": Load Game ROM"; static unsigned char s_pPOPGrpGenre [] = ": Group Titles by Genre"; static unsigned char s_pPOPGrpEmu [] = ": Group ROMs by Emulator"; static unsigned char s_pPOPGrpName [] = ": Group Titles by Name"; static unsigned char s_pPOPSwitch [] = ": Switch Display"; static unsigned char s_pPOP1of1 [] = "%s: %i of %i"; static unsigned char s_pPOPPlaying [] = "Playing"; static unsigned char s_pPOPPaused [] = "Paused"; static unsigned char s_pPOPVol [] = "[Volume: %i]"; // Alpha group "Other" static unsigned char s_pOther [] = "Other"; // Genres static unsigned char s_pGENOther [] = "Other"; static unsigned char s_pGENAct [] = "Action"; static unsigned char s_pGENAdv [] = "Adventure"; static unsigned char s_pGENFam [] = "Family"; static unsigned char s_pGENFight [] = "Fighting"; static unsigned char s_pGENParty [] = "Party"; static unsigned char s_pGENPlat [] = "Platform"; static unsigned char s_pGENPuzz [] = "Puzzle"; static unsigned char s_pGENRole [] = "Role Playing"; static unsigned char s_pGENRace [] = "Racing"; static unsigned char s_pGENShoot [] = "Shooter"; static unsigned char s_pGENSim [] = "Sim"; static unsigned char s_pGENSport [] = "Sports"; static unsigned char s_pGENStrat [] = "Strategy"; static unsigned char s_pGENTriv [] = "Trivia"; static unsigned char s_pGEN3D [] = "3D Support"; // Retro Groups static unsigned char s_pRETRO [] = "Retro"; static unsigned char s_pRETSNES [] = "SNES"; static unsigned char s_pRETFCEU [] = "FCEU"; static unsigned char s_pRETVBA [] = "VBA"; static unsigned char s_pRETGEN [] = "GEN+"; static unsigned char s_pRETFBA [] = "FBANext"; // XMMB Column names ("Empty", "multiMAN", ... Retro, ...) static unsigned char s_pXCS [] = "Settings"; // 2 static unsigned char s_pXCP [] = "Photo"; // 3 static unsigned char s_pXCM [] = "Music"; // 4 static unsigned char s_pXCV [] = "Video"; // 5 static unsigned char s_pXCG [] = "Game"; // 6 static unsigned char s_pXCF [] = "Favorites"; // 7 static unsigned char s_pXCW [] = "Web"; // 9 static unsigned char s_pPS2 [] = "multiMAN will now exit to XMB\xE2\x84\xA2 and you can start the game from the [PLAYSTATION\xC2\xAE\x32 Format Game] icon."; static unsigned char s_pPKG [] = "Do you want to exit to XMB\xE2\x84\xA2 to install selected package from [* Install package files] menu?"; static unsigned char s_pNoSplit1 [] = "You cannot launch games with split big files!\n\nTransfer the game to internal HDD and try again\nor use XMMB mode to launch the title."; static unsigned char s_pNoSplit2 [] = "You cannot launch games with split big files!\n\nTransfer the game to internal HDD and try again\nor use [Hermes] option for BD-Emulator type in SETTINGS XMMB column\nand restart your PS3\xE2\x84\xA2 system."; static unsigned char s_pNoSplit3 [] = "You cannot launch games with split big files!\n\nTransfer the game to internal HDD and try again\nor enable [Verify USB Games] option in SETTINGS XMMB column\nand restart your PS3\xE2\x84\xA2 system."; static unsigned char s_pVerifying [] = "Verifying game data, please wait..."; static unsigned char s_pCanceled [] = "Operation failed or canceled."; static unsigned char s_pNotSupported[] = "Your current configuration doesn't support this function!"; static unsigned char s_pNotSupported2[] = "Your current configuration doesn't support this function!\n\n (unable to create file cache)"; static unsigned char s_pPS3DISC [] = "Please insert an original PLAYSTATION\xC2\xAE\x33 game disc before proceeding!"; static unsigned char s_pThmInstall [] = "Do you want to exit to XMB\xE2\x84\xA2 to install \x22%s\x22 theme from [* Install package files] menu?"; static unsigned char s_pToDBoot [] = "Do you want to start the game without exiting to XMB?\n\nWarning: Some games do not support such launch mode!"; static unsigned char s_pDLST [] = "Showtime for multiMAN application is missing!\n\nDo you want to download it now?"; static unsigned char s_pStartBD1 [] = "multiMAN will now exit to XMB\xE2\x84\xA2 and you can start the game from the /app_home icon."; static unsigned char s_pStartBD2 [] = "multiMAN will now exit to XMB\xE2\x84\xA2 and you can start the game from the Blu-ray\xE2\x84\xA2 Game Disc icon."; static unsigned char s_pOverwrite [] = "Destination already contains folder with the same name!\n\nContinue and overwrite?\n\n[%s]"; static unsigned char s_pIncomplete [] = "WARNING:\n\nYour installation of multiMAN is incomplete!\nPlease install BASE or FULL version or you may experience graphics display problems!"; static unsigned char s_pErrBDEMU1 [] = "multiMAN cannot enable selected BD-ROM emulator type. Functionality may be restricted!\n\nError: BDEMU.BIN incorrect version"; static unsigned char s_pErrBDEMU2 [] = "multiMAN cannot enable BD-ROM emulator. Functionality may be restricted!\n\nError: BDEMU.BIN missing"; static unsigned char s_pErrBDEMU3 [] = "multiMAN cannot enable BD-ROM emulator. Functionality may be restricted!\n\nError: Unsupported system firmware or BDEMU.BIN incorrect version"; static unsigned char s_pCritical [] = "CRITICAL ERROR:\n\nmultiMAN cannot access or create default backup folder!\nGame backup functions may not work properly.\n\nPlease use different payload if necessary!"; static unsigned char s_pDelFile [] = "Do you want to delete the selected file?\n\n[%s]"; static unsigned char s_pDelFiles [] = "Do you want to delete the selected %i files?"; static unsigned char s_pDelDir [] = "Do you want to delete the selected folder and its contents?\n\n[%s]"; static unsigned char s_pDelDirs [] = "Do you want to delete the selected %i folders and their contents?"; static unsigned char s_pDelFromHDD [] = "Do you want to delete title from internal HDD?"; static unsigned char s_pDelFromUSB [] = "Do you want to delete title from external USB00%c?"; static unsigned char s_pDelFromCache[] = "There is cached data for this title. Do you want to clear it?"; static unsigned char s_pCpHdd2Usb [] = "Do you want to copy game from internal HDD to external USB00%c?"; static unsigned char s_pCpUsb2Hdd [] = "Do you want to copy game from external USB00%c to internal HDD?\n\nSource: /dev_usb00%i/%s/%s\nDestination: %s/%s"; static unsigned char s_pCpPfs2Hdd [] = "Do you want to copy game from external USB disk to internal HDD?\n\nSource: %s\nDestination: %s/%s"; static unsigned char s_pCpUsb2Usb [] = "Do you want to copy game from external USB00%c to external USB00%c?\n\nSource: /dev_usb00%i/%s/%s\nDestination: /dev_usb00%i/%s/%s"; static unsigned char s_pOverwriteNo [] = "Destination already contains folder with the same name!\n\nPlease use FILE MANAGER [SELECT+START] to rename or remove:\n\n[%s]"; static unsigned char s_pDelPartHDD [] = "%s\n\nDelete partial copy from internal HDD?"; static unsigned char s_pDelPartUSB [] = "%s\n\nDelete partial copy from USB00%c?"; static unsigned char s_pDelCacheDone[] = "Game Cache Data cleared!"; static unsigned char s_pCpBD2Hdd [] = "Do you want to copy game from BD-ROM to internal HDD?"; static unsigned char s_pCpBD2Usb [] = "Do you want to copy game from BD-ROM to external USB00%c?"; static unsigned char s_pPinGame [] = "Game parental level: %i - Enter access PIN code:"; static unsigned char s_pPinErr [] = "Entered PIN code is incorrect!"; static unsigned char s_pPinEnter [] = "Enter access PIN code:"; static unsigned char s_pPinNew [] = "Enter NEW access PIN code:"; static unsigned char s_pPinErr2 [] = "Entered PIN code is not accepted!\n\nPlease use four character alphanumeric PIN!"; static unsigned char s_pBd2AVCHD [] = "::: %s :::\n\nDo you want to convert the Blu-ray\xE2\x84\xA2 disc structure to AVCHD\xE2\x84\xA2 format?\n\nNote: The action may improve playback compatibility!"; static unsigned char s_pBd2AVCHD2 [] = "Converting Blu-ray\xE2\x84\xA2 structure to AVCHD\xE2\x84\xA2, please wait..."; static unsigned char s_pActAVCHD [] = "Activate currently selected AVCHD\xE2\x84\xA2 video folder?\n\n::: %s :::\n\nNote: You can start video playback from XMB\xE2\x84\xA2 [Video] tab"; static unsigned char s_pActAVCHD2 [] = "Activating AVCHD\xE2\x84\xA2 structure, please wait..."; static unsigned char s_pBd2AVCHD3 [] = "::: %s :::\n\n%s: %s\n\nDo you want to convert the Blu-ray\xE2\x84\xA2 disc structure to AVCHD\xE2\x84\xA2 format?\n\nNote: The action may improve playback compatibility!"; static unsigned char s_pActBDMV [] = "Activate currently selected Blu-ray\xE2\x84\xA2 (BDMV) video folder?\n\n::: %s :::\n\n[%s: %s]\n\nNote: You can start video playback from XMB\xE2\x84\xA2 [Video] tab"; static unsigned char s_pAttUSB [] = "Please attach USB, SDHC or MemoryStick\xE2\x84\xA2 storage device to activate AVCHD\xE2\x84\xA2 HDD playback!"; static unsigned char s_pAttPFS [] = "Please attach USB storage device before you proceed!\n\nIs the disk connected to your PLAYSTATION\xC2\xAE\x33 system?"; static unsigned char s_pCacheFile [] = "Caching file to internal temporary folder..."; static unsigned char s_pHddErr [] = "This title cannot be loaded from internal HDD.\n\nTransfer to external USB HDD or change title options."; static unsigned char s_pUsbErr [] = "This title cannot be loaded from external USB HDD.\n\nTransfer to internal HDD or change title options."; static unsigned char s_pTitleLocked [] = "Options cannot be changed or title is locked!"; static unsigned char s_pTitleRO [] = "Options cannot be changed for this title!"; static unsigned char s_pRenameTo [] = "Rename [%s] to:"; static unsigned char s_pCreateNew [] = "CREATE NEW FOLDER - Enter name for the new folder:"; static unsigned char s_pXCUP [] = "Update"; static unsigned char s_pXCUP1 [] = "Check for multiMAN updates"; static unsigned char s_pXCFM [] = "File Manager"; static unsigned char s_pXCFM0 [] = "File Manager (Disabled)"; static unsigned char s_pXCFM1 [] = "Manage files and folders"; static unsigned char s_pXCRF [] = "Refresh"; static unsigned char s_pXCRF1 [] = "Scan all connected devices for supported content"; static unsigned char s_pXCRF2 [] = "Scan all connected devices and refresh game list"; static unsigned char s_pXCRF3 [] = "Scan all emulator folders for newly added game ROMs"; static unsigned char s_pXCPF [] = "PFS Driver"; static unsigned char s_pXCPF1 [] = "Toggle between FAT32 and NTFS driver"; static unsigned char s_pXCSS [] = "Screensaver"; static unsigned char s_pXCSS1 [] = "Turn on screensaver mode"; static unsigned char s_pXCTH [] = "Themes"; static unsigned char s_pXCTH1 [] = "Change multiMAN appearance"; static unsigned char s_pXCHL [] = "Help"; static unsigned char s_pXCHL1 [] = "Start helpMMe application"; static unsigned char s_pXCRS [] = "Restart"; static unsigned char s_pXCRS1 [] = "Close and restart multiMAN"; static unsigned char s_pXCQT [] = "Quit"; static unsigned char s_pXCQT1 [] = "Quit multiMAN and return to XMB\xE2\x84\xA2 screen"; static unsigned char s_pXC5LK [] = "Link Video Library to Showtime"; static unsigned char s_pXC5LK1 [] = "Make XMB\xE2\x84\xA2 video files available to Showtime"; static unsigned char s_pXC5ST [] = "Start Showtime Media Center"; static unsigned char s_pXC5ST1 [] = "Launch Showtime to play movies and listen to music"; static unsigned char s_pXC2SS [] = "System Information"; static unsigned char s_pXC2SS1 [] = "Displays information about your PS3\xE2\x84\xA2 system."; static unsigned char s_pXC2IL [] = "Interface Language"; static unsigned char s_pXC2IL1 [] = "Changes multiMAN interface language."; static unsigned char s_pXC2GC [] = "Clear Game Cache Data"; static unsigned char s_pXC2GC1 [] = "Removes cache files for selected title."; /* static unsigned char s_p [] = static unsigned char s_p [] = static unsigned char s_p [] = static unsigned char s_p [] = static unsigned char s_p [] = static unsigned char s_p [] = */ static MMString s_MMStringDef[] = { { sizeof ( s_pDebugMode ) - 1, s_pDebugMode }, //0 { sizeof ( s_pQuit0 ) - 1, s_pQuit0 }, //1 { sizeof ( s_pQuit1 ) - 1, s_pQuit1 }, { sizeof ( s_pRestart0 ) - 1, s_pRestart0 }, { sizeof ( s_pWarnFTP ) - 1, s_pWarnFTP }, { sizeof ( s_pWarnSNES ) - 1, s_pWarnSNES }, { sizeof ( s_pWarnGEN ) - 1, s_pWarnGEN }, { sizeof ( s_pWarnFCEU ) - 1, s_pWarnFCEU }, { sizeof ( s_pWarnVBA ) - 1, s_pWarnVBA }, { sizeof ( s_pWarnFBA ) - 1, s_pWarnFBA }, //9 { sizeof ( s_pCopy0 ) - 1, s_pCopy0 }, //10 { sizeof ( s_pCopy1 ) - 1, s_pCopy1 }, { sizeof ( s_pCopy2 ) - 1, s_pCopy2 }, { sizeof ( s_pCopy3 ) - 1, s_pCopy3 }, { sizeof ( s_pCopy4 ) - 1, s_pCopy4 }, { sizeof ( s_pCopy5 ) - 1, s_pCopy5 }, { sizeof ( s_pCopy6 ) - 1, s_pCopy6 }, { sizeof ( s_pCopy7 ) - 1, s_pCopy7 }, { sizeof ( s_pCopy8 ) - 1, s_pCopy8 }, { sizeof ( s_pCopy9 ) - 1, s_pCopy9 }, { sizeof ( s_pCopy10 ) - 1, s_pCopy10 }, { sizeof ( s_pCopy11 ) - 1, s_pCopy11 }, { sizeof ( s_pCopy12 ) - 1, s_pCopy12 }, //22 { sizeof ( s_pNetCopy0 ) - 1, s_pNetCopy0 }, //23 { sizeof ( s_pNetCopy1 ) - 1, s_pNetCopy1 }, { sizeof ( s_pNetCopy2 ) - 1, s_pNetCopy2 }, { sizeof ( s_pNetCopy3 ) - 1, s_pNetCopy3 }, { sizeof ( s_pNetCopy4 ) - 1, s_pNetCopy4 }, //27 { sizeof ( s_pMove0 ) - 1, s_pMove0 }, //28 { sizeof ( s_pMove1 ) - 1, s_pMove1 }, { sizeof ( s_pMove2 ) - 1, s_pMove2 }, { sizeof ( s_pMove3 ) - 1, s_pMove3 }, { sizeof ( s_pMove4 ) - 1, s_pMove4 }, //32 { sizeof ( s_pWarnINET ) - 1, s_pWarnINET }, //33 { sizeof ( s_pErrSRV0 ) - 1, s_pErrSRV0 }, { sizeof ( s_pErrUPD0 ) - 1, s_pErrUPD0 }, { sizeof ( s_pErrUPD1 ) - 1, s_pErrUPD1 }, //36 { sizeof ( s_pErrMNT ) - 1, s_pErrMNT }, //37 { sizeof ( s_pErrMVGAME ) - 1, s_pErrMVGAME }, { sizeof ( s_pErrMVAV ) - 1, s_pErrMVAV }, { sizeof ( s_pDownUpdate ) - 1, s_pDownUpdate }, //40 { sizeof ( s_pDownCover ) - 1, s_pDownCover }, { sizeof ( s_pDownFile ) - 1, s_pDownFile }, { sizeof ( s_pDownTheme ) - 1, s_pDownTheme }, { sizeof ( s_pDownMSG0 ) - 1, s_pDownMSG0 }, //44 { sizeof ( s_pDownMSG1 ) - 1, s_pDownMSG1 }, { sizeof ( s_pDownMSG2 ) - 1, s_pDownMSG2 }, { sizeof ( s_pParamVer ) - 1, s_pParamVer }, //47 { sizeof ( s_pLastPlay ) - 1, s_pLastPlay }, { sizeof ( s_pSetAccess ) - 1, s_pSetAccess }, { sizeof ( s_pSetAccess1 ) - 1, s_pSetAccess1 }, { sizeof ( s_pPreProcess ) - 1, s_pPreProcess }, //51 { sizeof ( s_pNoSpace0 ) - 1, s_pNoSpace0 }, //52 { sizeof ( s_pNoSpace0 ) - 1, s_pNoSpace1 }, { sizeof ( s_pErrNoMemWeb ) - 1, s_pErrNoMemWeb }, //54 { sizeof ( s_pErrNoMem ) - 1, s_pErrNoMem }, { sizeof ( s_pPleaseWait ) - 1, s_pPleaseWait }, { sizeof ( s_pWhatsNew ) - 1, s_pWhatsNew }, { sizeof ( s_pNewVer ) - 1, s_pNewVer }, { sizeof ( s_pNewVerDL ) - 1, s_pNewVerDL }, { sizeof ( s_pNewVerNN ) - 1, s_pNewVerNN }, //60 { sizeof ( s_pNewVerUSB ) - 1, s_pNewVerUSB }, { sizeof ( s_pGameUpdate1 ) - 1, s_pGameUpdate1 }, //62 { sizeof ( s_pGameUpdate2 ) - 1, s_pGameUpdate2 }, { sizeof ( s_pGameUpdate3 ) - 1, s_pGameUpdate3 }, { sizeof ( s_pGameUpdate5 ) - 1, s_pGameUpdate5 }, { sizeof ( s_pGameUpdate6 ) - 1, s_pGameUpdate6 }, { sizeof ( s_pGameUpdate7 ) - 1, s_pGameUpdate7 }, //67 { sizeof ( s_pSelTheme ) - 1, s_pSelTheme }, { sizeof ( s_pSelLang ) - 1, s_pSelLang }, { sizeof ( s_pDelGameC ) - 1, s_pDelGameC }, //70 { sizeof ( s_pFMGames ) - 1, s_pFMGames }, { sizeof ( s_pFMUpdate ) - 1, s_pFMUpdate }, { sizeof ( s_pFMAbout ) - 1, s_pFMAbout }, { sizeof ( s_pFMHelp ) - 1, s_pFMHelp }, { sizeof ( s_pFMThemes ) - 1, s_pFMThemes }, //75 { sizeof ( s_pCMMulDir ) - 1, s_pCMMulDir }, //76 { sizeof ( s_pCMMulFile ) - 1, s_pCMMulFile }, { sizeof ( s_pCMCopy ) - 1, s_pCMCopy }, //78 { sizeof ( s_pCMMove ) - 1, s_pCMMove }, { sizeof ( s_pCMRename ) - 1, s_pCMRename }, { sizeof ( s_pCMDelete ) - 1, s_pCMDelete }, { sizeof ( s_pCMShortcut ) - 1, s_pCMShortcut }, { sizeof ( s_pCMShadow ) - 1, s_pCMShadow }, { sizeof ( s_pCMBDMirror ) - 1, s_pCMBDMirror }, { sizeof ( s_pCMNetHost ) - 1, s_pCMNetHost }, { sizeof ( s_pCMHexView ) - 1, s_pCMHexView }, { sizeof ( s_pCMProps ) - 1, s_pCMProps }, { sizeof ( s_pCMNewDir ) - 1, s_pCMNewDir }, //88 { sizeof ( s_pApplyTheme ) - 1, s_pApplyTheme }, //89 { sizeof ( s_pMMUpdate ) - 1, s_pMMUpdate }, //90 { sizeof ( s_pMMUpdateL1 ) - 1, s_pMMUpdateL1 }, { sizeof ( s_pMMUpdateL2 ) - 1, s_pMMUpdateL2 }, { sizeof ( s_pMMUpdateL3 ) - 1, s_pMMUpdateL3 }, { sizeof ( s_pMMUpdateL4 ) - 1, s_pMMUpdateL4 }, { sizeof ( s_pMMRefresh ) - 1, s_pMMRefresh }, //95 { sizeof ( s_pMMRefreshL1 ) - 1, s_pMMRefreshL1 }, { sizeof ( s_pMMRefreshL2 ) - 1, s_pMMRefreshL2 }, { sizeof ( s_pMMRefreshL3 ) - 1, s_pMMRefreshL3 }, { sizeof ( s_pMMRefreshL4 ) - 1, s_pMMRefreshL4 }, { sizeof ( s_pMMFileMan ) - 1, s_pMMFileMan }, //100 { sizeof ( s_pMMFileManL1 ) - 1, s_pMMFileManL1 }, { sizeof ( s_pMMFileManL2 ) - 1, s_pMMFileManL2 }, { sizeof ( s_pMMFileManL3 ) - 1, s_pMMFileManL3 }, { sizeof ( s_pMMFileManL4 ) - 1, s_pMMFileManL4 }, { sizeof ( s_pMMShowtimeST ) - 1, s_pMMShowtimeST }, //105 { sizeof ( s_pMMShowtimeSTL1 ) - 1, s_pMMShowtimeSTL1 }, { sizeof ( s_pMMShowtimeSTL2 ) - 1, s_pMMShowtimeSTL2 }, { sizeof ( s_pMMShowtimeSTL3 ) - 1, s_pMMShowtimeSTL3 }, { sizeof ( s_pMMShowtimeSTL4 ) - 1, s_pMMShowtimeSTL4 }, { sizeof ( s_pMMNTFS ) - 1, s_pMMNTFS }, //110 { sizeof ( s_pMMNTFSL1 ) - 1, s_pMMNTFSL1 }, { sizeof ( s_pMMNTFSL2 ) - 1, s_pMMNTFSL2 }, { sizeof ( s_pMMNTFSL3 ) - 1, s_pMMNTFSL3 }, { sizeof ( s_pMMNTFSL4 ) - 1, s_pMMNTFSL4 }, { sizeof ( s_pMMShowtimeLK ) - 1, s_pMMShowtimeLK }, //115 { sizeof ( s_pMMShowtimeLKL1 ) - 1, s_pMMShowtimeLKL1 }, { sizeof ( s_pMMShowtimeLKL2 ) - 1, s_pMMShowtimeLKL2 }, { sizeof ( s_pMMShowtimeLKL3 ) - 1, s_pMMShowtimeLKL3 }, { sizeof ( s_pMMShowtimeLKL4 ) - 1, s_pMMShowtimeLKL4 }, { sizeof ( s_pMMScrShot ) - 1, s_pMMScrShot }, //120 { sizeof ( s_pMMScrShotL1 ) - 1, s_pMMScrShotL1 }, { sizeof ( s_pMMScrShotL2 ) - 1, s_pMMScrShotL2 }, { sizeof ( s_pMMScrShotL3 ) - 1, s_pMMScrShotL3 }, { sizeof ( s_pMMScrShotL4 ) - 1, s_pMMScrShotL4 }, { sizeof ( s_pMMScrSave ) - 1, s_pMMScrSave }, //125 { sizeof ( s_pMMScrSaveL1 ) - 1, s_pMMScrSaveL1 }, { sizeof ( s_pMMScrSaveL2 ) - 1, s_pMMScrSaveL2 }, { sizeof ( s_pMMScrSaveL3 ) - 1, s_pMMScrSaveL3 }, { sizeof ( s_pMMScrSaveL4 ) - 1, s_pMMScrSaveL4 }, { sizeof ( s_pMMRestart ) - 1, s_pMMRestart }, //130 { sizeof ( s_pMMRestartL1 ) - 1, s_pMMRestartL1 }, { sizeof ( s_pMMRestartL2 ) - 1, s_pMMRestartL2 }, { sizeof ( s_pMMRestartL3 ) - 1, s_pMMRestartL3 }, { sizeof ( s_pMMRestartL4 ) - 1, s_pMMRestartL4 }, { sizeof ( s_pMMSetup ) - 1, s_pMMSetup }, //135 { sizeof ( s_pMMSetupL1 ) - 1, s_pMMSetupL1 }, { sizeof ( s_pMMSetupL2 ) - 1, s_pMMSetupL2 }, { sizeof ( s_pMMSetupL3 ) - 1, s_pMMSetupL3 }, { sizeof ( s_pMMSetupL4 ) - 1, s_pMMSetupL4 }, { sizeof ( s_pMMQuit ) - 1, s_pMMQuit }, //140 { sizeof ( s_pMMQuitL1 ) - 1, s_pMMQuitL1 }, { sizeof ( s_pMMQuitL2 ) - 1, s_pMMQuitL2 }, { sizeof ( s_pMMQuitL3 ) - 1, s_pMMQuitL3 }, { sizeof ( s_pMMQuitL4 ) - 1, s_pMMQuitL4 }, { sizeof ( s_pMMHelp ) - 1, s_pMMHelp }, //145 { sizeof ( s_pMMHelpL1 ) - 1, s_pMMHelpL1 }, { sizeof ( s_pMMHelpL2 ) - 1, s_pMMHelpL2 }, { sizeof ( s_pMMHelpL3 ) - 1, s_pMMHelpL3 }, { sizeof ( s_pMMHelpL4 ) - 1, s_pMMHelpL4 }, { sizeof ( s_pButNavigate ) - 1, s_pButNavigate }, //150 { sizeof ( s_pButSelect ) - 1, s_pButSelect }, { sizeof ( s_pButBack ) - 1, s_pButBack }, { sizeof ( s_pButCancel ) - 1, s_pButCancel }, { sizeof ( s_pButApply ) - 1, s_pButApply }, { sizeof ( s_pButConfirm ) - 1, s_pButConfirm }, { sizeof ( s_pButGenre ) - 1, s_pButGenre }, { sizeof ( s_pButDownload ) - 1, s_pButDownload }, { sizeof ( s_pButLoad ) - 1, s_pButLoad }, { sizeof ( s_pButPrev ) - 1, s_pButPrev }, { sizeof ( s_pButNext ) - 1, s_pButNext }, //160 { sizeof ( s_pButLast ) - 1, s_pButLast }, { sizeof ( s_pButFirst ) - 1, s_pButFirst }, { sizeof ( s_pSelGenre ) - 1, s_pSelGenre }, //163 { sizeof ( s_pButDownTheme ) - 1, s_pButDownTheme }, { sizeof ( s_pGMCopy ) - 1, s_pGMCopy }, //165 { sizeof ( s_pGMCopyL1 ) - 1, s_pGMCopyL1 }, { sizeof ( s_pGMCopyL2 ) - 1, s_pGMCopyL2 }, { sizeof ( s_pGMCopyL3 ) - 1, s_pGMCopyL3 }, { sizeof ( s_pGMDelete ) - 1, s_pGMDelete }, //169 { sizeof ( s_pGMDeleteL1 ) - 1, s_pGMDeleteL1 }, { sizeof ( s_pGMDeleteL2 ) - 1, s_pGMDeleteL2 }, { sizeof ( s_pGMDeleteL3 ) - 1, s_pGMDeleteL3 }, { sizeof ( s_pGMRename ) - 1, s_pGMRename }, //173 { sizeof ( s_pGMRenameL1 ) - 1, s_pGMRenameL1 }, { sizeof ( s_pGMRenameL2 ) - 1, s_pGMRenameL2 }, { sizeof ( s_pGMRenameL3 ) - 1, s_pGMRenameL3 }, { sizeof ( s_pGMUpdate ) - 1, s_pGMUpdate }, //177 { sizeof ( s_pGMUpdateL1 ) - 1, s_pGMUpdateL1 }, { sizeof ( s_pGMUpdateL2 ) - 1, s_pGMUpdateL2 }, { sizeof ( s_pGMUpdateL3 ) - 1, s_pGMUpdateL3 }, { sizeof ( s_pGMTest ) - 1, s_pGMTest }, //181 { sizeof ( s_pGMTestL1 ) - 1, s_pGMTestL1 }, { sizeof ( s_pGMTestL2 ) - 1, s_pGMTestL2 }, { sizeof ( s_pGMTestL3 ) - 1, s_pGMTestL3 }, { sizeof ( s_pGMPerm ) - 1, s_pGMPerm }, //185 { sizeof ( s_pGMPermL1 ) - 1, s_pGMPermL1 }, { sizeof ( s_pGMPermL2 ) - 1, s_pGMPermL2 }, { sizeof ( s_pGMPermL3 ) - 1, s_pGMPermL3 }, //188 { sizeof ( s_pPOPGS ) - 1, s_pPOPGS }, //189 { sizeof ( s_pPOPChangeS ) - 1, s_pPOPChangeS }, { sizeof ( s_pPOPSysInfo ) - 1, s_pPOPSysInfo }, { sizeof ( s_pPOPLang ) - 1, s_pPOPLang }, { sizeof ( s_pPOPCache ) - 1, s_pPOPCache }, { sizeof ( s_pPOPPhoto ) - 1, s_pPOPPhoto }, { sizeof ( s_pPOPMusic ) - 1, s_pPOPMusic }, { sizeof ( s_pPOPST ) - 1, s_pPOPST }, { sizeof ( s_pPOPVideo ) - 1, s_pPOPVideo }, { sizeof ( s_pPOPRefGames ) - 1, s_pPOPRefGames }, { sizeof ( s_pPOPRefRoms ) - 1, s_pPOPRefRoms }, { sizeof ( s_pPOPRom ) - 1, s_pPOPRom }, //200 { sizeof ( s_pPOPGrpGenre ) - 1, s_pPOPGrpGenre }, //201 { sizeof ( s_pPOPGrpEmu ) - 1, s_pPOPGrpEmu }, { sizeof ( s_pPOPGrpName ) - 1, s_pPOPGrpName }, { sizeof ( s_pPOPSwitch ) - 1, s_pPOPSwitch }, { sizeof ( s_pPOP1of1 ) - 1, s_pPOP1of1 }, //205 { sizeof ( s_pPOPPlaying ) - 1, s_pPOPPlaying }, { sizeof ( s_pPOPPaused ) - 1, s_pPOPPaused }, { sizeof ( s_pPOPVol ) - 1, s_pPOPVol }, //208 { sizeof ( s_pOther ) - 1, s_pOther }, //209 { sizeof ( s_pGENOther ) - 1, s_pGENOther }, //210 { sizeof ( s_pGENAct ) - 1, s_pGENAct }, { sizeof ( s_pGENAdv ) - 1, s_pGENAdv }, { sizeof ( s_pGENFam ) - 1, s_pGENFam }, { sizeof ( s_pGENFight ) - 1, s_pGENFight }, { sizeof ( s_pGENParty ) - 1, s_pGENParty }, { sizeof ( s_pGENPlat ) - 1, s_pGENPlat }, { sizeof ( s_pGENPuzz ) - 1, s_pGENPuzz }, { sizeof ( s_pGENRole ) - 1, s_pGENRole }, { sizeof ( s_pGENRace ) - 1, s_pGENRace }, { sizeof ( s_pGENShoot ) - 1, s_pGENShoot }, //220 { sizeof ( s_pGENSim ) - 1, s_pGENSim }, { sizeof ( s_pGENSport ) - 1, s_pGENSport }, { sizeof ( s_pGENStrat ) - 1, s_pGENStrat }, { sizeof ( s_pGENTriv ) - 1, s_pGENTriv }, { sizeof ( s_pGEN3D ) - 1, s_pGEN3D }, //225 { sizeof ( s_pRETRO ) - 1, s_pRETRO }, //226 { sizeof ( s_pRETSNES ) - 1, s_pRETSNES }, { sizeof ( s_pRETFCEU ) - 1, s_pRETFCEU }, { sizeof ( s_pRETVBA ) - 1, s_pRETVBA }, { sizeof ( s_pRETGEN ) - 1, s_pRETGEN }, { sizeof ( s_pRETFBA ) - 1, s_pRETFBA }, //231 { sizeof ( s_pXCS ) - 1, s_pXCS }, //232 { sizeof ( s_pXCP ) - 1, s_pXCP }, { sizeof ( s_pXCM ) - 1, s_pXCM }, { sizeof ( s_pXCV ) - 1, s_pXCV }, { sizeof ( s_pXCG ) - 1, s_pXCG }, { sizeof ( s_pXCF ) - 1, s_pXCF }, { sizeof ( s_pXCW ) - 1, s_pXCW }, //238 { sizeof ( s_pPS2 ) - 1, s_pPS2 }, //239 { sizeof ( s_pPKG ) - 1, s_pPKG }, { sizeof ( s_pNoSplit1 ) - 1, s_pNoSplit1 }, { sizeof ( s_pNoSplit2 ) - 1, s_pNoSplit2 }, { sizeof ( s_pNoSplit3 ) - 1, s_pNoSplit3 }, { sizeof ( s_pVerifying ) - 1, s_pVerifying }, //244 { sizeof ( s_pCanceled ) - 1, s_pCanceled }, { sizeof ( s_pNotSupported ) - 1, s_pNotSupported }, { sizeof ( s_pNotSupported2) - 1, s_pNotSupported2 }, { sizeof ( s_pPS3DISC ) - 1, s_pPS3DISC }, { sizeof ( s_pThmInstall ) - 1, s_pThmInstall }, { sizeof ( s_pToDBoot ) - 1, s_pToDBoot }, { sizeof ( s_pDLST ) - 1, s_pDLST }, //251 { sizeof ( s_pStartBD1 ) - 1, s_pStartBD1 }, { sizeof ( s_pStartBD2 ) - 1, s_pStartBD2 }, { sizeof ( s_pOverwrite ) - 1, s_pOverwrite }, { sizeof ( s_pIncomplete ) - 1, s_pIncomplete }, //255 { sizeof ( s_pErrBDEMU1 ) - 1, s_pErrBDEMU1 }, { sizeof ( s_pErrBDEMU2 ) - 1, s_pErrBDEMU2 }, { sizeof ( s_pErrBDEMU3 ) - 1, s_pErrBDEMU3 }, { sizeof ( s_pCritical ) - 1, s_pCritical }, //259 { sizeof ( s_pDelFile ) - 1, s_pDelFile }, //260 { sizeof ( s_pDelFiles ) - 1, s_pDelFiles }, { sizeof ( s_pDelDir ) - 1, s_pDelDir }, { sizeof ( s_pDelDirs ) - 1, s_pDelDirs }, { sizeof ( s_pDelFromHDD ) - 1, s_pDelFromHDD }, { sizeof ( s_pDelFromUSB ) - 1, s_pDelFromUSB }, { sizeof ( s_pDelFromCache ) - 1, s_pDelFromCache }, { sizeof ( s_pCpHdd2Usb ) - 1, s_pCpHdd2Usb }, //267 { sizeof ( s_pCpUsb2Hdd ) - 1, s_pCpUsb2Hdd }, { sizeof ( s_pCpPfs2Hdd ) - 1, s_pCpPfs2Hdd }, { sizeof ( s_pCpUsb2Usb ) - 1, s_pCpUsb2Usb }, { sizeof ( s_pOverwriteNo ) - 1, s_pOverwriteNo }, //271 { sizeof ( s_pDelPartHDD ) - 1, s_pDelPartHDD }, { sizeof ( s_pDelPartUSB ) - 1, s_pDelPartUSB }, { sizeof ( s_pDelCacheDone ) - 1, s_pDelCacheDone }, { sizeof ( s_pCpBD2Hdd ) - 1, s_pCpBD2Hdd }, //275 { sizeof ( s_pCpBD2Usb ) - 1, s_pCpBD2Usb }, { sizeof ( s_pPinGame ) - 1, s_pPinGame }, //277 { sizeof ( s_pPinErr ) - 1, s_pPinErr }, { sizeof ( s_pPinEnter ) - 1, s_pPinEnter }, { sizeof ( s_pPinNew ) - 1, s_pPinNew }, { sizeof ( s_pPinErr2 ) - 1, s_pPinErr2 }, //281 { sizeof ( s_pBd2AVCHD ) - 1, s_pBd2AVCHD }, //282 { sizeof ( s_pBd2AVCHD2 ) - 1, s_pBd2AVCHD2 }, { sizeof ( s_pActAVCHD ) - 1, s_pActAVCHD }, { sizeof ( s_pActAVCHD2 ) - 1, s_pActAVCHD2 }, //285 { sizeof ( s_pBd2AVCHD3 ) - 1, s_pBd2AVCHD3 }, { sizeof ( s_pActBDMV ) - 1, s_pActBDMV }, { sizeof ( s_pAttUSB ) - 1, s_pAttUSB }, { sizeof ( s_pAttPFS ) - 1, s_pAttPFS }, { sizeof ( s_pCacheFile ) - 1, s_pCacheFile }, //290 { sizeof ( s_pHddErr ) - 1, s_pHddErr }, { sizeof ( s_pUsbErr ) - 1, s_pUsbErr }, { sizeof ( s_pTitleLocked ) - 1, s_pTitleLocked }, { sizeof ( s_pTitleRO ) - 1, s_pTitleRO }, //294 { sizeof ( s_pRenameTo ) - 1, s_pRenameTo }, { sizeof ( s_pCreateNew ) - 1, s_pCreateNew }, { sizeof ( s_pXCUP ) - 1, s_pXCUP }, //297 { sizeof ( s_pXCUP1 ) - 1, s_pXCUP1 }, { sizeof ( s_pXCFM ) - 1, s_pXCFM }, { sizeof ( s_pXCFM0 ) - 1, s_pXCFM0 }, //300 { sizeof ( s_pXCFM1 ) - 1, s_pXCFM1 }, { sizeof ( s_pXCRF ) - 1, s_pXCRF }, { sizeof ( s_pXCRF1 ) - 1, s_pXCRF1 }, { sizeof ( s_pXCRF2 ) - 1, s_pXCRF2 }, { sizeof ( s_pXCRF3 ) - 1, s_pXCRF3 }, { sizeof ( s_pXCPF ) - 1, s_pXCPF }, //306 { sizeof ( s_pXCPF1 ) - 1, s_pXCPF1 }, { sizeof ( s_pXCSS ) - 1, s_pXCSS }, { sizeof ( s_pXCSS1 ) - 1, s_pXCSS1 }, { sizeof ( s_pXCTH ) - 1, s_pXCTH }, { sizeof ( s_pXCTH1 ) - 1, s_pXCTH1 }, { sizeof ( s_pXCHL ) - 1, s_pXCHL }, //312 { sizeof ( s_pXCHL1 ) - 1, s_pXCHL1 }, { sizeof ( s_pXCRS ) - 1, s_pXCRS }, { sizeof ( s_pXCRS1 ) - 1, s_pXCRS1 }, { sizeof ( s_pXCQT ) - 1, s_pXCQT }, { sizeof ( s_pXCQT1 ) - 1, s_pXCQT1 }, //317 { sizeof ( s_pXC5LK ) - 1, s_pXC5LK }, { sizeof ( s_pXC5LK1 ) - 1, s_pXC5LK1 }, { sizeof ( s_pXC5ST ) - 1, s_pXC5ST }, { sizeof ( s_pXC5ST1 ) - 1, s_pXC5ST1 }, //321 { sizeof ( s_pXC2SS ) - 1, s_pXC2SS }, { sizeof ( s_pXC2SS1 ) - 1, s_pXC2SS1 }, { sizeof ( s_pXC2IL ) - 1, s_pXC2IL }, { sizeof ( s_pXC2IL1 ) - 1, s_pXC2IL1 }, { sizeof ( s_pXC2GC ) - 1, s_pXC2GC }, { sizeof ( s_pXC2GC1 ) - 1, s_pXC2GC1 }, //327 /*, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, { sizeof ( s_p ) - 1, s_p }, */ }; static MMString s_MMStringUDF[ sizeof ( s_MMStringDef ) / sizeof ( s_MMStringDef[ 0 ] ) ]; //UDF - user defined file with texts MMString g_MMString [ sizeof ( s_MMStringDef ) / sizeof ( s_MMStringDef[ 0 ] ) ]; //holds default GUI texts int MM_LocaleInit ( char *lang_file ) { long lSize=0; unsigned int lIdx = 0; FILE *lFD = fopen(lang_file, "rb"); if ( lFD != NULL ) { fseek ( lFD, 0, SEEK_END ); lSize = ftell(lFD); if ( lSize > 0 ) { unsigned char* lpEnd; unsigned char* lpPtr; unsigned char* lpBuff = lpPtr = ( unsigned char* )malloc ( lSize + 1 ); lpEnd = lpBuff + lSize; fseek( lFD, 3, SEEK_SET); fread( (unsigned char*) lpBuff, lSize, 1, lFD); for(int m=0; m<lSize; m++) { if(lpBuff[m]=='\n') lpBuff[m]=' '; if(lpBuff[m]=='|') lpBuff[m]='\n'; } while ( 1 ) { while ( lpPtr != lpEnd && *lpPtr != '\r' ) ++lpPtr; *lpPtr = '\x00'; s_MMStringUDF[ lIdx ].m_pStr = lpBuff; s_MMStringUDF[ lIdx ].m_Len = lpPtr - lpBuff; if ( !s_MMStringUDF[ lIdx++ ].m_Len || lpPtr++ == lpEnd || lIdx == sizeof ( s_MMStringUDF ) / sizeof ( s_MMStringUDF[ 0 ] ) ) break; if ( *lpPtr == '\r' ) ++lpPtr; lpBuff = lpPtr; } } fclose ( lFD ); } return lIdx; } void MM_LocaleSet ( bool mm_language ) { MMString* lpStr; if ( mm_language ) lpStr = s_MMStringUDF; //user defined translation file else lpStr = s_MMStringDef; //default English memcpy ( g_MMString, lpStr, sizeof ( g_MMString ) ); }
C++
#include <stdio.h> #include <string.h> #include <sys/process.h> SYS_PROCESS_PARAM(1001, 0x10000) int main(int argc, char **argv) { (void) argc; char tn[128]; char filename[128]; sprintf(tn, "%s", argv[0]); char *pch=tn; char *pathpos=strrchr(pch,'/'); pathpos[0]=0; sprintf(filename, "%s/RELOADED.BIN", tn); remove(filename); sprintf(filename, "%s/RELOAD.SELF", tn); sys_game_process_exitspawn2(filename, NULL, NULL, NULL, 0, 1200, SYS_PROCESS_PRIMARY_STACK_SIZE_512K); }
C++
#include "mscommon.h" static int audioInitCell(void); // SPURS information #define SPURS_SPU_NUM 1 #define SPU_THREAD_GROUP_PRIORITY 128 CellSpurs spurs __attribute__((aligned (128))); sys_ppu_thread_t s_MultiStreamPuThread = 0; void * s_pMultiStreamMemory = NULL; #define CHANNEL CELL_AUDIO_PORT_8CH #define BLOCK CELL_AUDIO_BLOCK_8 #define EXIT_CODE (0xbee) /********************************************************************************** audioInitCell Returns: audio port number returned from cellAudioPortOpen(..) **********************************************************************************/ static int audioInitCell(void) { int ret = 0; unsigned int portNum = -1; // cellMSSystemConfigureSysUtil returns the following data: // Bits 0-3: Number of available output channels // Bit 4: Dolby On status // unsigned int retSysUtil = cellMSSystemConfigureSysUtil(); // unsigned int numChans = (retSysUtil & 0x0000000F); // unsigned int dolbyOn = (retSysUtil & 0x00000010) >> 4; // printf("Number Of Channels: %u\n", numChans); // printf("Dolby enabled: %u\n", dolbyOn); ret = cellAudioInit(); if (ret !=CELL_OK) return -1; audioParam.nChannel = CHANNEL; audioParam.nBlock = BLOCK; ret = cellAudioPortOpen(&audioParam, &portNum); if (ret != CELL_OK) { cellAudioQuit(); return -1; } ret = cellAudioGetPortConfig(portNum, &portConfig); if (ret != CELL_OK) { cellAudioQuit(); return -1; } cellMSSystemConfigureLibAudio(&audioParam, &portConfig); return portNum; } int InitSPURS(void) { int ret = -1; sys_ppu_thread_t thread_id; int ppu_thr_prio __attribute__((aligned (128))); // information for the reverb sys_ppu_thread_get_id(&thread_id); ret = sys_ppu_thread_get_priority(thread_id, &ppu_thr_prio); if(ret == CELL_OK) ret = cellSpursInitialize(&spurs, SPURS_SPU_NUM, SPU_THREAD_GROUP_PRIORITY, ppu_thr_prio-1, 1); if(ret != CELL_OK) return -1; return 1; } /********************************************************************************** InitialiseAudio This function sets up the audio system. Requires: nStreams Maximum number of streams to be active at any time nmaxSubs Maximum number of sub channels to init in MultiStream _nPortNumber Reference to int - Returns port number from CELL audio init _audioParam Reference to CellAudioPortParam - Returns audio params from CELL audio init _portConfig Reference to CellAudioPortConfig - Returns port configuration from CELL audio init Returns: 0 OK -1 Error **********************************************************************************/ long InitialiseAudio( const long nStreams, const long nmaxSubs, int &_nPortNumber , CellAudioPortParam &_audioParam, CellAudioPortConfig &_portConfig) { CellMSSystemConfig cfg; uint8_t prios[8] = {1, 0, 0, 0, 0, 0, 0, 0}; cfg.channelCount=nStreams; cfg.subCount=nmaxSubs; cfg.dspPageCount=0; cfg.flags=CELL_MS_NOFLAGS; _nPortNumber = audioInitCell(); if(_nPortNumber < 0) { return -1; } _audioParam = audioParam; _portConfig = portConfig; // Initialise SPURS MultiStream version int nMemoryNeeded = cellMSSystemGetNeededMemorySize(&cfg); s_pMultiStreamMemory = memalign(128, nMemoryNeeded); if(InitSPURS()==1) cellMSSystemInitSPURS(s_pMultiStreamMemory, &cfg, &spurs, &prios[0]); else return -1; return 0; } void ShutdownMultiStream() { void* pMemory = cellMSSystemClose(); assert(pMemory == s_pMultiStreamMemory); free( s_pMultiStreamMemory); s_pMultiStreamMemory = NULL; pMemory = NULL; }
C++
#include <stdio.h> #include <stdlib.h> #include <stdarg.h> #include <assert.h> #include <string.h> #include <dirent.h> #include <unistd.h> #include <fcntl.h> #include <time.h> #include <math.h> #include <stddef.h> #include <netdb.h> #include <stdbool.h> #include <sys/synchronization.h> #include <sys/spu_initialize.h> #include <sys/ppu_thread.h> #include <sys/return_code.h> #include <sys/sys_time.h> #include <sys/process.h> #include <sys/memory.h> #include <sys/timer.h> #include <sys/paths.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/socket.h> //#include <sys/vm.h> #include <cell/http.h> #include <cell/mixer.h> #include <cell/codec.h> #include <cell/audio.h> #include <cell/gcm.h> #include <cell/sysmodule.h> #include <cell/font.h> #include <cell/fontFT.h> #include <cell/dbgfont.h> #include <cell/mstream.h> #include <cell/cell_fs.h> #include <cell/control_console.h> #include <cell/rtc.h> #include <cell/rtc/rtcsvc.h> #include <cell/pad.h> #include <cell/mouse.h> #include <cell/keyboard.h> #include <cell/codec/pngdec.h> #include <cell/codec/jpgdec.h> #include <cell/codec.h> #include <sysutil/sysutil_video_export.h> #include <sysutil/sysutil_music_export.h> #include <sysutil/sysutil_photo_export.h> #include <sysutil/sysutil_msgdialog.h> #include <sysutil/sysutil_oskdialog.h> #include <sysutil/sysutil_syscache.h> #include <sysutil/sysutil_sysparam.h> #include <sysutil/sysutil_common.h> #include <sysutil/sysutil_screenshot.h> #include <sysutil/sysutil_bgmplayback.h> #include <sysutil/sysutil_webbrowser.h> #include <netex/libnetctl.h> #include <netex/errno.h> #include <netex/net.h> #include <arpa/inet.h> #include <netinet/in.h> #include <libftp.h> #include "libpfsm.h" #include "mscommon.h" #include "semaphore.h" #include "syscall8.h" #include "syscall36.h" #include "graphics.h" #include "fonts.h" #include "language.h" #define FB(x) ((x)*1920*1080*4) // 1 video frame buffer #define MB(x) ((x)*1024*1024) // 1 MB #define KB(x) ((x)*1024) // 1 KB SYS_PROCESS_PARAM(1200, 0x80000) //colors (COLOR.INI) u32 COL_PS3DISC=0xff807000; u32 COL_PS3DISCSEL=0xfff0e000; u32 COL_SEL=0xff00ffff; u32 COL_PS3=0xe0e0e0e0; u32 COL_PS2=0xff06b02e; u32 COL_DVD=0xffdcc503; u32 COL_BDMV=0xff0050ff; u32 COL_AVCHD=0xff30ffff; u32 COL_LEGEND=0xc0c0c0a0; u32 COL_FMFILE=0xc0c0c0c0; u32 COL_FMDIR=0xc0808080; u32 COL_FMJPG=0xcc00cc00; u32 COL_FMMP3=0xc033ffee; u32 COL_FMEXE=0xc03310ee; u32 COL_HEXVIEW=0xc0a0a0a0; u32 COL_SPLIT=0xc00080ff; u32 COL_XMB_CLOCK=0xffd0d0d0; u32 COL_XMB_COLUMN=0xf0e0e0e0; u32 COL_XMB_TITLE=0xf0e0e0e0; u32 COL_XMB_SUBTITLE=0xf0909090; u8 XMB_SPARK_SIZE=4; u32 XMB_SPARK_COLOR=0xffffff00; // theme related bool th_device_list=1; bool th_device_separator=1; u16 th_device_separator_y=956; bool th_legend=1; u16 th_legend_y=853; bool th_drive_icon=1; u16 th_drive_icon_x=1790; u16 th_drive_icon_y=964; //NTFS/PFS driver int max_usb_volumes=1; typedef struct _DEV_INFO { struct _DEV_INFO *next; PFSM_DEVICE dev; } DEV_INFO; static DEV_INFO *dev_info; typedef uint64_t u64; //memory info typedef struct { uint32_t total; uint32_t avail; } _meminfo; _meminfo meminfo; // mp3 related #define MP3_MEMORY_KB 384 #define MP3_BUF (MP3_MEMORY_KB/2) #define SAMPLE_FREQUENCY (44100) #define MAX_STREAMS (4) //CELL_MS_MAX_STREAMS//(400) #define MAX_SUBS (4) //(31) CellAudioPortParam audioParam; CellAudioPortConfig portConfig; int nChannel; int sizeNeeded; int *mp3Memory; u64 _mp3_buffer=KB(MP3_MEMORY_KB); int mp3_freq=44100; u32 mp3_durr=0; float mp3_skip=0.f; u32 mp3_packet=0; float mp3_packet_time=0.001f; char mp3_now_playing[512]; float mp3_volume=0.5f; char *pData=NULL; char *pDataB=NULL; char my_mp3_file[512]; bool update_ms=true; bool force_mp3; int force_mp3_fd=-1; char force_mp3_file[512]; u64 force_mp3_offset=0; u64 force_mp3_size=0; bool mm_audio=true; //goes to false if XMB BGM is playing bool mm_is_playing=false; bool is_theme_playing=false; bool audio_sub_proc=false; bool mp3_force_position=false; int StartMultiStream(); void stop_audio(float attn); void stop_mp3(float _attn); void prev_mp3(); void next_mp3(); void main_mp3( char *temp_mp3); int main_mp3_th( char *my_mp3, float skip); void *color_base_addr; u32 frame_index = 0; u32 video_buffer; int V_WIDTH, V_HEIGHT;//, _V_WIDTH, _V_HEIGHT; u8 mp_WIDTH=30, mp_HEIGHT=42; //mouse icon HR // for network and file_copy buffering #define BUF_SIZE (3 * 1024 * 1024) //folder copy #define MAX_FAST_FILES 1 #define MAX_FAST_FILE_SIZE (3 * 1024 * 1024) //used x3 = 9MB #define MEMORY_CONTAINER_SIZE_WEB (64 * 1024 * 1024) //for web browser #define MEMORY_CONTAINER_SIZE (8 * 1024 * 1024) //for OSK, video/photo/music export uint32_t MEMORY_CONTAINER_SIZE_ACTIVE; enum { CALLBACK_TYPE_INITIALIZE = 0, CALLBACK_TYPE_REGIST_1, CALLBACK_TYPE_FINALIZE }; bool ve_initialized=0; bool me_initialized=0; bool pe_initialized=0; static sys_memory_container_t memory_container; static sys_memory_container_t memory_container_web; static int ve_result = 0xDEAD; static int me_result = 0xDEAD; static int pe_result = 0xDEAD; static void video_export( char *filename_v, char *album, int to_unregister); static int video_finalize( void ); static void cb_export_finish( int result, void *userdata); static void cb_export_finish2( int result, void *userdata); static void music_export( char *filename_v, char *album, int to_unregister); static int music_finalize( void ); static void cb_export_finish_m( int result, void *userdata); static void cb_export_finish2_m( int result, void *userdata); static void photo_export( char *filename_v, char *album, int to_unregister); static int photo_finalize( void ); static void cb_export_finish_p( int result, void *userdata); static void cb_export_finish2_p( int result, void *userdata); int download_file(const char *http_file, const char *save_path, int show_progress); int download_file_th(const char *http_file, const char *save_path, int params); //void replacemem(uint64_t _val_search1, uint64_t _val_replace1); static void del_temp( char *path); static void parse_color_ini(); void pokeq( uint64_t addr, uint64_t val); uint64_t peekq(uint64_t addr); void enable_sc36(); void write_last_state(); void save_options(); void mip_texture( uint8_t *buffer_to, uint8_t *buffer_from, uint32_t width, uint32_t height, int scaleF); void blur_texture(uint8_t *buffer_to, uint32_t width, uint32_t height, int x, int y, int wx, int wy, uint32_t c_BRI, int use_grayscale, int iterations, int p_range); void print_label(float x, float y, float scale, uint32_t color, char *str1p, float weight, float slant, int font); void print_label_ex(float x, float y, float scale, uint32_t color, char *str1p, float weight, float slant, int font, float hscale, float vscale, int centered); void flush_ttf(uint8_t *buffer, uint32_t _V_WIDTH, uint32_t _V_HEIGHT); void show_sysinfo(); int get_param_sfo_field(char *file, char *field, char *value); void file_copy(char *path, char *path2, int progress); void cache_png(char *path, char *title_id); void fix_perm_recursive(const char* start_path); int my_game_delete(char *path); int my_game_copy(char *path, char *path2); int my_game_copy_pfsm(char *path, char *path2); int load_png_texture(u8 *data, char *name, uint16_t _DW); void change_opacity(u8 *buffer, int delta, u32 size); void draw_stars(); float use_drops=false; void draw_whole_xmb(u8 mode); void draw_xmb_clock(u8 *buffer, const int _xmb_icon); void draw_xmb_icon_text(int _xmb_icon); void draw_xmb_bare(u8 _xmb_icon, u8 _all_icons, bool recursive, int _sub_level); void init_xmb_icons(t_menu_list *list, int max, int sel); void redraw_column_texts(int _xmb_icon); void reset_xmb_checked(); void reset_xmb(u8 _flag); void free_all_buffers(); void free_text_buffers(); void draw_fileman(); void draw_xmb_info(); void apply_theme (const char *theme_file, const char *theme_path); int vert_indx=0, vert_texture_indx=0; void flip(void); //misc thread sys_ppu_thread_t addmus_thr_id; static void add_music_column_thread_entry( uint64_t arg ); bool is_music_loading=0; sys_ppu_thread_t addpic_thr_id; static void add_photo_column_thread_entry( uint64_t arg ); bool is_photo_loading=0; sys_ppu_thread_t addret_thr_id; static void add_retro_column_thread_entry( uint64_t arg ); bool is_retro_loading=0; sys_ppu_thread_t addvid_thr_id; static void add_video_column_thread_entry( uint64_t arg ); bool is_video_loading=0; bool is_decoding_jpg=0; void load_jpg_threaded(int _xmb_icon, int cn); bool is_decoding_png=0; void load_png_threaded(int _xmb_icon, int cn); static void download_thread_entry( uint64_t arg ); sys_ppu_thread_t download_thr_id; static void misc_thread_entry( uint64_t arg ); sys_ppu_thread_t misc_thr_id; static void jpg_thread_entry( uint64_t arg ); sys_ppu_thread_t jpgdec_thr_id; static void png_thread_entry( uint64_t arg ); sys_ppu_thread_t pngdec_thr_id; const int32_t misc_thr_prio = 1600; const size_t app_stack_size = 32768; bool is_game_loading=0; u8 is_any_xmb_column=0; u8 drawing_xmb=0; float angle=0.f; bool debug_mode=false; bool use_pad_sensor=true; static int old_fi=-1; u16 counter_png=0; u8 is_reloaded=0; u32 fdevices=0; u32 fdevices_old=0; //int sub_menu_open=0; int pb_step=429; bool never_used_pfs=1; int repeat_init_delay=60; int repeat_key_delay=6; int repeat_counter1=repeat_init_delay; //wait before repeat int repeat_counter2=repeat_key_delay; // repeat after pause u8 repeat_counter3=1; // accelerate repeat (multiplier) float repeat_counter3_inc=0.f; bool key_repeat=0; char time_result[2]; u16 seconds_clock=0; bool xmb_legend_drawn=0; bool xmb_info_drawn=0; bool use_analog=0; bool join_copy=0; u8 xmb_settings_sel=0; typedef struct { char split_file[512]; char cached_file[512]; } cached_files_struct; cached_files_struct file_to_join[10]; u8 max_joined=0; char d1[512], d2[512], df[512]; unsigned char bdemu[0x1380]; unsigned char mouse[5120]; u8 bdemu2_present=0; bool search_mmiso=false; unsigned int debug_print=102030; long long int last_refresh=0; CellSysCacheParam cache_param ; //web browser volatile int www_running = 0; char status_info[256]; static CellWebBrowserConfig2 config_full; int dim=0, dimc=0; int c_opacity=0xff, c_opacity_delta=-1; int c_opacity2=0xff; int b_box_opaq= 0xf8; //for display mode 2 int b_box_step= -4; float c_firmware=3.41f; bool use_symlinks=0; bool ftp_service=0; u8 ftp_clients=0; bool http_active=false; //nethost char get_cmd[1024]; //pfs static u8 *buf2; u32 BUF_SIZE2=0; time_t time_start; uint32_t blockSize; uint64_t freeSize; uint64_t freeSpace; //FONTS typedef struct SampleRenderTarget { CellFontRenderer Renderer; CellFontRenderSurface Surface; }SampleRenderWork; static const CellFontLibrary* freeType; static Fonts_t* fonts; static SampleRenderWork RenderWork; int legend_y=760, legend_h=96, last_selected, rnd, game_last_page; u16 dox_width=256; u16 dox_height=256; u16 dox_cross_x=15; u16 dox_cross_y=14; u16 dox_cross_w=34; u16 dox_cross_h=34; u16 dox_circle_x=207; u16 dox_circle_y=14; u16 dox_circle_w=34; u16 dox_circle_h=34; u16 dox_triangle_x=80; u16 dox_triangle_y=14; u16 dox_triangle_w=34; u16 dox_triangle_h=34; u16 dox_square_x=143; u16 dox_square_y=14; u16 dox_square_w=36; u16 dox_square_h=34; u16 dox_start_x=12; u16 dox_start_y=106; u16 dox_start_w=42; u16 dox_start_h=36; u16 dox_select_x=72; u16 dox_select_y=108; u16 dox_select_w=50; u16 dox_select_h=34; u16 dox_ls_x=132; u16 dox_ls_y=70; u16 dox_ls_w=56; u16 dox_ls_h=56; u16 dox_rs_x=196; u16 dox_rs_y=196; u16 dox_rs_w=58; u16 dox_rs_h=56; u16 dox_pad_x=7; u16 dox_pad_y=200; u16 dox_pad_w=53; u16 dox_pad_h=53; u16 dox_l1_x=130; u16 dox_l1_y=143; u16 dox_l1_w=60; u16 dox_l1_h=24; u16 dox_r1_x=194; u16 dox_r1_y=143; u16 dox_r1_w=60; u16 dox_r1_h=24; u16 dox_l2_x=2; u16 dox_l2_y=143; u16 dox_l2_w=62; u16 dox_l2_h=24; u16 dox_r2_x=66; u16 dox_r2_y=143; u16 dox_r2_w=62; u16 dox_r2_h=24; u16 dox_l3_x=68; u16 dox_l3_y=196; u16 dox_l3_w=58; u16 dox_l3_h=56; u16 dox_r3_x=132; u16 dox_r3_y=196; u16 dox_r3_w=58; u16 dox_r3_h=56; //white circle u16 dox_rb1u_x=192; u16 dox_rb1u_y=70; u16 dox_rb1u_w=32; u16 dox_rb1u_h=31; //white circle selected u16 dox_rb1s_x=192; u16 dox_rb1s_y=101; u16 dox_rb1s_w=32; u16 dox_rb1s_h=31; //gray circle u16 dox_rb2u_x=224; u16 dox_rb2u_y=70; u16 dox_rb2u_w=31; u16 dox_rb2u_h=31; //gray circle selected u16 dox_rb2s_x=224; u16 dox_rb2s_y=101; u16 dox_rb2s_w=31; u16 dox_rb2s_h=31; //selection circle u16 dox_rb3s_x=177; u16 dox_rb3s_y=40; u16 dox_rb3s_w=31; u16 dox_rb3s_h=30; //attention sign u16 dox_att_x=1; u16 dox_att_y=65; u16 dox_att_w=44; u16 dox_att_h=39; //white arrow u16 dox_arrow_w_x=44; u16 dox_arrow_w_y=41; u16 dox_arrow_w_w=44; u16 dox_arrow_w_h=44; //black arrow u16 dox_arrow_b_x=87; u16 dox_arrow_b_y=58; u16 dox_arrow_b_w=44; u16 dox_arrow_b_h=44; static int unload_modules(); void draw_text_stroke(float x, float y, float size, u32 color, const char *str); #define GAME_INI_VER "MMGI0100" //PS3GAME.INI game flags (submenu) #define GAME_STATE_VER "MMLS0106" //LSTAT.BIN multiMAN last state data #define GAME_LIST_VER "MMGL0106" //LLIST.BIN cache for game list #define XMB_COL_VER "MMXC0109" //XMBS.00x xmb[?] structure (1 XMMB column) char current_version[9]="02.01.00"; char current_version_NULL[10]; char versionUP[64]; char hdd_folder[64]="/dev_hdd0/GAMES/"; bool first_launch=1; char app_path[32]; char app_temp[128]; char app_usrdir[64]; char app_homedir[64]; char options_ini[128]; char options_bin[128]; char color_ini[128]; char url_base[28]; char list_file[128]; char list_file_state[128]; char snes_self[512]; char snes_roms[512]; char genp_self[512]; char genp_roms[512]; char fceu_self[512]; char fceu_roms[512]; char vba_self[512]; char vba_roms[512]; char fba_self[512]; char fba_roms[512]; char ini_hdd_dir[64]="/dev_hdd0/GAMES/"; char ini_usb_dir[64]="GAMES"; char hdd_home[128]="/dev_hdd0/GAMES"; //aux search folders char hdd_home_2[128]="/_skip_"; char hdd_home_3[128]="/_skip_"; char hdd_home_4[128]="/_skip_"; char hdd_home_5[128]="/_skip_"; char usb_home[128]="/GAMES"; char usb_home_2[128]="/GAMEZ"; char usb_home_3[128]=" "; char usb_home_4[128]=" "; char usb_home_5[128]=" "; static char cache_dir[128]=" "; char covers_retro[128]=" "; char covers_dir[128]=" "; char themes_dir[128]=" "; char themes_web_dir[128]=" "; char game_cache_dir[128]; char update_dir[128]="/_skip"; char download_dir[128]="/_skip"; int verify_data=1; int usb_mirror=0; int scan_for_apps=0; int date_format=0; // 1=MM/DD/YYYY, 2=YYYY/MM/DD int time_format=1; // 0=12h 1=24h int progress_bar=1; int dim_setting=5; //5 seconds to dim titles int ss_timeout=2; int ss_timer=0; int egg=0; int ss_timer_last=0; int direct_launch_forced=0; int clear_activity_logs=1; int sc36_path_patch=0; int lock_display_mode=-1; int lock_fileman=0; int scale_icon_h=0; char fm_func[32]; int parental_level=0; int parental_pin_entered=0; char parental_pass[16]; int pfs_enabled=0; int xmb_sparks=1; int xmb_game_bg=1; int xmb_cover=1; u8 xmb_cover_column=0; //0-show icon0, 1-show cover int xmb_popup=1; u8 gray_poster=1; u8 confirm_with_x=1; u8 hide_bd=0; #define BUTTON_SELECT (1<<0) #define BUTTON_L3 (1<<1) #define BUTTON_R3 (1<<2) #define BUTTON_START (1<<3) #define BUTTON_UP (1<<4) #define BUTTON_RIGHT (1<<5) #define BUTTON_DOWN (1<<6) #define BUTTON_LEFT (1<<7) #define BUTTON_L2 (1<<8) #define BUTTON_R2 (1<<9) #define BUTTON_L1 (1<<10) #define BUTTON_R1 (1<<11) #define BUTTON_TRIANGLE (1<<12) #define _BUTTON_CIRCLE (1<<13) #define _BUTTON_CROSS (1<<14) #define BUTTON_SQUARE (1<<15) #define BUTTON_PAUSE (1<<16) u16 BUTTON_CROSS = _BUTTON_CROSS; u16 BUTTON_CIRCLE= _BUTTON_CIRCLE; u8 init_finished=0; bool mm_shutdown=0; char userBG[64]; char auraBG[64]; char avchdBG[64]; char blankBG[64]; char playBG[64]; char legend[64]; char xmbicons[64]; char xmbicons2[64]; char xmbdevs[64]; char xmbbg[64]; //char playBGL[64]; char playBGR[64]; char avchdIN[64]; char avchdMV[64]; char helpNAV[64]; char helpMME[128]; int abort_rec=0; char disclaimer[64], bootmusic[64]; char ps2png[64], dvdpng[64]; //char sys_cache[512]; char mouseInfo[128];//char mouseInfo2[128]; u8 *text_bmp=NULL; u8 *text_bmpS=NULL; u8 *text_bmpUBG=NULL; u8 *text_BOOT=NULL; u8 *text_USB=NULL; u8 *text_HDD=NULL; u8 *text_BLU_1=NULL; u8 *text_NET_6=NULL; u8 *text_OFF_2=NULL; u8 *text_FMS=NULL; u8 *text_DOX=NULL; u8 *text_MSG=NULL; u8 *text_INFO=NULL; u8 *text_CFC_3=NULL; u8 *text_SDC_4=NULL; u8 *text_MSC_5=NULL; u8 *text_bmpUPSR=NULL; u8 *text_bmpIC; u8 *text_TEMP; u8 *text_DROPS; u8 *text_legend; u8 *text_FONT; u8 *xmb_col; u8 *xmb_clock; u8 *xmb_icon_globe = NULL; u8 *xmb_icon_help = NULL; u8 *xmb_icon_quit = NULL; u8 *xmb_icon_star = NULL; u8 *xmb_icon_star_small = NULL; u8 *xmb_icon_retro = NULL; u8 *xmb_icon_ftp = NULL; u8 *xmb_icon_folder = NULL; u8 *xmb_icon_desk = NULL; u8 *xmb_icon_hdd = NULL; u8 *xmb_icon_blu = NULL; u8 *xmb_icon_tool = NULL; u8 *xmb_icon_note = NULL; u8 *xmb_icon_film = NULL; u8 *xmb_icon_photo = NULL; u8 *xmb_icon_update = NULL; //u8 *xmb_icon_restart= NULL; u8 *xmb_icon_dev = NULL; u8 *xmb_icon_ss = NULL; u8 *xmb_icon_showtime = NULL; u8 *xmb_icon_theme = NULL; FILE *fpV; int do_move=0; int no_real_progress=0; int payload=0; char payloadT[2]; int socket_handle; int portNum = -1; int multiStreamStarted=0; //OSK CellOskDialogCallbackReturnParam OutputInfo; CellOskDialogInputFieldInfo inputFieldInfo; uint16_t Result_Text_Buffer[128 + 1]; //sys_memory_container_t container=NULL; int enteredCounter = 0; char new_file_name[128]; char iconHDD[64], iconUSB[64], iconBLU[64], iconNET[64], iconOFF[64], iconSDC[64], iconCFC[64], iconMSC[64]; char this_pane[256], other_pane[256]; int cover_available=0, cover_available_1=0, cover_available_2=0, cover_available_3=0, cover_available_4=0, cover_available_5=0, cover_available_6=0; u8 scan_avchd=1; u8 expand_avchd=1; u8 mount_bdvd=1; u8 mount_hdd1=1; u8 animation=3; int direct_launch=1; u8 disable_options=0, force_disable_copy=0; u8 download_covers=0; float overscan=0.0f; u8 force_update_check=0; u8 display_mode=0; // 0-All titles, 1-Games only, 2-AVCHD/Video only u8 game_bg_overlay=1; typedef struct { path_open_entry entries[24]; char arena[0x9000]; } path_open_table; path_open_table open_table; uint64_t dest_table_addr; char gameID[512]; #define MAX_LIST 768 t_menu_list menu_list[MAX_LIST]; void DBPrintf( const char *string) { if(debug_print==102030) return; #if (CELL_SDK_VERSION>0x210001) cellConsolePrintf(debug_print, string); #else (void) string; #endif } #define MAX_LIST_OPTIONS 128 typedef struct { u8 enabled; char label[64]; char value[512]; } t_opt_list; t_opt_list opt_list[MAX_LIST_OPTIONS]; u8 opt_list_max=0; int open_select_menu(char *_caption, int _width, t_opt_list *list, int _max, u8 *buffer, int _max_entries, int _centered); int open_list_menu(char *_caption, int _width, t_opt_list *list, int _max, int _x, int _y, int _max_entries, int _centered); int open_dd_menu(char *_caption, int _width, t_opt_list *list, int _max, int _x, int _y, int _max_entries); int context_menu(char *_cap, int _type, char *c_pane, char *o_pane); #define MAX_PANE_SIZE 2560 typedef struct { //unsigned flags; u8 type; //0-dir 1-file char name[128]; char path[512]; char entry[128]; // __0+name for dirs and __1+name for files - used for sorting dirs first int64_t size; time_t time; char datetime[10]; mode_t mode; u8 selected; } t_dir_pane; t_dir_pane pane_l[MAX_PANE_SIZE]; //left directory pane t_dir_pane pane_r[MAX_PANE_SIZE]; //right directory pane int max_dir_l=0; int max_dir_r=0; #define MAX_PANE_SIZE_BARE 2560 typedef struct { char name[128]; char path[512]; int64_t size; time_t time; } t_dir_pane_bare; int state_read=1; int state_draw=1; int draw_legend=1; char current_left_pane[512]="/", current_right_pane[512]="/", my_txt_file[512]; int first_left=0, first_right=0, viewer_open=0; int max_menu_list=0; typedef struct { char host[64]; // char root[512]; char name[512]; char friendly[32]; int port; } net_hosts; net_hosts host_list[10]; int max_hosts=0; #define MAX_F_FILES 3000 typedef struct { char path[384]; uint64_t size; } f_files_stru; f_files_stru f_files[MAX_F_FILES]; int max_f_files=0; int file_counter=0; // to count files int abort_copy=0; // abort process int num_directories=0, num_files_big=0, num_files_split=0; typedef struct { char label[256]; float x; float y; float scale; float weight; float slant; u8 font; float hscale; float vscale; u8 centered; float cut; uint32_t color; } ttf_labels; ttf_labels ttf_label[512]; int max_ttf_label=0; int mode_list=0; u32 forcedevices=0xffff; u8 fm_sel=0; u8 fm_sel_old=15; int game_sel=0; int game_sel_last=0; int cover_mode=8, initial_cover_mode=8, user_font=1, last_cover_mode=8; u8 dir_mode=2; u8 game_details=2; u8 bd_emulator=1; u8 mm_locale=0; u8 mui_font=4; // font for multilingual user interface int net_available=0; union CellNetCtlInfo net_info; int net_avail=1; u8 theme_sound=1; int copy_file_counter=0; //int64_t uint64_t copy_global_bytes=0x00ULL; uint64_t global_device_bytes=0x00ULL; int lastINC=0, lastINC3=0, lastINC2=0; uint64_t memvaloriginal = 0x386000014E800020ULL; uint64_t memvaltemp = 0x386000014E800020ULL; uint64_t memvalnew = 0xE92296887C0802A6ULL; int patchmode = -1; using namespace cell::Gcm; #define IS_DISC (1<<0) #define IS_HDD (1<<1) #define IS_USB (1<<2) #define IS_DBOOT (1<<5) #define IS_BDMIRROR (1<<6) #define IS_PATCHED (1<<7) #define IS_FAV (1<<8) #define IS_EXTGD (1<<9) #define IS_PS3 (1<<13) #define IS_LOCKED (1<<14) #define IS_PROTECTED (1<<15) #define IS_OTHER (0<<16) #define IS_ACTION (1<<16) #define IS_ADVENTURE (2<<16) #define IS_FAMILY (3<<16) #define IS_FIGHTING (4<<16) #define IS_PARTY (5<<16) #define IS_PLATFORM (6<<16) #define IS_PUZZLE (7<<16) #define IS_ROLEPLAY (8<<16) #define IS_RACING (9<<16) #define IS_SHOOTER (10<<16) #define IS_SIM (11<<16) #define IS_SPORTS (12<<16) #define IS_STRATEGY (13<<16) #define IS_TRIVIA (14<<16) #define IS_3D (15<<16) static char genre [16] [48]; static char retro_groups[ 6] [32]; static char xmb_columns [10] [32]; static char alpha_groups[16] [32] = { "All", "A-B", "C-D", "E-F", "G-H", "I-J", "K-L", "M-N", "O-P", "Q-R", "S-T", "U-V", "W-X", "Y-Z", "Other", "---" }; typedef struct { u8 val; u8 font_id; char id[4]; unsigned char eng_name[32]; unsigned char loc_name[32]; } _locales; #define MAX_LOCALES 24 static _locales locales[] = { { 0, 4, "EN", "English", "English" }, { 1, 4, "BG", "Bulgarian", "Български" }, { 2, 4, "RU", "Russian", "Русский" }, { 3, 16, "RO", "Romanian", "Română" }, { 4, 16, "TR", "Turkish", "Türkçe" }, { 5, 4, "ES", "Spanish", "Español" }, { 6, 4, "DE", "German", "Deutsch" }, { 7, 4, "FR", "French", "Français" }, { 8, 4, "IT", "Italian", "Italiano" }, { 9, 4, "BR", "Brazilian", "Português BR" }, { 10, 4, "PR", "Portuguese", "Português" }, { 11, 4, "NL", "Dutch", "Nederlands" }, { 12, 16, "PL", "Polish", "Polski" }, { 13, 16, "GR", "Greek", "Ελληνικά" }, { 14, 4, "UA", "Ukrainian", "Українська" }, { 15, 16, "HU", "Hungarian", "Magyar" }, { 16, 4, "DK", "Danish", "Dansk" }, { 17, 4, "FI", "Finnish", "Suomi" }, { 18, 4, "SE", "Swedish", "Svenska" }, { 19, 4, "MY", "Malaysian", "Melayu" }, { 20, 4, "CN", "Chinese (S)", "简体中文" }, { 21, 4, "CT", "Chinese (T)", "繁体中文" }, { 22, 16, "AR", "Arabic", "ﺔﻴﺑﺮﻌﻟا" }, { 23, 4, "XX", "Other", "Other" } }; uint8_t padLYstick=0, padLXstick=0, padRYstick=0, padRXstick=0; double mouseX=0.5f, mouseY=0.5f, mouseYD=0.0000f, mouseXD=0.0000f, mouseYDR=0.0000f, mouseXDR=0.0000f, mouseYDL=0.0000f, mouseXDL=0.0000f; uint8_t xDZ=30, yDZ=30; uint8_t xDZa=30, yDZa=30; float offY=0.0f, BoffY=0.0f, offX=0.0f, incZ=0.7f, BoffX=0.0f, slideX=0.0f; static void *host_addr; static uint32_t syscall35(const char *srcpath, const char *dstpath); static void syscall_mount(const char *path, int mountbdvd); int load_texture(u8 *data, char *name, uint16_t dw); time_t rawtime; struct tm * timeinfo; int xmb_bg_show=0; int xmb_bg_counter=200; #define MAX_STARS 128 typedef struct { u16 x; u16 y; u8 bri; u8 size; } stars_def; stars_def stars[MAX_STARS]; #define XMB_TEXT_WIDTH 912 #define XMB_TEXT_HEIGHT 74 #define MAX_XMB_TEXTS (1920 * 1080 * 2) / (XMB_TEXT_WIDTH * XMB_TEXT_HEIGHT) typedef struct __xmbtexts { bool used; u8 *data; //pointer to image } xmbtexts __attribute__((aligned(8))); xmbtexts xmb_txt_buf[MAX_XMB_TEXTS]; int xmb_txt_buf_max=0; #define XMB_THUMB_WIDTH 408 #define XMB_THUMB_HEIGHT 408 #define MAX_XMB_THUMBS (1920 * 1080 * 3) / (XMB_THUMB_WIDTH * XMB_THUMB_HEIGHT) typedef struct { int used; int column; u8 *data; //pointer to image } xmbthumbs; xmbthumbs xmb_icon_buf[MAX_XMB_THUMBS]; int xmb_icon_buf_max=0; #define MAX_XMB_OPTIONS 12 typedef struct { // u8 type; //0-list 1-text char label[32]; char value[4]; } xmbopt; //sys_addr_t vm; //pointer to virtual memory #define MAX_XMB_MEMBERS 2560 typedef struct __xmbmem { u8 type; //0 unkn, 1 ps3 game, 2 AVCHD/Blu-ray video from gamelist, 3 showtime vid, 4 music, 5 photo, 6 function, 7 setting, 8 snes rom, 9 fceu rom, 10 vba rom, 11 genp rom, 12 fbanext u8 status; //0 idle, 1 loading, 2 loaded bool is_checked; int game_id; //pointer to menu_list[id] u8 game_split; u32 game_user_flags; char name[128]; char subname[96]; u8 option_size; u8 option_selected; char optionini[20]; xmbopt option[MAX_XMB_OPTIONS]; int data; //pointer to text image (xmbtexts) xmb_txt_buf int icon_buf; u8 *icon; //pointer to icon image u16 iconw; u16 iconh; char file_path[256]; //path to entry file char icon_path[128]; //path to entry icon } xmbmem __attribute__((aligned(16))); #define MAX_XMB_ICONS 10 typedef struct { u8 init; u16 size; u16 first; u8 *data; char name[32]; u8 group; // Bits 0-4: for genre/emulators: genres/retro_groups // Bits 7-5: for alphabetic grouping (alpha_groups) xmbmem member[MAX_XMB_MEMBERS]; } xmb_def; xmb_def xmb[MAX_XMB_ICONS]; //xmb[0] can be used as temp column when doing grouping u8 xmb_icon=6; //1 home, 2 settings, 3 photo, 4 music, 5 video, 6 game, 7 faves, 8 retro, 9 web u8 xmb_icon_last=6; u16 xmb_icon_last_first=0; int xmb_slide=0; int xmb_slide_y=0; int xmb_slide_step=0; int xmb_slide_step_y=0; u8 xmb_sublevel=0; #define MAX_WWW_THEMES 128 typedef struct { u8 type; char name[64]; char pkg[128]; char img[128]; char author[32]; char mmver[16]; char info[64]; } theme_def; theme_def www_theme[MAX_WWW_THEMES]; u8 max_theme=0; int open_theme_menu(char *_caption, int _width, theme_def *list, int _max, int _x, int _y, int _max_entries, int _centered); void draw_xmb_icons(xmb_def *_xmb, const int _xmb_icon, int _xmb_x_offset, int _xmb_y_offset, const bool _recursive, int sub_level); void draw_coverflow_icons(xmb_def *_xmb, const int _xmb_icon_, int __xmb_y_offset); void add_home_column(); void mod_xmb_member(xmbmem *_member, u16 _size, char *_name, char *_subname); #define MAX_DOWN_LIST (128) //queue for background downloads typedef struct { u8 status; char url[512]; char local[512]; } downqueue; downqueue downloads[MAX_DOWN_LIST]; int downloads_max=0; /* #define MAX_MSG (128) //queue for pop-up messages typedef struct { u8 status; char line1[64]; char line2[64]; char line3[64]; } msgqueue; msgqueue message[MAX_MSG]; int max_message=0; */ #define MAX_MP3 1024//MAX_XMB_MEMBERS typedef struct { char path[512]; // u64 size; // u64 pos; } mp3_playlist_type; mp3_playlist_type mp3_playlist[MAX_MP3]; int max_mp3=0; int current_mp3=0; char *tmhour(int _hour) { int th=_hour; if(time_format) th=_hour;//sprintf(time_result, "%2d", _hour); else { if(_hour>11) th=_hour-12; if(!th) th=12; } sprintf(time_result, "%2d", th); return time_result; } void set_xo() { if(confirm_with_x) { BUTTON_CROSS = _BUTTON_CROSS; //(1<<12) BUTTON_CIRCLE= _BUTTON_CIRCLE; //(1<<13) dox_cross_x=15; dox_cross_y=14; dox_cross_w=34; dox_cross_h=34; dox_circle_x=207; dox_circle_y=14; dox_circle_w=34; dox_circle_h=34; } else { BUTTON_CROSS = _BUTTON_CIRCLE; BUTTON_CIRCLE= _BUTTON_CROSS; dox_circle_x=15; dox_circle_y=14; dox_circle_w=34; dox_circle_h=34; dox_cross_x=207; dox_cross_y=14; dox_cross_w=34; dox_cross_h=34; } } /*****************************************************/ /* DIALOG */ /*****************************************************/ #define CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_OFF (0<<7) #define CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_ON (1<<7) #define CELL_MSGDIALOG_TYPE_PROGRESSBAR_DOUBLE (2<<12) volatile int no_video=0; int osk_dialog=0; int osk_open=0; volatile int dialog_ret=0; u32 type_dialog_yes_no = CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL | CELL_MSGDIALOG_TYPE_BG_VISIBLE | CELL_MSGDIALOG_TYPE_BUTTON_TYPE_YESNO | CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_OFF | CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NO; u32 type_dialog_yes_back = CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL | CELL_MSGDIALOG_TYPE_BG_VISIBLE | CELL_MSGDIALOG_TYPE_BUTTON_TYPE_OK | CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_OFF | CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_OK; u32 type_dialog_ok = CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL | CELL_MSGDIALOG_TYPE_BG_VISIBLE | CELL_MSGDIALOG_TYPE_BUTTON_TYPE_OK | CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_ON| CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_OK; u32 type_dialog_no = CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL | CELL_MSGDIALOG_TYPE_BG_VISIBLE | CELL_MSGDIALOG_TYPE_BUTTON_TYPE_NONE | CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_ON; u32 type_dialog_back = CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL | CELL_MSGDIALOG_TYPE_BG_VISIBLE | CELL_MSGDIALOG_TYPE_BUTTON_TYPE_NONE | CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_OFF; static void dialog_fun1( int button_type, void * ) { switch ( button_type ) { case CELL_MSGDIALOG_BUTTON_YES: dialog_ret=1; break; case CELL_MSGDIALOG_BUTTON_NO: // case CELL_MSGDIALOG_BUTTON_ESCAPE: case CELL_MSGDIALOG_BUTTON_NONE: dialog_ret=2; break; case CELL_MSGDIALOG_BUTTON_ESCAPE: dialog_ret=3; break; default: break; } } static void dialog_fun2( int button_type, void * ) { switch ( button_type ) { case CELL_MSGDIALOG_BUTTON_OK: // case CELL_MSGDIALOG_BUTTON_ESCAPE: case CELL_MSGDIALOG_BUTTON_NONE: dialog_ret=1; break; case CELL_MSGDIALOG_BUTTON_ESCAPE: dialog_ret=3; break; default: break; } } void ClearSurface() { cellGcmSetClearSurface(CELL_GCM_CLEAR_Z | CELL_GCM_CLEAR_R | CELL_GCM_CLEAR_G | CELL_GCM_CLEAR_B | CELL_GCM_CLEAR_A); } void wait_dialog() { while(!dialog_ret) { if(init_finished) { if(cover_mode==8) draw_whole_xmb(xmb_icon);//draw_xmb_bare(xmb_icon, 1, 0, 0); else if(cover_mode==5) { ClearSurface(); draw_fileman(); flip();sys_timer_usleep(1668);} else if(cover_mode>=0 && cover_mode<3 || cover_mode==6 || cover_mode==7) { ClearSurface(); set_texture( text_bmp, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); sys_timer_usleep(1668); flip(); } else if(cover_mode==4) { ClearSurface(); draw_coverflow_icons(xmb, xmb_icon, xmb_slide_y); sys_timer_usleep(1668); flip(); } else {flip();sys_timer_usleep(1668);} } else {flip();sys_timer_usleep(1668);} } cellMsgDialogClose(60.0f); setRenderColor(); } void wait_dialog_simple() { while(!dialog_ret) { sys_timer_usleep(1668); flip(); } cellMsgDialogClose(60.0f); setRenderColor(); } void load_localization(int id) { MM_LocaleSet(0); mui_font = locales[0].font_id; if(id) { char lfile[128]; sprintf(lfile, "%s/lang/LANG_%s.TXT", app_usrdir, locales[id].id); int llines = MM_LocaleInit ( lfile ); if(llines==STR_LAST_ID) { MM_LocaleSet (1); mui_font = locales[id].font_id; user_font = locales[id].font_id; } else { mm_locale=0; char errlang[512]; sprintf(errlang, "Localization file for %s (%s) language is missing or incomplete!\n\n%s: %i lines read, but %i expected!\n\nRestart multiMAN while holding L2+R2 for \"Debug Mode\" to generate LANG_DEFAULT.TXT\nwith all required localization labels.", locales[id].eng_name, locales[id].loc_name, lfile, llines, STR_LAST_ID); dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, errlang, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog_simple(); } } if (mui_font>4 && mui_font<10) mui_font+=5; for(int n=0; n<16; n++) sprintf(genre[n], "%s", (const char*)MM_STRING(210+n)); for(int n=0; n< 6; n++) sprintf(retro_groups[n], "%s", (const char*)MM_STRING(226+n)); sprintf(alpha_groups[14], "%s", (const char*)STR_OTHER); sprintf(xmb_columns[0], "Empty"); sprintf(xmb_columns[1], "multiMAN"); for(int n=2; n<8 ; n++) sprintf(xmb_columns[n], "%s", (const char*)MM_STRING(230+n)); // 232-237 sprintf(xmb_columns[8], "%s", (const char*)STR_GRP_RETRO); // Retro sprintf(xmb_columns[9], "%s", (const char*)MM_STRING(238)); // Web for(int n=0; n<MAX_XMB_ICONS ; n++) sprintf(xmb[n].name, "%s", xmb_columns[n]); } int exist(char *path) { struct stat p_stat; return (stat(path, &p_stat)>=0); } int exist_c(const char *path) { struct stat p_stat; return (stat(path, &p_stat)>=0); } int rndv(int maxval) { return (int) ((float)rand() * ((float)maxval / (float)RAND_MAX)); } #if (CELL_SDK_VERSION>0x210001) static void usbdev_init(int check) { FILE *fid; int vid, pid; DEV_INFO *usbdev; int32_t r; char usbcfg[128]; sprintf(usbcfg, "%s/USB.CFG", app_usrdir); fid = fopen(usbcfg, "r"); if (!fid) return; while (fscanf(fid, "%x:%x:%i", &vid, &pid, &max_usb_volumes) != EOF) { if ((usbdev = (DEV_INFO *)malloc(sizeof(DEV_INFO))) == NULL) break; if(check) { if ((r = PfsmDevAdd(vid, pid, &usbdev->dev))) { free(usbdev); } else { usbdev->next = dev_info; dev_info = usbdev; } } } fclose(fid); } static void usbdev_uninit(void) { DEV_INFO *usbdev; while ((usbdev = dev_info)) { dev_info = usbdev->next; PfsmDevDel(&usbdev->dev); free(usbdev); } } #endif void flipc(int _fc) { int flipF; for(flipF = 0; flipF<_fc; flipF++) { sys_timer_usleep(3336); flip(); } } void get_free_memory() { system_call_1(352, (uint64_t) &meminfo); } u32 new_pad=0, old_pad=0; uint8_t old_status=0; uint8_t old_status_k=0; int pad_num=0; static u32 old_info[7]; static int pad_read( void ) { ss_timer=(time(NULL)-ss_timer_last); int ret; u32 padd; u32 dev_type=0; static CellPadData databuf; static CellMouseInfo Info; static CellMouseData Data; static CellKbInfo info; static CellKbData kdata; float mouse_speed=0.001f; uint32_t old_info_m = 0; uint32_t old_info_k = 0; u16 padSensorX; u16 padSensorY; u16 padSensorG; //check for keyboard input if(cellKbSetReadMode (0, CELL_KB_RMODE_INPUTCHAR) != CELL_KB_OK) goto read_mouse; if(cellKbSetCodeType (0, CELL_KB_CODETYPE_ASCII) != CELL_KB_OK) goto read_mouse; if(cellKbGetInfo (&info) != CELL_KB_OK) goto read_mouse; if((info.info & CELL_KB_INFO_INTERCEPTED) && (!(old_info_k & CELL_KB_INFO_INTERCEPTED))){ old_info_k = info.info; }else if((!(info.info & CELL_KB_INFO_INTERCEPTED)) && (old_info_k & CELL_KB_INFO_INTERCEPTED)){ old_info_k = info.info; } if (info.status[0] == CELL_KB_STATUS_DISCONNECTED) goto read_mouse; if (cellKbRead (0, &kdata)!=CELL_KB_OK) goto read_mouse; if (kdata.len == 0) goto read_mouse; // sprintf(mouseInfo, "Keyboard: Buttons : %02X %c", kdata.keycode[0], kdata.keycode[0]); old_status_k = info.status[0]; padd = 0; if(kdata.keycode[0]>0x2f && kdata.keycode[0]<0x37) pad_num=kdata.keycode[0]-0x30; //0-6 switch pad port if(kdata.keycode[0]>0x8039 && kdata.keycode[0]<0x8040 && cover_mode!=5) //F1-F6 switch cover mode { cover_mode=kdata.keycode[0]-0x803a; old_fi=0; old_fi=-1; counter_png=0; goto pad_out; } if(cover_mode==5) { if(kdata.keycode[0]==0x8049 || kdata.keycode[0]==0xC049) padd = (1<<11); //INS= R1 else if(kdata.keycode[0]==0x803b) padd = padd | (1<<14)|(1<<0); //F2= select+x else if(kdata.keycode[0]==0x0009) padd = padd | (1<<10); //TAB= L1 else if(kdata.keycode[0]==0xC050) mouseX-=0.02f; //LEFT (NUM BLOCK) else if(kdata.keycode[0]==0xC04F) mouseX+=0.02f; //RIGHT else if(kdata.keycode[0]==0xC052) mouseY-=0.02f; //UP else if(kdata.keycode[0]==0xC051) mouseY+=0.02f; //DOWN else if(kdata.keycode[0]==0x78 || kdata.keycode[0]==0x58) padd = padd | (1<<13) | (1<<0); //x = select+circle / move else if(kdata.keycode[0]==0x76 || kdata.keycode[0]==0x56) padd = padd | (1<<2); //v = R3 / HEX view else if(kdata.keycode[0]==0xC04B) padd = padd | (1<<8); //PGUP->L2 else if(kdata.keycode[0]==0xC04E) padd = padd | (1<<9); //PGDN->R2 } if(kdata.keycode[0]==0x8050) padd = padd | (1<<7); //LEFT else if(kdata.keycode[0]==0x804F) padd = padd | (1<<5); //RIGHT else if(kdata.keycode[0]==0x8052) padd = padd | (1<<4); //UP else if(kdata.keycode[0]==0x8051) padd = padd | (1<<6); //DOWN else if(kdata.keycode[0]==0x804B) padd = padd | (1<<7); //PGUP->LEFT else if(kdata.keycode[0]==0x804E) padd = padd | (1<<5); //PGDN->RIGHT else if(kdata.keycode[0]==0x804C || kdata.keycode[0]==0xC04C) padd = padd | (1<<15); //DEL else if(kdata.keycode[0]==0x400A || kdata.keycode[0]==0x000A) padd = padd | (1<<14); //ENTER else if(kdata.keycode[0]==0x8029) padd = padd | (1<<12); //ESC->TRIANGLE else if(kdata.keycode[0]==0x402b) padd = padd | (1<<3) | (1<<4); //NUM+ = START-UP else if(kdata.keycode[0]==0x402d) padd = padd | (1<<3) | (1<<6); //NUM- = START-DOWN else if(kdata.keycode[0]==0x402f) padd = padd | (1<<3) | (1<<7); // / = START-left else if(kdata.keycode[0]==0x402a) padd = padd | (1<<3) | (1<<5); // *- = START-right else if(kdata.keycode[0]==0x8044) padd = padd | (1<<0) | (1<<10); //F11 = SELECT+L1 else if(kdata.keycode[0]==0x8045 || kdata.keycode[0]==0x0009) padd = padd | (1<<10); //F12 = L1 else if(kdata.keycode[0]==0x8043) padd = padd | (1<<2); //F10 = R3 else if(kdata.keycode[0]==0x8042) padd = padd | (1<<9); //F9 = R2 else if(kdata.keycode[0]==0x8041) padd = padd | (1<<11); //F8 = R1 else if(kdata.keycode[0]==0x8040 || kdata.keycode[0]==0x8039) padd = padd | (1<<1); //F7 = L3 else if(kdata.keycode[0]==0x43 || kdata.keycode[0]==0x63) padd = padd | (1<<13); //c = circle / copy goto pad_out; // check for mouse input read_mouse: ret = cellMouseGetInfo (&Info); if((Info.info & CELL_MOUSE_INFO_INTERCEPTED) && (!(old_info_m & CELL_MOUSE_INFO_INTERCEPTED))){ old_info_m = Info.info; }else if((!(Info.info & CELL_MOUSE_INFO_INTERCEPTED)) && (old_info_m & CELL_MOUSE_INFO_INTERCEPTED)){ old_info_m = Info.info; } if (Info.status[0] == CELL_MOUSE_STATUS_DISCONNECTED) goto read_pad; ret = cellMouseGetData (0, &Data); if (CELL_OK != ret) goto read_pad; if (Data.update != CELL_MOUSE_DATA_UPDATE) goto read_pad; // sprintf(mouseInfo, "Buttons : %02X | x-axis : %d | y-axis : %d | Wheel : %d | Tilt : %d ", Data.buttons, Data.x_axis, Data.y_axis, Data.wheel, Data.tilt); old_status = Info.status[0]; padd= ((Data.buttons & 1)<<14) | ((Data.buttons & 2)<<12); //LEFT=X / RIGHT=CIRCLE padd = padd | ( (Data.buttons & 4)<<8); //WHEEL=L1 if(Data.x_axis<-1 || Data.x_axis> 1) mouseX+= Data.x_axis*mouse_speed; if(Data.y_axis<-1 || Data.y_axis> 1) mouseY+= Data.y_axis*mouse_speed; if(cover_mode!=4) { if(Data.wheel>0) padd = padd | (1<<4); if(Data.wheel<0) padd = padd | (1<<6); } else { if(Data.wheel>0) padd = padd | (1<<7); if(Data.wheel<0) padd = padd | (1<<5); } if(cover_mode!=5) { if(Data.x_axis>10) padd = padd | (1<<5); if(Data.x_axis<-10) padd = padd | (1<<7); if(Data.y_axis>10) padd = padd | (1<<6); if(Data.y_axis<-10) padd = padd | (1<<4); } mouseYD=0.0f; mouseXD=0.0f; mouseYDL=0.0f; mouseXDL=0.0f; mouseYDR=0.0f; mouseXDR=0.0f; mouseXD=0; mouseYD=0; cellMouseClearBuf(0); goto pad_out; read_pad: CellPadInfo2 infobuf; if ( cellPadGetInfo2(&infobuf) != 0 ) { old_pad = new_pad = 0; return 1; } //pad_num++; //if(pad_num>6) pad_num=0; for(pad_num=0;pad_num<7;pad_num++) if ( infobuf.port_status[pad_num] == CELL_PAD_STATUS_CONNECTED ) {goto pad_ok;} old_pad = new_pad = 0; return 1; pad_ok: if((infobuf.system_info & CELL_PAD_INFO_INTERCEPTED) && (!(old_info[pad_num] & CELL_PAD_INFO_INTERCEPTED))) { old_info[pad_num] = infobuf.system_info; } else if((!(infobuf.system_info & CELL_PAD_INFO_INTERCEPTED)) && (old_info[pad_num] & CELL_PAD_INFO_INTERCEPTED)) { old_info[pad_num] = infobuf.system_info; old_pad = new_pad = 0; goto pad_repeat; } if (cellPadGetDataExtra( pad_num, &dev_type, &databuf ) != CELL_PAD_OK) { old_pad=new_pad = 0; return 1; } if (databuf.len == 0) { new_pad = 0; goto pad_repeat; } padd = ( databuf.button[2] | ( databuf.button[3] << 8 ) ); //digital buttons padRXstick = databuf.button[4]; // right stick padRYstick = databuf.button[5]; padLXstick = databuf.button[6]; // left stick padLYstick = databuf.button[7]; if(use_pad_sensor) { cellPadSetPortSetting( pad_num, CELL_PAD_SETTING_SENSOR_ON); //CELL_PAD_SETTING_PRESS_ON | padSensorX = databuf.button[20]; padSensorY = databuf.button[21]; padSensorG = databuf.button[23]; if(padSensorX>404 && padSensorX<424) padd|=BUTTON_L1; if(padSensorX>620 && padSensorY<640) padd|=BUTTON_R1; } else cellPadSetPortSetting( pad_num, 0); if(debug_mode) { get_free_memory(); sprintf(status_info, "%i %i %i %i (MEM: %.f) %s", databuf.button[20], databuf.button[21], databuf.button[22], databuf.button[23], (double) (meminfo.avail/1024.0f), STR_DEBUG_MODE); } //sprintf(www_info, "--- %i %i ", databuf.len, pad_num); if(dev_type==CELL_PAD_DEV_TYPE_BD_REMOCON) { if(databuf.button[25]==0x0b || databuf.button[25]==0x32) padd|=(1 << 14); //map BD remote [enter] and [play] to [X] else if(databuf.button[25]==0x38) padd|=BUTTON_START | BUTTON_SQUARE; //stop_mp3(5); else if(databuf.button[25]==0x30) padd|=BUTTON_START | BUTTON_LEFT; //prev_mp3(); else if(databuf.button[25]==0x31) padd|=BUTTON_START | BUTTON_RIGHT; //next_mp3(); else if(databuf.button[25]==0x80) padd|=BUTTON_START | BUTTON_SELECT; //BLUE button -> file manager else if(databuf.button[25]==0x82) padd|=BUTTON_L2 | BUTTON_R2; //GREEN -> screensaver else if(databuf.button[25]==0x60) padd|=BUTTON_START | BUTTON_DOWN; //SLOW REV button -> decrease volume else if(databuf.button[25]==0x61) padd|=BUTTON_START | BUTTON_UP; //SLOW FWD button -> increase volume else if(databuf.button[25]==0x39) padd|=BUTTON_PAUSE; } if(cover_mode!=5 && !use_analog) { if(padLYstick<2) padd=padd | BUTTON_UP; if(padLYstick>253) padd=padd | BUTTON_DOWN; if(padLXstick<2) padd=padd | BUTTON_LEFT; if(padLXstick>253) padd=padd | BUTTON_RIGHT; if(padRYstick<2) padd=padd | BUTTON_UP; if(padRYstick>253) padd=padd | BUTTON_DOWN; if(padRXstick<2) padd=padd | BUTTON_LEFT; if(padRXstick>253) padd=padd | BUTTON_RIGHT; } mouseYD=0.0f; mouseXD=0.0f; mouseYDL=0.0f; mouseXDL=0.0f; mouseYDR=0.0f; mouseXDR=0.0f; //deadzone: x=100 y=156 (28 / 10%) if(padRXstick<=(128-xDZa)){ mouseXD=(float)(((padRXstick+xDZa-128.0f))/11000.0f);//*(1.f-overscan); mouseXDR=mouseXD;} if(padRXstick>=(128+xDZa)){ mouseXD=(float)(((padRXstick-xDZa-128.0f))/11000.0f);//*(1.f-overscan); mouseXDR=mouseXD;} if(padRYstick<=(128-yDZa)){ mouseYD=(float)(((padRYstick+yDZa-128.0f))/11000.0f);//*(1.f-overscan); mouseYDR=mouseYD;} if(padRYstick>=(128+yDZa)){ mouseYD=(float)(((padRYstick-yDZa-128.0f))/11000.0f);//*(1.f-overscan); mouseYDR=mouseYD;} if(padLXstick<=(128-xDZa)){ mouseXD=(float)(((padLXstick+xDZa-128.0f))/11000.0f);//*(1.f-overscan); mouseXDL=mouseXD;} if(padLXstick>=(128+xDZa)){ mouseXD=(float)(((padLXstick-xDZa-128.0f))/11000.0f);//*(1.f-overscan); mouseXDL=mouseXD;} if(padLYstick<=(128-yDZa)){ mouseYD=(float)(((padLYstick+yDZa-128.0f))/11000.0f);//*(1.f-overscan); mouseYDL=mouseYD;} if(padLYstick>=(128+yDZa)){ mouseYD=(float)(((padLYstick-yDZa-128.0f))/11000.0f);//*(1.f-overscan); mouseYDL=mouseYD;} pad_out: new_pad=padd & (~old_pad); old_pad= padd; if(new_pad==0 && old_pad==0) goto pad_repeat; c_opacity_delta=16; dimc=0; dim=1; b_box_opaq= 0xfe; b_box_step= -4; ss_timer=(time(NULL)-ss_timer_last); ss_timer_last=time(NULL); pad_repeat: key_repeat=0; if(new_pad==0 && old_pad!=0) { repeat_counter1--; if(repeat_counter1<=0) { repeat_counter1=0; repeat_counter2--; if(repeat_counter2<=0) { if(repeat_counter3_inc<3.f) repeat_counter3_inc+=0.02f; repeat_counter3+=(int)repeat_counter3_inc; repeat_counter2=repeat_key_delay; new_pad=old_pad; ss_timer=0; ss_timer_last=time(NULL); xmb_bg_counter=200; } key_repeat=1; } } else { repeat_counter1=repeat_init_delay; repeat_counter2=repeat_key_delay; repeat_counter3=1; repeat_counter3_inc=0.f; } // sprintf(www_info, "%i %i %i %i %i", new_pad, old_pad, repeat_counter1, repeat_counter2, key_repeat); return 1; } void screen_saver() { pad_read(); c_opacity_delta=0; new_pad=0; old_pad=0; int initial_skip=0; int www_running_old=www_running; if(use_drops) { sprintf(auraBG, "%s/DROPS.PNG", app_usrdir); if(exist(auraBG)) load_png_texture(text_DROPS, auraBG, 256); else use_drops=false; } while(1) { ss_timer=0; ss_timer_last=time(NULL); ClearSurface(); if(use_drops) set_texture(text_DROPS, 256, 256); for(int n=0; n<MAX_STARS; n++) { int move_star= rndv(10); if(use_drops) { display_img(stars[n].x, stars[n].y, 256, 256, 256, 256, 0.85f, 256, 256); if(move_star>4) {stars[n].y+=24; } else {stars[n].y+=16; } if(stars[n].x>1919 || stars[n].y>1079 || stars[n].x<1 || stars[n].y<1 || stars[n].bri<4) { stars[n].x=rndv(1920); stars[n].y=rndv(256); stars[n].bri=rndv(200); stars[n].size=rndv(XMB_SPARK_SIZE)+1; } } else { draw_square(((float)stars[n].x/1920.0f-0.5f)*2.0f, (0.5f-(float)stars[n].y/1080.0f)*2.0f, (stars[n].size/1920.f), (stars[n].size/1080.f), 0.0f, (0xffffff00 | stars[n].bri)); if(move_star>4) {stars[n].x++; } else {stars[n].x--; } if(move_star>3) {stars[n].y++; } if(move_star==2) {stars[n].y--; } if(move_star>7) stars[n].bri-=4; if(stars[n].x>1919 || stars[n].y>1079 || stars[n].x<1 || stars[n].y<1 || stars[n].bri<4) { stars[n].x=rndv(1920); stars[n].y=rndv(1080); stars[n].bri=rndv(200); stars[n].size=rndv(XMB_SPARK_SIZE)+1; } } } setRenderColor(); flip(); sys_timer_usleep(3336); initial_skip++; new_pad=0; old_pad=0; pad_read(); if (( (new_pad || old_pad) && initial_skip>150) || www_running!=www_running_old) {// || c_opacity_delta==16 new_pad=0; break; } } state_draw=1; c_opacity=0xff; c_opacity2=0xff; } void slide_screen_left(uint8_t *buffer) { int slide; for(slide=0;slide>-2048;slide-=128) { ClearSurface(); set_texture( buffer, 1920, 1080); display_img((int)slide, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); setRenderColor(); flip(); } max_ttf_label=0; memset(buffer, 0, FB(1)); //0x505050 print_label_ex( 0.5f, 0.50f, 1.0f, 0xffffffff, (char*)STR_PLEASE_WAIT, 1.04f, 0.0f, mui_font, 1.0f, 1.0f, 1); flush_ttf(buffer, 1920, 1080); ClearSurface(); set_texture( buffer, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); setRenderColor(); flip(); } void slide_screen_right(uint8_t *buffer) { int slide; for(slide=0;slide<2048;slide+=128) { ClearSurface(); set_texture( buffer, 1920, 1080); display_img((int)slide, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); setRenderColor(); flip(); // new_pad=0; old_pad=0; // pad_read(); // if ( (new_pad || old_pad || c_opacity_delta==16)) { new_pad=0; old_pad=0; break;} } max_ttf_label=0; memset(buffer, 0, FB(1)); print_label_ex( 0.5f, 0.50f, 1.0f, 0xffffffff, (char*)STR_PLEASE_WAIT, 1.04f, 0.0f, mui_font, 1.0f, 1.0f, 1); flush_ttf(buffer, 1920, 1080); ClearSurface(); set_texture( buffer, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); setRenderColor(); flip(); } int net_used_ignore() { if(ftp_clients==0) return 1; int t_dialog_ret=dialog_ret; dialog_ret=0; cellMsgDialogAbort(); cellMsgDialogOpen2(type_dialog_yes_no, (const char*) STR_WARN_FTP, dialog_fun1, (void *) 0x0000aaaa, NULL); wait_dialog(); if(dialog_ret==1) {dialog_ret=t_dialog_ret; return 1;} dialog_ret=t_dialog_ret; return 0; } bool is_video(char *vfile) { if((strstr(vfile, ".M2TS")!=NULL || strstr(vfile, ".m2ts")!=NULL || strstr(vfile, ".DIVX")!=NULL || strstr(vfile, ".divx")!=NULL || strstr(vfile, ".AVI")!=NULL || strstr(vfile, ".avi")!=NULL || strstr(vfile, ".MTS")!=NULL || strstr(vfile, ".mts")!=NULL || strstr(vfile, ".MPG")!=NULL || strstr(vfile, ".mpg")!=NULL || strstr(vfile, ".MPEG")!=NULL || strstr(vfile, ".mpeg")!=NULL || strstr(vfile, ".MKV")!=NULL || strstr(vfile, ".mkv")!=NULL || strstr(vfile, ".MP4")!=NULL || strstr(vfile, ".mp4")!=NULL || strstr(vfile, ".VOB")!=NULL || strstr(vfile, ".vob")!=NULL || strstr(vfile, ".WMV")!=NULL || strstr(vfile, ".wmv")!=NULL || strstr(vfile, ".FLV")!=NULL || strstr(vfile, ".flv")!=NULL || strstr(vfile, ".MOV")!=NULL || strstr(vfile, ".mov")!=NULL || strstr(vfile, ".M2V")!=NULL || strstr(vfile, ".m2v")!=NULL || strstr(vfile, ".BIK")!=NULL || strstr(vfile, ".bik")!=NULL || strstr(vfile, ".BINK")!=NULL || strstr(vfile, ".bink")!=NULL || strstr(vfile, ".264")!=NULL || strstr(vfile, ".h264")!=NULL) && (strstr(vfile, ".jpg")==NULL && strstr(vfile, ".JPG")==NULL) ) return true; else return false; } bool is_snes9x(char *rom) { if( (strstr(rom, ".smc")!=NULL || strstr(rom, ".SMC")!=NULL || strstr(rom, ".sfc")!=NULL || strstr(rom, ".SFC")!=NULL || strstr(rom, ".fig")!=NULL || strstr(rom, ".FIG")!=NULL || strstr(rom, ".gd3")!=NULL || strstr(rom, ".GD3")!=NULL || strstr(rom, ".gd7")!=NULL || strstr(rom, ".GD7")!=NULL || strstr(rom, ".dx2")!=NULL || strstr(rom, ".DX2")!=NULL || strstr(rom, ".bsx")!=NULL || strstr(rom, ".BSX")!=NULL || strstr(rom, ".swc")!=NULL || strstr(rom, ".SWC")!=NULL || ( (strstr(rom, ".zip")!=NULL || strstr(rom, ".ZIP")!=NULL) && (strstr(rom, "/ROMS/snes/")!=NULL || strstr(rom, snes_roms)!=NULL) ) || strstr(rom, ".jma")!=NULL || strstr(rom, ".JMA")!=NULL) && strstr(rom, ".jpg")==NULL && strstr(rom, ".JPG")==NULL) return true; else return false; } void launch_snes_emu(char *rom) { if(!net_used_ignore()) return; if(!exist(snes_self)) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*)STR_WARN_SNES, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); return; } char* launchargv[2]; memset(launchargv, 0, sizeof(launchargv)); int len = strlen(rom); launchargv[0] = (char*)malloc(len + 1); strcpy(launchargv[0], rom); launchargv[1] = (char*)malloc(len + 1); strcpy(launchargv[1], rom); unload_modules(); sys_game_process_exitspawn2((char*)snes_self, (const char**)launchargv, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_512K); } bool is_genp(char *rom) { if( ( ( (strstr(rom, ".bin")!=NULL || strstr(rom, ".BIN")!=NULL) && (strstr(rom, "/ROMS/gen/")!=NULL || strstr(rom, genp_roms)!=NULL)) || strstr(rom, ".smd")!=NULL || strstr(rom, ".SMD")!=NULL || strstr(rom, ".md")!=NULL || strstr(rom, ".MD")!=NULL || strstr(rom, ".sms")!=NULL || strstr(rom, ".SMS")!=NULL || ( (strstr(rom, ".zip")!=NULL || strstr(rom, ".ZIP")!=NULL) && (strstr(rom, "/ROMS/gen/")!=NULL || strstr(rom, genp_roms)!=NULL) ) || strstr(rom, ".gen")!=NULL || strstr(rom, ".GEN")!=NULL) && strstr(rom, ".jpg")==NULL && strstr(rom, ".JPG")==NULL) return true; else return false; } bool is_fceu(char *rom) { if( (strstr(rom, ".nes")!=NULL || strstr(rom, ".NES")!=NULL || ( (strstr(rom, ".zip")!=NULL || strstr(rom, ".ZIP")!=NULL) && (strstr(rom, "/ROMS/fceu/")!=NULL || strstr(rom, fceu_roms)!=NULL) ) || strstr(rom, ".fds")!=NULL || strstr(rom, ".FDS")!=NULL || strstr(rom, ".unif")!=NULL || strstr(rom, ".UNIF")!=NULL) && strstr(rom, ".jpg")==NULL && strstr(rom, ".JPG")==NULL) return true; else return false; } bool is_vba(char *rom) { if( (strstr(rom, ".gba")!=NULL || strstr(rom, ".GBA")!=NULL || strstr(rom, ".gbc")!=NULL || strstr(rom, ".GBC")!=NULL || ( (strstr(rom, ".zip")!=NULL || strstr(rom, ".ZIP")!=NULL) && (strstr(rom, "/ROMS/vba/")!=NULL || strstr(rom, vba_roms)!=NULL) ) || strstr(rom, ".gb")!=NULL || strstr(rom, ".GB")!=NULL) && strstr(rom, ".jpg")==NULL && strstr(rom, ".JPG")==NULL) return true; else return false; } bool is_fba(char *rom) { if( (strstr(rom, ".")==NULL || ( (strstr(rom, ".zip")!=NULL || strstr(rom, ".ZIP")!=NULL) && (strstr(rom, "/ROMS/fba/")!=NULL || strstr(rom, fba_roms)!=NULL) ) ) ) return true; else return false; } void launch_genp_emu(char *rom) { if(!net_used_ignore()) return; if(!exist(genp_self)) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*)STR_WARN_GEN, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); return; } char* launchargv[2]; memset(launchargv, 0, sizeof(launchargv)); int len = strlen(rom); launchargv[0] = (char*)malloc(len + 1); strcpy(launchargv[0], rom); launchargv[1] = (char*)malloc(len + 1); strcpy(launchargv[1], rom); unload_modules(); sys_game_process_exitspawn2((char*)genp_self, (const char**)launchargv, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_512K); } void launch_fceu_emu(char *rom) { if(!net_used_ignore()) return; if(!exist(fceu_self)) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_WARN_FCEU, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); return; } char* launchargv[2]; memset(launchargv, 0, sizeof(launchargv)); int len = strlen(rom); launchargv[0] = (char*)malloc(len + 1); strcpy(launchargv[0], rom); launchargv[1] = (char*)malloc(len + 1); strcpy(launchargv[1], rom); unload_modules(); sys_game_process_exitspawn2((char*)fceu_self, (const char**)launchargv, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_512K); } void launch_vba_emu(char *rom) { if(!net_used_ignore()) return; if(!exist(vba_self)) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_WARN_VBA, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); return; } char* launchargv[2]; memset(launchargv, 0, sizeof(launchargv)); int len = strlen(rom); launchargv[0] = (char*)malloc(len + 1); strcpy(launchargv[0], rom); launchargv[1] = (char*)malloc(len + 1); strcpy(launchargv[1], rom); unload_modules(); sys_game_process_exitspawn2((char*)vba_self, (const char**)launchargv, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_512K); } void launch_fba_emu(char *rom) { if(!net_used_ignore()) return; if(!exist(fba_self)) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_WARN_FBA, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); return; } char* launchargv[2]; memset(launchargv, 0, sizeof(launchargv)); int len = strlen(rom); launchargv[0] = (char*)malloc(len + 1); strcpy(launchargv[0], rom); launchargv[1] = (char*)malloc(len + 1); strcpy(launchargv[1], rom); unload_modules(); sys_game_process_exitspawn2((char*)fba_self, (const char**)launchargv, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_512K); } void get_game_flags(int _game_sel) { menu_list[_game_sel].user=0; if(!exist(menu_list[_game_sel].path)) return; FILE *flist; char game_opts[512]; char tmpid[9]; sprintf(game_opts, "%s/PS3_GAME/PS3GAME.INI", menu_list[_game_sel].path); flist = fopen(game_opts, "rb"); if ( flist != NULL ) { fread((char*) &tmpid, 8, 1, flist); if(strstr(tmpid, GAME_INI_VER)!=NULL) { fseek(flist, 8, SEEK_SET); fread((char*) &menu_list[_game_sel].user, sizeof(menu_list[_game_sel].user), 1, flist); fclose(flist); goto quit_with_ok; } fclose(flist); } quit_with_ok: sprintf(game_opts, "%s/PS3_GAME/PS3DATA.BIN", menu_list[_game_sel].path); if(exist(game_opts)) { remove(game_opts); menu_list[_game_sel].user|= IS_BDMIRROR | IS_USB; } return; } int set_game_flags(int _game_sel) { char game_opts[512]; sprintf(game_opts, "%s/PS3_GAME", menu_list[_game_sel].path); if(!exist(game_opts) || strstr(game_opts, "/dev_bdvd")!=NULL || strstr(game_opts, "/pvd_usb")!=NULL) return 0; sprintf(game_opts, "%s/PS3_GAME/PS3GAME.INI", menu_list[_game_sel].path); FILE *flist; remove(game_opts); flist = fopen(game_opts, "wb"); if ( flist != NULL ) { fwrite( GAME_INI_VER, 8, 1, flist); fwrite( (char*) &menu_list[_game_sel].user, sizeof(menu_list[_game_sel].user), 1, flist); fclose(flist); } return 1; } /****************************************************/ /* FTP SECTION */ /****************************************************/ void ftp_handler(CellFtpServiceEvent event, void * /*data*/, size_t /*datalen*/) { switch(event) { case CELL_FTP_SERVICE_EVENT_SHUTDOWN: case CELL_FTP_SERVICE_EVENT_FATAL: case CELL_FTP_SERVICE_EVENT_STOPPED: ftp_service=0; ftp_clients=0; break; case CELL_FTP_SERVICE_EVENT_CLIENT_CONNECTED: ftp_clients++; break; case CELL_FTP_SERVICE_EVENT_CLIENT_DISCONNECTED: ftp_clients--; break; default: break; } } void ftp_on() { if(ftp_service) return; if(cellFtpServiceRegisterHandler(ftp_handler)>=0) { cellFtpServiceStart(); ftp_service=1; } } void ftp_off() { if(!ftp_service) return; uint64_t result; cellFtpServiceStop(&result); cellFtpServiceUnregisterHandler(); ftp_service=0; ftp_clients=0; } /* #if (CELL_SDK_VERSION>0x210001) #else void ftp_on() { ftp_service=0; } void ftp_off() { ftp_service=0; } #endif */ #define SOCKET_BUF_SIZE_RCV (384 * 1024) #define SOCKET_BUF_SIZE_SND ( 1 * 1024) #define REQUEST_GET2 "\r\n\r\n" // command: DIR GET INF //ret = network_com("GET", "10.20.2.208", 11222, "/", "/dev_hdd0/GAMES/down_test.bin", 3); void net_folder_copy(char *path, char *path_new, char *path_name) { FILE *fp; del_temp(app_temp); int n=0, foundslash=0, t_files, t_folders; uint64_t copy_folder_bytes=0; uint64_t global_folder_bytes=0; char net_host_file[512], net_host_file2[512];//, tempname2[512]; char net_path_bare[512], title[512], date2[10], timeF[8], type[1], net_path[512], parent[512]; char path2[1024], path3[1024], path4[1024], path_relative[512]; char temp[3], length[128], tempname2[128]; char cpath[1024], cpath2[1024], tempname[1024]; int chost=0; int pl=0, pr=0; int len; int ret; int optval; unsigned int temp_a; char sizestr[32]="0"; char string1n[1024]; int seconds2=0; struct sockaddr_in sin; struct hostent *hp; FILE *fid; unsigned char* buf = (unsigned char *) memalign(128, BUF_SIZE); sprintf(net_host_file2, "%s", path); net_host_file2[10]=0; sprintf(net_host_file,"%s%s", app_usrdir, net_host_file2); fp = fopen ( net_host_file, "r" ); if ( fp != NULL ) { temp[0]=0x2e; temp[1]=0x2e; temp[2]=0; chost=path[9]-0x30; initConsole(); sprintf(path2, "%s/", path); // host_list[chost].host // host_list[chost].port if ((unsigned int)-1 != (temp_a = inet_addr(host_list[chost].host))) { sin.sin_family = AF_INET; sin.sin_addr.s_addr = temp_a; } else { if (NULL == (hp = gethostbyname(host_list[chost].host))) { // printf("unknown host %s, %d\n", host_list[chost].host, sys_net_h_errno); goto termination2X; } sin.sin_family = hp->h_addrtype; memcpy(&sin.sin_addr, hp->h_addr, hp->h_length); } sin.sin_port = htons(host_list[chost].port); socket_handle = socket(AF_INET, SOCK_STREAM, 0); if (socket_handle < 0) { goto termination2X; } optval = SOCKET_BUF_SIZE_RCV; ret = setsockopt(socket_handle, SOL_SOCKET, SO_RCVBUF, &optval, sizeof(optval)); optval = SOCKET_BUF_SIZE_SND; ret = setsockopt(socket_handle, SOL_SOCKET, SO_SNDBUF, &optval, sizeof(optval)); if (ret < 0) { // DPrintf("setsockopt() failed (errno=%d)\n", sys_net_errno); goto termination2X; } ret = connect(socket_handle, (struct sockaddr *)&sin, sizeof(sin)); if (ret < 0) { // DPrintf("connect() failed (errno=%d)\n", sys_net_errno); goto termination2X; } copy_folder_bytes=0x00ULL; t_files=0; t_folders=0; while (fscanf(fp,"%[^|]|%[^|]|%[^|]|%[^|]|%[^|]|%[^|]|%[^|]|%s\n", net_path_bare, title, length, timeF, date2, type, parent, tempname2)>=7) { sprintf(net_path, "%s%s", net_host_file2, net_path_bare); net_path[strlen(path2)]=0; // sprintf(string1n, "[%s] [%s] [%s]", path_new); //, (double) (copy_global_bytes/1024.0f/1024.0f) // dialog_ret=0;cellMsgDialogOpen2( type_dialog_yes_no, string1n, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if((strstr(path_new, "/ps3_home/video")!=NULL && strcmp(net_path, path2)==0 && (strstr(title, ".avi")!=NULL || strstr(title, ".AVI")!=NULL || strstr(title, ".m2ts")!=NULL || strstr(title, ".M2TS")!=NULL || strstr(title, ".mts")!=NULL || strstr(title, ".MTS")!=NULL || strstr(title, ".m2t")!=NULL || strstr(title, ".M2T")!=NULL || strstr(title, ".divx")!=NULL || strstr(title, ".DIVX")!=NULL || strstr(title, ".mpg")!=NULL || strstr(title, ".MPG")!=NULL || strstr(title, ".mpeg")!=NULL || strstr(title, ".MPEG")!=NULL || strstr(title, ".mp4")!=NULL || strstr(title, ".MP4")!=NULL || strstr(title, ".vob")!=NULL || strstr(title, ".VOB")!=NULL || strstr(title, ".wmv")!=NULL || strstr(title, ".WMV")!=NULL || strstr(title, ".ts")!=NULL || strstr(title, ".TS")!=NULL || strstr(title, ".mov")!=NULL || strstr(title, ".MOV")!=NULL) )) { temp[0]=0x2e; temp[1]=0x2e; temp[2]=0; if(strcmp(temp, title)!=0) { copy_folder_bytes+=strtoull(length, NULL, 10); t_files++;} else t_folders++; } if((strstr(path_new, "/ps3_home/music")!=NULL && strcmp(net_path, path2)==0 && (strstr(title, ".mp3")!=NULL || strstr(title, ".MP3")!=NULL || strstr(title, ".wav")!=NULL || strstr(title, ".WAV")!=NULL || strstr(title, ".aac")!=NULL || strstr(title, ".AAC")!=NULL) )) { temp[0]=0x2e; temp[1]=0x2e; temp[2]=0; if(strcmp(temp, title)!=0) { copy_folder_bytes+=strtoull(length, NULL, 10); t_files++;} else t_folders++; } if((strstr(path_new, "/ps3_home/photo")!=NULL && strcmp(net_path, path2)==0 && (strstr(title, ".jpg")!=NULL || strstr(title, ".JPG")!=NULL || strstr(title, ".jpeg")!=NULL || strstr(title, ".JPEG")!=NULL || strstr(title, ".png")!=NULL || strstr(title, ".PNG")!=NULL) )) { temp[0]=0x2e; temp[1]=0x2e; temp[2]=0; if(strcmp(temp, title)!=0) { copy_folder_bytes+=strtoull(length, NULL, 10); t_files++;} else t_folders++; } if((strstr(path_new, "/ps3_home")==NULL && strcmp(net_path, path2)==0)) { temp[0]=0x2e; temp[1]=0x2e; temp[2]=0; if(strcmp(temp, title)!=0) { copy_folder_bytes+=strtoull(length, NULL, 10); t_files++;} else t_folders++; } } fclose(fp); // sprintf(string1n, "Copying network folder (%i files in %i folders) from [%s], please wait!\n\n Press [O] twice to abort.", t_files, t_folders, host_list[chost].host); //, (double) (copy_global_bytes/1024.0f/1024.0f) // dialog_ret=0;cellMsgDialogOpen2( type_dialog_yes_no, string1n, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(copy_folder_bytes<1) goto termination2X; fp = fopen ( net_host_file, "r" ); // if(copy_folder_bytes>1048576) { sprintf(string1n, (const char*)STR_NETCOPY0, t_files, t_folders, host_list[chost].host); //, (double) (copy_global_bytes/1024.0f/1024.0f) // dialog_ret=0;cellMsgDialogOpen2( type_dialog_yes_no, string1n, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); // ClearSurface(); cellDbgFontPrintf( 0.20f, 0.45f, 0.8f, 0xc0c0c0c0, string1); cellDbgFontDrawGcm(); dialog_ret=0; cellMsgDialogOpen2(CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL |CELL_MSGDIALOG_TYPE_BUTTON_TYPE_NONE|CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_OFF |CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NONE |CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE, string1n, NULL, NULL, NULL); flip(); } dialog_ret=0; time_start= time(NULL); lastINC2=0;lastINC=0; while (fscanf(fp,"%[^|]|%[^|]|%[^|]|%[^|]|%[^|]|%[^|]|%[^|]|%s\n", net_path_bare, title, length, timeF, date2, type, parent, tempname2)>=7) { global_device_bytes=0x00ULL; sprintf(net_path, "%s%s", net_host_file2, net_path_bare); net_path[strlen(path2)]=0; // sprintf(path4, "%s%s%s", net_host_file2, parent, type); // sprintf(path3, "%s/0", path); // if(strcmp(path3, path4)==0) // { // strncpy(list[*max ].path, net_path, strlen(net_path)-1); list[*max ].path[strlen(net_path)-1]=0; // } //subfolder if(strcmp(net_path, path2)==0 && strstr(path_new, "/ps3_home")==NULL) { sprintf(path_relative, "/"); sprintf(tempname, "%s%s", net_host_file2, net_path_bare); if(strcmp(tempname, path2)!=0) { pl=strlen(tempname); pr=strlen(path2); for(n=pr;n<pl;n++) { path_relative[n-pr+1]=tempname[n]; path_relative[n-pr+2]=0; } } sprintf(path3, "%s/%s%s", path_new, path_name, path_relative); // sprintf(tempname, "[%s]=[%s] Net: [%s]\n\nLocal: [%s]\n\nRel: %s\n\nNet_path: [%s]", temp, title, net_path_bare, path3, path_relative, net_path); dialog_ret=0;cellMsgDialogOpen2( type_dialog_yes_no, tempname, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); temp[0]=0x2e; temp[1]=0x2e; temp[2]=0; if(strcmp(temp, title)==0) { foundslash=0; pl=strlen(path3); for(n=0;n<pl;n++) { tempname[n]=path3[n]; tempname[n+1]=0; if(path3[n]==0x2F && !exist(tempname)) { mkdir(tempname, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(tempname, 0777); } } } } if(strcmp(net_path, path2)==0 && strcmp(temp, title)!=0) { if(strtoull(length, NULL, 10)<1) goto skip_zero_files; sprintf(path4, "%s%s%s", net_host_file2, net_path_bare, title); pl=strlen(path4); for(n=11;n<pl;n++) {cpath[n-11]=path4[n]; cpath[n-10]=0;} sprintf(cpath2, "/%s", cpath); //host_list[chost].root, sprintf(cpath, "%s%s" , path3, title); if((strstr(path_new, "/ps3_home")!=NULL && strcmp(net_path, path2)==0 && (strstr(title, ".avi")!=NULL || strstr(title, ".AVI")!=NULL || strstr(title, ".m2ts")!=NULL || strstr(title, ".M2TS")!=NULL || strstr(title, ".mts")!=NULL || strstr(title, ".MTS")!=NULL || strstr(title, ".m2t")!=NULL || strstr(title, ".M2T")!=NULL || strstr(title, ".divx")!=NULL || strstr(title, ".DIVX")!=NULL || strstr(title, ".mpg")!=NULL || strstr(title, ".MPG")!=NULL || strstr(title, ".mpeg")!=NULL || strstr(title, ".MPEG")!=NULL || strstr(title, ".mp4")!=NULL || strstr(title, ".MP4")!=NULL || strstr(title, ".vob")!=NULL || strstr(title, ".VOB")!=NULL || strstr(title, ".wmv")!=NULL || strstr(title, ".WMV")!=NULL || strstr(title, ".ts")!=NULL || strstr(title, ".TS")!=NULL || strstr(title, ".mov")!=NULL || strstr(title, ".MOV")!=NULL || strstr(title, ".mp3")!=NULL || strstr(title, ".MP3")!=NULL || strstr(title, ".wav")!=NULL || strstr(title, ".WAV")!=NULL || strstr(title, ".aac")!=NULL || strstr(title, ".AAC")!=NULL || strstr(title, ".jpg")!=NULL || strstr(title, ".JPG")!=NULL || strstr(title, ".jpeg")!=NULL || strstr(title, ".JPEG")!=NULL || strstr(title, ".png")!=NULL || strstr(title, ".PNG")!=NULL) )) { sprintf(cpath, "%s/%s", app_temp, title); } else if(strstr(path_new, "/ps3_home")!=NULL) goto skip_zero_files; remove(cpath); fid = fopen(cpath, "wb"); sprintf(get_cmd, "GET %s%s", cpath2, REQUEST_GET2); len = strlen(get_cmd); ret = send(socket_handle, get_cmd, len, 0); if (ret < 0 || ret!=len) { goto terminationX; } ret = recv(socket_handle, (char*)sizestr, 32, 0); copy_global_bytes=strtoull(sizestr+10, NULL, 10); if(copy_global_bytes<1 || copy_folder_bytes<1) goto terminationX; while (1) { int seconds= (int) (time(NULL)-time_start); int eta=0; if(global_folder_bytes>0 && seconds>0) eta=(int) ((copy_folder_bytes-global_folder_bytes)/(global_folder_bytes/seconds)); lastINC3=0; if( ( ((int)(global_folder_bytes*100ULL/copy_folder_bytes)) - lastINC2)>0) { lastINC2=(int) (global_folder_bytes*100ULL / copy_folder_bytes); if(lastINC<lastINC2) {lastINC3=lastINC2-lastINC; lastINC=lastINC2;} if(lastINC3>0) cellMsgDialogProgressBarInc(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE,lastINC3); } // if(copy_folder_bytes>1048576) { if(lastINC3>3 || (time(NULL)-seconds2)>0 || global_device_bytes==0) { // ClearSurface(); // draw_square(-1.0f, 1.0f, 2.0f, 2.0f, 0.0f, 0x101010ff); /* sprintf(string1,"Transferred %1.2f of %1.2f KB\n\nRemaining : %imin %2.2isec\nElapsed : %imin %2.2isec",((double) global_device_bytes)/(1024.0),((double) copy_global_bytes)/(1024.0), (eta/60), eta % 60, (seconds/60), seconds % 60); cellDbgFontPrintf( 0.07f, 0.1f, 1.2f, 0xc0c0c0c0, string1); sprintf(string1,"Source : host://%s:%i%s\nDestination: %s", server_name, server_port, net_file, save_path); cellDbgFontPrintf( 0.07f, 0.3f, 1.2f, 0xc0c0c0c0, string1); sprintf(string1,"Speed : %3.2f KB/s (%2.3f Mbit/s)", ((double) global_device_bytes)/seconds/1024.0, ((double) global_device_bytes*8)/seconds/1000.0/1000.0); cellDbgFontPrintf( 0.07f, 0.5f, 1.2f, 0xc0c0c0c0, string1); cellDbgFontDrawGcm(); */ sprintf(string1n, (const char*) STR_NETCOPY4,((double) global_folder_bytes)/(1024.0)/(1024.0),((double) copy_folder_bytes)/(1024.0)/(1024.0), (eta/60), eta % 60); cellMsgDialogProgressBarSetMsg(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE, string1n); seconds2= (int) (time(NULL)); flip(); } } ret = recv(socket_handle, buf, BUF_SIZE, 0); if (ret < 0) { goto terminationX; } if (ret > 0) { global_device_bytes+=ret; global_folder_bytes+=ret; fwrite(buf, ret, 1, fid); } if (ret == 0 || global_device_bytes>=copy_global_bytes) { break; } pad_read(); if ( (new_pad & BUTTON_TRIANGLE) || (new_pad & BUTTON_CIRCLE) || dialog_ret==3) break; } //while // DPrintf("Sending WAIT command... "); if(copy_global_bytes<1048576) sys_timer_usleep(250*1000); sprintf(get_cmd, "WAIT ! %s", REQUEST_GET2); len = strlen(get_cmd); ret = send(socket_handle, get_cmd, len, 0); // DPrintf("%i\n", len); terminationX: fclose(fid); skip_zero_files: len=0; //if(copy_global_bytes>1048576) {cellMsgDialogAbort(); flip();} // list[*max].type=strtol(type, NULL, 10); // sprintf(list[*max ].path, "%s/%s", path, title); // temp[0]=0x2e; temp[1]=0x2e; temp[2]=0; // if(strcmp(temp, title)==0) // { // sprintf(list[*max ].path, "%s", path); // char *pch=list[*max ].path; // char *pathpos=strrchr(pch,'/'); int lastO=pathpos-pch; // list[*max ].path[lastO]=0; // } // sprintf(list[*max ].entry, "__%i%s", list[*max].type, title); // list[*max].size=strtoull(length, NULL, 10); } pad_read(); if (new_pad & BUTTON_CIRCLE) { new_pad=0; break; } } //while /* cellDbgFontPrintf( 0.5f-0.15f, 1.0f-0.07*2.0f, 1.2f, 0xc0c0c0c0, "Press [O] to continue!"); cellDbgFontDrawGcm(); while(1) { pad_read(); if (new_pad & BUTTON_CIRCLE) { new_pad=0; break; } } */ termination2X: // DPrintf("Sent STOP command!\n"); sprintf(get_cmd, "STOP ! %s", REQUEST_GET2); len = strlen(get_cmd); ret = send(socket_handle, get_cmd, len, 0); // DPrintf("Aborting socket...\n"); sys_net_abort_socket (socket_handle, SYS_NET_ABORT_STRICT_CHECK); ret = shutdown(socket_handle, SHUT_RDWR); if (ret < 0) { DPrintf("shutdown() failed (errno=%d)\n", sys_net_errno); } socketclose(socket_handle); fclose(fp); cellMsgDialogAbort(); sys_timer_usleep(1000000); flip(); /* DPrintf("\nPress [O] to continue..."); while(1) { pad_read(); flip(); if (new_pad & BUTTON_CIRCLE) { new_pad=0; break; } } */ if(strstr(path_new, "/ps3_home")!=NULL) { DIR *dir; char tr[512]; for (n=0;n<256;n++ ) { dir=opendir (app_temp); if(!dir) goto quit1; while(1) { struct dirent *entry=readdir (dir); if(!entry) break; if(!(entry->d_type & DT_DIR)) { sprintf(tr, "%s", entry->d_name); cellDbgFontDrawGcm(); ClearSurface(); set_texture( text_FMS, 1920, 48); display_img(0, 47, 1920, 60, 1920, 48, -0.15f, 1920, 48); display_img(0, 952, 1920, 76, 1920, 48, -0.15f, 1920, 48);time ( &rawtime ); timeinfo = localtime ( &rawtime ); cellDbgFontPrintf( 0.83f, 0.89f, 0.7f ,0xc0a0a0a0, "%02d/%02d/%04d\n %s:%02d:%02d ", timeinfo->tm_mday, timeinfo->tm_mon+1, timeinfo->tm_year+1900, tmhour(timeinfo->tm_hour), timeinfo->tm_min, timeinfo->tm_sec); set_texture( text_bmpIC, 320, 320); display_img(800, 200, 320, 176, 320, 176, 0.0f, 320, 320); if( strstr(path_new, "/ps3_home/video")!=NULL ) { cellDbgFontPrintf( 0.35f, 0.45f, 0.8f, 0xc0c0c0c0, "Adding files to video library...\n\nPlease wait!\n\n[%s]",tr); cellDbgFontDrawGcm(); flip(); video_export(tr, path_name, 0); } else if( strstr(path_new, "/ps3_home/music")!=NULL ) { cellDbgFontPrintf( 0.35f, 0.45f, 0.8f, 0xc0c0c0c0, "Adding files to music library...\n\nPlease wait!\n\n[%s]",tr); cellDbgFontDrawGcm(); flip(); music_export(tr, path_name, 0); } else if( strstr(path_new, "/ps3_home/photo")!=NULL ) { cellDbgFontPrintf( 0.35f, 0.45f, 0.8f, 0xc0c0c0c0, "Adding files to photo library...\n\nPlease wait!\n\n[%s]",tr); cellDbgFontDrawGcm(); flip(); photo_export(tr, path_name, 0); } sprintf(tr, "%s/%s", app_temp, entry->d_name); if(exist(tr)) remove(tr); } } closedir(dir); } ret = video_finalize(); ret = music_finalize(); ret = photo_finalize(); del_temp(app_temp); } termConsole(); } quit1: if(buf) free(buf); } int network_put(char *command, char *server_name, int server_port, char *net_file, char *save_path, int show_progress ) { int len; int ret; int optval; unsigned int temp_a; // char sizestr[32]="0"; char string1[1024]; int seconds2=0; global_device_bytes=0x00ULL; struct sockaddr_in sin; struct hostent *hp; // time_t time_start; if(show_progress==1) { sprintf(string1, "Establishing server connection, please wait!\n\nContacting %s...", server_name); ClearSurface(); cellDbgFontPrintf( 0.28f, 0.45f, 0.8f, 0xc0c0c0c0, string1); cellDbgFontDrawGcm(); flip(); } if ((unsigned int)-1 != (temp_a = inet_addr(server_name))) { sin.sin_family = AF_INET; sin.sin_addr.s_addr = temp_a; } else { if (NULL == (hp = gethostbyname(server_name))) { // printf("unknown host %s, %d\n", server_name, sys_net_h_errno); return -1; } sin.sin_family = hp->h_addrtype; memcpy(&sin.sin_addr, hp->h_addr, hp->h_length); } sin.sin_port = htons(server_port); socket_handle = socket(AF_INET, SOCK_STREAM, 0); if (socket_handle < 0) { return -1; } int fs; uint64_t fsiz = 0, msiz = 0; uint64_t chunk = 320 * 1024; uint64_t readb=0; unsigned char* buf = (unsigned char *) memalign(128, BUF_SIZE); if(cellFsOpen(save_path, CELL_FS_O_RDONLY, &fs, NULL, 0)!=CELL_FS_SUCCEEDED) goto termination_PUT; cellFsLseek(fs, 0, CELL_FS_SEEK_END, &msiz); cellFsClose(fs); copy_global_bytes=msiz; if(msiz<chunk && msiz>0) chunk=msiz; cellFsOpen(save_path, CELL_FS_O_RDONLY, &fs, NULL, 0); cellFsLseek(fs, 0, CELL_FS_SEEK_SET, NULL); // FILE *fid = fopen(save_path, "rb"); // if(fid==NULL) goto termination_PUT; // fseek(fid, 0, SEEK_END); // copy_global_bytes=ftell(fid); // fseek(fid, 0, SEEK_SET); optval = 1 * 1024; ret = setsockopt(socket_handle, SOL_SOCKET, SO_RCVBUF, &optval, sizeof(optval)); if (ret < 0) goto termination_PUT; optval = 320 * 1024; ret = setsockopt(socket_handle, SOL_SOCKET, SO_SNDBUF, &optval, sizeof(optval)); if (ret < 0) goto termination_PUT; ret = connect(socket_handle, (struct sockaddr *)&sin, sizeof(sin)); if (ret < 0) goto termination_PUT; sprintf(get_cmd, "%s %s%s", command, net_file, REQUEST_GET2); len = strlen(get_cmd); ret = send(socket_handle, get_cmd, len, 0); if (ret < 0) { goto termination_PUT; } if (ret != len) { goto termination_PUT; } ret = recv(socket_handle, buf, BUF_SIZE, 0); if(show_progress!=0 && copy_global_bytes>1048576){ dialog_ret=0; sprintf(string1, (const char*) STR_NETCOPY1, server_name); //, (double) (copy_global_bytes/1024.0f/1024.0f) cellMsgDialogOpen2(CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL |CELL_MSGDIALOG_TYPE_BUTTON_TYPE_NONE|CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_OFF |CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NONE |CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE, string1, NULL, NULL, NULL); flip(); } lastINC2=0;lastINC=0; global_device_bytes=0x00ULL; time_start = time(NULL); while(fsiz < msiz) { int seconds= (int) (time(NULL)-time_start); int eta=(int) ((copy_global_bytes-global_device_bytes)/(global_device_bytes/seconds)); lastINC3=0; if( ( ((int)(global_device_bytes*100ULL/copy_global_bytes)) - lastINC2)>0) { lastINC2=(int) (global_device_bytes*100ULL / copy_global_bytes); if(lastINC<lastINC2) {lastINC3=lastINC2-lastINC; lastINC=lastINC2;} if(show_progress!=0){ if(lastINC3>0) cellMsgDialogProgressBarInc(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE,lastINC3); } } if(show_progress!=0 && copy_global_bytes>1048576){ if(lastINC3>3 || (time(NULL)-seconds2)>0 || global_device_bytes==0) { ClearSurface(); draw_square(-1.0f, 1.0f, 2.0f, 2.0f, 0.0f, 0x101010ff); sprintf(string1, (const char*) STR_NETCOPY4,((double) global_device_bytes)/(1024.0)/(1024.0),((double) copy_global_bytes)/(1024.0)/(1024.0), (eta/60), eta % 60); cellMsgDialogProgressBarSetMsg(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE, string1); seconds2= (int) (time(NULL)); flip(); } } if((fsiz+chunk) > msiz) chunk = (msiz-fsiz); if(cellFsRead(fs, (void *)buf, chunk, &readb)!=CELL_FS_SUCCEEDED) goto termination_PUT; fsiz = fsiz + readb; global_device_bytes=fsiz; if(send(socket_handle, buf, readb, 0)<0) goto termination_PUT; if (readb == 0 || global_device_bytes>=copy_global_bytes) { break; } pad_read(); if ( (new_pad & BUTTON_TRIANGLE) || (new_pad & BUTTON_CIRCLE) ) break; } //while termination_PUT: cellFsClose(fs); sys_net_abort_socket (socket_handle, SYS_NET_ABORT_STRICT_CHECK); ret = shutdown(socket_handle, SHUT_RDWR); socketclose(socket_handle); if(show_progress!=0){ cellMsgDialogAbort(); } //flip(); free(buf); return (0); } int network_del(char *command, char *server_name, int server_port, char *net_file, char *save_path, int show_progress ) { int len; int ret; (void) show_progress; (void) save_path; int optval; unsigned int temp_a; struct sockaddr_in sin; struct hostent *hp; if ((unsigned int)-1 != (temp_a = inet_addr(server_name))) { sin.sin_family = AF_INET; sin.sin_addr.s_addr = temp_a; } else { if (NULL == (hp = gethostbyname(server_name))) { // printf("unknown host %s, %d\n", server_name, sys_net_h_errno); return (-1); } sin.sin_family = hp->h_addrtype; memcpy(&sin.sin_addr, hp->h_addr, hp->h_length); } sin.sin_port = htons(server_port); socket_handle = socket(AF_INET, SOCK_STREAM, 0); if (socket_handle < 0) { return (-1); } unsigned char* buf = (unsigned char *) memalign(128, BUF_SIZE); optval = 1 * 1024; ret = setsockopt(socket_handle, SOL_SOCKET, SO_RCVBUF, &optval, sizeof(optval)); if (ret < 0) goto termination_DEL; optval = 1 * 1024; ret = setsockopt(socket_handle, SOL_SOCKET, SO_SNDBUF, &optval, sizeof(optval)); if (ret < 0) goto termination_DEL; ret = connect(socket_handle, (struct sockaddr *)&sin, sizeof(sin)); if (ret < 0) goto termination_DEL; sprintf(get_cmd, "%s %s%s", command, net_file, REQUEST_GET2); len = strlen(get_cmd); ret = send(socket_handle, get_cmd, len, 0); if (ret < 0) { goto termination_DEL; } if (ret != len) { goto termination_DEL; } ret = recv(socket_handle, buf, BUF_SIZE, 0); termination_DEL: sys_net_abort_socket (socket_handle, SYS_NET_ABORT_STRICT_CHECK); ret = shutdown(socket_handle, SHUT_RDWR); socketclose(socket_handle); return (0); } int read_folder(char *path) { DIR *dir; if(abort_copy==1) return -1; dir=opendir (path); if(!dir) return -1; while(1) { struct dirent *entry=readdir (dir); if(!entry) break; if(entry->d_name[0]=='.' && entry->d_name[1]==0) continue; if(entry->d_name[0]=='.' && entry->d_name[1]=='.' && entry->d_name[2]==0) continue; if((entry->d_type & DT_DIR)) { char *d1f= (char *) malloc(512); num_directories++; if(!d1f) {closedir (dir);abort_copy=2;return -1;} sprintf(d1f,"%s/%s", path, entry->d_name); sprintf(f_files[max_f_files].path, "%s/", d1f); f_files[max_f_files].size=0; max_f_files++; if(max_f_files>=MAX_F_FILES) break; read_folder(d1f); free(d1f); if(abort_copy) break; } else { char *f= (char *) malloc(512); struct stat s; off64_t size=0LL; if(!f) {abort_copy=2;closedir (dir);return -1;} sprintf(f, "%s/%s", path, entry->d_name); if(stat(f, &s)<0) {abort_copy=3;if(f) free(f);break;} size= s.st_size; sprintf(f_files[max_f_files].path, "%s", f); f_files[max_f_files].size=size; max_f_files++; if(max_f_files>=MAX_F_FILES) break; file_counter++; global_device_bytes+=size; if(f) free(f); if(abort_copy) break; } } closedir (dir); return 0; } int network_com(char *command, char *server_name, int server_port, char *net_file, char *save_path, int show_progress ) { // char *server_name; int len; int ret; int optval; unsigned int temp_a; char string1[1024]; int seconds2=0; global_device_bytes=0x00ULL; struct sockaddr_in sin; struct hostent *hp; // time_t time_start; if(show_progress==1) { if(strstr(command, "GET!")!=NULL) sprintf(string1, "Refreshing network directory structure, please wait!\n\nContacting %s...", server_name); else sprintf(string1, "Establishing server connection, please wait!\n\nContacting %s...", server_name); ClearSurface(); cellDbgFontPrintf( 0.28f, 0.45f, 0.8f, 0xc0c0c0c0, string1); cellDbgFontDrawGcm(); flip(); } if ((unsigned int)-1 != (temp_a = inet_addr(server_name))) { sin.sin_family = AF_INET; sin.sin_addr.s_addr = temp_a; } else { if (NULL == (hp = gethostbyname(server_name))) { // printf("unknown host %s, %d\n", server_name, sys_net_h_errno); return (-1); } sin.sin_family = hp->h_addrtype; memcpy(&sin.sin_addr, hp->h_addr, hp->h_length); } sin.sin_port = htons(server_port); socket_handle = socket(AF_INET, SOCK_STREAM, 0); if (socket_handle < 0) { return (-1); } unsigned char* buf = (unsigned char *) memalign(128, BUF_SIZE); char sizestr[32]="0"; remove(save_path); FILE *fid = fopen(save_path, "wb"); optval = SOCKET_BUF_SIZE_RCV; ret = setsockopt(socket_handle, SOL_SOCKET, SO_RCVBUF, &optval, sizeof(optval)); optval = SOCKET_BUF_SIZE_SND; ret = setsockopt(socket_handle, SOL_SOCKET, SO_SNDBUF, &optval, sizeof(optval)); if (ret < 0) { DPrintf("setsockopt() failed (errno=%d)\n", sys_net_errno); goto termination; } // optval = 15; //set socket send/receive/connect timeout to 15 seconds // ret = setsockopt(socket_handle, SOL_SOCKET, SO_RCVTIMEO, &optval, sizeof(optval)); // ret = setsockopt(socket_handle, SOL_SOCKET, SO_SNDTIMEO, &optval, sizeof(optval)); ret = connect(socket_handle, (struct sockaddr *)&sin, sizeof(sin)); if (ret < 0) { DPrintf("connect() failed (errno=%d)\n", sys_net_errno); goto termination; } // strcpy(get_cmd, command); // strcat(get_cmd, " "); // strcat(get_cmd, net_file); // strcat(get_cmd, REQUEST_GET2); sprintf(get_cmd, "%s %s%s", command, net_file, REQUEST_GET2); len = strlen(get_cmd); ret = send(socket_handle, get_cmd, len, 0); if (ret < 0) { goto termination; } if (ret != len) { goto termination; } ret = recv(socket_handle, (char*)sizestr, 32, 0); copy_global_bytes=strtoull(sizestr+10, NULL, 10); if(copy_global_bytes<1) goto termination; if(show_progress!=0 && copy_global_bytes>1048576){ sprintf(string1, (const char*) STR_NETCOPY2, server_name); //, (double) (copy_global_bytes/1024.0f/1024.0f) // ClearSurface(); cellDbgFontPrintf( 0.20f, 0.45f, 0.8f, 0xc0c0c0c0, string1); cellDbgFontDrawGcm(); cellMsgDialogOpen2(CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL |CELL_MSGDIALOG_TYPE_BUTTON_TYPE_NONE|CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_OFF |CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NONE |CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE, string1, NULL, NULL, NULL); flip(); } lastINC2=0;lastINC=0; global_device_bytes=0x00ULL; time_start = time(NULL); // len = 0; while (1) { int seconds= (int) (time(NULL)-time_start); int eta=(int) ((copy_global_bytes-global_device_bytes)/(global_device_bytes/seconds)); lastINC3=0; if( ( ((int)(global_device_bytes*100ULL/copy_global_bytes)) - lastINC2)>0) { lastINC2=(int) (global_device_bytes*100ULL / copy_global_bytes); if(lastINC<lastINC2) {lastINC3=lastINC2-lastINC; lastINC=lastINC2;} if(show_progress!=0){ if(lastINC3>0) cellMsgDialogProgressBarInc(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE,lastINC3); } } if(show_progress!=0 && copy_global_bytes>1048576){ if(lastINC3>3 || (time(NULL)-seconds2)>0 || global_device_bytes==0) { ClearSurface(); draw_square(-1.0f, 1.0f, 2.0f, 2.0f, 0.0f, 0x101010ff); /* sprintf(string1,"Transferred %1.2f of %1.2f KB\n\nRemaining : %imin %2.2isec\nElapsed : %imin %2.2isec",((double) global_device_bytes)/(1024.0),((double) copy_global_bytes)/(1024.0), (eta/60), eta % 60, (seconds/60), seconds % 60); cellDbgFontPrintf( 0.07f, 0.1f, 1.2f, 0xc0c0c0c0, string1); sprintf(string1,"Source : host://%s:%i%s\nDestination: %s", server_name, server_port, net_file, save_path); cellDbgFontPrintf( 0.07f, 0.3f, 1.2f, 0xc0c0c0c0, string1); sprintf(string1,"Speed : %3.2f KB/s (%2.3f Mbit/s)", ((double) global_device_bytes)/seconds/1024.0, ((double) global_device_bytes*8)/seconds/1000.0/1000.0); cellDbgFontPrintf( 0.07f, 0.5f, 1.2f, 0xc0c0c0c0, string1); cellDbgFontDrawGcm(); */ sprintf(string1, (const char*) STR_NETCOPY4,((double) global_device_bytes)/(1024.0)/(1024.0),((double) copy_global_bytes)/(1024.0)/(1024.0), (eta/60), eta % 60); cellMsgDialogProgressBarSetMsg(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE, string1); seconds2= (int) (time(NULL)); flip(); } } ret = recv(socket_handle, buf, BUF_SIZE, 0); if (ret < 0) { fclose(fid); goto termination; } if (ret > 0) { global_device_bytes+=ret; fwrite(buf, ret, 1, fid); } if (ret == 0 || global_device_bytes>=copy_global_bytes) { break; } pad_read(); if ( (new_pad & BUTTON_TRIANGLE) || (new_pad & BUTTON_CIRCLE) ) break; } //while termination: fclose(fid); //termination2: sys_net_abort_socket (socket_handle, SYS_NET_ABORT_STRICT_CHECK); ret = shutdown(socket_handle, SHUT_RDWR); if (ret < 0) { DPrintf("shutdown() failed (errno=%d)\n", sys_net_errno); } socketclose(socket_handle); // sys_timer_usleep(250*1000); if(show_progress!=0){ cellMsgDialogAbort(); } //flip(); free(buf); return (0); } void net_folder_copy_put(char *path, char *path_new, char *path_name) { file_counter=0; global_device_bytes=0; num_directories=0; max_f_files=0; dialog_ret=0; cellMsgDialogOpen2( type_dialog_no, "Preparing data and network connection, please wait...", dialog_fun2, (void*)0x0000aaab, NULL ); flipc(60); read_folder((char*) path); int e=0; if(max_f_files>0) { int len; int ret; int optval; unsigned int temp_a; struct sockaddr_in sin; struct hostent *hp; int fs; uint64_t fsiz = 0, msiz = 0; uint64_t chunk = 1 * 1024 * 1024; //320 * 1024; uint64_t readb=0; int seconds2=0; copy_global_bytes=global_device_bytes; global_device_bytes=0x00ULL; lastINC=0, lastINC3=0, lastINC2=0; char cpath2[1024]; int chost=0; chost=path_new[9]-0x30; if(strlen(path_new)>11) sprintf(cpath2, "/%s", path_new+11); else cpath2[0]=0x00; char server_name[64]; // char net_folder[512]; int server_port; sprintf(server_name, "%s", host_list[chost].host); server_port=host_list[chost].port; if ((unsigned int)-1 != (temp_a = inet_addr(server_name))) { sin.sin_family = AF_INET; sin.sin_addr.s_addr = temp_a; } else { if (NULL == (hp = gethostbyname(server_name))) { cellMsgDialogAbort(); return; } sin.sin_family = hp->h_addrtype; memcpy(&sin.sin_addr, hp->h_addr, hp->h_length); } sin.sin_port = htons(server_port); socket_handle = socket(AF_INET, SOCK_STREAM, 0); if (socket_handle < 0) { cellMsgDialogAbort(); return; } unsigned char* buf = (unsigned char *) memalign(128, BUF_SIZE); optval = 1 * 1024; ret = setsockopt(socket_handle, SOL_SOCKET, SO_RCVBUF, &optval, sizeof(optval)); if (ret < 0) goto termination_FC; optval = 320 * 1024; ret = setsockopt(socket_handle, SOL_SOCKET, SO_SNDBUF, &optval, sizeof(optval)); if (ret < 0) goto termination_FC; ret = connect(socket_handle, (struct sockaddr *)&sin, sizeof(sin)); if (ret < 0) goto termination_FC; cellMsgDialogAbort(); flip(); char string1[256]; sprintf(string1, (const char*) STR_NETCOPY3, file_counter, num_directories, host_list[chost].host); cellMsgDialogOpen2(CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL |CELL_MSGDIALOG_TYPE_BUTTON_TYPE_NONE|CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_OFF |CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NONE |CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE, string1, NULL, NULL, NULL); flipc(60); // dialog_ret=0;cellMsgDialogOpen2( type_dialog_yes_no, string1, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); seconds2= (int) time(NULL); time_start = time(NULL); for(e=0; e<max_f_files; e++) { if(f_files[e].path[strlen(f_files[e].path)-1]!=0x2f) // file sprintf(get_cmd, "PUT-%.f %s/%s%s%s", (double)f_files[e].size, cpath2, path_name, f_files[e].path+strlen(path), REQUEST_GET2); else sprintf(get_cmd, "PUT %s/%s%s%s", cpath2, path_name, f_files[e].path+strlen(path), REQUEST_GET2); len = strlen(get_cmd); ret = send(socket_handle, get_cmd, len, 0); if (ret < 0) goto termination_FC; if (ret != len) goto termination_FC; ret = recv(socket_handle, buf, 1 * 1024, 0); if(f_files[e].path[strlen(f_files[e].path)-1]!=0x2f) // file { if(cellFsOpen(f_files[e].path, CELL_FS_O_RDONLY, &fs, NULL, 0)!=CELL_FS_SUCCEEDED) goto termination_SEND; msiz=f_files[e].size; cellFsLseek(fs, 0, CELL_FS_SEEK_SET, NULL); fsiz=0; while(fsiz < msiz) { int seconds= (int) (time(NULL)-time_start); int eta=(int) ((copy_global_bytes-global_device_bytes)/(global_device_bytes/seconds)); lastINC3=0; if( ( ((int)(global_device_bytes*100ULL/copy_global_bytes)) - lastINC2)>0) { lastINC2=(int) (global_device_bytes*100ULL / copy_global_bytes); if(lastINC<lastINC2) {lastINC3=lastINC2-lastINC; lastINC=lastINC2;} if(lastINC3>0) cellMsgDialogProgressBarInc(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE,lastINC3); } // if(copy_global_bytes>1048576) { if(lastINC3>3 || (time(NULL)-seconds2)>0 || global_device_bytes==0) { ClearSurface(); draw_square(-1.0f, 1.0f, 2.0f, 2.0f, 0.0f, 0x101010ff); sprintf(string1,(const char*) STR_NETCOPY4,((double) global_device_bytes)/(1024.0)/(1024.0),((double) copy_global_bytes)/(1024.0)/(1024.0), (eta/60), eta % 60); cellMsgDialogProgressBarSetMsg(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE, string1); seconds2= (int) (time(NULL)); flip(); } } // if((fsiz+chunk) > msiz) { chunk = (msiz-fsiz);} else chunk = 320*1024; // if(cellFsRead(fs, (void *)w, chunk, &readb)!=CELL_FS_SUCCEEDED) {cellFsClose(fs); goto termination_SEND;} cellFsRead(fs, (void *)buf, chunk, &readb); fsiz = fsiz + readb; if (readb == 0 || global_device_bytes>=copy_global_bytes) { break; } if(send(socket_handle, buf, readb, 0)<0) goto termination_SEND; global_device_bytes+=readb; if(fsiz>=msiz) break; pad_read(); if ( (new_pad & BUTTON_TRIANGLE) || (new_pad & BUTTON_CIRCLE) ) break; } //while cellFsClose(fs); if ( (new_pad & BUTTON_TRIANGLE) || (new_pad & BUTTON_CIRCLE) ) break; } if(e!=(max_f_files-1)) { sprintf(get_cmd, "WAIT ! %s", REQUEST_GET2); len = strlen(get_cmd); sys_timer_usleep(500*1000); ret = send(socket_handle, get_cmd, len, 0); if(ret<0) break; sys_timer_usleep(333*1000); } else { sys_timer_usleep(500*1000); sprintf(get_cmd, "STOP ! %s", REQUEST_GET2); len = strlen(get_cmd); ret = send(socket_handle, get_cmd, len, 0); } } termination_SEND: termination_FC: cellMsgDialogAbort(); sys_net_abort_socket (socket_handle, SYS_NET_ABORT_STRICT_CHECK); ret = shutdown(socket_handle, SHUT_RDWR); socketclose(socket_handle); if(buf) free(buf); network_com((char*)"GET!",(char*)host_list[chost].host, host_list[chost].port, (char*)"/", (char*) host_list[chost].name, 1); } //there are files to copy else cellMsgDialogAbort(); } #define HTTP_POOL_SIZE (64 * 1024) int download_file(const char *http_file, const char *save_path, int show_progress) { if(net_avail<0) return 0; // time_t time_start; time_start= time(NULL); char string1[256]; global_device_bytes=0x00UL; int seconds2=0; if(show_progress==1) sprintf(string1, "%s", (const char*) STR_DOWN_UPD); if(show_progress==2) sprintf(string1, "%s", (const char*) STR_DOWN_COVER); if(show_progress==3) sprintf(string1, "%s", (const char*) STR_DOWN_FILE); if(show_progress==4) sprintf(string1, "%s", (const char*) STR_DOWN_THM); if(show_progress!=0){ ClearSurface(); cellDbgFontPrintf( 0.3f, 0.45f, 0.8f, 0xc0c0c0c0, string1); cellDbgFontDrawGcm(); } if(show_progress>0 && show_progress!=3) { cellMsgDialogOpen2( CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL |CELL_MSGDIALOG_TYPE_BUTTON_TYPE_NONE |CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_OFF |CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NONE |CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE, string1, NULL, NULL, NULL); flip(); } lastINC2=0;lastINC=0; int ret = 0; static char buffer[10240]; CellHttpClientId client = 0; CellHttpTransId trans = 0; CellHttpUri uri; int code = 0; uint64_t length = 0; size_t localRecv = -1; size_t poolSize = 0; void *uriPool = NULL; void *httpPool = NULL; FILE *fid; global_device_bytes=0; remove(save_path); httpPool = malloc(HTTP_POOL_SIZE); if (!httpPool) { goto quit; } if (cellHttpInit(httpPool, (size_t)HTTP_POOL_SIZE) < 0) { goto quit; } if (cellHttpCreateClient(&client) < 0) { goto quit; } cellHttpClientSetConnTimeout(client, 5 * 1000000); if (cellHttpUtilParseUri(NULL, http_file, NULL, 0, &poolSize) < 0) { goto quit; } uriPool = malloc(poolSize); if (!uriPool) { goto quit; } if (cellHttpUtilParseUri(&uri, http_file, uriPool, poolSize, NULL) < 0) { goto quit; } if (cellHttpCreateTransaction(&trans, client, CELL_HTTP_METHOD_GET, &uri) < 0) { goto quit; } free(uriPool); uriPool = NULL; if (cellHttpSendRequest(trans, NULL, 0, NULL) < 0) {goto quit;} if (cellHttpResponseGetStatusCode(trans, &code) < 0) {goto quit;} if (code == 404 || code == 403) {ret=-1; goto quit;} if (cellHttpResponseGetContentLength(trans, &length) < 0) {goto quit;} copy_global_bytes=length; fid = fopen(save_path, "wb"); if (!fid) {goto quit;} memset(buffer, 0x00, sizeof(buffer)); while (localRecv != 0) { if (cellHttpRecvResponse(trans, buffer, sizeof(buffer) - 1, &localRecv) < 0) { fclose(fid); goto quit; } if (localRecv == 0) break; global_device_bytes+=localRecv; fwrite(buffer, localRecv, 1, fid); int seconds= (int) (time(NULL)-time_start); int eta=(copy_global_bytes-global_device_bytes)/(global_device_bytes/seconds); lastINC3=0; if( ( ((int)(global_device_bytes*100ULL/copy_global_bytes)) - lastINC2)>0) { lastINC2=(int) (global_device_bytes*100ULL / copy_global_bytes); if(lastINC<lastINC2) {lastINC3=lastINC2-lastINC; lastINC=lastINC2;} if(show_progress!=0 && show_progress!=3){ if(lastINC3>0) cellMsgDialogProgressBarInc(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE,lastINC3); } } if(show_progress!=0){ if(lastINC3>3 || (time(NULL)-seconds2)>1 || (show_progress==3 && www_running)) { ClearSurface(); if(show_progress==3 && www_running) { if(cover_mode==8) { draw_xmb_clock(xmb_clock, 0); set_texture( text_bmp, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); } else { set_texture( text_bmpUPSR, 1920, 1080); BoffX--; if(BoffX<= -3840) BoffX=0; if(BoffX>= -1920) { display_img((int)BoffX, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); } display_img(1920+(int)BoffX, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); if(BoffX<= -1920) { display_img(3840+(int)BoffX, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); } } sprintf(string1, (const char*) STR_DOWN_MSG0,((double) global_device_bytes)/(1024.0)/(1024.0f),((double) copy_global_bytes)/(1024.0)/(1024.0f), (eta/60), eta % 60, save_path); cellDbgFontPrintf( 0.07f, 0.9f, 1.0f, 0xc0c0c0c0, string1); } else { draw_square(-1.0f, 1.0f, 2.0f, 2.0f, 0.0f, 0x101010ff); sprintf(string1, (const char*) STR_DOWN_MSG1,((double) global_device_bytes)/(1024.0),((double) copy_global_bytes)/(1024.0), (eta/60), eta % 60); cellDbgFontPrintf( 0.07f, 0.07f, 1.2f, 0xc0c0c0c0, string1); } cellDbgFontDrawGcm(); seconds2= (int) (time(NULL)); sprintf(string1, (const char*) STR_DOWN_MSG2,((double) global_device_bytes)/(1024.0),((double) copy_global_bytes)/(1024.0), (eta/60), eta % 60); if(show_progress!=3) cellMsgDialogProgressBarSetMsg(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE, string1); flip(); } } pad_read(); if ( ( new_pad & BUTTON_TRIANGLE) || ( old_pad & BUTTON_TRIANGLE)) { ret = 2; new_pad=0; old_pad=0; fclose(fid); remove(save_path); goto quit; } } fclose(fid); ret = 1; quit: if (trans) cellHttpDestroyTransaction(trans); if (client) cellHttpDestroyClient(client); cellHttpEnd(); if (httpPool) free(httpPool); if (uriPool) free(uriPool); if(show_progress==3){ if(exist(download_dir)) sprintf(current_right_pane, "%s", download_dir); else sprintf(current_right_pane, "%s/DOWNLOADS", app_usrdir); state_read=3; } if(show_progress!=0){ cellMsgDialogAbort(); flip(); } if(global_device_bytes==0) remove(save_path); return ret; } int download_file_th(const char *http_file, const char *save_path, int params) { (void) params; // if(net_avail<0) return 0; int ret = 0; u32 received_bytes=0; unsigned char *buffer=NULL; buffer = (unsigned char *) malloc(16384); CellHttpClientId client = 0; CellHttpTransId trans = 0; CellHttpUri uri; int code = 0; uint64_t length = 0; size_t localRecv = -1; size_t poolSize = 0; void *uriPool = NULL; void *httpPool = NULL; FILE *fid; received_bytes=0; remove(save_path); httpPool = malloc(HTTP_POOL_SIZE); if (!httpPool) goto quit_th; if (cellHttpInit(httpPool, (size_t)HTTP_POOL_SIZE) < 0) {goto quit_th;} if (cellHttpCreateClient(&client) < 0) {goto quit_th;} cellHttpClientSetConnTimeout(client, 5 * 1000000); if (cellHttpUtilParseUri(NULL, http_file, NULL, 0, &poolSize) < 0) {goto quit_th;} uriPool = malloc(poolSize);if (!uriPool) {goto quit_th;} if (cellHttpUtilParseUri(&uri, http_file, uriPool, poolSize, NULL) < 0) {goto quit_th;} if (cellHttpCreateTransaction(&trans, client, CELL_HTTP_METHOD_GET, &uri) < 0) {goto quit_th;} free(uriPool); uriPool = NULL; if (cellHttpSendRequest(trans, NULL, 0, NULL) < 0) {goto quit_th;} if (cellHttpResponseGetStatusCode(trans, &code) < 0) {goto quit_th;} if (code == 404 || code == 403) {ret=-1; goto quit_th;} if (cellHttpResponseGetContentLength(trans, &length) < 0) {goto quit_th;} fid = fopen(save_path, "wb"); if (!fid) {goto quit_th;} http_active=true; memset(buffer, 0x00, sizeof(buffer)); while (localRecv != 0) { if (cellHttpRecvResponse(trans, buffer, sizeof(buffer) - 1, &localRecv) < 0) { fclose(fid); goto quit_th; } if (localRecv == 0) break; if (localRecv > 0) { fwrite(buffer, localRecv, 1, fid); received_bytes+=localRecv; } } fclose(fid); ret = 1; quit_th: if(buffer) free(buffer); if (trans) cellHttpDestroyTransaction(trans); if (client) cellHttpDestroyClient(client); cellHttpEnd(); if (httpPool) free(httpPool); if (uriPool) free(uriPool); if(received_bytes==0) remove(save_path); http_active=false; return ret; } void download_cover(char *title_id, char *name) { if(strlen(title_id)!=9 || download_covers!=1 || net_avail<0) return; //strstr (title_id,"NO_ID")!=NULL || strstr (title_id,"AVCHD")!=NULL) return; net_avail=cellNetCtlGetInfo(16, &net_info); if(net_avail<0) return; char covers_url[128]; char string1x[128]; if(strstr(name, ".jpg")!=NULL || strstr(name, ".JPG")!=NULL || strstr(name, ".jpeg")!=NULL || strstr(name, ".JPEG")!=NULL) sprintf(string1x, "%s/%s.JPG", covers_dir, title_id); else sprintf(string1x, "%s/%s.PNG", covers_dir, title_id); sprintf(covers_url, "%s/covers_jpg/%s.JPG", url_base, title_id); u8 is_in_queue=0; for(int n=0;n<downloads_max; n++) if(!strcmp(downloads[downloads_max].url, covers_url)){is_in_queue=1; break;} if(!is_in_queue) { if(downloads_max>=MAX_DOWN_LIST) downloads_max=0; sprintf(downloads[downloads_max].url, "%s", covers_url); sprintf(downloads[downloads_max].local, "%s", string1x); downloads[downloads_max].status=1; downloads_max++; if(downloads_max>=MAX_DOWN_LIST) downloads_max=0; } //if(download_file(covers_url, string1x, 2)==0) net_avail=-1; } //u64 ret2 = syscall_837(837, (u64)"CELL_FS_IOS:USB_MASS_STORAGE000", (u64)"CELL_FS_UDF", (u64)"/dev_usb006", 0, 0, 0, 0, 0); static uint64_t syscall_837(const char *device, const char *format, const char *point, u32 a, u32 b, u32 c, void *buffer, u32 len) { system_call_8(837, (u64)device, (u64)format, (u64)point, a, b, c, (u64)buffer, len); return_to_user_prog(uint64_t); } static uint64_t syscall_838(const char *device) { system_call_1(838, (u64)device); return_to_user_prog(uint64_t); } /*******************/ /* Control Console */ #if (CELL_SDK_VERSION>0x210001) CellConsoleInputProcessorResult _cellConsoleResetBDVD (unsigned int uiConnection, const char *pcInput, void *pvDummy, int iContinuation) { (void) pvDummy; (void) iContinuation; (void)uiConnection; (void)iContinuation; (void) pcInput; cellConsolePrintf(uiConnection, "\nResetting dev_bdvd...\n"); syscall_838("/dev_bdvd"); syscall_837("CELL_FS_IOS:BDVD_DRIVE", "CELL_FS_UDF", "/dev_bdvd", 0, 1, 0, 0, 0); cellConsolePrintf(uiConnection, "Done!\n\n"); return CELL_CONSOLE_INPUT_PROCESSED; } CellConsoleInputProcessorResult _cellConsoleFTP (unsigned int uiConnection, const char *pcInput, void *pvDummy, int iContinuation) { (void) pvDummy; (void) iContinuation; char ftp_command[32]; if (sscanf(pcInput, "%*s %s", ftp_command)==1) { if(strcmp(ftp_command, "start")==0){ cellConsolePrintf(uiConnection, "Status: Starting FTP server...\n"); ftp_on(); if(ftp_service==0) cellConsolePrintf(uiConnection, "Status: Failed to start FTP server!\n"); else cellConsolePrintf(uiConnection, "Status: FTP server started!\n"); } if(strstr(ftp_command, "stop")!=NULL){ cellConsolePrintf(uiConnection, "Status: Stopping FTP server...\n"); ftp_off(); if(ftp_service==1) cellConsolePrintf(uiConnection, "Status: Failed to start FTP server!\n"); else cellConsolePrintf(uiConnection, "Status: FTP server stopped!\n"); } if(strstr(ftp_command, "restart")!=NULL){ cellConsolePrintf(uiConnection, "Status: Stopping FTP server...\n"); ftp_off(); cellConsolePrintf(uiConnection, "Status: Starting FTP server...\n"); ftp_on(); if(ftp_service==0) cellConsolePrintf(uiConnection, "Status: Failed to restart FTP server!\n"); else cellConsolePrintf(uiConnection, "Status: FTP server restarted!\n"); } } else { if(ftp_service) cellConsolePrintf(uiConnection, "Status: FTP server is running\n\n"); else cellConsolePrintf(uiConnection, "Status: FTP server is stopped\n\n"); cellConsolePrintf(uiConnection, "Usage:\nftp\nftp start\nftp stop\nftp restart\n"); } cellConsolePrintf(uiConnection, "\nmultiMAN> "); return CELL_CONSOLE_INPUT_PROCESSED; } CellConsoleInputProcessorResult _cellConsolePeek (unsigned int uiConnection, const char *pcInput, void *pvDummy, int iContinuation) { (void) pvDummy; (void) iContinuation; char peek_addr[32]; peek_addr[0]=0; uint64_t peekA=0; if (sscanf(pcInput, "%*s %s", peek_addr)==1) { peekA=strtoull(peek_addr, NULL, 16)+0x8000000000000000ULL; if(peekA>0x80000000007ffff8ULL) return CELL_CONSOLE_INPUT_PROCESSED; cellConsolePrintf(uiConnection, "peek(0x80000000%08X): 0x%08X%08X\n", peekA, (peekq(peekA)>>32), peekq(peekA)); } else { cellConsolePrintf(uiConnection, "Usage: peek <u32 address>\n\npeek 2f8011\n\n"); } cellConsolePrintf(uiConnection, "\nmultiMAN> "); return CELL_CONSOLE_INPUT_PROCESSED; } CellConsoleInputProcessorResult _cellConsolePeekL (unsigned int uiConnection, const char *pcInput, void *pvDummy, int iContinuation) { (void) pvDummy; (void) iContinuation; char peek_addr[32]; peek_addr[0]=0; uint64_t peekA=0; int n=0; if (sscanf(pcInput, "%*s %s", peek_addr)==1) { for(n=0; n<256; n+=8) { peekA=strtoull(peek_addr, NULL, 16)+0x8000000000000000ULL + (uint64_t) n; if(peekA>0x80000000007ffff8ULL) break; cellConsolePrintf(uiConnection, "peek(0x80000000%08X): 0x%08X%08X\n", peekA, (peekq(peekA)>>32), peekq(peekA)); } } else { cellConsolePrintf(uiConnection, "Usage: peekl <u32 address>\n\npeek 2f8011\n\n"); } cellConsolePrintf(uiConnection, "\nmultiMAN> "); return CELL_CONSOLE_INPUT_PROCESSED; } CellConsoleInputProcessorResult _cellConsolePoke (unsigned int uiConnection, const char *pcInput, void *pvDummy, int iContinuation) { (void) pvDummy; (void) iContinuation; char peek_addr[32]; peek_addr[0]=0; char poke_val[32]; poke_val[0]=0; uint64_t peekA=0, pokeA=0; if (sscanf(pcInput, "%*s %s %s", peek_addr, poke_val)==2) { peekA=strtoull(peek_addr, NULL, 16)+0x8000000000000000ULL; if(peekA>0x80000000007ffff8ULL) return CELL_CONSOLE_INPUT_PROCESSED; cellConsolePrintf(uiConnection, "peek(0x80000000%08X): 0x%08X%08X\n", peekA, (peekq(peekA)>>32), peekq(peekA)); pokeA=strtoull(poke_val, NULL, 16); pokeq(peekA, pokeA); peekA=strtoull(peek_addr, NULL, 16)+0x8000000000000000ULL; cellConsolePrintf(uiConnection, "poke(0x80000000%08X)= 0x%08X%08X\n", peekA, (peekq(peekA)>>32), peekq(peekA)); } else { cellConsolePrintf(uiConnection, "Usage: poke <u32 address> <u64 value>\n\npoke 2f8011 1020304050607080\n\n"); } cellConsolePrintf(uiConnection, "\nmultiMAN> "); return CELL_CONSOLE_INPUT_PROCESSED; } CellConsoleInputProcessorResult _cellConsoleQuitXMB (unsigned int uiConnection, const char *pcInput, void *pvDummy, int iContinuation) { (void) pvDummy; (void) iContinuation; (void)uiConnection; (void)iContinuation; (void) pcInput; cellConsolePrintf(uiConnection, "\nShutting down multiMAN...\n"); unload_modules(); cellConsolePrintf(uiConnection, "Done!\n\n"); sys_process_exit(1); return CELL_CONSOLE_INPUT_PROCESSED; } CellConsoleInputProcessorResult _cellConsoleSS (unsigned int uiConnection, const char *pcInput, void *pvDummy, int iContinuation) { (void) pvDummy; (void) iContinuation; (void)uiConnection; (void)iContinuation; (void) pcInput; time ( &rawtime ); timeinfo = localtime ( &rawtime ); char video_mem[64], scm[128]; sprintf(video_mem, "/dev_hdd0/%04d%02d%02d-%02d%02d%02d-SCREENSHOT.RAW", timeinfo->tm_year+1900, timeinfo->tm_mon+1, timeinfo->tm_mday, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); sprintf(scm, "\nSaving screenshot to: [%s]...\n", video_mem); cellConsolePrintf(uiConnection, scm); FILE *fpA; remove(video_mem); fpA = fopen ( video_mem, "wb" ); uint64_t c_pos=0; // fwrite(color_base_addr, video_buffer, 1, fpA); for(c_pos=0;c_pos<video_buffer;c_pos+=4){ fwrite((uint8_t*)(color_base_addr)+c_pos+1, 3, 1, fpA); } fclose(fpA); cellConsolePrintf(uiConnection, "Done!\n\nmultiMAN> "); return CELL_CONSOLE_INPUT_PROCESSED; } CellConsoleInputProcessorResult _cellConsoleRESTART (unsigned int uiConnection, const char *pcInput, void *pvDummy, int iContinuation) { (void) pvDummy; (void) iContinuation; (void)uiConnection; (void)iContinuation; (void) pcInput; cellConsolePrintf(uiConnection, "\nShutting down multiMAN...\n"); cellConsolePrintf(uiConnection, "Trying to restart...\n"); // debug_print=102030; char reload_self[128]; sprintf(reload_self, "%s/RELOAD.SELF", app_usrdir); if(exist(reload_self)) { cellConsolePrintf(uiConnection, "Re-spawning [RELOAD.SELF]...\n"); unload_modules(); sys_game_process_exitspawn2((char*) reload_self, NULL, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } return CELL_CONSOLE_INPUT_PROCESSED; } CellConsoleInputProcessorResult _cellConsoleDebug (unsigned int uiConnection, const char *pcInput, void *pvDummy, int iContinuation) { (void) pvDummy; (void) iContinuation; (void)uiConnection; (void)iContinuation; (void) pcInput; debug_print=uiConnection; cellConsolePrintf(uiConnection, "Debug enabled.\n\nmultiMAN> "); dialog_ret=3; return CELL_CONSOLE_INPUT_PROCESSED; } #endif /****************************************************/ /* MODULES SECTION */ /****************************************************/ static int unload_mod=0; static int load_modules() { int ret; ret = cellSysmoduleLoadModule(CELL_SYSMODULE_FS); if (ret != CELL_OK) return ret; else unload_mod|=1; ret = cellSysmoduleLoadModule(CELL_SYSMODULE_PNGDEC); if(ret != CELL_OK) return ret; else unload_mod|=2; ret = cellSysmoduleLoadModule( CELL_SYSMODULE_IO ); if (ret != CELL_OK) return ret; else unload_mod|=4; ret = cellSysmoduleLoadModule(CELL_SYSMODULE_JPGDEC); //cellSysmoduleLoadModule( CELL_SYSMODULE_VDEC_MPEG2 ); cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT); CellScreenShotSetParam screenshot_param = {0, 0, 0, 0}; screenshot_param.photo_title = "multiMAN"; screenshot_param.game_title = "multiMAN Screenshots"; screenshot_param.game_comment = current_version_NULL; cellScreenShotSetParameter (&screenshot_param); cellScreenShotSetOverlayImage(app_homedir, (char*) "ICON0.PNG", 50, 850); cellScreenShotEnable(); cellSysmoduleLoadModule( CELL_SYSMODULE_AUDIO ); cellSysmoduleLoadModule( CELL_SYSMODULE_SPURS ); cellMouseInit (1); cellKbInit(1); ret = cellSysmoduleLoadModule(CELL_SYSMODULE_NET); if (ret < 0) return ret; else unload_mod|=16; cellNetCtlInit(); net_available = (cellSysmoduleLoadModule(CELL_SYSMODULE_HTTP)==CELL_OK); net_available = (sys_net_initialize_network()==0) | net_available; #if (CELL_SDK_VERSION>0x210001) cellConsoleInit(); cellConsoleNetworkInitialize(); cellConsoleNetworkServerInit(8080); cellConsoleInputProcessorAdd("resetbd", "Unmount/mount dev_bdvd", "", 0, _cellConsoleResetBDVD); cellConsoleInputProcessorAdd("debug", "Enable disable debug messages", "on|off", 0, _cellConsoleDebug); cellConsoleInputProcessorAdd("poke", "Write value to LV2 memory", "<u32 address> <u64 value>", 0, _cellConsolePoke); cellConsoleInputProcessorAdd("peekl", "Read 256 values from LV2 memory", "<u32 address>", 0, _cellConsolePeekL); cellConsoleInputProcessorAdd("peek", "Read value from LV2 memory", "<u32 address>", 0, _cellConsolePeek); cellConsoleInputProcessorAdd("ftp", "Manage FTP server", "start|stop|restart", 0, _cellConsoleFTP); cellConsoleInputProcessorAdd("quit", "Quit multiMAN and exit to XMB", "", 0, _cellConsoleQuitXMB); cellConsoleInputProcessorAdd("screenshot", "Save current screen as RAW (RGB) image in /dev_hdd0", "", 0, _cellConsoleSS); cellConsoleInputProcessorAdd("restart", "Restart multiMAN", "", 0, _cellConsoleRESTART); #endif ret = Fonts_LoadModules(); if ( ret != CELL_OK ) { return CELL_OK; } fonts = Fonts_Init(); if ( fonts ) { ret = Fonts_InitLibraryFreeType( &freeType ); if ( ret == CELL_OK ) { ret = Fonts_OpenFonts( freeType, fonts, app_usrdir ); if ( ret == CELL_OK ) { ret = Fonts_CreateRenderer( freeType, 0, &RenderWork.Renderer ); if ( ret == CELL_OK ) { // printf("App:Fonts Initialize All OK!\n"); //ret = Fonts_AttachFont( fonts, FONT_SYSTEM_GOTHIC_JP, &FontBitmaps.Font ); //Fonts_BindRenderer( &FontBitmaps.Font, &RenderWork.Renderer ); //FontBitmaps_Init( &FontBitmaps, (CellFont*)0, 24.f, 18.f, 1.0f, 0.1f, 256 ); return CELL_OK; } Fonts_CloseFonts( fonts ); } Fonts_EndLibrary( freeType ); } Fonts_End(); fonts = (Fonts_t*)0; } return ret; } void pfs_mode(int _mode) { #if (CELL_SDK_VERSION>0x210001) if(pfs_enabled && _mode==0) { pfs_enabled=0; usbdev_uninit(); } if(!pfs_enabled && _mode==1) { if(never_used_pfs) { usbdev_init(0); PfsmInit(max_usb_volumes); } usbdev_init(1); pfs_enabled=1; never_used_pfs=0; } if(pfs_enabled && _mode==2) { pfs_enabled=0; usbdev_uninit(); PfsmUninit(); } #else (void) _mode; #endif } void delete_entries(t_menu_list *list, int *max, u32 flag) { int n; n=0; while(n<(*max) ) { if(list[n].flags & flag) { if((*max) >1) { list[n].flags=0; list[n]=list[(*max) -1]; (*max) --; } else {if((*max) == 1)(*max) --; break;} } else n++; } } void sort_entries(t_menu_list *list, int *max) { int n,m,o1=0,o2=0; int fi= (*max); for(n=0; n< (fi -1);n++) for(m=n+1; m< fi ;m++) { if(list[n].title[0]=='_') o1=1; else o1=0; if(list[m].title[0]=='_') o2=1; else o2=0; if((strcasecmp(list[n].title+o1, list[m].title+o2)>0 && ((list[n].flags | list[m].flags) & 2048)==0) || ((list[m].flags & 2048) && n==0)) { t_menu_list swap; swap=list[n];list[n]=list[m];list[m]=swap; } } for(n=0; n< (fi -1);n++) for(m=n+1; m< fi ;m++) if(strcasecmp(list[n].path, list[m].path)==0 && strstr(list[n].content,"PS3")!=NULL) sprintf(list[m].title, "%s", "_DELETE"); n=0; while(n<(*max) ) { if(strstr(list[n].title, "_DELETE")!=NULL) { if((*max) >1) { list[n].flags=0; list[n]=list[(*max) -1]; (*max) --; } else {if((*max) == 1)(*max) --; break;} } else n++; } } void delete_xmb_member(xmbmem *_xmb, u16 *max, int n) { if((*max) >1) { _xmb[n]=_xmb[(*max) -1]; (*max) --; } else {if((*max) == 1)(*max) --;} } void sort_xmb_col(xmbmem *_xmb, u16 max, int _first) { if((max)<3) return; int n,m,o1=0,o2=0; u16 fi= (max); for(n=_first; n< (fi -1);n++) for(m=n+1; m< fi ;m++) { if(_xmb[n].name[0]=='_') o1=1; else o1=0; if(_xmb[m].name[0]=='_') o2=1; else o2=0; if(strcasecmp(_xmb[n].name+o1, _xmb[m].name+o2)>0) { xmbmem swap; swap=_xmb[n];_xmb[n]=_xmb[m];_xmb[m]=swap; } else //remove duplicate entries (by name) in music/photo/video columns (excl. AVCHD/Blu-ray) //preference goes to hdd entries usually (null entries removed by delete_xmb_dubs if(!strcasecmp(_xmb[n].name+o1, _xmb[m].name+o2) && (_xmb[n].type>=4 && _xmb[n].type<=5)) _xmb[n].name[0]=0; } } void delete_xmb_dubs(xmbmem *_xmb, u16 *max) { if((*max)<2) return; int n; for(n=0; n< ((*max) -1);n++) if(_xmb[n].name[0]==0) { if((*max) >1) { _xmb[n]=_xmb[(*max) -1]; (*max) --; } else {if((*max) == 1)(*max) --;} } } void read_xmb_column(int c, const u8 group) { char colfile[128]; char string1[9]; int backup_group=xmb[c].group; sprintf(colfile, "%s/XMBS.00%i", app_usrdir, c); FILE *flist = fopen(colfile, "rb"); if(flist!=NULL) { fread((char*) &string1, 8, 1, flist); if(strstr(string1, XMB_COL_VER)!=NULL) { fseek(flist, 0, SEEK_END); int llist_size=ftell(flist)-8; fseek(flist, 8, SEEK_SET); fread((char*) &xmb[c], llist_size, 1, flist); fclose(flist); if(group) { for(int n=0; n<xmb[c].size; n++) { if(xmb[c].member[n].type!=6 && xmb[c].member[n].type!=7) { u8 m_grp= (group-1)*2; if( group!=14 && (m_grp+0x41) != xmb[c].member[n].name[0] && (m_grp+0x42) != xmb[c].member[n].name[0] && (m_grp+0x61) != xmb[c].member[n].name[0] && (m_grp+0x62) != xmb[c].member[n].name[0] ) { delete_xmb_member(xmb[c].member, &xmb[c].size, n); if(n>=xmb[c].size) break; n--; } else if( group==14 && ( (xmb[c].member[n].name[0]>=0x41 && xmb[c].member[n].name[0]<=0x5a) || (xmb[c].member[n].name[0]>=0x61 && xmb[c].member[n].name[0]<=0x7a) ) ) { delete_xmb_member(xmb[c].member, &xmb[c].size, n); if(n>=xmb[c].size) break; n--; } } } sort_xmb_col(xmb[c].member, xmb[c].size, (c==8 ? 1 : 0)); if(xmb[c].size) xmb[c].first= (c==8 ? 1 : 0); } } else { fclose(flist); remove(colfile); xmb[c].size=0; xmb[c].init=0; xmb[c].first=0; backup_group=0; } xmb[c].group=backup_group; free_all_buffers(); free_text_buffers(); } } void read_xmb_column_type(int c, u8 type, const u8 group) { char colfile[128]; char string1[9]; int backup_group=xmb[c].group; sprintf(colfile, "%s/XMBS.00%i", app_usrdir, c); FILE *flist = fopen(colfile, "rb"); if(flist!=NULL) { fread((char*) &string1, 8, 1, flist); if(strstr(string1, XMB_COL_VER)!=NULL) { fseek(flist, 0, SEEK_END); int llist_size=ftell(flist)-8; fseek(flist, 8, SEEK_SET); fread((char*) &xmb[c], llist_size, 1, flist); fclose(flist); } else { fclose(flist); remove(colfile); xmb[c].size=0; xmb[c].init=0; xmb[c].first=0; xmb[c].group=0; backup_group=0; } for(int n=0; n<xmb[c].size; n++) { if(xmb[c].member[n].type!=type && xmb[c].member[n].type!=6 && xmb[c].member[n].type!=7) { delete_xmb_member(xmb[c].member, &xmb[c].size, n); if(n>=xmb[c].size) break; n--; } } if(group) { for(int n=0; n<xmb[c].size; n++) { if(xmb[c].member[n].type!=6 && xmb[c].member[n].type!=7) { u8 m_grp= (group-1)*2; if( group!=14 && (m_grp+0x41) != xmb[c].member[n].name[0] && (m_grp+0x42) != xmb[c].member[n].name[0] && (m_grp+0x61) != xmb[c].member[n].name[0] && (m_grp+0x62) != xmb[c].member[n].name[0] ) { delete_xmb_member(xmb[c].member, &xmb[c].size, n); if(n>=xmb[c].size) break; n--; } else if( group==14 && ( (xmb[c].member[n].name[0]>=0x41 && xmb[c].member[n].name[0]<=0x5a) || (xmb[c].member[n].name[0]>=0x61 && xmb[c].member[n].name[0]<=0x7a) ) ) { delete_xmb_member(xmb[c].member, &xmb[c].size, n); if(n>=xmb[c].size) break; n--; } } } sort_xmb_col(xmb[c].member, xmb[c].size, (c==8 ? 1 : 0)); if(xmb[c].size) xmb[c].first= (c==8 ? 1 : 0); } xmb[c].group=backup_group; free_all_buffers(); free_text_buffers(); } } void save_xmb_column(int c) { if(xmb[c].group) return; char colfile[128]; sprintf(colfile, "%s/XMBS.00%i", app_usrdir, c); remove(colfile); if(xmb[c].size) { FILE *flist = fopen(colfile, "wb"); if(flist!=NULL) { fwrite((char*) XMB_COL_VER, 8, 1, flist); fwrite((char*) &xmb[c], sizeof(xmbmem)*xmb[c].size, 1, flist); fclose(flist); } } } static int unload_modules() { mm_shutdown=true; init_finished=0; /* if(text_bmp!=NULL) { u8 *buffer=text_bmp; ClearSurface(); flip(); max_ttf_label=0; memset(buffer, 0, 1920*1080*4); print_label_ex( 0.5f, 0.50f, 1.0f, 0xffffffff, (char*)"Boo!", 1.04f, 0.0f, 15, 1.0f, 1.0f, 1); flush_ttf(buffer, 1920, 1080); ClearSurface(); set_texture( buffer, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); setRenderColor(); flip(); }*/ ClearSurface();flip(); ClearSurface();flip(); save_options(); write_last_state(); FILE *flist; remove(list_file); if(!pfs_enabled) { flist = fopen(list_file, "wb"); if(flist!=NULL) { fwrite((char*) GAME_LIST_VER, 8, 1, flist); fwrite((char*) &menu_list, ((max_menu_list+1)*sizeof(t_menu_list)), 1, flist); //556 sizeof(t_menu_list) fclose(flist); } } else { fdevices_old=0; sprintf(current_left_pane, "%s", "/"); sprintf(current_right_pane, "%s", "/"); } reset_xmb_checked(); if( !(is_video_loading || is_music_loading || is_photo_loading || is_retro_loading || is_game_loading || is_any_xmb_column)) { for(int c=3;c<9;c++) { if(c==6) c=8; save_xmb_column(c); } } sprintf(list_file_state, "%s/LSTAT.BIN", app_usrdir); remove(list_file_state); flist = fopen(list_file_state, "wb"); if(flist!=NULL) { if(xmb_icon==1 && xmb[xmb_icon].first>6) xmb[xmb_icon].first=1; fwrite((char*) GAME_STATE_VER, 8, 1, flist); fwrite((char*) &fdevices_old, sizeof(fdevices_old), 1, flist); fwrite((char*) &mouseX, sizeof(mouseX), 1, flist); fwrite((char*) &mouseY, sizeof(mouseY), 1, flist); fwrite((char*) &mp3_volume, sizeof(mp3_volume), 1, flist); fwrite((char*) &current_left_pane, sizeof(current_left_pane), 1, flist); fwrite((char*) &current_right_pane, sizeof(current_right_pane), 1, flist); fwrite((char*) &xmb_icon, sizeof(xmb_icon), 1, flist); fwrite((char*) &xmb[xmb_icon].first, sizeof(xmb[xmb_icon].first), 1, flist); fwrite((char*) &xmb[6].group, sizeof(xmb[6].group), 1, flist); fwrite((char*) &xmb[8].group, sizeof(xmb[8].group), 1, flist); fwrite((char*) &xmb[4].group, sizeof(xmb[4].group), 1, flist); fclose(flist); } enable_sc36(); ftp_off(); cellPadEnd(); if(multiStreamStarted) ShutdownMultiStream(); pfs_mode(2); //sys_vm_unmap(vm); if(unload_mod & 16) cellSysmoduleUnloadModule(CELL_SYSMODULE_NET); if(unload_mod & 8) cellSysmoduleUnloadModule(CELL_SYSMODULE_GCM_SYS); if(unload_mod & 4) cellSysmoduleUnloadModule(CELL_SYSMODULE_IO); if(unload_mod & 2) cellSysmoduleUnloadModule(CELL_SYSMODULE_PNGDEC); cellSysmoduleUnloadModule(CELL_SYSMODULE_JPGDEC); if(unload_mod & 1) cellSysmoduleUnloadModule(CELL_SYSMODULE_FS); //cellSysmoduleUnloadModule(CELL_SYSMODULE_VDEC_MPEG2); cellSysmoduleUnloadModule( CELL_SYSMODULE_SYSUTIL_SCREENSHOT ); cellSysmoduleUnloadModule( CELL_SYSMODULE_AUDIO ); //cellSysmoduleUnloadModule( CELL_SYSMODULE_USBD ); cellSysmoduleUnloadModule( CELL_SYSMODULE_RESC ); cellSysmoduleUnloadModule( CELL_SYSMODULE_SPURS ); if(ve_initialized) cellSysmoduleUnloadModule( CELL_SYSMODULE_VIDEO_EXPORT ); if(me_initialized) cellSysmoduleUnloadModule( CELL_SYSMODULE_MUSIC_EXPORT ); if(pe_initialized) cellSysmoduleUnloadModule( CELL_SYSMODULE_PHOTO_EXPORT ); //FontBitmaps_End( &FontBitmaps ); //Fonts_UnbindRenderer( &FontBitmaps.Font ); //Fonts_DetachFont( &FontBitmaps.Font ); Fonts_CloseFonts( fonts ); Fonts_DestroyRenderer( &RenderWork.Renderer ); Fonts_EndLibrary( freeType ); Fonts_End(); Fonts_UnloadModules(); cellMouseEnd(); cellKbEnd(); sys_memory_container_destroy( memory_container_web ); sys_memory_container_destroy( memory_container ); cellSysmoduleFinalize(); return 0; } /****************************************************/ /* PNG SECTION */ /****************************************************/ typedef struct CtrlMallocArg { u32 mallocCallCounts; } CtrlMallocArg; typedef struct CtrlFreeArg { u32 freeCallCounts; } CtrlFreeArg; void *png_malloc(u32 size, void * a) { CtrlMallocArg *arg; arg = (CtrlMallocArg *) a; arg->mallocCallCounts++; return memalign(16,size+16); } static int png_free(void *ptr, void * a) { CtrlFreeArg *arg; arg = (CtrlFreeArg *) a; arg->freeCallCounts++; free(ptr); return 0; } int map_rsx_memory(u8 *buffer, size_t buf_size) { int ret; u32 offset; ret = cellGcmMapMainMemory(buffer, buf_size, &offset); if(CELL_OK != ret ) return ret; return 0; } int png_w=0, png_h=0, png_w2, png_h2; int jpg_w=0, jpg_h=0; int png_w_th=0, png_h_th=0; /* typedef struct{ sys_ppu_thread_t *ppuThreadId; uint32_t fileNum; usecond_t sleepTime; CellJpgDecCommand *commandPtr; } CellJpgTimerThreadArg_t; */ //typedef int32_t(*CellPngDecCbControlStream)( /*int32_t png_callback( CellPngDecStrmInfo *strmInfo, CellPngDecStrmParam *strmParam, void *cbCtrlStrmArg) { return 0; }*/ /* typedef struct CellPngDecDispInfo { uint64_t outputFrameWidthByte; uint32_t outputFrameHeight; uint64_t outputStartXByte; uint32_t outputStartY; uint64_t outputWidthByte; uint32_t outputHeight; uint32_t outputBitDepth; uint32_t outputComponents; uint32_t nextOutputStartY; uint32_t scanPassCount; void *outputImage; } CellPngDecDispInfo; typedef struct CellPngDecDispParam { void *nextOutputImage; } CellPngDecDispParam; */ /* int32_t pngDispCb( CellPngDecDispInfo *dispInfo, CellPngDecDispParam *dispParam, void *cbCtrlDispArg ) { (void) cbCtrlDispArg; dispParam->nextOutputImage=(u8*)(dispInfo->outputImage) + (dispInfo->outputWidthByte * dispInfo->outputHeight); // ClearSurface(); // set_texture( text_bmp, 1920, 1080); //PIC1.PNG // display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); // flip(); pad_read(); { if ((new_pad & BUTTON_UP)) { c_opacity_delta=16; dimc=0; dim=1; if(cover_mode==8 && xmb[xmb_icon].size>1) { if(xmb[xmb_icon].first==0) {xmb[xmb_icon].first=xmb[xmb_icon].size-1; xmb_bg_show=0; xmb_bg_counter=200;} else xmb_slide_step_y=10; } } else if ((new_pad & BUTTON_DOWN)) { if(cover_mode==8 && xmb[xmb_icon].size>1) { if(xmb[xmb_icon].first==xmb[xmb_icon].size-1) {xmb[xmb_icon].first=0; xmb_bg_show=0; xmb_bg_counter=200;} else xmb_slide_step_y=-10;// && xmb[xmb_icon].first<xmb[xmb_icon].size-1) xmb[xmb_icon].first++; } } else if ((new_pad & BUTTON_LEFT)) { if(cover_mode==8 && xmb_icon>1) xmb_slide_step=15; } else if ((new_pad & BUTTON_RIGHT)) { if(cover_mode==8 && xmb_icon<MAX_XMB_ICONS-1) xmb_slide_step=-15; } } draw_xmb_bare(xmb_icon, 1, 1, 0); return 0; } int load_png_partial(u8 *data, char *name, uint16_t _DW, u32 _lines, u16 *_image_id) { int ret_file, ret, ok=-1; CellPngDecMainHandle mHandle; CellPngDecSubHandle sHandle; CellPngDecThreadInParam InParam; CellPngDecThreadOutParam OutParam; CellPngDecOpnParam opnParam; CellPngDecExtInfo extInfo; CellPngDecSrc src; CellPngDecOpnInfo opnInfo; CellPngDecInfo info; CellPngDecDataOutInfo dOutInfo; CellPngDecDataCtrlParam dCtrlParam; CellPngDecInParam inParam; CellPngDecExtInParam extInParam; CellPngDecOutParam outParam; CellPngDecExtOutParam extoutParam; CtrlMallocArg MallocArg; CtrlFreeArg FreeArg; // CellPngDecCbCtrlStrm pngCallback; // pngCallback.cbCtrlStrmFunc= png_callback; // pngCallback.cbCtrlStrmArg = NULL; CellPngDecCbCtrlDisp pngDisp; pngDisp.cbCtrlDispFunc = pngDispCb; pngDisp.cbCtrlDispArg = &_image_id; CellPngDecDispParam pngDispInfo; pngDispInfo.nextOutputImage = data; int ret_png=-1; opnParam.selectChunk = 0; //no extra chunks needed InParam.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_DISABLE; InParam.ppuThreadPriority = 3071; InParam.spuThreadPriority = 255; InParam.cbCtrlMallocFunc = png_malloc; InParam.cbCtrlMallocArg = &MallocArg; InParam.cbCtrlFreeFunc = png_free; InParam.cbCtrlFreeArg = &FreeArg; extInParam.bufferMode = CELL_PNGDEC_LINE_MODE; extInParam.spuMode = CELL_PNGDEC_TRYRECEIVE_EVENT; extInParam.outputCounts = _lines; //extoutParam.outputWidthByte //extoutParam.outputHeight ret_png= ret= cellPngDecCreate(&mHandle, &InParam, &OutParam); // memset(data, 0x00, sizeof(data)); //(DISPLAY_WIDTH * DISPLAY_HEIGHT * 4) png_w= png_h= 0; if(ret_png == CELL_OK) { memset(&src, 0, sizeof(CellPngDecSrc)); src.srcSelect = CELL_PNGDEC_FILE; src.fileName = name; src.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_DISABLE; // ret_file=ret = cellPngDecOpen(mHandle, &sHandle, &src, &opnInfo); // ret_file=ret = cellPngDecExtOpen(mHandle, &sHandle, &src, &opnInfo, &pngCallback, &opnParam); ret_file=ret = cellPngDecExtOpen(mHandle, &sHandle, &src, &opnInfo, NULL, &opnParam); if(ret == CELL_OK) { // ret = cellPngDecReadHeader(mHandle, sHandle, &info); ret = cellPngDecExtReadHeader(mHandle, sHandle, &info, &extInfo); } if(ret == CELL_OK && (_DW * info.imageHeight <= 2073600)) { inParam.commandPtr = NULL; inParam.outputMode = CELL_PNGDEC_TOP_TO_BOTTOM; inParam.outputColorSpace = CELL_PNGDEC_RGBA; inParam.outputBitDepth = 8; inParam.outputPackFlag = CELL_PNGDEC_1BYTE_PER_1PIXEL; if((info.colorSpace == CELL_PNGDEC_GRAYSCALE_ALPHA) || (info.colorSpace == CELL_PNGDEC_RGBA) || (info.chunkInformation & 0x10)) inParam.outputAlphaSelect = CELL_PNGDEC_STREAM_ALPHA; else inParam.outputAlphaSelect = CELL_PNGDEC_FIX_ALPHA; inParam.outputColorAlpha = 0xff; // ret = cellPngDecSetParameter(mHandle, sHandle, &inParam, &outParam); ret = cellPngDecExtSetParameter(mHandle, sHandle, &inParam, &outParam, &extInParam, &extoutParam); } else ret=-1; if(ret == CELL_OK) { dCtrlParam.outputBytesPerLine = _DW * 4; // ret = cellPngDecDecodeData(mHandle, sHandle, data, &dCtrlParam, &dOutInfo); ret = cellPngDecExtDecodeData(mHandle, sHandle, data, &dCtrlParam, &dOutInfo, &pngDisp, &pngDispInfo); if((ret == CELL_OK) && (dOutInfo.status == CELL_PNGDEC_DEC_STATUS_FINISH)) { png_w= outParam.outputWidth; png_h= outParam.outputHeight; ok=0; } } if(ret_file==0) ret = cellPngDecClose(mHandle, sHandle); ret = cellPngDecDestroy(mHandle); } //InParam.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_DISABLE; // use_png_alpha=0; return ok; } */ int load_jpg_texture_th(u8 *data, char *name, uint16_t _DW) { int ret, ok=-1; jpg_w=0; jpg_h=0; CellJpgDecMainHandle mHandle; CellJpgDecSubHandle sHandle; CellJpgDecInParam inParam; CellJpgDecOutParam outParam; CellJpgDecSrc src; CellJpgDecOpnInfo opnInfo; CellJpgDecInfo info; CellJpgDecDataOutInfo dOutInfo; CellJpgDecDataCtrlParam dCtrlParam; CellJpgDecThreadInParam InParam; CellJpgDecThreadOutParam OutParam; CtrlMallocArg MallocArg; CtrlFreeArg FreeArg; float downScale; bool unsupportFlag; MallocArg.mallocCallCounts = 0; FreeArg.freeCallCounts = 0; // InParam.spuThreadEnable = CELL_JPGDEC_SPU_THREAD_DISABLE; InParam.spuThreadEnable = CELL_JPGDEC_SPU_THREAD_ENABLE; InParam.ppuThreadPriority = 1001; InParam.spuThreadPriority = 250; InParam.cbCtrlMallocFunc = png_malloc; InParam.cbCtrlMallocArg = &MallocArg; InParam.cbCtrlFreeFunc = png_free; InParam.cbCtrlFreeArg = &FreeArg; ret = cellJpgDecCreate(&mHandle, &InParam, &OutParam); if(ret == CELL_OK){ src.srcSelect = CELL_JPGDEC_FILE; src.fileName = name; src.fileOffset = 0; src.fileSize = 0; src.streamPtr = NULL; src.streamSize = 0; src.spuThreadEnable = CELL_JPGDEC_SPU_THREAD_ENABLE; unsupportFlag = false; ret = cellJpgDecOpen(mHandle, &sHandle, &src, &opnInfo); if(ret == CELL_OK){ ret = cellJpgDecReadHeader(mHandle, sHandle, &info); if(info.jpegColorSpace == CELL_JPG_UNKNOWN){ unsupportFlag = true; } if(ret !=CELL_OK || info.imageHeight==0) { src.spuThreadEnable = CELL_JPGDEC_SPU_THREAD_DISABLE; unsupportFlag = false; ret = cellJpgDecClose(mHandle, sHandle); ret = cellJpgDecOpen(mHandle, &sHandle, &src, &opnInfo); ret = cellJpgDecReadHeader(mHandle, sHandle, &info); if(info.jpegColorSpace == CELL_JPG_UNKNOWN){ unsupportFlag = true; } } } //decoder open if(ret == CELL_OK){ if(scale_icon_h) { // if(info.imageHeight>info.imageWidth) if( ((float)info.imageHeight / (float)XMB_THUMB_HEIGHT) > ((float)info.imageWidth / (float) XMB_THUMB_WIDTH)) downScale=(float)info.imageHeight / (float)(XMB_THUMB_HEIGHT); else downScale=(float)info.imageWidth / (float) (XMB_THUMB_WIDTH); } else { if(info.imageWidth>1920 || info.imageHeight>1080){ if( ((float)info.imageWidth / 1920) > ((float)info.imageHeight / 1080 ) ){ downScale = (float)info.imageWidth / 1920; }else{ downScale = (float)info.imageHeight / 1080; } } else downScale=1.f; if(strstr(name, "/HDAVCTN/BDMT_O1.jpg")!=NULL || strstr(name, "/BDMV/META/DL/HDAVCTN_O1.jpg")!=NULL) downScale = (float) (info.imageWidth / 320); } if( downScale <= 1.f ){ inParam.downScale = 1; }else if( downScale <= 2.f ){ inParam.downScale = 2; }else if( downScale <= 4.f ){ inParam.downScale = 4; }else{ inParam.downScale = 8; } if(downScale>8.0f) { jpg_w=0; jpg_h=0; goto leave_jpg_th; } inParam.commandPtr = NULL; inParam.method = CELL_JPGDEC_FAST; inParam.outputMode = CELL_JPGDEC_TOP_TO_BOTTOM; inParam.outputColorSpace = CELL_JPG_RGBA; // if(scale_icon_h) // inParam.outputColorAlpha = 0x80; // else inParam.outputColorAlpha = 0xfe; ret = cellJpgDecSetParameter(mHandle, sHandle, &inParam, &outParam); } if(ret == CELL_OK){ // if( _DW<1920 ) if(scale_icon_h && inParam.downScale) dCtrlParam.outputBytesPerLine = (int) ((info.imageWidth/inParam.downScale) * 4); else dCtrlParam.outputBytesPerLine = _DW * 4; // else // dCtrlParam.outputBytesPerLine = 1920 * 4; // memset(data, 0, sizeof(data)); ret = cellJpgDecDecodeData(mHandle, sHandle, data, &dCtrlParam, &dOutInfo); if((ret == CELL_OK) && (dOutInfo.status == CELL_JPGDEC_DEC_STATUS_FINISH)) { jpg_w= outParam.outputWidth; jpg_h= outParam.outputHeight; ok=0; } } leave_jpg_th: ret = cellJpgDecClose(mHandle, sHandle); ret = cellJpgDecDestroy(mHandle); } //decoder create scale_icon_h=0; return ret; } int load_jpg_texture(u8 *data, char *name, uint16_t _DW) { scale_icon_h=0; while(is_decoding_jpg || is_decoding_png){ sys_timer_usleep(3336); cellSysutilCheckCallback();} is_decoding_jpg=1; int ret, ok=-1; png_w=0; png_h=0; CellJpgDecMainHandle mHandle; CellJpgDecSubHandle sHandle; CellJpgDecInParam inParam; CellJpgDecOutParam outParam; CellJpgDecSrc src; CellJpgDecOpnInfo opnInfo; CellJpgDecInfo info; CellJpgDecDataOutInfo dOutInfo; CellJpgDecDataCtrlParam dCtrlParam; CellJpgDecThreadInParam InParam; CellJpgDecThreadOutParam OutParam; CtrlMallocArg MallocArg; CtrlFreeArg FreeArg; float downScale; bool unsupportFlag; MallocArg.mallocCallCounts = 0; FreeArg.freeCallCounts = 0; // InParam.spuThreadEnable = CELL_JPGDEC_SPU_THREAD_DISABLE; InParam.spuThreadEnable = CELL_JPGDEC_SPU_THREAD_ENABLE; InParam.ppuThreadPriority = 1001; InParam.spuThreadPriority = 250; InParam.cbCtrlMallocFunc = png_malloc; InParam.cbCtrlMallocArg = &MallocArg; InParam.cbCtrlFreeFunc = png_free; InParam.cbCtrlFreeArg = &FreeArg; ret = cellJpgDecCreate(&mHandle, &InParam, &OutParam); if(ret == CELL_OK){ src.srcSelect = CELL_JPGDEC_FILE; src.fileName = name; src.fileOffset = 0; src.fileSize = 0; src.streamPtr = NULL; src.streamSize = 0; src.spuThreadEnable = CELL_JPGDEC_SPU_THREAD_ENABLE; unsupportFlag = false; ret = cellJpgDecOpen(mHandle, &sHandle, &src, &opnInfo); if(ret == CELL_OK){ ret = cellJpgDecReadHeader(mHandle, sHandle, &info); if(info.jpegColorSpace == CELL_JPG_UNKNOWN){ unsupportFlag = true; } if(ret !=CELL_OK || info.imageHeight==0) { src.spuThreadEnable = CELL_JPGDEC_SPU_THREAD_DISABLE; unsupportFlag = false; ret = cellJpgDecClose(mHandle, sHandle); ret = cellJpgDecOpen(mHandle, &sHandle, &src, &opnInfo); ret = cellJpgDecReadHeader(mHandle, sHandle, &info); if(info.jpegColorSpace == CELL_JPG_UNKNOWN){ unsupportFlag = true; } } } //decoder open if(ret == CELL_OK){ if(scale_icon_h) { // if(info.imageHeight>info.imageWidth) if( ((float)info.imageHeight / (float)XMB_THUMB_HEIGHT) > ((float)info.imageWidth / (float) XMB_THUMB_WIDTH)) downScale=(float)info.imageHeight / (float)(XMB_THUMB_HEIGHT); else downScale=(float)info.imageWidth / (float) (XMB_THUMB_WIDTH); } else { if(info.imageWidth>1920 || info.imageHeight>1080){ if( ((float)info.imageWidth / 1920) > ((float)info.imageHeight / 1080 ) ){ downScale = (float)info.imageWidth / 1920; }else{ downScale = (float)info.imageHeight / 1080; } } else downScale=1.f; if(strstr(name, "/HDAVCTN/BDMT_O1.jpg")!=NULL || strstr(name, "/BDMV/META/DL/HDAVCTN_O1.jpg")!=NULL) downScale = (float) (info.imageWidth / 320); } if( downScale <= 1.f ){ inParam.downScale = 1; }else if( downScale <= 2.f ){ inParam.downScale = 2; }else if( downScale <= 4.f ){ inParam.downScale = 4; }else{ inParam.downScale = 8; } if(downScale>8.0f) { png_w=0; png_h=0; goto leave_jpg; } inParam.commandPtr = NULL; inParam.method = CELL_JPGDEC_FAST; inParam.outputMode = CELL_JPGDEC_TOP_TO_BOTTOM; inParam.outputColorSpace = CELL_JPG_RGBA; // if(scale_icon_h) // inParam.outputColorAlpha = 0x80; // else inParam.outputColorAlpha = 0xfe; ret = cellJpgDecSetParameter(mHandle, sHandle, &inParam, &outParam); } if(ret == CELL_OK){ // if( _DW<1920 ) if(scale_icon_h && inParam.downScale) dCtrlParam.outputBytesPerLine = (int) ((info.imageWidth/inParam.downScale) * 4); else dCtrlParam.outputBytesPerLine = _DW * 4; // else // dCtrlParam.outputBytesPerLine = 1920 * 4; // memset(data, 0, sizeof(data)); ret = cellJpgDecDecodeData(mHandle, sHandle, data, &dCtrlParam, &dOutInfo); if((ret == CELL_OK) && (dOutInfo.status == CELL_JPGDEC_DEC_STATUS_FINISH)) { png_w= outParam.outputWidth; png_h= outParam.outputHeight; ok=0; } } leave_jpg: ret = cellJpgDecClose(mHandle, sHandle); ret = cellJpgDecDestroy(mHandle); } //decoder create scale_icon_h=0; is_decoding_jpg=0; return ret; } int load_png_texture_th(u8 *data, char *name)//, uint16_t _DW) { int ret_file, ret, ok=-1; CellPngDecMainHandle mHandle; CellPngDecSubHandle sHandle; CellPngDecThreadInParam InParam; CellPngDecThreadOutParam OutParam; CellPngDecSrc src; CellPngDecOpnInfo opnInfo; CellPngDecInfo info; CellPngDecDataOutInfo dOutInfo; CellPngDecDataCtrlParam dCtrlParam; CellPngDecInParam inParam; CellPngDecOutParam outParam; CtrlMallocArg MallocArg; CtrlFreeArg FreeArg; int ret_png=-1; // InParam.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_DISABLE; InParam.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_ENABLE; InParam.ppuThreadPriority = 1001; InParam.spuThreadPriority = 250; InParam.cbCtrlMallocFunc = png_malloc; InParam.cbCtrlMallocArg = &MallocArg; InParam.cbCtrlFreeFunc = png_free; InParam.cbCtrlFreeArg = &FreeArg; ret_png= ret= cellPngDecCreate(&mHandle, &InParam, &OutParam); // memset(data, 0x00, sizeof(data)); //(DISPLAY_WIDTH * DISPLAY_HEIGHT * 4) png_w_th= png_h_th= 0; if(ret_png == CELL_OK) { memset(&src, 0, sizeof(CellPngDecSrc)); src.srcSelect = CELL_PNGDEC_FILE; src.fileName = name; // src.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_DISABLE; src.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_ENABLE; ret_file=ret = cellPngDecOpen(mHandle, &sHandle, &src, &opnInfo); if(ret == CELL_OK) { ret = cellPngDecReadHeader(mHandle, sHandle, &info); if(ret !=CELL_OK || info.imageHeight==0) { src.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_DISABLE; cellPngDecClose(mHandle, sHandle); ret_file=ret = cellPngDecOpen(mHandle, &sHandle, &src, &opnInfo); ret = cellPngDecReadHeader(mHandle, sHandle, &info); } } if(ret == CELL_OK)// && (_DW * info.imageHeight <= 2073600)) { inParam.commandPtr = NULL; inParam.outputMode = CELL_PNGDEC_TOP_TO_BOTTOM; inParam.outputColorSpace = CELL_PNGDEC_RGBA; inParam.outputBitDepth = 8; inParam.outputPackFlag = CELL_PNGDEC_1BYTE_PER_1PIXEL; if((info.colorSpace == CELL_PNGDEC_GRAYSCALE_ALPHA) || (info.colorSpace == CELL_PNGDEC_RGBA) || (info.chunkInformation & 0x10)) inParam.outputAlphaSelect = CELL_PNGDEC_STREAM_ALPHA; else inParam.outputAlphaSelect = CELL_PNGDEC_FIX_ALPHA; // if(use_png_alpha) // inParam.outputAlphaSelect = CELL_PNGDEC_STREAM_ALPHA; // else inParam.outputColorAlpha = 0xff; // inParam.outputColorAlpha = 0x00; ret = cellPngDecSetParameter(mHandle, sHandle, &inParam, &outParam); } else ret=-1; if(ret == CELL_OK) { dCtrlParam.outputBytesPerLine = info.imageWidth * 4;//_DW * 4; ret = cellPngDecDecodeData(mHandle, sHandle, data, &dCtrlParam, &dOutInfo); // sys_timer_usleep(500); if((ret == CELL_OK) && (dOutInfo.status == CELL_PNGDEC_DEC_STATUS_FINISH)) { png_w_th= outParam.outputWidth; png_h_th= outParam.outputHeight; ok=0; } } if(ret_file==0) ret = cellPngDecClose(mHandle, sHandle); ret = cellPngDecDestroy(mHandle); } //InParam.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_DISABLE; // use_png_alpha=0; return ok; } int load_png_texture(u8 *data, char *name, uint16_t _DW) { while(is_decoding_jpg || is_decoding_png){ sys_timer_usleep(3336); cellSysutilCheckCallback();} is_decoding_png=1; int ret_file, ret, ok=-1; CellPngDecMainHandle mHandle; CellPngDecSubHandle sHandle; CellPngDecThreadInParam InParam; CellPngDecThreadOutParam OutParam; CellPngDecSrc src; CellPngDecOpnInfo opnInfo; CellPngDecInfo info; CellPngDecDataOutInfo dOutInfo; CellPngDecDataCtrlParam dCtrlParam; CellPngDecInParam inParam; CellPngDecOutParam outParam; CtrlMallocArg MallocArg; CtrlFreeArg FreeArg; int ret_png=-1; // InParam.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_DISABLE; InParam.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_ENABLE; InParam.ppuThreadPriority = 1001; InParam.spuThreadPriority = 250; InParam.cbCtrlMallocFunc = png_malloc; InParam.cbCtrlMallocArg = &MallocArg; InParam.cbCtrlFreeFunc = png_free; InParam.cbCtrlFreeArg = &FreeArg; ret_png= ret= cellPngDecCreate(&mHandle, &InParam, &OutParam); // memset(data, 0x00, sizeof(data)); //(DISPLAY_WIDTH * DISPLAY_HEIGHT * 4) png_w= png_h= 0; if(ret_png == CELL_OK) { memset(&src, 0, sizeof(CellPngDecSrc)); src.srcSelect = CELL_PNGDEC_FILE; src.fileName = name; // src.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_DISABLE; src.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_ENABLE; ret_file=ret = cellPngDecOpen(mHandle, &sHandle, &src, &opnInfo); if(ret == CELL_OK) { ret = cellPngDecReadHeader(mHandle, sHandle, &info); if(ret !=CELL_OK || info.imageHeight==0) { src.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_DISABLE; cellPngDecClose(mHandle, sHandle); ret_file=ret = cellPngDecOpen(mHandle, &sHandle, &src, &opnInfo); ret = cellPngDecReadHeader(mHandle, sHandle, &info); } } if(ret == CELL_OK && (_DW * info.imageHeight <= 2073600)) { inParam.commandPtr = NULL; inParam.outputMode = CELL_PNGDEC_TOP_TO_BOTTOM; inParam.outputColorSpace = CELL_PNGDEC_RGBA; inParam.outputBitDepth = 8; inParam.outputPackFlag = CELL_PNGDEC_1BYTE_PER_1PIXEL; if((info.colorSpace == CELL_PNGDEC_GRAYSCALE_ALPHA) || (info.colorSpace == CELL_PNGDEC_RGBA) || (info.chunkInformation & 0x10)) inParam.outputAlphaSelect = CELL_PNGDEC_STREAM_ALPHA; else inParam.outputAlphaSelect = CELL_PNGDEC_FIX_ALPHA; // if(use_png_alpha) // inParam.outputAlphaSelect = CELL_PNGDEC_STREAM_ALPHA; // else inParam.outputColorAlpha = 0xff; // inParam.outputColorAlpha = 0x00; ret = cellPngDecSetParameter(mHandle, sHandle, &inParam, &outParam); } else ret=-1; if(ret == CELL_OK) { dCtrlParam.outputBytesPerLine = _DW * 4; ret = cellPngDecDecodeData(mHandle, sHandle, data, &dCtrlParam, &dOutInfo); // sys_timer_usleep(500); if((ret == CELL_OK) && (dOutInfo.status == CELL_PNGDEC_DEC_STATUS_FINISH)) { png_w= outParam.outputWidth; png_h= outParam.outputHeight; ok=0; } } if(ret_file==0) ret = cellPngDecClose(mHandle, sHandle); ret = cellPngDecDestroy(mHandle); } //InParam.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_DISABLE; // use_png_alpha=0; is_decoding_png=0; return ok; } int load_raw_texture(u8 *data, char *name, uint16_t _DW) { FILE *fpA; uint32_t _DWO=80, _DHO=45; if(strstr(name, "_960.RAW")!=NULL) { _DWO=960; _DHO=540; } if(strstr(name, "_640.RAW")!=NULL) { _DWO=640; _DHO=360; } if(strstr(name, "_480.RAW")!=NULL) { _DWO=480; _DHO=270; } if(strstr(name, "_320.RAW")!=NULL) { _DWO=320; _DHO=180; } if(strstr(name, "_240.RAW")!=NULL) { _DWO=240; _DHO=135; } if(strstr(name, "_160.RAW")!=NULL) { _DWO=160; _DHO= 90; } if(strstr(name, "_80.RAW")!=NULL) { _DWO= 80; _DHO= 45; } fpA = fopen ( name, "rb" ); if (fpA != NULL) { fseek(fpA, 0, SEEK_SET); if(_DW!=_DWO) { unsigned char* buf = (unsigned char *) memalign(128, ((_DWO * _DHO * 4)<BUF_SIZE?(_DWO * _DHO * 4):BUF_SIZE)); if(buf) { fread(buf, (_DWO * _DHO * 4), 1, fpA); mip_texture( data, (uint8_t *)buf, _DWO, _DHO, (_DW/_DWO)); //scale to 1920x1080 free(buf); } } else fread((u8*)data, (_DWO * _DHO * 4), 1, fpA); fclose(fpA); // int blur=(_DW/_DWO)-1; // if(blur>3) blur=3; // blur_texture( data, _DW, _DHO*(_DW/_DWO), 0, 0, _DW, _DHO*(_DW/_DWO), 0, 0, 1, blur); return 1; } return 0; } int load_texture(u8 *data, char *name, uint16_t dw) { if(strstr(name, ".jpg")!=NULL || strstr(name, ".JPG")!=NULL || strstr(name, ".jpeg")!=NULL || strstr(name, ".JPEG")!=NULL) load_jpg_texture( data, name, dw); else if(strstr(name, ".png")!=NULL || strstr(name, ".PNG")!=NULL) { // if(data==text_bmp && dw==1920) // load_png_partial( data, name, dw, 18, 0); // else load_png_texture( data, name, dw); } else if(strstr(name, ".RAW")!=NULL) load_raw_texture( data, name, dw); return 0; } /****************************************************/ /* syscalls */ /****************************************************/ static void poke_sc36_path( const char *path) { if(sc36_path_patch==0 || payload!=0 || c_firmware!=3.55f || strstr(path, "/dev_bdvd")!=NULL) return; char r_path[64]; u64 p_len; u64 val0=0x0000000000000000ULL; u64 base=0x80000000002D84DEULL; u64 val=0x0000000000000000ULL; strncpy(r_path, path, 18); r_path[19]=0; u8 * p = (u8 *) r_path; p_len=strlen(r_path); if(p_len>18) p_len=18; int n=0; for(n = 0; n < 24; n += 8) { if(n==16 && p_len<=16) break; memcpy(&val, &p[n], 8); pokeq(base + (u64) n, val); if(n>15) pokeq(0x80000000002D84F0ULL, 0x7FA3EB783BE00001ULL ); __asm__("sync"); val0=peekq(0x8000000000000000ULL); } u64 val1 = 0x38A000004BD761D1ULL; u64 val2 = 0x389D00004BD76155ULL; val2 = (val2) | ( (p_len) << 32); if(strstr(path, "/app_home")!=NULL) p_len=2; val1 = (val1) | ( (p_len) << 32); pokeq(0x80000000002D8504ULL, val1 ); pokeq(0x80000000002D852CULL, val2 ); // pokeq(0x80000000003F662DULL, 0x6170705F686F6D65ULL ); // /app_home -> /app_home // pokeq(0x80000000003F662DULL, 0x6465765F62647664ULL ); // /app_home -> /dev_bdvd // pokeq(0x80000000003F672DULL, 0x6465765F62647664ULL ); // /host_root -> /dev_bdvd // pokeq(0x80000000003F6735ULL, 0x0000000000000000ULL ); // /host_root -> /dev_bdvd __asm__("sync"); val0=peekq(0x8000000000000000ULL); } void pokeq( uint64_t addr, uint64_t val) { if(c_firmware!=3.55f && c_firmware!=3.41f && c_firmware!=3.15f) return; system_call_2(7, addr, val); } uint64_t peekq(uint64_t addr) { if(c_firmware!=3.55f && c_firmware!=3.41f && c_firmware!=3.15f) return 0; system_call_1(6, addr); return_to_user_prog(uint64_t); } void disable_sc36() { return; if( (peekq(0x80000000002D8488ULL) == 0x3BE000017BFFF806ULL) && payloadT[0]==0x44 ) // syscall36 enabled pokeq(0x80000000002D8488ULL, 0x480000447BFFF806ULL ); // syscall36 disable! } void enable_sc36() { return; if( (peekq(0x80000000002D8488ULL) == 0x480000447BFFF806ULL) && payloadT[0]==0x44) // syscall36 disabled pokeq(0x80000000002D8488ULL, 0x3BE000017BFFF806ULL ); // syscall36 enable! } static uint32_t syscall35(const char *srcpath, const char *dstpath) { if(payload==-1) return 0; system_call_2(35, (uint32_t) srcpath, (uint32_t) dstpath); return_to_user_prog(uint32_t); } static void syscall_mount(const char *path, int mountbdvd) { if(mountbdvd==0 || payload==-1) return; if(payload!=2) { system_call_1(36, (uint32_t) path); } if(payload==2) { (void) syscall35("/dev_bdvd", path); (void) syscall35("/app_home", path); } } static void syscall_mount2(char *mountpoint, const char *path) { if(payload==-1) return; if(payload==0) { //PSGroove poke_sc36_path( (char *) mountpoint); system_call_1(36, (uint32_t) path); } if(payload==1) { //Hermes typedef struct { path_open_entry entries[2]; char arena[0x600]; } path_open_table2; syscall_mount( (char*)path, mount_bdvd); (void)sys8_path_table(0ULL); dest_table_addr= 0x80000000007FF000ULL-((sizeof(path_open_table)+15) & ~15); open_table.entries[0].compare_addr= ((uint64_t) &open_table.arena[0]) - ((uint64_t) &open_table) + dest_table_addr; open_table.entries[0].replace_addr= ((uint64_t) &open_table.arena[0x200])- ((uint64_t) &open_table) + dest_table_addr; open_table.entries[1].compare_addr= 0ULL; // the last entry always 0 strncpy(&open_table.arena[0], mountpoint, 0x200); // compare 1 strncpy(&open_table.arena[0x200], path, 0x200); // replace 1 open_table.entries[0].compare_len= strlen(&open_table.arena[0]); // 1 open_table.entries[0].replace_len= strlen(&open_table.arena[0x200]); sys8_memcpy(dest_table_addr, (uint64_t) &open_table, sizeof(path_open_table2)); (void)sys8_path_table( dest_table_addr); } if(payload==2) { //PL3 // (void)syscall35((char *)mountpoint, NULL); (void)syscall35((char *)mountpoint, (char *)path); } } static void mount_with_cache(const char *path, int _joined, u32 flags, const char *title_id) { if(payload!=1) return; // leave if payload is not Hermes if(!(flags & IS_BDMIRROR)) syscall_mount( (char*)path, mount_bdvd); (void) title_id; char s1[512]; char s2[512]; //char s1a[512]; //char s2a[512]; char s_tmp[512]; char cached_file[512]; char ext_gd_path[512]; char hdd_gd_path[512]; u8 no_gd=0; if(strstr(path, "/dev_usb")!=NULL || (flags & IS_BDMIRROR)) { if(flags & IS_BDMIRROR) {sprintf(s_tmp, "%s", "/dev_bdvd");s_tmp[9]=0;} else {strncpy(s_tmp, path, 11); s_tmp[11]=0;} if((flags & IS_EXTGD)) { sprintf(ext_gd_path, "%s/GAMEI", s_tmp); mkdir(ext_gd_path, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(ext_gd_path, 0777); } //sprintf(ext_gd_path, "%s/GAMEI/%s", s_tmp, title_id); } else { for(int u=0;u<200;u++) { sprintf(s_tmp, "/dev_usb%03i", u); if(exist(s_tmp)) break; } if(exist(s_tmp) && (flags & IS_EXTGD)) { sprintf(ext_gd_path, "%s/GAMEI", s_tmp); mkdir(ext_gd_path, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(ext_gd_path, 0777); fix_perm_recursive(ext_gd_path); //sprintf(ext_gd_path, "%s/GAMEI/%s", s_tmp, title_id); } else no_gd=1; } //sprintf(s1a, "%s", "/dev_bdvd");s1a[9]=0; //sprintf(s2a, "%s", "/app_home");s2a[9]=0; u8 entries=0; u32 m_step=0x200; (void)sys8_path_table(0ULL); dest_table_addr= 0x80000000007FF000ULL-((sizeof(path_open_table)+15) & ~15); for(int n=0; n<_joined; n++) { sprintf(s1, "/dev_bdvd%s", file_to_join[n].split_file); sprintf(s2, "/app_home%s", file_to_join[n].split_file); sprintf(cached_file, "%s", file_to_join[n].cached_file); //sprintf(filename, "#%i [%s]\n[%s]\n[%s]", n+1, s1, s2, cached_file); //dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, filename, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); strncpy(&open_table.arena[entries*m_step*2], s1, m_step); strncpy(&open_table.arena[entries*m_step*2+m_step], cached_file, m_step); open_table.entries[entries].compare_addr= ((uint64_t) &open_table.arena[entries*m_step*2]) - ((uint64_t) &open_table) + dest_table_addr; open_table.entries[entries].compare_len= strlen(&open_table.arena[entries*m_step*2]); open_table.entries[entries].replace_addr= ((uint64_t) &open_table.arena[entries*m_step*2+m_step])- ((uint64_t) &open_table) + dest_table_addr; open_table.entries[entries].replace_len= strlen(&open_table.arena[entries*m_step*2+m_step]); entries++; strncpy(&open_table.arena[entries*m_step*2], s2, m_step); strncpy(&open_table.arena[entries*m_step*2+m_step], cached_file, m_step); open_table.entries[entries].compare_addr= ((uint64_t) &open_table.arena[entries*m_step*2]) - ((uint64_t) &open_table) + dest_table_addr; open_table.entries[entries].compare_len= strlen(&open_table.arena[entries*m_step*2]); open_table.entries[entries].replace_addr= ((uint64_t) &open_table.arena[entries*m_step*2+m_step])- ((uint64_t) &open_table) + dest_table_addr; open_table.entries[entries].replace_len= strlen(&open_table.arena[entries*m_step*2+m_step]); entries++; } if( (flags & IS_EXTGD) && no_gd==0 ) { sprintf(hdd_gd_path, "%s", "/dev_hdd0/game");///%s", title_id); strncpy(&open_table.arena[entries*m_step*2], hdd_gd_path , m_step); strncpy(&open_table.arena[entries*m_step*2+m_step], ext_gd_path, m_step); open_table.entries[entries].compare_addr= ((uint64_t) &open_table.arena[entries*m_step*2]) - ((uint64_t) &open_table) + dest_table_addr; open_table.entries[entries].compare_len= strlen(&open_table.arena[entries*m_step*2]); open_table.entries[entries].replace_addr= ((uint64_t) &open_table.arena[entries*m_step*2+m_step])- ((uint64_t) &open_table) + dest_table_addr; open_table.entries[entries].replace_len= strlen(&open_table.arena[entries*m_step*2+m_step]); entries++; } /*if(!(flags & IS_BDMIRROR)) { strncpy(&open_table.arena[entries*m_step*2], s1a, m_step); strncpy(&open_table.arena[entries*m_step*2+m_step], path, m_step); open_table.entries[entries].compare_addr= ((uint64_t) &open_table.arena[entries*m_step*2]) - ((uint64_t) &open_table) + dest_table_addr; open_table.entries[entries].compare_len= strlen(&open_table.arena[entries*m_step*2]); open_table.entries[entries].replace_addr= ((uint64_t) &open_table.arena[entries*m_step*2+m_step])- ((uint64_t) &open_table) + dest_table_addr; open_table.entries[entries].replace_len= strlen(&open_table.arena[entries*m_step*2+m_step]); entries++; strncpy(&open_table.arena[entries*m_step*2], s2a, m_step); strncpy(&open_table.arena[entries*m_step*2+m_step], path, m_step); open_table.entries[entries].compare_addr= ((uint64_t) &open_table.arena[entries*m_step*2]) - ((uint64_t) &open_table) + dest_table_addr; open_table.entries[entries].compare_len= strlen(&open_table.arena[entries*m_step*2]); open_table.entries[entries].replace_addr= ((uint64_t) &open_table.arena[entries*m_step*2+m_step])- ((uint64_t) &open_table) + dest_table_addr; open_table.entries[entries].replace_len= strlen(&open_table.arena[entries*m_step*2+m_step]); entries++; } */ open_table.entries[entries].compare_addr= 0ULL; sys8_memcpy(dest_table_addr, (uint64_t) &open_table, sizeof(path_open_table)); (void)sys8_path_table( dest_table_addr); } static void mount_with_ext_data(const char *path, u32 flags) { if(!(flags & IS_BDMIRROR)) syscall_mount( (char*)path, mount_bdvd); if(payload!=1 || !(flags & IS_EXTGD)) return; //leave if not Hermes payload or not flagged for External Game Data //char s1a[512]; //char s2a[512]; char s_tmp[512]; char ext_gd_path[512]; char hdd_gd_path[512]; u8 no_gd=0; if(strstr(path, "/dev_usb")!=NULL || (flags & IS_BDMIRROR)) { if(flags & IS_BDMIRROR) {sprintf(s_tmp, "%s", "/dev_bdvd");s_tmp[9]=0;} else {strncpy(s_tmp, path, 11); s_tmp[11]=0;} if((flags & IS_EXTGD)) { sprintf(ext_gd_path, "%s/GAMEI", s_tmp); mkdir(ext_gd_path, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(ext_gd_path, 0777); //sprintf(ext_gd_path, "%s/GAMEI/%s", s_tmp, title_id); } } else { for(int u=0;u<200;u++) { sprintf(s_tmp, "/dev_usb%03i", u); if(exist(s_tmp)) break; } if(exist(s_tmp) && (flags & IS_EXTGD)) { sprintf(ext_gd_path, "%s/GAMEI", s_tmp); mkdir(ext_gd_path, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(ext_gd_path, 0777); //sprintf(ext_gd_path, "%s/GAMEI/%s", s_tmp, title_id); } else no_gd=1; } //sprintf(s1a, "%s", "/dev_bdvd");s1a[9]=0; //sprintf(s2a, "%s", "/app_home");s2a[9]=0; u8 entries=0; u32 m_step=0x200; (void)sys8_path_table(0ULL); dest_table_addr= 0x80000000007FF000ULL-((sizeof(path_open_table)+15) & ~15); if( (flags & IS_EXTGD) && no_gd==0 ) { sprintf(hdd_gd_path, "%s", "/dev_hdd0/game");///%s", title_id); strncpy(&open_table.arena[entries*m_step*2], hdd_gd_path , m_step); strncpy(&open_table.arena[entries*m_step*2+m_step], ext_gd_path, m_step); open_table.entries[entries].compare_addr= ((uint64_t) &open_table.arena[entries*m_step*2]) - ((uint64_t) &open_table) + dest_table_addr; open_table.entries[entries].compare_len= strlen(&open_table.arena[entries*m_step*2]); open_table.entries[entries].replace_addr= ((uint64_t) &open_table.arena[entries*m_step*2+m_step])- ((uint64_t) &open_table) + dest_table_addr; open_table.entries[entries].replace_len= strlen(&open_table.arena[entries*m_step*2+m_step]); entries++; } /*if(!(flags & IS_BDMIRROR)) { strncpy(&open_table.arena[entries*m_step*2], s1a, m_step); strncpy(&open_table.arena[entries*m_step*2+m_step], path, m_step); open_table.entries[entries].compare_addr= ((uint64_t) &open_table.arena[entries*m_step*2]) - ((uint64_t) &open_table) + dest_table_addr; open_table.entries[entries].compare_len= strlen(&open_table.arena[entries*m_step*2]); open_table.entries[entries].replace_addr= ((uint64_t) &open_table.arena[entries*m_step*2+m_step])- ((uint64_t) &open_table) + dest_table_addr; open_table.entries[entries].replace_len= strlen(&open_table.arena[entries*m_step*2+m_step]); entries++; strncpy(&open_table.arena[entries*m_step*2], s2a, m_step); strncpy(&open_table.arena[entries*m_step*2+m_step], path, m_step); open_table.entries[entries].compare_addr= ((uint64_t) &open_table.arena[entries*m_step*2]) - ((uint64_t) &open_table) + dest_table_addr; open_table.entries[entries].compare_len= strlen(&open_table.arena[entries*m_step*2]); open_table.entries[entries].replace_addr= ((uint64_t) &open_table.arena[entries*m_step*2+m_step])- ((uint64_t) &open_table) + dest_table_addr; open_table.entries[entries].replace_len= strlen(&open_table.arena[entries*m_step*2+m_step]); entries++; }*/ open_table.entries[entries].compare_addr= 0ULL; sys8_memcpy(dest_table_addr, (uint64_t) &open_table, sizeof(path_open_table)); (void)sys8_path_table( dest_table_addr); } static void reset_mount_points() { if(payload==-1) return; //syscall_838("/dev_bdvd"); //syscall_837("CELL_FS_IOS:BDVD_DRIVE", "CELL_FS_UDF", "/dev_bdvd", 0, 1, 0, 0, 0); if(payload!=2) { //Hermes poke_sc36_path( (char *) "/app_home"); system_call_1(36, (uint32_t) "/dev_bdvd"); } if(payload==1) { //Hermes (void)sys8_path_table(0ULL); system_call_1(36, (uint32_t) "/dev_bdvd"); } if(payload==2) { //PL3 (void)syscall35((char *)"/dev_bdvd", NULL);//(char *)"/dev_bdvd" (void)syscall35((char *)"/app_home", (char *)"/dev_usb000"); } } static void mp3_callback( int nCh, void *userData, int callbackType, void *readBuffer, int readSize) { (void) nCh; (void) userData; uint64_t nRead = 0; if(force_mp3_fd==-1) callbackType=CELL_MS_CALLBACK_FINISHSTREAM; if(readSize && callbackType==CELL_MS_CALLBACK_MOREDATA) { if(CELL_FS_SUCCEEDED==cellFsRead(force_mp3_fd, (void*)readBuffer, KB(MP3_BUF), &nRead)) { if(nRead>0) { force_mp3_offset+=nRead; } else { cellFsClose(force_mp3_fd); force_mp3_fd=-1; memset(readBuffer, 0, KB(MP3_BUF)); } } else { cellFsClose(force_mp3_fd); force_mp3_fd=-1; goto try_next_mp3; } //(int) (((float)KB(MP3_BUF)/(float)mp3_packet) * mp3_packet_time * 1000000.f)); goto try_next_mp3;} } if(callbackType==CELL_MS_CALLBACK_FINISHSTREAM || callbackType==CELL_MS_CALLBACK_CLOSESTREAM) { try_next_mp3: update_ms=false; force_mp3_offset=0; if(max_mp3!=0) { current_mp3++; if(current_mp3>max_mp3) current_mp3=1; main_mp3((char*) mp3_playlist[current_mp3].path); xmb_info_drawn=0; } if(!mm_audio) {stop_audio(0); current_mp3=0; max_mp3=0; xmb_info_drawn=0;} } //sprintf(www_info, "[%s]: %.f / %.f (req'd: %i, read: %i)", force_mp3_file, (double)force_mp3_offset, (double)force_mp3_size, readSize, nRead); } static void unknown_mimetype_callback(const char* mimetype, const char* url, void* usrdata) { // sprintf(www_info, "%s(): mimetype:%s url:%s userdata:0x%p\n", __FUNCTION__, mimetype, url, usrdata); (void) mimetype; (void) usrdata; char local_file_d[512], tempfileD[512]; tempfileD[0]=0; sprintf(local_file_d, "%s/DOWNLOADS", app_usrdir); if(exist(download_dir) || strstr(download_dir, "/dev_")!=NULL) sprintf(local_file_d, "%s", download_dir); mkdir(local_file_d, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(local_file_d, 0777); sprintf(tempfileD, "%s", url); char *pathpos=strrchr(tempfileD, '/'); if(exist(download_dir)) sprintf(local_file_d, "%s/%s", download_dir, (pathpos+1)); else sprintf(local_file_d, "%s/DOWNLOADS/%s", app_usrdir, (pathpos+1)); download_file( url, (char *) local_file_d, 3); } DECL_WEBBROWSER_SYSTEM_CALLBACK(system_callback, cb_type, userdata) { (void)userdata; switch (cb_type) { case CELL_SYSUTIL_WEBBROWSER_UNLOADING_FINISHED: www_running = 0; dialog_ret=3; cellWebBrowserShutdown(); //case CELL_SYSUTIL_WEBBROWSER_RELEASED: case CELL_SYSUTIL_WEBBROWSER_SHUTDOWN_FINISHED: www_running = 0; dialog_ret=3; sys_memory_container_destroy( memory_container_web ); break; case CELL_SYSUTIL_REQUEST_EXITGAME: unload_modules(); sys_process_exit(1); break; default: break; } } static void sysutil_callback( uint64_t status, uint64_t param, void * userdata ) { (void)param; (void)userdata; int ret=0; switch(status) { case CELL_SYSUTIL_REQUEST_EXITGAME: unload_modules(); sys_process_exit(1); break; case CELL_SYSUTIL_OSKDIALOG_LOADED: break; case CELL_SYSUTIL_OSKDIALOG_INPUT_CANCELED: osk_dialog=-1; enteredCounter=0; osk_open=0; ret = cellOskDialogAbort(); ret = cellOskDialogUnloadAsync(&OutputInfo); break; case CELL_SYSUTIL_OSKDIALOG_FINISHED: if(osk_dialog!=-1) osk_dialog=1; ret = cellOskDialogUnloadAsync(&OutputInfo); break; case CELL_SYSUTIL_OSKDIALOG_UNLOADED: break; case CELL_SYSUTIL_DRAWING_BEGIN: case CELL_SYSUTIL_DRAWING_END: break; case CELL_SYSUTIL_BGMPLAYBACK_PLAY: update_ms=false; mm_audio=false; break; case CELL_SYSUTIL_BGMPLAYBACK_STOP: mm_audio=true; update_ms=true; case CELL_SYSUTIL_OSKDIALOG_INPUT_ENTERED: ret = cellOskDialogGetInputText( &OutputInfo ); break; case CELL_SYSUTIL_OSKDIALOG_INPUT_DEVICE_CHANGED: if(param == CELL_OSKDIALOG_INPUT_DEVICE_KEYBOARD ){ // ret = cellOskDialogSetDeviceMask( CELL_OSKDIALOG_DEVICE_MASK_PAD ); } break; default: break; } } void draw_box( uint8_t *buffer_to, uint32_t width, uint32_t height, int x, int y, uint32_t border_color) { int line = 1920 * 4; uint32_t pos_to_border = ( y * line) + (x * 4), cline=0; uint32_t lines=0; unsigned char* bt; for(lines=0; lines<(height); lines++) { for(cline=0; cline<(width*4); cline+=4) { bt = (uint8_t*)(buffer_to) + pos_to_border + cline; *(uint32_t*)bt = border_color; } pos_to_border+=line; } } void put_texture( uint8_t *buffer_to, uint8_t *buffer_from, uint32_t width, uint32_t height, int from_width, int x, int y, int border, uint32_t border_color) { int row = from_width * 4; int line = 1920 * 4; uint32_t pos_to = ( y * line) + (x * 4), cline=0; uint32_t pos_to_border = ( (y-border) * line) + ((x-border) * 4); uint32_t pos_from = 0; uint32_t lines=0; unsigned char* bt; if(border) { for(lines=0; lines<(height+(border*2)); lines++) { for(cline=0; cline<((width+border*2)*4); cline+=4) { bt = (uint8_t*)(buffer_to) + pos_to_border + cline; *(uint32_t*)bt = border_color; } pos_to_border+=line; } } for(lines=0; lines<height; lines++) { memcpy(buffer_to + pos_to, buffer_from + pos_from, width * 4); pos_from+=row; pos_to+=line; } } void put_texture_with_alpha( uint8_t *buffer_to, uint8_t *buffer_from, uint32_t _width, uint32_t _height, int from_width, int x, int y, int border, uint32_t border_color) { int row = from_width * 4; int line = 1920 * 4; uint32_t pos_to = ( y * line) + (x * 4), cline=0; uint32_t pos_to_border = ( (y-border) * line) + ((x-border) * 4); uint32_t pos_from = 0; uint32_t lines=0; uint32_t c_pixel_N_R, c_pixel_N_G, c_pixel_N_B; uint32_t c_pixelR, c_pixelG, c_pixelB, c_pixel_N_A, c_pixel; uint32_t width=_width; uint32_t height=_height; unsigned char* bt; unsigned char* btF; if( (x+width) > 1920) width=(1920-x); if( (y+height) > 1080) height=(1080-y); if(border) { for(lines=0; lines<(height+(border*2)); lines++) { for(cline=0; cline<((width+border*2)*4); cline+=4) { bt = (uint8_t*)(buffer_to) + pos_to_border + cline; *(uint32_t*)bt = border_color; } pos_to_border+=line; } } for(lines=0; lines<height; lines++) { for(cline=0; cline<((width)*4); cline+=4) { btF = (uint8_t*)(buffer_from) + pos_from + cline; bt = (uint8_t*)(buffer_to) + pos_to + cline; c_pixel = *(uint32_t*)btF; c_pixel_N_A = (c_pixel ) & 0xff; if(c_pixel_N_A) { float d_alpha = (c_pixel_N_A / 255.0f); float d_alpha1 = 1.0f-d_alpha; c_pixel_N_R = (int)(buffer_from[pos_from + cline + 0] * d_alpha); c_pixel_N_G = (int)(buffer_from[pos_from + cline + 1] * d_alpha); c_pixel_N_B = (int)(buffer_from[pos_from + cline + 2] * d_alpha); c_pixelR = (int)(buffer_to[pos_to + cline + 0] * d_alpha1) + c_pixel_N_R; c_pixelG = (int)(buffer_to[pos_to + cline + 1] * d_alpha1) + c_pixel_N_G; c_pixelB = (int)(buffer_to[pos_to + cline + 2] * d_alpha1) + c_pixel_N_B; //keep the higher alpha *(uint32_t*)bt = ((buffer_to[pos_to + cline + 3]>(c_pixel_N_A) ? buffer_to[pos_to + cline + 3] : (c_pixel_N_A) )) | (c_pixelR<<24) | (c_pixelG<<16) | (c_pixelB<<8); } } pos_from+=row; pos_to+=line; } } void put_texture_with_alpha_gen( uint8_t *buffer_to, uint8_t *buffer_from, uint32_t _width, uint32_t _height, int from_width, u16 to_width, int x, int y) { int row = from_width * 4; int line = to_width * 4; uint32_t pos_to = ( y * line) + (x * 4), cline=0; uint32_t pos_from = 0; uint32_t lines=0; uint32_t c_pixel_N_R, c_pixel_N_G, c_pixel_N_B; uint32_t c_pixelR, c_pixelG, c_pixelB, c_pixel_N_A, c_pixel; uint32_t width=_width; uint32_t height=_height; unsigned char* bt; unsigned char* btF; if( (x+width) > to_width) width=(to_width-x); for(lines=0; lines<height; lines++) { for(cline=0; cline<((width)*4); cline+=4) { btF = (uint8_t*)(buffer_from) + pos_from + cline; bt = (uint8_t*)(buffer_to) + pos_to + cline; c_pixel = *(uint32_t*)btF; c_pixel_N_A = (c_pixel ) & 0xff; if(c_pixel_N_A) { float d_alpha = (c_pixel_N_A / 255.0f); float d_alpha1 = 1.0f-d_alpha; c_pixel_N_R = (int)(buffer_from[pos_from + cline + 0] * d_alpha); c_pixel_N_G = (int)(buffer_from[pos_from + cline + 1] * d_alpha); c_pixel_N_B = (int)(buffer_from[pos_from + cline + 2] * d_alpha); c_pixelR = (int)(buffer_to[pos_to + cline + 0] * d_alpha1) + c_pixel_N_R; c_pixelG = (int)(buffer_to[pos_to + cline + 1] * d_alpha1) + c_pixel_N_G; c_pixelB = (int)(buffer_to[pos_to + cline + 2] * d_alpha1) + c_pixel_N_B; //keep the higher alpha *(uint32_t*)bt = ((buffer_to[pos_to + cline + 3]>(c_pixel_N_A) ? buffer_to[pos_to + cline + 3] : (c_pixel_N_A) )) | (c_pixelR<<24) | (c_pixelG<<16) | (c_pixelB<<8); } } pos_from+=row; pos_to+=line; } } void put_texture_VM_Galpha( uint8_t *buffer_to, uint32_t Twidth, uint32_t Theight, uint8_t *buffer_from, uint32_t _width, uint32_t _height, int from_width, int x, int y, int border, uint32_t border_color) { int row = from_width * 4; int line = V_WIDTH * 4; uint32_t pos_to = ( y * line) + (x * 4), cline=0; uint32_t pos_to_border = ( (y-border) * line) + ((x-border) * 4); uint32_t pos_from = 0; uint32_t lines=0; uint32_t c_pixel_N_R, c_pixel_N_G, c_pixel_N_B; uint32_t c_pixelR, c_pixelG, c_pixelB, c_pixel_N_A, c_pixel; uint32_t width=_width-1; uint32_t height=_height-1; unsigned char* bt; unsigned char* btF; if( (x+width) > Twidth) width=(Twidth-x); if( (y+height) > Theight) height=(Theight-y); if(border) { for(lines=0; lines<(height+(border*2)); lines++) { for(cline=0; cline<((width+border*2)*4); cline+=4) { bt = (uint8_t*)(buffer_to) + pos_to_border + cline; *(uint32_t*)bt = border_color; } pos_to_border+=line; } } for(lines=0; lines<height; lines++) { for(cline=0; cline<((width)*4); cline+=4) { btF = (uint8_t*)(buffer_from) + pos_from + cline; bt = (uint8_t*)(buffer_to) + pos_to + cline; c_pixel = *(uint32_t*)btF; c_pixel_N_R = (c_pixel>>24) & 0xff; c_pixel_N_G = (c_pixel>>16) & 0xff; c_pixel_N_B = (c_pixel>>8) & 0xff; c_pixel_N_A = 255-c_pixel_N_G; if(c_pixel_N_B==0 && c_pixel_N_R==0) { float d_alpha = (c_pixel_N_A / 255.0f); float d_alpha1 = 1.0f-d_alpha; //c_pixel_N_R = (int)(0x0 * d_alpha); //c_pixel_N_G = (int)(0x0 * d_alpha); //c_pixel_N_B = (int)(0x0 * d_alpha); c_pixelR = (int)(buffer_to[pos_to + cline + 1] * d_alpha1);// + c_pixel_N_R; c_pixelG = (int)(buffer_to[pos_to + cline + 2] * d_alpha1);// + c_pixel_N_G; c_pixelB = (int)(buffer_to[pos_to + cline + 3] * d_alpha1);// + c_pixel_N_B; *(uint32_t*)bt = 0xff000000 | (c_pixelR<<16) | (c_pixelG<<8) | c_pixelB; } else { *(uint32_t*)bt = 0xff000000 | (c_pixel>>8);// | (c_pixel_N_R<<16) | (c_pixel_N_G<<8) | c_pixel_N_B; } } pos_from+=row; pos_to+=line; } } void draw_mouse_pointer(int m_type) { (void) m_type; put_texture_VM_Galpha( (uint8_t*)(color_base_addr)+video_buffer*frame_index, V_WIDTH, V_HEIGHT, mouse, mp_WIDTH, mp_HEIGHT, mp_WIDTH, (int)(mouseX*(float)V_WIDTH*(1.f-overscan)+overscan*(float)V_WIDTH*0.5f), (int)(mouseY*(float)V_HEIGHT*(1.f-overscan)+overscan*(float)V_HEIGHT*0.5f), 0, 0); } void put_texture_Galpha( uint8_t *buffer_to, uint32_t Twidth, uint32_t Theight, uint8_t *buffer_from, uint32_t _width, uint32_t _height, int from_width, int x, int y, int border, uint32_t border_color) { int row = from_width * 4; int line = Twidth * 4; uint32_t pos_to = ( y * line) + (x * 4), cline=0; uint32_t pos_to_border = ( (y-border) * line) + ((x-border) * 4); uint32_t pos_from = 0; uint32_t lines=0; uint32_t c_pixel_N_R, c_pixel_N_G, c_pixel_N_B; uint32_t c_pixelR, c_pixelG, c_pixelB, c_pixel_N_A, c_pixel; uint32_t width=_width; uint32_t height=_height; unsigned char* bt; unsigned char* btF; if( (x+width) > Twidth) width=(Twidth-x); if( (y+height) > Theight) height=(Theight-y); if(border) { for(lines=0; lines<(height+(border*2)); lines++) { for(cline=0; cline<((width+border*2)*4); cline+=4) { bt = (uint8_t*)(buffer_to) + pos_to_border + cline; *(uint32_t*)bt = border_color; } pos_to_border+=line; } } for(lines=0; lines<height; lines++) { for(cline=0; cline<((width)*4); cline+=4) { btF = (uint8_t*)(buffer_from) + pos_from + cline; bt = (uint8_t*)(buffer_to) + pos_to + cline; c_pixel = *(uint32_t*)btF; c_pixel_N_R = (c_pixel>>24) & 0xff; c_pixel_N_G = (c_pixel>>16) & 0xff; c_pixel_N_B = (c_pixel>>8) & 0xff; c_pixel_N_A = 255-c_pixel_N_G; if(c_pixel_N_B==0 && c_pixel_N_R==0) { // if(c_pixel_N_G) { float d_alpha = (c_pixel_N_A / 255.0f); float d_alpha1 = 1.0f-d_alpha; //c_pixel_N_R = (int)(0x0 * d_alpha); //c_pixel_N_G = (int)(0x0 * d_alpha); //c_pixel_N_B = (int)(0x0 * d_alpha); c_pixelR = (int)(buffer_to[pos_to + cline + 0] * d_alpha1);// + c_pixel_N_R; c_pixelG = (int)(buffer_to[pos_to + cline + 1] * d_alpha1);// + c_pixel_N_G; c_pixelB = (int)(buffer_to[pos_to + cline + 2] * d_alpha1);// + c_pixel_N_B; *(uint32_t*)bt = (c_pixelR<<24) | (c_pixelG<<16) | (c_pixelB<<8) | (c_pixel & 0xff) ; } } else { *(uint32_t*)bt = (c_pixel);// | 0xff);// | (c_pixel_N_R<<16) | (c_pixel_N_G<<8) | c_pixel_N_B; } } pos_from+=row; pos_to+=line; } } void put_reflection( uint8_t *buffer_to, uint32_t Twidth, uint32_t Theight, uint32_t _width, uint32_t _height, int x, int y, int dx, int dy, int factor) { int row = Twidth * 4; int line = Twidth * 4; uint32_t pos_to = ( (dy + (_height/factor)) * line) + (dx * 4), cline=0; uint32_t pos_from = ( y * line) + (x * 4); uint32_t lines=0; uint32_t c_pixel_N_R, c_pixel_N_G, c_pixel_N_B; float c_pixel_N_RF, c_pixel_N_GF, c_pixel_N_BF; uint32_t c_pixelR, c_pixelG, c_pixelB, c_pixel_N_A, c_pixel; uint32_t width=_width; uint32_t height=_height; unsigned char* bt; unsigned char* btF; if( (dx+width) > Twidth) width=(Twidth-dx); if( (dy+height/factor) > Theight) height=(Theight-dy); for(lines=0; lines<height; lines+=factor) { for(cline=0; cline<((width)*4); cline+=4) { btF = (uint8_t*)(buffer_to) + pos_from + cline; bt = (uint8_t*)(buffer_to) + pos_to + cline; c_pixel = *(uint32_t*)btF; c_pixel_N_RF = ( (c_pixel>>24) & 0xff ) * ( (float)(c_pixel & 0xff) / 255.0f) ; c_pixel_N_GF = ( (c_pixel>>16) & 0xff ) * ( (float)(c_pixel & 0xff) / 255.0f) ; c_pixel_N_BF = ( (c_pixel>>8) & 0xff ) * ( (float)(c_pixel & 0xff) / 255.0f) ; c_pixel_N_A = (uint32_t) ( (255.0f - ( 255.0f * ( (float)(lines/(float)height)) )) ); float d_alpha = (c_pixel_N_A / 255.0f); float d_alpha1 = (1.0f-d_alpha)/2.0f; d_alpha= 1.0f - d_alpha1; c_pixel_N_R = (int)(buffer_to[pos_to + cline + 0] * d_alpha); c_pixel_N_G = (int)(buffer_to[pos_to + cline + 1] * d_alpha); c_pixel_N_B = (int)(buffer_to[pos_to + cline + 2] * d_alpha); c_pixelR = (int)(c_pixel_N_RF * d_alpha1) + c_pixel_N_R; c_pixelG = (int)(c_pixel_N_GF * d_alpha1) + c_pixel_N_G; c_pixelB = (int)(c_pixel_N_BF * d_alpha1) + c_pixel_N_B; *(uint32_t*)bt = (c_pixelR<<24) | (c_pixelG<<16) | (c_pixelB<<8) | (0xff) ; } pos_from+=(row*factor); pos_to-=line; } } /* void alter_texture( uint8_t *buffer_to, uint8_t *buffer_from, uint32_t width, uint32_t height, int x, int y, int border, uint32_t border_color) { int row = 320 * 4; int line = 1920 * 4; uint32_t pos_to = ( y * line) + (x * 4), cline=0; uint32_t pos_to_border = ( (y-border) * line) + ((x-border) * 4); uint32_t pos_from = 0; uint32_t lines=0; uint16_t c_pixel, c_pixelR, c_pixelG, c_pixelB, c_pixelR_AVG, c_pixelG_AVG, c_pixelB_AVG, c_BRI; c_BRI=0; //brightness decrease int use_grayscale=0; int use_blur=0; if(border) { for(lines=0; lines<(height+(border*2)); lines++) { for(cline=0; cline<((width+border*2)*4); cline+=4) { memset(buffer_to + pos_to_border + cline + 0, (border_color>> 8) & 0xff, 1); memset(buffer_to + pos_to_border + cline + 1, (border_color>>16) & 0xff, 1); memset(buffer_to + pos_to_border + cline + 2, (border_color>>24) & 0xff, 1); memset(buffer_to + pos_to_border + cline + 3, (border_color ) & 0xff, 1); } pos_to_border+=line; } } for(lines=0; lines<height; lines++) { if(!use_blur && !use_grayscale) memcpy(buffer_to + pos_to, buffer_from + pos_from, width * 4); else for(cline=0; cline<(width*4); cline+=4) { if(use_blur) { // box blur if(lines>0 && cline>0 && lines<(height-1) && cline<((width-1)*4)) { c_pixelB = buffer_from[pos_from + cline + 0 + 4]; c_pixelG = buffer_from[pos_from + cline + 1 + 4]; c_pixelR = buffer_from[pos_from + cline + 2 + 4]; c_pixelB+= buffer_from[pos_from + cline + 0 - 4]; c_pixelG+= buffer_from[pos_from + cline + 1 - 4]; c_pixelR+= buffer_from[pos_from + cline + 2 - 4]; c_pixelB+= buffer_from[pos_from + cline + 0 - row]; c_pixelG+= buffer_from[pos_from + cline + 1 - row]; c_pixelR+= buffer_from[pos_from + cline + 2 - row]; c_pixelB+= buffer_from[pos_from + cline + 0 + row]; c_pixelG+= buffer_from[pos_from + cline + 1 + row]; c_pixelR+= buffer_from[pos_from + cline + 2 + row]; c_pixelB+= buffer_from[pos_from + cline + 0 - row - 4]; c_pixelG+= buffer_from[pos_from + cline + 1 - row - 4]; c_pixelR+= buffer_from[pos_from + cline + 2 - row - 4]; c_pixelB+= buffer_from[pos_from + cline + 0 + row + 4]; c_pixelG+= buffer_from[pos_from + cline + 1 + row + 4]; c_pixelR+= buffer_from[pos_from + cline + 2 + row + 4]; c_pixelB+= buffer_from[pos_from + cline + 0 - row + 4]; c_pixelG+= buffer_from[pos_from + cline + 1 - row + 4]; c_pixelR+= buffer_from[pos_from + cline + 2 - row + 4]; c_pixelB+= buffer_from[pos_from + cline + 0 + row - 4]; c_pixelG+= buffer_from[pos_from + cline + 1 + row - 4]; c_pixelR+= buffer_from[pos_from + cline + 2 + row - 4]; // average values c_pixelB_AVG=((uint8_t) (c_pixelB/8)); c_pixelG_AVG=((uint8_t) (c_pixelG/8)); c_pixelR_AVG=((uint8_t) (c_pixelR/8)); if(c_BRI>0) { if(c_pixelB_AVG>c_BRI) c_pixelB_AVG-=c_BRI; else c_pixelB_AVG=0; if(c_pixelG_AVG>c_BRI) c_pixelG_AVG-=c_BRI; else c_pixelG_AVG=0; if(c_pixelR_AVG>c_BRI) c_pixelR_AVG-=c_BRI; else c_pixelR_AVG=0; } if(use_grayscale) { // greyscale + box blur c_pixel = c_pixelB_AVG + c_pixelG_AVG + c_pixelR_AVG; memset(buffer_to + pos_to + cline + 0, (uint8_t) (c_pixel/3), 3); } else { memset(buffer_to + pos_to + cline + 0, c_pixelB_AVG, 1); memset(buffer_to + pos_to + cline + 1, c_pixelG_AVG, 1); memset(buffer_to + pos_to + cline + 2, c_pixelR_AVG, 1); } } else { // convert to grayscale only c_pixel = buffer_from[pos_from + cline + 0]; c_pixel+= buffer_from[pos_from + cline + 1]; c_pixel+= buffer_from[pos_from + cline + 2]; if(c_BRI>0) { if(c_pixel>(c_BRI*3)) c_pixel-=(c_BRI*3); else c_pixel=0; } memset(buffer_to + pos_to + cline + 0, (uint8_t) (c_pixel/3), 3); } } //use blur else { // convert to grayscale only c_pixel = buffer_from[pos_from + cline + 0]; c_pixel+= buffer_from[pos_from + cline + 1]; c_pixel+= buffer_from[pos_from + cline + 2]; if(c_BRI>0) { if(c_pixel>(c_BRI*3)) c_pixel-=(c_BRI*3); else c_pixel=0; } memset(buffer_to + pos_to + cline + 0, (uint8_t) (c_pixel/3), 3); } // keep alpha memset(buffer_to + pos_to + cline + 3, buffer_from[pos_from + cline + 3], 1); } pos_from+=row; pos_to+=line; } } */ void gray_texture( uint8_t *buffer_to, uint32_t width, uint32_t height, int step) { if(gray_poster==0) return; uint32_t cline=0; uint16_t c_pixel; int line=0; (void) step; (void) line; for(cline=0; cline<(width*height*4); cline+=4) { /*if(step){ line++; if(line>=width) { line=0; memset(buffer_to + cline, 0, width*4); cline+=width*4; continue; } }*/ c_pixel = buffer_to[cline]; c_pixel+= buffer_to[cline + 1]; c_pixel+= buffer_to[cline + 2]; memset(buffer_to + cline, (uint8_t) (c_pixel/3), 3); } } /* void to_565_texture( uint8_t *buffer_from, uint8_t *buffer_to, uint32_t width, uint32_t height) { uint32_t cline=0, pos_to=0;//, height=sizeof(buffer_from)/4/width; uint8_t c_pixelR, c_pixelG, c_pixelB, c_pixel1, c_pixel2; for(cline=0; cline<(width*height*4); cline+=4) { c_pixelR = buffer_from[cline]; c_pixelG = buffer_from[cline + 1]; c_pixelB = buffer_from[cline + 2]; c_pixel1 = (c_pixelR & 0xF8) | ( (c_pixelG & 0xE0) >> 5); c_pixel2 = ( (c_pixelG & 0x1C) << 3) | (c_pixelB >> 3); memset(buffer_to + pos_to, c_pixel1, 1); memset(buffer_to + pos_to+1, c_pixel2, 1); pos_to+=2; } } void to_RGB_texture( uint8_t *buffer_from, uint8_t *buffer_to, uint32_t width, uint32_t height) { uint32_t cline=0, pos_to=0;//, height=sizeof(buffer_from)/4/width; uint8_t c_pixelR, c_pixelG, c_pixelB, c_pixel1, c_pixel2; for(cline=0; cline<(width*height*2); cline+=2) { c_pixel1 = buffer_from[cline]; c_pixel2 = buffer_from[cline + 1]; c_pixelR = (c_pixel1 & 0xF8); c_pixelG = ( (c_pixel1 & 0x7) << 5) | ((c_pixel2 & 0xE0)>>5); c_pixelB = (c_pixel2 & 0x1f)<<3; memset(buffer_to + pos_to, c_pixelR, 1); memset(buffer_to + pos_to+1, c_pixelG, 1); memset(buffer_to + pos_to+2, c_pixelB, 1); memset(buffer_to + pos_to+3, 0xff, 1); pos_to+=4; } } void to_333_texture( uint8_t *buffer_from, uint8_t *buffer_to, uint32_t width, uint32_t height) { uint32_t cline=0, pos_to=0;//, height=sizeof(buffer_from)/4/width; for(cline=0; cline<(width*height*4); cline+=4) { memcpy(buffer_to + pos_to, buffer_from + cline, 3); // memcpy(buffer_to + pos_to, buffer_to + cline, 3); pos_to+=3; } } void to_RGB3_texture( uint8_t *buffer_from, uint8_t *buffer_to, uint32_t width, uint32_t height) { uint32_t cline=0, pos_to=0; for(cline=0; cline<(width*height*3); cline+=3) { memcpy(buffer_to + pos_to, buffer_from + cline, 3); memset(buffer_to + pos_to + 3, 0xff, 1); pos_to+=4; } } */ void mip_texture( uint8_t *buffer_to, uint8_t *buffer_from, uint32_t width, uint32_t height, int scaleF) { uint32_t pos_to = 0, pos_from = 0, cline=0, scale, cscale; uint32_t lines=0; if(scaleF<0) { scale=(-1)*scaleF; for(lines=0; lines<height; lines+=scale) { pos_from = lines * width * 4; for(cline=0; cline<(width*4); cline+=(4*scale)) { memcpy(buffer_to + pos_to, buffer_from + pos_from + cline, 4); pos_to+=4; } } } else { scale=scaleF; for(lines=0; lines<height; lines++) { pos_from = lines * width * 4; for(cline=0; cline<(width*4); cline+=4) { for(cscale=0; cscale<scale; cscale++) { memcpy(buffer_to + pos_to, buffer_from + pos_from + cline, 4); pos_to+=4; } } for(cscale=0; cscale<(scale-1); cscale++) { memcpy(buffer_to + pos_to, buffer_to + pos_to - width * scale * 4, width * scale * 4); pos_to+=width * scale * 4; } } } } void blur_texture(uint8_t *buffer_to, uint32_t width, uint32_t height, int x, int y, int wx, int wy, uint32_t c_BRI, int use_grayscale, int iterations, int p_range) { int p_step = 4 * p_range; int row = width * p_step; int line = width * 4; uint32_t pos_to=0; int lines=0, cline=0, iter=0; (void) height; uint32_t c_pixel, c_pixelR, c_pixelG, c_pixelB, c_pixelR_AVG, c_pixelG_AVG, c_pixelB_AVG; int use_blur=1; if(iterations==0) {use_blur=0; iterations=1;} for(iter=0; iter<iterations; iter++) { pos_to = ( y * line) + (x * 4); for(lines=0; lines<wy; lines++) { for(cline=0; cline<(wx*4); cline+=4) { if(lines>=p_range && cline>=p_range && lines<(wy-p_range) && cline<((wx-p_range)*4)) { /* bt = (uint8_t*)(buffer_to) + pos_to + cline; c_pixel = (*(uint32_t*)(bt + p_step))>>8; c_pixelB = (c_pixel>>16)&0xff; c_pixelG = (c_pixel>> 8)&0xff; c_pixelR = c_pixel&0xff; c_pixel= (*(uint32_t*)(bt - p_step))>>8; c_pixelB+= (c_pixel>>16)&0xff; c_pixelG+= (c_pixel>> 8)&0xff; c_pixelR+= c_pixel&0xff; c_pixel= (*(uint32_t*)(bt - row))>>8; c_pixelB+= (c_pixel>>16)&0xff; c_pixelG+= (c_pixel>> 8)&0xff; c_pixelR+= c_pixel&0xff; c_pixel= (*(uint32_t*)(bt + row))>>8; c_pixelB+= (c_pixel>>16)&0xff; c_pixelG+= (c_pixel>> 8)&0xff; c_pixelR+= c_pixel&0xff; c_pixel= (*(uint32_t*)(bt - row - p_step))>>8; c_pixelB+= (c_pixel>>16)&0xff; c_pixelG+= (c_pixel>> 8)&0xff; c_pixelR+= c_pixel&0xff; c_pixel= (*(uint32_t*)(bt + row + p_step))>>8; c_pixelB+= (c_pixel>>16)&0xff; c_pixelG+= (c_pixel>> 8)&0xff; c_pixelR+= c_pixel&0xff; c_pixel= (*(uint32_t*)(bt - row + p_step))>>8; c_pixelB+= (c_pixel>>16)&0xff; c_pixelG+= (c_pixel>> 8)&0xff; c_pixelR+= c_pixel&0xff; c_pixel= (*(uint32_t*)(bt + row - p_step))>>8; c_pixelB+= (c_pixel>>16)&0xff; c_pixelG+= (c_pixel>> 8)&0xff; c_pixelR+= c_pixel&0xff; // *(uint32_t*)bt = c_pixel; */ if(use_blur) { // box blur // get RGB values for all surrounding pixels // to create average for blurring c_pixelB = buffer_to[pos_to + cline + 0 + p_step]; c_pixelG = buffer_to[pos_to + cline + 1 + p_step]; c_pixelR = buffer_to[pos_to + cline + 2 + p_step]; c_pixelB+= buffer_to[pos_to + cline + 0 - p_step]; c_pixelG+= buffer_to[pos_to + cline + 1 - p_step]; c_pixelR+= buffer_to[pos_to + cline + 2 - p_step]; c_pixelB+= buffer_to[pos_to + cline + 0 - row]; c_pixelG+= buffer_to[pos_to + cline + 1 - row]; c_pixelR+= buffer_to[pos_to + cline + 2 - row]; c_pixelB+= buffer_to[pos_to + cline + 0 + row]; c_pixelG+= buffer_to[pos_to + cline + 1 + row]; c_pixelR+= buffer_to[pos_to + cline + 2 + row]; c_pixelB+= buffer_to[pos_to + cline + 0 - row - p_step]; c_pixelG+= buffer_to[pos_to + cline + 1 - row - p_step]; c_pixelR+= buffer_to[pos_to + cline + 2 - row - p_step]; c_pixelB+= buffer_to[pos_to + cline + 0 + row + p_step]; c_pixelG+= buffer_to[pos_to + cline + 1 + row + p_step]; c_pixelR+= buffer_to[pos_to + cline + 2 + row + p_step]; c_pixelB+= buffer_to[pos_to + cline + 0 - row + p_step]; c_pixelG+= buffer_to[pos_to + cline + 1 - row + p_step]; c_pixelR+= buffer_to[pos_to + cline + 2 - row + p_step]; c_pixelB+= buffer_to[pos_to + cline + 0 + row - p_step]; c_pixelG+= buffer_to[pos_to + cline + 1 + row - p_step]; c_pixelR+= buffer_to[pos_to + cline + 2 + row - p_step]; // average values c_pixelB_AVG=((uint8_t) (c_pixelB/8)); c_pixelG_AVG=((uint8_t) (c_pixelG/8)); c_pixelR_AVG=((uint8_t) (c_pixelR/8)); } else //no blur { c_pixelB_AVG = buffer_to[pos_to + cline + 0]; c_pixelG_AVG = buffer_to[pos_to + cline + 1]; c_pixelR_AVG = buffer_to[pos_to + cline + 2]; } /* if(c_BRI>0 && c_BRI<100) // decrease brightness { if(c_pixelB_AVG>c_BRI) c_pixelB_AVG-=c_BRI; else c_pixelB_AVG=0; if(c_pixelG_AVG>c_BRI) c_pixelG_AVG-=c_BRI; else c_pixelG_AVG=0; if(c_pixelR_AVG>c_BRI) c_pixelR_AVG-=c_BRI; else c_pixelR_AVG=0; }*/ if(c_BRI>0) // increase brightnes by percent (101+=1%+) { c_pixelB_AVG=(uint32_t) (c_pixelB_AVG*(((float)c_BRI)/100.0f) ); if(c_pixelB_AVG>0xff) c_pixelB_AVG=0xff; c_pixelG_AVG=(uint32_t) (c_pixelG_AVG*(((float)c_BRI)/100.0f) ); if(c_pixelG_AVG>0xff) c_pixelG_AVG=0xff; c_pixelR_AVG=(uint32_t) (c_pixelR_AVG*(((float)c_BRI)/100.0f) ); if(c_pixelR_AVG>0xff) c_pixelR_AVG=0xff; } if(use_grayscale) { // greyscale + box blur c_pixel = c_pixelB_AVG + c_pixelG_AVG + c_pixelR_AVG; memset(buffer_to + pos_to + cline + 0, (uint8_t) (c_pixel/3), 3); } else { buffer_to[pos_to + cline ]= c_pixelB_AVG; buffer_to[pos_to + cline + 1]= c_pixelG_AVG; buffer_to[pos_to + cline + 2]= c_pixelR_AVG; } } else { c_pixelB_AVG = buffer_to[pos_to + cline + 0]; c_pixelG_AVG = buffer_to[pos_to + cline + 1]; c_pixelR_AVG = buffer_to[pos_to + cline + 2]; if(c_BRI>0) // increase brightnes by percent (101+=1%+) { c_pixelB_AVG=(uint32_t) (c_pixelB_AVG*(((float)c_BRI)/100.0f) ); if(c_pixelB_AVG>0xff) c_pixelB_AVG=0xff; c_pixelG_AVG=(uint32_t) (c_pixelG_AVG*(((float)c_BRI)/100.0f) ); if(c_pixelG_AVG>0xff) c_pixelG_AVG=0xff; c_pixelR_AVG=(uint32_t) (c_pixelR_AVG*(((float)c_BRI)/100.0f) ); if(c_pixelR_AVG>0xff) c_pixelR_AVG=0xff; } if(use_grayscale) { // greyscale + box blur c_pixel = c_pixelB_AVG + c_pixelG_AVG + c_pixelR_AVG; memset(buffer_to + pos_to + cline + 0, (uint8_t) (c_pixel/3), 3); } else { buffer_to[pos_to + cline ]= c_pixelB_AVG; buffer_to[pos_to + cline + 1]= c_pixelG_AVG; buffer_to[pos_to + cline + 2]= c_pixelR_AVG; } } if(use_grayscale && !use_blur) { // convert to grayscale only c_pixel = buffer_to[pos_to + cline + 0]; c_pixel+= buffer_to[pos_to + cline + 1]; c_pixel+= buffer_to[pos_to + cline + 2]; if(c_BRI>0) { if(c_pixel>(c_BRI*3)) c_pixel-=(c_BRI*3); else c_pixel=0; } memset(buffer_to + pos_to + cline, (uint8_t) (c_pixel/3), 3); } // keep alpha // memset(buffer_to + pos_to + cline + 3, buffer_to[pos_to + cline + 3], 1); //if(sub_menu_open) //buffer_to[pos_to + cline + 3] = 0x80; } pos_to+=line; } }//iterations } void draw_list_text( uint8_t *buffer, uint32_t width, uint32_t height, t_menu_list *menu, int menu_size, int selected, int _dir_mode, int _display_mode, int _cover_mode, int opaq, int to_draw ) { //uint8_t *buffer = NULL; //buffer=(uint8_t*)(color_base_addr)+video_buffer*frame_index; if(to_draw && (_cover_mode==0)) memset(buffer, 0x00, FB(1)); float y = 0.1f, yb; int i = 0, c=0; char str[256]; char ansi[256]; char is_split[8]; float len=0; u32 color, color2; game_sel_last+=0; int flagb= selected & 0x10000; int max_entries=14; yb=y; selected&= 0xffff; if(!to_draw) { while( (c<max_entries && i < menu_size) ) { if( (_display_mode==1 && strstr(menu[i].content,"AVCHD")!=NULL) || (_display_mode==2 && strstr(menu[i].content,"PS3")!=NULL) ) { i++; continue;} if( (i >= (int) (selected / max_entries)*max_entries) ) { { len=1.18f; if(i==selected){ u32 b_color=0x0080ffd0; b_box_opaq+=b_box_step; if(_cover_mode==2){ if(b_box_opaq>0xfb) b_box_step=-4; if(b_box_opaq<0x20) b_box_step= 8; } else{ if(b_box_opaq>0xc0) b_box_step=-2; if(b_box_opaq<0x30) b_box_step= 1; } b_color = (b_color & 0xffffff00) | (b_box_opaq-20); if(_cover_mode==2) { draw_square((0.08f-0.5f)*2.0f-0.02f, (0.5f-y+0.01)*2.0f , len+0.04f, 0.006f, -0.5f, b_color); b_color = (b_color & 0xffffff00) | b_box_opaq; draw_square((0.08f-0.5f)*2.0f-0.02f, (0.5f-y-0.038)*2.0f , len+0.04f, 0.006f, -0.5f, b_color); } else draw_square((0.08f-0.5f)*2.0f-0.02f, (0.5f-y+0.01)*2.0f , len+0.04f, 0.1f, 0.0f, b_color); break; } y += 0.05f; c++; } } i++; } // bottom device icon if(th_drive_icon==1) { if(strstr(menu[selected].path, "/dev_usb")!=NULL || strstr(menu[selected].path, "/pvd_usb")!=NULL) { put_texture( buffer, text_USB, 96, 96, 320, th_drive_icon_x, th_drive_icon_y, 0, 0x0080ff80); } else if(strstr(menu[selected].path, "/dev_hdd")!=NULL) { put_texture( buffer, text_HDD, 96, 96, 320, th_drive_icon_x, th_drive_icon_y, 0, 0xff800080); } else if(strstr(menu[selected].path, "/dev_bdvd")!=NULL) { put_texture( buffer, text_BLU_1, 96, 96, 320, th_drive_icon_x, th_drive_icon_y, 0, 0xff800080); } } return; } CellFontRenderer* renderer; CellFontRenderSurface* surf; CellFont Font[1]; CellFont* cf; int fn; int ret; int i_offset=0; surf = &RenderWork.Surface; cellFontRenderSurfaceInit( surf, buffer, width*4, 4, width, height ); if(_cover_mode==2 || _cover_mode==0) cellFontRenderSurfaceSetScissor( surf, 0, 0, (int)(0.62f*width)+(int)((0.05f)*width), height ); else cellFontRenderSurfaceSetScissor( surf, 0, 0, width, height ); renderer = &RenderWork.Renderer; fn = FONT_SYSTEM_5; if(user_font==1 || user_font>19) fn = FONT_SYSTEM_GOTHIC_JP; else if (user_font==2) fn = FONT_SYSTEM_GOTHIC_LATIN; else if (user_font==3) fn = FONT_SYSTEM_SANS_SERIF; else if (user_font==4) fn = FONT_SYSTEM_SERIF; else if (user_font>4 && user_font<10) fn=user_font+5; else if (user_font>14 && user_font<20) fn=user_font; /* if(user_font==0) fn = FONT_USER_FONT0; if(user_font==5) fn = FONT_SYSTEM_5; if(user_font==6) fn = FONT_SYSTEM_6; if(user_font==7) fn = FONT_SYSTEM_7; if(user_font==8) fn = FONT_SYSTEM_8; if(user_font==9) fn = FONT_SYSTEM_9; */ // fn = FONT_SYSTEM_GOTHIC_LATIN; // fn = FONT_SYSTEM_SANS_SERIF; // fn = FONT_SYSTEM_SERIF; // fn = FONT_USER_FONT0; ret = Fonts_AttachFont( fonts, fn, &Font[0] ); if ( ret == CELL_OK ) cf = &Font[0]; else cf = (CellFont*)0; if ( cf ) { static float weight = 1.04f; static float slant = 0.08f; float scale; float step; float lineH, baseY; step = 0.f; scale = 24.f; ret = Fonts_SetFontScale( cf, scale ); ret = Fonts_SetFontEffectWeight( cf, weight ); ret = Fonts_SetFontEffectSlant( cf, slant ); ret = Fonts_GetFontHorizontalLayout( cf, &lineH, &baseY ); Fonts_BindRenderer( cf, renderer ); int it; for(it=0;it<2;it++) { y=yb; i = 0; c=0; while( (c<max_entries && i < menu_size) ) { if( (_display_mode==1 && strstr(menu[i].content,"AVCHD")!=NULL) || (_display_mode==2 && strstr(menu[i].content,"PS3")!=NULL) ) { i++; continue;} if( (i >= (int) (selected / max_entries)*max_entries) ) { int grey=0; is_split[0]=0; if(i<menu_size) { grey=0; if(menu[i].title[0]=='_') { sprintf(ansi, "%s", menu[i].title+1); grey=1; sprintf(is_split, " (Split)");} else sprintf(ansi, "%s", menu[i].title); if(_dir_mode==0 && (_cover_mode==0 || _cover_mode==2)) { ansi[64]=0; } if(_dir_mode!=0 && (_cover_mode==0 || _cover_mode==2)) { ansi[64]=0; } if(_dir_mode==0 && _cover_mode==3) { ansi[47]=0; } if(_dir_mode!=0 && _cover_mode==3) { ansi[62]=0; } if( (_cover_mode==1 || _cover_mode==4 || _cover_mode==7)) { ansi[128]=0; } sprintf(str, "%s%s", ansi, is_split ); } else { sprintf(str, " "); } // color= 0xffffffff; if(i==selected) color= (flagb && i==0) ? COL_PS3DISCSEL : ((grey==0) ? COL_SEL : 0xff008080); else { color= (flagb && i==0)? COL_PS3DISC : ((grey==0) ? COL_PS3 : COL_SPLIT);// 0xd0ffffff if(strstr(menu[i].content,"AVCHD")!=NULL) color=COL_AVCHD; if(strstr(menu[i].content,"BDMV")!=NULL) color=COL_BDMV; if(strstr(menu[i].content,"PS2")!=NULL) color=COL_PS2; if(strstr(menu[i].content,"DVD")!=NULL) color=COL_DVD; } // color2=( (color & 0x00ffffff) | (opaq<<24)); color2=color; // color= opaq<<16 | opaq<<8 | opaq; if(i==selected) color2 = 0xffffffff;// else color2 = 0x17e8e8e8; // color2 = 0x00fefefe; // if(i!=selected && _cover_mode==0) color2 = 0x17e8e8e8; // color = (color & 0x00ffffff) | (((color>>24)/2)<<24); color = 0xff101010; ret = Fonts_SetFontEffectSlant( cf, 0.1f ); if(strstr(menu[i].content, "PS3")!=NULL) i_offset=100; else i_offset=0; if(_dir_mode!=0) { len=0.023f*(float)(strlen(str)+2); { if(_dir_mode==1) { if(_cover_mode!=0 && it==0) Fonts_RenderPropText( cf, surf, (int)((0.08f)*1920)+1+i_offset, (int)((y-0.005f)*1080)+1, (uint8_t*) str, scale*1.1f, scale, slant, step, color ); if(_cover_mode==0 || it==1) Fonts_RenderPropText( cf, surf, (int)((0.08f)*1920)+i_offset, (int)((y-0.005f)*1080), (uint8_t*) str, scale*1.1f, scale, slant, step, color2 ); } else { if(_cover_mode!=0 && it==0) Fonts_RenderPropText( cf, surf, (int)((0.08f)*1920)+2+i_offset, (int)((y+0.001f)*1080)+2, (uint8_t*) str, scale*1.3f, scale, slant, step, color ); if(_cover_mode==0 || it==1) Fonts_RenderPropText( cf, surf, (int)((0.08f)*1920)+i_offset, (int)((y+0.001f)*1080), (uint8_t*) str, scale*1.3f, scale, slant, step, color2 ); } } } else { len=0.03f*(float)(strlen(str)); if(opaq>0x020 || i==selected) { if(_cover_mode!=0 && it==0) Fonts_RenderPropText( cf, surf, (int)((0.08f)*1920)+2+i_offset, (int)((y-0.005f)*1080)+2, (uint8_t*) str, scale*1.5f, scale*1.4f, slant, step, color ); if(_cover_mode==0 || it==1) Fonts_RenderPropText( cf, surf, (int)((0.08f)*1920)+i_offset, (int)((y-0.005f)*1080), (uint8_t*) str, scale*1.5f, scale*1.4f, slant, step, color2 ); } } if(strlen(str)>1 && _dir_mode==1) { sprintf(str, "%s", menu[i].path); if(strstr(menu[i].content,"AVCHD")!=NULL || strstr(menu[i].content,"BDMV")!=NULL) sprintf(str, "(%s) %s", menu[i].entry, menu[i].details); str[102]=0; if(0.01125f*(float)(strlen(str))>len) len=0.01125f*(float)(strlen(str)); if(opaq>0x020 || i==selected) { if(_cover_mode!=0 && it==0) Fonts_RenderPropText( cf, surf, (int)((0.08f)*1920)+1+i_offset, (int)((y+0.022f)*1080)+1, (uint8_t*) str, scale/1.4f, scale/2.0f, 0.0f, step, color ); if(_cover_mode==0 || it==1) Fonts_RenderPropText( cf, surf, (int)((0.08f)*1920)+i_offset, (int)((y+0.022f)*1080), (uint8_t*) str, scale/1.4f, scale/2.0f, 0.0f, step, color2 ); } } if((_cover_mode==0 || it==1) && strstr(menu[i].content, "PS3")!=NULL && strstr(menu[i].title_id, "NO_ID")==NULL) { sprintf(str, "%s/%s_80.RAW", cache_dir, menu[i].title_id); if(load_raw_texture( (u8*)text_TEMP, str, 80)) put_texture( buffer, (u8*)text_TEMP, 80, 45, 80, (int)((0.08f)*1920), (int)((y-0.005f)*1080), 1, 0x80808080); } len=1.18f; y += 0.05f; c++; } i++; } if(_cover_mode==0) break; if((_cover_mode==2 && it==0)) { if(menu[selected].title[0]=='_' || menu_list[selected].split) { gray_texture(buffer, 1920, 1080, 1); blur_texture(buffer, 1920, 1080, (int)((0.05f)*1920), (int) ((0.1f-0.025f)*1080), 1250, (int)((0.05f*max_entries+0.025f)*1080), 55, 0, 0, 2); } else blur_texture(buffer, 1920, 1080, (int)((0.05f)*1920), (int) ((0.1f-0.025f)*1080), 1250, (int)((0.05f*max_entries+0.025f)*1080), 60, 0, 0, 2); // int it; // for(it=3;it<21;it+=3) // blur_texture(buffer, 1920, 1080, (int)((0.05f+_overscan)*1920)+it, (int) ((_overscan+0.1f-0.025f)*1080)+it, 1250-(it*2), (int)((0.05f*max_entries+0.025f)*1080)-(it*2), 1, 0, 1); // for(it=3;it<12;it+=3) // it=12; // blur_texture(buffer, 1920, 1080, (int)((0.05f+_overscan)*1920)+it, (int) ((_overscan+0.1f-0.025f)*1080)+it, 1250-(it*2), (int)((0.05f*max_entries+0.025f)*1080)-(it*2), 1, 0, 1); } /* ClearSurface(); set_texture( buffer, 1920, 1080); //PIC1.PNG display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); flip(); */ } if(th_drive_icon==1) { if(strstr(menu[selected].path, "/dev_usb")!=NULL || strstr(menu[selected].path, "/pvd_usb")!=NULL) { put_texture( buffer, text_USB, 96, 96, 320, th_drive_icon_x, th_drive_icon_y, 0, 0x0080ff80); } else if(strstr(menu[selected].path, "/dev_hdd")!=NULL) { put_texture( buffer, text_HDD, 96, 96, 320, th_drive_icon_x, th_drive_icon_y, 0, 0xff800080); } else if(strstr(menu[selected].path, "/dev_bdvd")!=NULL) { put_texture( buffer, text_BLU_1, 96, 96, 320, th_drive_icon_x, th_drive_icon_y, 0, 0xff800080); } } Fonts_UnbindRenderer( cf ); Fonts_DetachFont( cf ); } } //FONTS void put_label(uint8_t *buffer, uint32_t width, uint32_t height, char *str1p, char *str2p, char *str3p, uint32_t color) //uint8_t *texture, { if(game_details==3) return; CellFontRenderer* renderer; CellFontRenderSurface* surf; CellFont Font[1]; CellFont* cf; int fn; surf = &RenderWork.Surface; cellFontRenderSurfaceInit( surf, buffer, width*4, 4, width, height ); cellFontRenderSurfaceSetScissor( surf, 0, 0, width, height ); renderer = &RenderWork.Renderer; fn = FONT_SYSTEM_5; if(user_font==1 || user_font>19) fn = FONT_SYSTEM_GOTHIC_JP; else if (user_font==2) fn = FONT_SYSTEM_GOTHIC_LATIN; else if (user_font==3) fn = FONT_SYSTEM_SANS_SERIF; else if (user_font==4) fn = FONT_SYSTEM_SERIF; else if (user_font>4 && user_font<10) fn=user_font+5; else if (user_font>14 && user_font<20) fn=user_font; int ret = Fonts_AttachFont( fonts, fn, &Font[0] ); if ( ret == CELL_OK ) cf = &Font[0]; else cf = (CellFont*)0; if ( cf ) { static float textScale = 1.00f; static float weight = 1.04f; static float slant = 0.00f; float surfW = (float)width; float surfH = (float)height; float textX, textW = surfW; float textY, textH = surfW; float scale; float step; float lineH, baseY; uint8_t* utf8Str0 = (uint8_t*) str1p; uint8_t* utf8Str1 = (uint8_t*) str2p; uint8_t* utf8Str2 = (uint8_t*) str3p; float x, y, x2, x3; float w1,w2,w3; float w; if(str1p[0]=='_') utf8Str0++; step = 0.f; scale=28.f; textX = 0.5f * ( surfW - surfW * textScale ); textY = 0.03f * ( surfH - surfH * textScale ); textW = surfW * textScale; textH = surfH * textScale; ret = Fonts_SetFontScale( cf, scale ); if ( ret == CELL_OK ) { ret = Fonts_SetFontEffectWeight( cf, weight ); } if ( ret == CELL_OK ) { ret = Fonts_SetFontEffectSlant( cf, slant ); } ret = Fonts_GetFontHorizontalLayout( cf, &lineH, &baseY ); if ( ret == CELL_OK ) { w1 = Fonts_GetPropTextWidth( cf, utf8Str0, scale, scale, slant, step, NULL, NULL )*1.2f; w2 = Fonts_GetPropTextWidth( cf, utf8Str1, scale, scale, slant, step, NULL, NULL )*0.8f; w3 = Fonts_GetPropTextWidth( cf, utf8Str2, scale, scale, slant, step, NULL, NULL )*0.8f; w = (( w1 > w2 )? w1:w2); if ( w > textW ) { float ratio; scale = Fonts_GetPropTextWidthRescale( scale, w, textW, &ratio ); w1 *= ratio; w2 *= ratio; w3 *= ratio; baseY *= ratio; lineH *= ratio; step *= ratio; } Fonts_BindRenderer( cf, renderer ); x = 0.5f*(textW-w1);//+mouseXP; //textX-0.7f;// x2 = 0.5f*(textW-w2);//+mouseXP; //textX-0.7f;// x3 = 0.5f*(textW-w3);//+mouseXP; //textX-0.7f;// y=legend_y;//+mouseYP; if(game_details!=3) { if(game_details==0) y+=25; if(game_details==1) y+=12; Fonts_RenderPropText( cf, surf, x+1, y+1, utf8Str0, scale*1.2, scale, slant, step, 0xf0101010 );//f01010e0 //0xff404040 blur_texture(buffer, 1920, (int)(lineH+5), (int)x-2, (int)y-2, (int)(w1+15), (int)lineH+5, 0, 0, 3, 1); Fonts_RenderPropText( cf, surf, x, y, utf8Str0, scale*1.2f, scale, slant, step, color );//(color & 0x00ffffff) if(game_details>0) { Fonts_RenderPropText( cf, surf, x3+1, y+42, utf8Str2, scale*0.8f, scale*0.57f, slant, step, 0xff101010); blur_texture(buffer, 1920, (int)(lineH*0.8+5), (int)x3-2, (int)y+40, (int)w3+15, (int)(lineH*0.57+5), 0, 0, 1, 1); Fonts_RenderPropText( cf, surf, x3, y+41, utf8Str2, scale*0.8f, scale*0.57f, slant, step, 0xffd0d0ff ); } if(game_details>1) { Fonts_RenderPropText( cf, surf, x2+1, y+68, utf8Str1, scale*0.8f, scale*0.8f, slant, step, 0xff101010); blur_texture(buffer, 1920, (int)(lineH*0.8+5), (int)x2-2, (int)y+65, (int)w2+15, (int)(lineH*0.8+5), 0, 0, 1, 1); Fonts_RenderPropText( cf, surf, x2, y+67, utf8Str1, scale*0.8f, scale*0.8f, slant, step, 0xc000ffff ); } } Fonts_UnbindRenderer( cf ); } Fonts_DetachFont( cf ); } } void print_label(float x, float y, float scale, uint32_t color, char *str1p, float weight, float slant, int ufont) { if(max_ttf_label<512) { ttf_label[max_ttf_label].x = x; ttf_label[max_ttf_label].y = y; ttf_label[max_ttf_label].scale = scale; ttf_label[max_ttf_label].color = color; ttf_label[max_ttf_label].weight = weight; ttf_label[max_ttf_label].slant = slant; ttf_label[max_ttf_label].font = ufont; ttf_label[max_ttf_label].hscale = 1.0f; ttf_label[max_ttf_label].vscale = 1.0f; ttf_label[max_ttf_label].centered = 0; ttf_label[max_ttf_label].cut = 0.0f; sprintf(ttf_label[max_ttf_label].label, "%s", str1p); max_ttf_label++; } } void print_label_width(float x, float y, float scale, uint32_t color, char *str1p, float weight, float slant, int ufont, float cut) { if(max_ttf_label<512) { ttf_label[max_ttf_label].x = x; ttf_label[max_ttf_label].y = y; ttf_label[max_ttf_label].scale = scale; ttf_label[max_ttf_label].color = color; ttf_label[max_ttf_label].weight = weight; ttf_label[max_ttf_label].slant = slant; ttf_label[max_ttf_label].font = ufont; ttf_label[max_ttf_label].hscale = 1.0f; ttf_label[max_ttf_label].vscale = 1.0f; ttf_label[max_ttf_label].centered = 0; ttf_label[max_ttf_label].cut = cut; sprintf(ttf_label[max_ttf_label].label, "%s", str1p); max_ttf_label++; } } void print_label_ex(float x, float y, float scale, uint32_t color, char *str1p, float weight, float slant, int ufont, float hscale, float vscale, int centered) { if(max_ttf_label<512) { ttf_label[max_ttf_label].x = x; ttf_label[max_ttf_label].y = y; ttf_label[max_ttf_label].scale = scale; ttf_label[max_ttf_label].color = color; ttf_label[max_ttf_label].weight = weight; ttf_label[max_ttf_label].slant = slant; ttf_label[max_ttf_label].font = ufont; ttf_label[max_ttf_label].hscale = hscale; ttf_label[max_ttf_label].vscale = vscale; ttf_label[max_ttf_label].centered = centered; ttf_label[max_ttf_label].cut = 0.0f; sprintf(ttf_label[max_ttf_label].label, "%s", str1p); max_ttf_label++; } } void flush_ttf(uint8_t *buffer, uint32_t _V_WIDTH, uint32_t _V_HEIGHT) { if(!max_ttf_label) return; uint32_t color; CellFontRenderer* renderer; CellFontRenderSurface* surf; CellFont Font[1]; CellFont* cf; int fn; // uint8_t *buffer = NULL; // buffer=(uint8_t*)(color_base_addr)+video_buffer*(c_frame_index); surf = &RenderWork.Surface; cellFontRenderSurfaceInit( surf, buffer, _V_WIDTH*4, 4, _V_WIDTH, _V_HEIGHT ); cellFontRenderSurfaceSetScissor( surf, 0, 0, _V_WIDTH, _V_HEIGHT ); renderer = &RenderWork.Renderer; fn = FONT_SYSTEM_5; if(user_font==1 || user_font>19) fn = FONT_SYSTEM_GOTHIC_JP; else if (user_font==2) fn = FONT_SYSTEM_GOTHIC_LATIN; else if (user_font==3) fn = FONT_SYSTEM_SANS_SERIF; else if (user_font==4) fn = FONT_SYSTEM_SERIF; else if (user_font>4 && user_font<10) fn=user_font+5; else if (user_font>14 && user_font<20) fn=user_font; int ret; if(ttf_label[0].font!=0) fn=ttf_label[0].font; ret = Fonts_AttachFont( fonts, fn, &Font[0] ); if ( ret == CELL_OK ) cf = &Font[0]; else cf = (CellFont*)0; if ( cf ) { static float textScale = 1.00f; static float weight = 1.00f; static float slant = 0.00f; float surfW = (float)_V_WIDTH; float surfH = (float)_V_HEIGHT; float textW;// = surfW; float textH;// = surfH; float step = 0.f; float lineH, baseY; float w; textW = surfW * textScale; textH = surfH * textScale; uint8_t* utf8Str0; float scale, scaley, x, y; int cl=0; for(cl=0; cl<max_ttf_label; cl++) { weight = ttf_label[cl].weight; scale = 30.0f * ttf_label[cl].scale * ((float)_V_WIDTH/1920.0f) * ttf_label[cl].hscale; scaley = 29.0f * ttf_label[cl].scale * ((float)_V_HEIGHT/1080.0f) * ttf_label[cl].vscale; slant = ttf_label[cl].slant; ret = Fonts_SetFontScale( cf, scale ); if ( ret == CELL_OK ) ret = Fonts_SetFontEffectWeight( cf, weight ); if ( ret == CELL_OK ) ret = Fonts_SetFontEffectSlant( cf, slant ); ret = Fonts_GetFontHorizontalLayout( cf, &lineH, &baseY ); utf8Str0 = (uint8_t*) ttf_label[cl].label; x = ttf_label[cl].x; y = ttf_label[cl].y; color = ttf_label[cl].color; //0x80ffffff;// if ( ret == CELL_OK ) { w = Fonts_GetPropTextWidth( cf, utf8Str0, scale, scaley, slant, step, NULL, NULL ); if ( (w+x+16.f) > textW && ttf_label[cl].cut==0.0f ) { float ratio; scale = Fonts_GetPropTextWidthRescale( scale, w, textW-x-16.f, &ratio ); w *= ratio; baseY *= ratio; lineH *= ratio; step *= ratio; } else if ( ttf_label[cl].cut>0.0f && w>((int)(ttf_label[cl].cut*(float)V_WIDTH))) { float ratio; scale = Fonts_GetPropTextWidthRescale( scale, w, ((int)(ttf_label[cl].cut*(float)V_WIDTH)), &ratio ); w *= ratio; baseY *= ratio; lineH *= ratio; step *= ratio; } if(ttf_label[cl].centered==1) x=(ttf_label[cl].x - (w/2.0f)/(float)_V_WIDTH); else if(ttf_label[cl].centered==2) x=(ttf_label[cl].x - (w)/(float)_V_WIDTH); //right justified if(cl==0) Fonts_BindRenderer( cf, renderer ); if(cover_mode!=8 && cover_mode!=5) Fonts_RenderPropText( cf, surf, (int)(x*(float)_V_WIDTH)+1, (int)(y *(float)_V_HEIGHT)+1, utf8Str0, scale, scaley, slant, step, 0xff000000 ); if(cover_mode==8) Fonts_RenderPropText( cf, surf, (int)(x*(float)_V_WIDTH)+2, (int)(y *(float)_V_HEIGHT)+2, utf8Str0, scale, scaley, slant, step, 0x10101010 ); // && cover_mode!=8 Fonts_RenderPropText( cf, surf, (int)(x*(float)_V_WIDTH), (int)(y*(float)_V_HEIGHT), utf8Str0, scale, scaley, slant, step, color );//(color & 0x00ffffff) } } Fonts_UnbindRenderer( cf ); Fonts_DetachFont( cf ); } max_ttf_label=0; } void draw_boot_flags(u32 gflags, bool is_locked, int selected) { //boot flags if(gflags & IS_DBOOT) { if(is_locked) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2s_x *4 + dox_rb2s_y * dox_width*4), dox_rb2s_w, dox_rb2s_h, dox_width, 580, 695, 0, 0); else put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1s_x *4 + dox_rb1s_y * dox_width*4), dox_rb1s_w, dox_rb1s_h, dox_width, 580, 695, 0, 0); } else { if(is_locked) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2u_x *4 + dox_rb2u_y * dox_width*4), dox_rb2u_w, dox_rb2u_h, dox_width, 580, 695, 0, 0); else put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1u_x *4 + dox_rb1u_y * dox_width*4), dox_rb1u_w, dox_rb1u_h, dox_width, 580, 695, 0, 0); } if(gflags & IS_BDMIRROR) { if(is_locked) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2s_x *4 + dox_rb2s_y * dox_width*4), dox_rb1u_w, dox_rb2s_h, dox_width, 580, 735, 0, 0); else put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1s_x *4 + dox_rb1s_y * dox_width*4), dox_rb1u_w, dox_rb1s_h, dox_width, 580, 735, 0, 0); } else { if(is_locked) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2u_x *4 + dox_rb2u_y * dox_width*4), dox_rb2u_w, dox_rb2u_h, dox_width, 580, 735, 0, 0); else put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1u_x *4 + dox_rb1u_y * dox_width*4), dox_rb1u_w, dox_rb1u_h, dox_width, 580, 735, 0, 0); } if(gflags & IS_PATCHED) { if(is_locked || c_firmware!=3.41f) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2s_x *4 + dox_rb2s_y * dox_width*4), dox_rb1u_w, dox_rb2s_h, dox_width, 580, 775, 0, 0); else put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1s_x *4 + dox_rb1s_y * dox_width*4), dox_rb1u_w, dox_rb1s_h, dox_width, 580, 775, 0, 0); } else { if(is_locked || c_firmware!=3.41f) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2u_x *4 + dox_rb2u_y * dox_width*4), dox_rb2u_w, dox_rb2u_h, dox_width, 580, 775, 0, 0); else put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1u_x *4 + dox_rb1u_y * dox_width*4), dox_rb1u_w, dox_rb1u_h, dox_width, 580, 775, 0, 0); } if(gflags & IS_EXTGD) { if(is_locked || payload!=1) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2s_x *4 + dox_rb2s_y * dox_width*4), dox_rb1u_w, dox_rb2s_h, dox_width, 580, 815, 0, 0); else put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1s_x *4 + dox_rb1s_y * dox_width*4), dox_rb1u_w, dox_rb1s_h, dox_width, 580, 815, 0, 0); } else { if(is_locked || payload!=1) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2u_x *4 + dox_rb2u_y * dox_width*4), dox_rb2u_w, dox_rb2u_h, dox_width, 580, 815, 0, 0); else put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1u_x *4 + dox_rb1u_y * dox_width*4), dox_rb1u_w, dox_rb1u_h, dox_width, 580, 815, 0, 0); } if(gflags & IS_FAV) { if(is_locked) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2s_x *4 + dox_rb2s_y * dox_width*4), dox_rb1u_w, dox_rb2s_h, dox_width, 580, 855, 0, 0); else put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1s_x *4 + dox_rb1s_y * dox_width*4), dox_rb1u_w, dox_rb1s_h, dox_width, 580, 855, 0, 0); } else { if(is_locked) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2u_x *4 + dox_rb2u_y * dox_width*4), dox_rb2u_w, dox_rb2u_h, dox_width, 580, 855, 0, 0); else put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1u_x *4 + dox_rb1u_y * dox_width*4), dox_rb1u_w, dox_rb1u_h, dox_width, 580, 855, 0, 0); } if(selected) { // if(selected<4) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb3s_x *4 + dox_rb3s_y * dox_width*4), dox_rb3s_w, dox_rb3s_h, dox_width, 580, 695+((selected-1)*40), 0, 0); // else // put_texture_with_alpha( text_FONT, text_DOX+(dox_rb3s_x *4 + dox_rb3s_y * dox_width*4), dox_rb3s_w, dox_rb3s_h, dox_width, 580, 695+((selected)*40), 0, 0); } } void draw_reqd_flags(u32 gflags, bool is_locked, int selected) { //required flags if(gflags & IS_DISC) { if(is_locked) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2s_x *4 + dox_rb2s_y * dox_width*4), dox_rb2s_w, dox_rb2s_h, dox_width, 240, 695, 0, 0); else put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1s_x *4 + dox_rb1s_y * dox_width*4), dox_rb1s_w, dox_rb1s_h, dox_width, 240, 695, 0, 0); } else { if(is_locked) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2u_x *4 + dox_rb2u_y * dox_width*4), dox_rb2u_w, dox_rb2u_h, dox_width, 240, 695, 0, 0); else put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1u_x *4 + dox_rb1u_y * dox_width*4), dox_rb1u_w, dox_rb1u_h, dox_width, 240, 695, 0, 0); } if(gflags & IS_HDD) { if(is_locked) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2s_x *4 + dox_rb2s_y * dox_width*4), dox_rb1u_w, dox_rb2s_h, dox_width, 240, 735, 0, 0); else put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1s_x *4 + dox_rb1s_y * dox_width*4), dox_rb1u_w, dox_rb1s_h, dox_width, 240, 735, 0, 0); } else { if(is_locked) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2u_x *4 + dox_rb2u_y * dox_width*4), dox_rb2u_w, dox_rb2u_h, dox_width, 240, 735, 0, 0); else put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1u_x *4 + dox_rb1u_y * dox_width*4), dox_rb1u_w, dox_rb1u_h, dox_width, 240, 735, 0, 0); } if(gflags & IS_USB) { if(is_locked) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2s_x *4 + dox_rb2s_y * dox_width*4), dox_rb1u_w, dox_rb2s_h, dox_width, 240, 775, 0, 0); else put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1s_x *4 + dox_rb1s_y * dox_width*4), dox_rb1u_w, dox_rb1s_h, dox_width, 240, 775, 0, 0); } else { if(is_locked) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2u_x *4 + dox_rb2u_y * dox_width*4), dox_rb2u_w, dox_rb2u_h, dox_width, 240, 775, 0, 0); else put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1u_x *4 + dox_rb1u_y * dox_width*4), dox_rb1u_w, dox_rb1u_h, dox_width, 240, 775, 0, 0); } if(selected) put_texture_with_alpha( text_FONT, text_DOX+(dox_rb3s_x *4 + dox_rb3s_y * dox_width*4), dox_rb3s_w, dox_rb3s_h, dox_width, 240, 695+((selected-1)*40), 0, 0); } int open_submenu(uint8_t *buffer, int *_game_sel) { xmb_bg_show=0; xmb_bg_counter=200; memcpy(text_FONT, buffer, FB(1)); u8 _menu_font=15; float y_scale=0.5; if(mm_locale) { _menu_font=mui_font; y_scale=0.4f; } reload_submenu: char label[256]; float x, y, top_o; int m; get_game_flags(*_game_sel); if(menu_list[*_game_sel].user & IS_BDMIRROR) {menu_list[*_game_sel].user &= ~(IS_HDD | IS_DBOOT); menu_list[*_game_sel].user|= IS_USB;} u32 gflags=menu_list[*_game_sel].user; set_game_flags(*_game_sel); u32 oflags=0; bool is_locked = (gflags & IS_LOCKED) || (gflags & IS_PROTECTED) || (strstr(menu_list[*_game_sel].path,"/pvd_usb")!=NULL || strstr(menu_list[*_game_sel].path,"/dev_bdvd")!=NULL); bool is_game = (strstr(menu_list[*_game_sel].content,"PS3")!=NULL); //(gflags & IS_PS3) || top_o=40.0f; // sub_menu_open=1; //blur_texture(text_FONT, 1920, 1080, 46, 52, 1828, 976, 35, 0, 1, 2); blur_texture(text_FONT, 1920, 1080, 0, 0, 1920, 1080, 25, 0, 1, 1); // sprintf(label, "%s/GLO.PNG", app_usrdir); // load_texture(text_bmp, label, 1920); // put_texture_with_alpha( text_FONT, text_bmp, 1920, 1080, 1920, 0, 0, 0, 0); /*for(m=100; m<200; m+=10) { ClearSurface(); set_texture( buffer, 1920, 1080); display_img((1920-1920*m/100)/2, (1080-1080*m/100)/2, 1920*m/100, 1080*m/100, 1920, 1080, -0.5f, 1920, 1080); setRenderColor(); flip(); }*/ draw_box( text_FONT, 1920, 2, 0, (int)top_o+75, 0xa0a0a0ff); draw_box( text_FONT, 1920, 2, 0, 964, 0x808080ff); sprintf(label, "%s/%s_640.RAW", cache_dir, menu_list[*_game_sel].title_id); if(exist(label)){ load_texture(text_bmp, label, 640); if(menu_list[*_game_sel].split || menu_list[*_game_sel].title[0]=='_') { menu_list[*_game_sel].split=1; gray_texture(text_bmp, 640, 360, 0); } put_texture(text_FONT, text_bmp, 640, 360, 640, 105, 110+(int)top_o, 2, 0xc0c0c080); } sprintf(label, "%s/%s.JPG", covers_dir, menu_list[*_game_sel].title_id); if(!exist(label)) sprintf(label, "%s/%s.PNG", covers_dir, menu_list[*_game_sel].title_id); else goto gs_cover; if(!exist(label)) sprintf(label, "%s/COVER.JPG", menu_list[*_game_sel].path); else goto gs_cover; if(!exist(label)) sprintf(label, "%s/COVER.PNG", menu_list[*_game_sel].path); else goto gs_cover; if(!exist(label)) sprintf(label, "%s/NOID.JPG", app_usrdir); else goto gs_cover; if(exist(label)){ gs_cover: load_texture(text_bmp, label, 260); if(menu_list[*_game_sel].split || menu_list[*_game_sel].title[0]=='_') { menu_list[*_game_sel].split=1; gray_texture(text_bmp, 260, 300, 0); } put_texture(text_FONT, text_bmp, 260, 300, 260, 295, 566+(int)top_o, 2, 0xc0c0c080); sprintf(label, "%s/GLC.PNG", app_usrdir); if(exist(label)) { load_texture(text_bmp+312000, label, 260); put_texture_with_alpha( text_FONT, text_bmp+312000, 260, 300, 260, 295, 566+(int)top_o, 0, 0); } } put_texture_with_alpha( text_FONT, text_DOX+(dox_pad_x *4 + dox_pad_y * dox_width*4), dox_pad_w, dox_pad_h, dox_width, 70, 968, 0, 0); put_texture_with_alpha( text_FONT, text_DOX+(dox_cross_x *4 + dox_cross_y * dox_width*4), dox_cross_w, dox_cross_h, dox_width, 1140, 975, 0, 0); put_texture_with_alpha( text_FONT, text_DOX+(dox_square_x *4 + dox_square_y * dox_width*4), dox_square_w, dox_square_h, dox_width, 1340, 975, 0, 0); put_texture_with_alpha( text_FONT, text_DOX+(dox_circle_x *4 + dox_circle_y * dox_width*4), dox_circle_w, dox_circle_h, dox_width, 1540, 975, 0, 0); put_texture_with_alpha( text_FONT, text_DOX+(dox_triangle_x*4 + dox_triangle_y * dox_width*4), dox_triangle_w, dox_triangle_h, dox_width, 1700, 975, 0, 0); float game_app_ver=0.00f; float ps3_sys_ver=0.00f; char temp_val[32]; temp_val[0]=0; if(is_game) { draw_boot_flags(gflags, is_locked, 0); draw_reqd_flags(gflags, is_locked, 0); sprintf(label, "/dev_hdd0/game/%s/PARAM.SFO", menu_list[*_game_sel].title_id); if(!exist(label))sprintf(label, "%s/PS3_GAME/PARAM.SFO", menu_list[*_game_sel].path); if(!exist(label)) sprintf(label, "%s/PARAM.SFO", menu_list[*_game_sel].path); if(get_param_sfo_field(label, (char *)"APP_VER", (char *)temp_val)) game_app_ver=strtof(temp_val, NULL); else if(get_param_sfo_field(label, (char *)"VERSION", (char *)temp_val)) game_app_ver=strtof(temp_val, NULL); if(get_param_sfo_field(label, (char *)"PS3_SYSTEM_VER", (char *)temp_val)) ps3_sys_ver=strtof(temp_val, NULL); temp_val[0]=0; if(game_app_ver && ps3_sys_ver) sprintf(temp_val, " ver. %4.2f (PS3 firmware %4.2f)", game_app_ver, ps3_sys_ver); else if(game_app_ver && !ps3_sys_ver) sprintf(temp_val, " ver. %4.2f", game_app_ver); else if(ps3_sys_ver) sprintf(temp_val, " (PS3 firmware %4.2f)", ps3_sys_ver); // put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1s_x *4 + dox_rb1s_y * dox_width*4), dox_rb1s_w, dox_rb1s_h, dox_width, 580, 695, 0, 0); // put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1u_x *4 + dox_rb1u_y * dox_width*4), dox_rb1u_w, dox_rb1u_h, dox_width, 580, 735, 0, 0); // put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2s_x *4 + dox_rb2s_y * dox_width*4), dox_rb2s_w, dox_rb2s_h, dox_width, 580, 775, 0, 0); // put_texture_with_alpha( text_FONT, text_DOX+(dox_rb2u_x *4 + dox_rb2u_y * dox_width*4), dox_rb2u_w, dox_rb2u_h, dox_width, 240, 695, 0, 0); // put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1s_x *4 + dox_rb1s_y * dox_width*4), dox_rb1s_w, dox_rb1s_h, dox_width, 240, 735, 0, 0); // put_texture_with_alpha( text_FONT, text_DOX+(dox_rb1u_x *4 + dox_rb1u_y * dox_width*4), dox_rb1u_w, dox_rb1u_h, dox_width, 240, 775, 0, 0); } // put_texture_with_alpha( text_FONT, text_DOX+(dox_att_x *4 + dox_att_y * dox_width*4), dox_att_w, dox_att_h, dox_width, 950, 1000, 0, 0); max_ttf_label=0; char *game_title = menu_list[*_game_sel].title[0]=='_' ? menu_list[*_game_sel].title+1 : menu_list[*_game_sel].title; x=860.0f; y=top_o+155.0f; u32 title_color=0xffc0c0c0; int x_icon=(int)(x-50); int y_icon=(int) (top_o + 158.0f); int option_number=0; // + (120.f * (option_number-1)) if(disable_options==2 || disable_options==3) {title_color=0xd0808080;} else {title_color=0xffc0c0c0; put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x-50, (int)y+3, 0, 0); oflags|=(1<<0); } print_label_ex( (x/1920.f), (y/1080.f), 1.5f, title_color, (char*)STR_GM_COPY, 1.04f, 0.0f, _menu_font, 1.0f, y_scale*2.f, 0); put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x-50, (int)y+3, 0, 0); put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_w_x*4 + dox_arrow_w_y * dox_width*4), dox_arrow_w_w, dox_arrow_w_h, dox_width, (int)x-50, (int)y+3, 0, 0); y+=120.0f; if(is_locked || disable_options==1 || disable_options==3) title_color=0xd0808080; else {title_color=0xffc0c0c0; put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x-50, (int)y+3, 0, 0); oflags|=(1<<1);} print_label_ex( (x/1920.f), (y/1080.f), 1.5f, title_color, (char*)STR_GM_DELETE, 1.04f, 0.0f, _menu_font, 1.0f, y_scale*2.f, 0); y+=120.0f; if(is_locked || !is_game) title_color=0xd0808080; else {title_color=0xffc0c0c0; put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x-50, (int)y+3, 0, 0);oflags|=(1<<2);} print_label_ex( (x/1920.f), (y/1080.f), 1.5f, title_color, (char*)STR_GM_RENAME, 1.04f, 0.0f, _menu_font, 1.0f, y_scale*2.f, 0); y+=120.0f; if(!is_game) title_color=0xd0808080; else {title_color=0xffc0c0c0; put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x-50, (int)y+3, 0, 0);oflags|=(1<<3);} print_label_ex( (x/1920.f), (y/1080.f), 1.5f, title_color, (char*)STR_GM_UPDATE, 1.04f, 0.0f, _menu_font, 1.0f, y_scale*2.f, 0); title_color=0xffc0c0c0; y+=120.0f; oflags|=(1<<4); print_label_ex( (x/1920.f), (y/1080.f), 1.5f, title_color, (char*)STR_GM_TEST, 1.04f, 0.0f, _menu_font, 1.0f, y_scale*2.f, 0); put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x-50, (int)y+3, 0, 0); // title_color=0xd0808080; y+=120.0f; if(is_locked) title_color=0xd0808080; else {title_color=0xffc0c0c0; put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x-50, (int)y+3, 0, 0);oflags|=(1<<5);} print_label_ex( (x/1920.f), (y/1080.f), 1.5f, title_color, (char*) STR_GM_PERM, 1.04f, 0.0f, _menu_font, 1.0f, y_scale*2.f, 0); u32 info_color=0xffa0a0a0; sprintf(label, " %s", (char*) STR_BUT_NAV); print_label_ex( ((70.f+dox_pad_w)/1920.f), (981.f/1080.f), 1.5f, info_color, label, 1.00f, 0.00f, _menu_font, 0.5f, y_scale, 0); sprintf(label, " %s", (char*) STR_BUT_SELECT); print_label_ex( ((1140.f+dox_cross_w)/1920.f), (980.f/1080.f), 1.5f, info_color, label, 1.00f, 0.00f, _menu_font, 0.5f, y_scale, 0); sprintf(label, " %s", (char*) STR_BUT_GENRE); print_label_ex( ((1340.f+dox_square_w)/1920.f), (980.f/1080.f), 1.5f, info_color, label, 1.00f, 0.00f, _menu_font, 0.5f, y_scale, 0); sprintf(label, " %s", (char*) STR_BUT_BACK); print_label_ex( ((1540.f+dox_circle_w)/1920.f), (980.f/1080.f), 1.5f, info_color, label, 1.00f, 0.00f, _menu_font, 0.5f, y_scale, 0); sprintf(label, " %s", (char*) STR_BUT_CANCEL); print_label_ex( ((1700.f+dox_triangle_w)/1920.f), (980.f/1080.f), 1.5f, info_color, label, 1.00f, 0.00f, _menu_font, 0.5f, y_scale, 0); info_color=0xffa0a0a0; x+=20; if(disable_options==2 || disable_options==3) info_color=0xc0707070; else info_color=0xffa0a0a0; y=top_o+(120.0f * 1.0f) + 77.0f; sprintf(label, (const char*) STR_GM_COPY_L1, game_title); print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, label, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_GM_COPY_L2, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_GM_COPY_L3, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; if(is_locked || disable_options==1 || disable_options==3) info_color=0xc0707070; else info_color=0xffa0a0a0; y=top_o+(120.0f * 2.0f) + 77.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_GM_DELETE_L1, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_GM_DELETE_L2, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_GM_DELETE_L3, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; if(is_locked || !is_game) info_color=0xc0707070; else info_color=0xffa0a0a0; y=top_o+(120.0f * 3.0f) + 77.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_GM_RENAME_L1, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_GM_RENAME_L2, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_GM_RENAME_L3, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; if(!is_game) info_color=0xc0707070; else info_color=0xffa0a0a0; y=top_o+(120.0f * 4.0f) + 77.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_GM_UPDATE_L1, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_GM_UPDATE_L2, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_GM_UPDATE_L3, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; info_color=0xffa0a0a0; y=top_o+(120.0f * 5.0f) + 77.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_GM_TEST_L1, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_GM_TEST_L2, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_GM_TEST_L3, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; // info_color=0xc0707070; if(is_locked) info_color=0xc0707070; else info_color=0xffa0a0a0; y=top_o+(120.0f * 6.0f) + 77.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_GM_PERM_L1, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_GM_PERM_L2, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_GM_PERM_L3, 1.00f, 0.05f, _menu_font, 0.5f, y_scale, 0); y+=20.0f; if((*_game_sel)) sprintf(label, "%s", (char*) STR_BUT_PREV); else sprintf(label, "%s", (char*) STR_BUT_LAST); print_label_ex( ((750.f)/1920.f), (981.f/1080.f), 1.5f, info_color, label, 1.00f, 0.00f, _menu_font, 0.5f, y_scale, 2); put_texture_with_alpha( text_FONT, text_DOX+(dox_l1_x*4 + dox_l1_y * dox_width*4), dox_l1_w, dox_l1_h, dox_width, 770, 982, 0, 0); if((*_game_sel)!=(max_menu_list-1)) sprintf(label, " %s", (char*) STR_BUT_NEXT); else sprintf(label, " %s", (char*) STR_BUT_FIRST); print_label_ex( ((840.f+dox_r1_w)/1920.f), (981.f/1080.f), 1.5f, info_color, label, 1.00f, 0.00f, _menu_font, 0.5f, y_scale, 0); put_texture_with_alpha( text_FONT, text_DOX+(dox_r1_x*4 + dox_r1_y * dox_width*4), dox_r1_w, dox_r1_h, dox_width, 840, 982, 0, 0); if(!(menu_list[*_game_sel].split || menu_list[*_game_sel].title[0]=='_' || strstr(menu_list[*_game_sel].path, "/pvd_usb")!=NULL)) { sprintf(label, " %s", (char*) STR_BUT_LOAD); print_label_ex( ((375.f+dox_start_w)/1920.f), (981.f/1080.f), 1.5f, info_color, label, 1.00f, 0.00f, _menu_font, 0.5f, y_scale, 0); put_texture_with_alpha( text_FONT, text_DOX+(dox_start_x*4 + dox_start_y * dox_width*4), dox_start_w, dox_start_h, dox_width, 375, 972, 0, 0); } else put_texture_with_alpha( text_FONT, text_DOX+(dox_att_x*4 + dox_att_y * dox_width*4), dox_att_w, dox_att_h, dox_width, 400, 972, 0, 0); sprintf(label, "%s: %s", (char*) STR_BUT_GENRE, genre[ (menu_list[*_game_sel].user>>16)&0x0f ]); print_label_ex( (420.0f/1920.f), ((538.0f+top_o)/1080.f), 1.5f, info_color, label, 1.00f, 0.00f, _menu_font, 0.5f, y_scale, 1); put_texture_with_alpha( text_FONT, text_DOX+(dox_start_x*4 + dox_start_y * dox_width*4), dox_start_w, dox_start_h, dox_width, 375, 972, 0, 0); flush_ttf(text_FONT, 1920, 1080); info_color=0xffa0a0a0; u32 dev_color=0xffe0e0e0; if(is_game) { if(is_locked) dev_color=0xc0808080; print_label_ex( (225.f/1920.f), ((top_o+657.f)/1080.f), 1.5f, dev_color, (char*)"Game disc", 1.00f, 0.00f, 15, 0.4f, 0.5f, 2); print_label_ex( (225.f/1920.f), ((top_o+697.f)/1080.f), 1.5f, dev_color, (char*)"Internal", 1.00f, 0.00f, 15, 0.4f, 0.5f, 2); print_label_ex( (225.f/1920.f), ((top_o+737.f)/1080.f), 1.5f, dev_color, (char*)"External", 1.00f, 0.00f, 15, 0.4f, 0.5f, 2); print_label_ex( (620.f/1920.f), ((top_o+660.f)/1080.f), 1.5f, dev_color, (char*)"Direct boot", 1.00f, 0.00f, 15, 0.4f, 0.5f, 0); print_label_ex( (620.f/1920.f), ((top_o+700.f)/1080.f), 1.5f, dev_color, (char*)"BD mirror", 1.00f, 0.00f, 15, 0.4f, 0.5f, 0); if(payload!=1) dev_color=0xc0808080; print_label_ex( (620.f/1920.f), ((top_o+780.f)/1080.f), 1.5f, dev_color, (char*)"Ext Game Data", 1.00f, 0.00f, 15, 0.4f, 0.5f, 0);dev_color=0xffe0e0e0; print_label_ex( (620.f/1920.f), ((top_o+820.f)/1080.f), 1.5f, dev_color, (char*)"Favorite", 1.00f, 0.00f, 15, 0.4f, 0.5f, 0); if(c_firmware!=3.41) dev_color=0xc0808080; print_label_ex( (620.f/1920.f), ((top_o+740.f)/1080.f), 1.5f, dev_color, (char*)"USB patch", 1.00f, 0.00f, 15, 0.4f, 0.5f, 0); } time ( &rawtime ); timeinfo = localtime ( &rawtime ); if(date_format==0) sprintf(label,"%d/%d %s:%02d", timeinfo->tm_mday, timeinfo->tm_mon+1, tmhour(timeinfo->tm_hour), timeinfo->tm_min); else sprintf(label,"%d/%d %s:%02d", timeinfo->tm_mon+1, timeinfo->tm_mday, tmhour(timeinfo->tm_hour), timeinfo->tm_min); print_label_ex( (1690.f/1920.f), ((top_o+50.f)/1080.f), 1.5f, info_color, label, 1.00f, 0.00f, 15, 0.5f, 0.5f, 0); sprintf(label, "%s%s", game_title, temp_val); print_label_ex( (70.f/1920.f), ((top_o+50.f)/1080.f), 1.5f, info_color, label, 1.00f, 0.00f, 15, 0.5f, 0.5f, 0); if(strstr(menu_list[*_game_sel].path, "/dev_bdvd")!=NULL) dev_color=0xffe0e0e0; else dev_color=0xc0808080; print_label_ex( (1460.f/1920.f), ((top_o+50.f)/1080.f), 1.5f, dev_color, (char*)"Blu", 1.00f, 0.00f, 15, 0.5f, 0.5f, 0); if(strstr(menu_list[*_game_sel].path, "/dev_hdd")!=NULL) dev_color=0xffe0e0e0; else dev_color=0xc0808080; print_label_ex( (1530.f/1920.f), ((top_o+50.f)/1080.f), 1.5f, dev_color, (char*)"Hdd", 1.00f, 0.00f, 15, 0.5f, 0.5f, 0); if(strstr(menu_list[*_game_sel].path, "/dev_usb")!=NULL || strstr(menu_list[*_game_sel].path, "/pvd_usb")!=NULL) dev_color=0xffe0e0e0; else dev_color=0xc0808080; print_label_ex( (1600.f/1920.f), ((top_o+50.f)/1080.f), 1.5f, dev_color, (char*)"Usb", 1.00f, 0.00f, 15, 0.5f, 0.5f, 0); flush_ttf(text_FONT, 1920, 1080); if(menu_list[*_game_sel].split || menu_list[*_game_sel].title[0]=='_') { menu_list[*_game_sel].split=1; sprintf(label, "%s (Split)", game_title); print_label_ex( (425.0f/1920.f), ((478.0f+top_o)/1080.f), 1.0f, COL_SPLIT, label, 1.04f, 0.0f, 1, 0.6f, 0.6f, 1); } else { sprintf(label, "%s", game_title); print_label_ex( (425.0f/1920.f), ((478.0f+top_o)/1080.f), 1.0f, 0xc0e0e0e0, label, 1.04f, 0.0f, 1, 0.6f, 0.6f, 1); } flush_ttf(text_FONT, 1920, 1080); sprintf(label, "[%s]", menu_list[*_game_sel].path+5); if(strlen(label)>64) {label[64]=0x2e;label[65]=0x2e;label[66]=0x0;} print_label_ex( (425.0f/1920.f), ((507.0f+top_o)/1080.f), 1.0f, 0xc0808080, label, 1.00f, 0.0f, 17, 0.7f, 0.7f, 1); flush_ttf(text_FONT, 1920, 1080); sprintf(label, "%s", menu_list[*_game_sel].title_id); print_label_ex( (425.0f/1920.f), ((873.0f+top_o)/1080.f), 1.0f, 0xc0c0c0c0, label, 1.00f, 0.0f, 18, 1.0f, 1.0f, 1); flush_ttf(text_FONT, 1920, 1080); if(V_WIDTH<1280) blur_texture(text_FONT, 1920, 1080, 0, 0, 1920, 1080, 0, 0, 1, 1); for(m=200; m>100; m-=10) { ClearSurface(); set_texture( text_FONT, 1920, 1080); display_img((1920-1920*m/100)/2, (1080-1080*m/100)/2, 1920*m/100, 1080*m/100, 1920, 1080, -0.5f, 1920, 1080); setRenderColor(); flip(); } int result=0; int main_options=1; //1-main 2-gameboot, 3-gamereq int options_req=1; int options_boot=1; u32 b_color = 0x0080ffff; while (1) { pad_read(); if ( (new_pad & BUTTON_L1)) { menu_list[*_game_sel].user=gflags; set_game_flags(*_game_sel); (*_game_sel)--; if((*_game_sel)<0) (*_game_sel)=(max_menu_list-1); sprintf(label, "%s/%s_1920.PNG", cache_dir, menu_list[*_game_sel].title_id); if(exist(label)) load_texture(text_FONT, label, 1920); else memset(text_FONT, 0, FB(1)); goto reload_submenu; } if ( (new_pad & BUTTON_R1)) { menu_list[*_game_sel].user=gflags; set_game_flags(*_game_sel); (*_game_sel)++; if((*_game_sel)>=max_menu_list) (*_game_sel)=0; sprintf(label, "%s/%s_1920.PNG", cache_dir, menu_list[*_game_sel].title_id); if(exist(label)) load_texture(text_FONT, label, 1920); else memset(text_FONT, 0, FB(1)); goto reload_submenu; } if ( (new_pad & BUTTON_SQUARE)) { use_analog=1; float b_mX=mouseX; float b_mY=mouseY; mouseX=660.f/1920.f; mouseY=225.f/1080.f; for (int n=0;n<16;n++ ) { sprintf(opt_list[n].label, "%s", genre[n]); sprintf(opt_list[n].value, "%i", n); } opt_list_max=16; int ret_f=open_select_menu((char*) STR_SEL_GENRE, 600, opt_list, opt_list_max, text_FONT, 16, 1); use_analog=0; mouseX=b_mX; mouseY=b_mY; if(ret_f!=-1) { menu_list[*_game_sel].user=(gflags & (u32)(~(15<<16))) | ((u32)(strtod(opt_list[ret_f].value, NULL))<<16); set_game_flags(*_game_sel); sprintf(label, "%s/%s_1920.PNG", cache_dir, menu_list[*_game_sel].title_id); if(exist(label)) load_texture(text_FONT, label, 1920); else memset(text_FONT, 0, FB(1)); goto reload_submenu; } else new_pad=0; } if ( (new_pad & BUTTON_START)) { if(!(menu_list[*_game_sel].split || menu_list[*_game_sel].title[0]=='_' || strstr(menu_list[*_game_sel].path, "/pvd_usb")!=NULL)) { menu_list[*_game_sel].user=gflags; set_game_flags(*_game_sel); result=7; break; } } if ( (new_pad & BUTTON_TRIANGLE)) {result=0; break;} //quit sub-menu if ( (new_pad & BUTTON_CIRCLE)) { if(is_locked || !is_game) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_TITLE_LOCKED, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog_simple(); } else { menu_list[*_game_sel].user=gflags; if(!set_game_flags(*_game_sel)) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_TITLE_RO, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog_simple(); } } result=0; break; } //save changes and quit sub-menu if ( (new_pad & BUTTON_LEFT) && is_game && !is_locked) { put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, x_icon, (int)(y_icon + (120.f * (option_number))), 0, 0); main_options++; if(main_options>3) main_options=1; if(main_options<1) main_options=3; if(main_options==1) {draw_boot_flags(gflags, is_locked, 0); draw_reqd_flags(gflags, is_locked, 0); put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_w_x*4 + dox_arrow_w_y * dox_width*4), dox_arrow_w_w, dox_arrow_w_h, dox_width, x_icon, (int)(y_icon + (120.f * (option_number))), 0, 0);} if(main_options==2) {draw_boot_flags(gflags, is_locked, options_boot); draw_reqd_flags(gflags, is_locked, 0);} if(main_options==3) {draw_boot_flags(gflags, is_locked, 0); draw_reqd_flags(gflags, is_locked, options_req);} } if ( (new_pad & BUTTON_RIGHT) && is_game && !is_locked) { put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, x_icon, (int)(y_icon + (120.f * (option_number))), 0, 0); main_options--; if(main_options<1) main_options=3; if(main_options==1) {draw_boot_flags(gflags, is_locked, 0); draw_reqd_flags(gflags, is_locked, 0); put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_w_x*4 + dox_arrow_w_y * dox_width*4), dox_arrow_w_w, dox_arrow_w_h, dox_width, x_icon, (int)(y_icon + (120.f * (option_number))), 0, 0);} if(main_options==2) {draw_boot_flags(gflags, is_locked, options_boot); draw_reqd_flags(gflags, is_locked, 0);} if(main_options==3) {draw_boot_flags(gflags, is_locked, 0); draw_reqd_flags(gflags, is_locked, options_req);} } if(main_options==1) { if ( (new_pad & BUTTON_DOWN)) { put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, x_icon, (int)(y_icon + (120.f * (option_number))), 0, 0); int oloop; for(oloop=option_number; oloop<7; oloop++) { option_number++; if(oflags & (1<<option_number)) break; } if(option_number>6) option_number=0; put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_w_x*4 + dox_arrow_w_y * dox_width*4), dox_arrow_w_w, dox_arrow_w_h, dox_width, x_icon, (int)(y_icon + (120.f * (option_number))), 0, 0); } if ( (new_pad & BUTTON_UP)) { put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, x_icon, (int)(y_icon + (120.f * (option_number))), 0, 0); int oloop; if(option_number==0) option_number=7; for(oloop=option_number; oloop>=0; oloop--) { option_number--; if(oflags & (1<<option_number)) break; } if(option_number<0) option_number=0; put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_w_x*4 + dox_arrow_w_y * dox_width*4), dox_arrow_w_w, dox_arrow_w_h, dox_width, x_icon, (int)(y_icon + (120.f * (option_number))), 0, 0); } if ( (new_pad & BUTTON_CROSS) ) { result=option_number+1; if(!is_locked && is_game) { menu_list[*_game_sel].user=gflags;set_game_flags(*_game_sel); } //save changed options on main options activation break; } } if (main_options==2){ if (new_pad & BUTTON_DOWN) { options_boot++; if(options_boot>5) options_boot=1; draw_boot_flags(gflags, is_locked, options_boot); } if (new_pad & BUTTON_UP) { options_boot--; if(options_boot<1) options_boot=5; draw_boot_flags(gflags, is_locked, options_boot); } if ( (new_pad & BUTTON_CROSS)) { if(options_boot<4) gflags ^= ( 1 << (options_boot+4) ); else { if(options_boot==4) gflags ^= ( 1 << (options_boot+5) ); if(options_boot==5) gflags ^= ( 1 << (options_boot+3) ); } if(gflags & IS_BDMIRROR) {gflags &= ~(IS_HDD | IS_DBOOT); gflags|= IS_USB;} draw_boot_flags(gflags, is_locked, options_boot); draw_reqd_flags(gflags, is_locked, 0); } } if (main_options==3){ if (new_pad & BUTTON_DOWN) { options_req++; if(options_req>3) options_req=1; draw_reqd_flags(gflags, is_locked, options_req); } if (new_pad & BUTTON_UP) { options_req--; if(options_req<1) options_req=3; draw_reqd_flags(gflags, is_locked, options_req); } if ( (new_pad & BUTTON_CROSS) ) { gflags ^= ( 1 << (options_req-1) ); if(gflags & IS_BDMIRROR) {gflags &= ~(IS_HDD | IS_DBOOT); gflags|= IS_USB;} draw_boot_flags(gflags, is_locked, 0); draw_reqd_flags(gflags, is_locked, options_req); } } ClearSurface(); b_box_opaq+=b_box_step; if(b_box_opaq>0xfe) b_box_step=-1; if(b_box_opaq<0x20) b_box_step= 2; b_color = (b_color & 0xffffff00) | (b_box_opaq); //105, 120+(int)top_o, draw_square(((0.054f-0.5f)*2.0f)-0.005f, ((0.5f-(110.f+top_o)/1080.f)+0.005f)*2.0f , 0.675f, 0.68f, -0.4f, b_color); set_texture( text_FONT, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, -0.5f, 1920, 1080); flip(); } old_fi=-1; game_last_page=-1; new_pad=0; ss_timer=0; return result; } int open_mm_submenu(uint8_t *buffer) // system settings menu { xmb_bg_show=0; xmb_bg_counter=200; char label[256]; float x, y, top_o; int m; u8 _menu_font=15; float y_scale=0.5f; float x_scale=0.5f; if(mm_locale) { _menu_font=mui_font; y_scale=0.42f; x_scale=0.48f; } u32 oflags=1; top_o=40.0f; if(cover_mode!=8) { memcpy(text_FONT, buffer, 0x7E9000); blur_texture(text_FONT, 1920, 1080, 0, 0, 1920, 1080, 25, 0, 1, 1); for(m=100; m<200; m+=10) { ClearSurface(); set_texture( buffer, 1920, 1080); display_img((1920-1920*m/100)/2, (1080-1080*m/100)/2, 1920*m/100, 1080*m/100, 1920, 1080, -0.5f, 1920, 1080); setRenderColor(); flip(); } } else memset(text_FONT, 0, 0x7E9000); draw_box( text_FONT, 1920, 2, 0, (int)top_o+75, 0xa0a0a0ff); draw_box( text_FONT, 1920, 2, 0, 964, 0x808080ff); put_texture_with_alpha( text_FONT, text_DOX+(dox_pad_x *4 + dox_pad_y * dox_width*4), dox_pad_w, dox_pad_h, dox_width, 70, 968, 0, 0); put_texture_with_alpha( text_FONT, text_DOX+(dox_cross_x *4 + dox_cross_y * dox_width*4), dox_cross_w, dox_cross_h, dox_width, 1450, 975, 0, 0); put_texture_with_alpha( text_FONT, text_DOX+(dox_circle_x *4 + dox_circle_y * dox_width*4), dox_circle_w, dox_circle_h, dox_width, 1700, 975, 0, 0); max_ttf_label=0; x=150.0f; y=top_o+95.0f; u32 title_color=0xffc0c0c0; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, title_color, (char*) STR_MM_UPDATE, 1.04f, 0.0f, _menu_font, x_scale*2.f, y_scale*1.85f, 0); put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x-50, (int)y, 0, 0); put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_w_x*4 + dox_arrow_w_y * dox_width*4), dox_arrow_w_w, dox_arrow_w_h, dox_width, (int)x-50, (int)y, 0, 0); print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, title_color, (char*) STR_MM_REFRESH, 1.04f, 0.0f, _menu_font, x_scale*2.f, y_scale*1.85f, 0); oflags|=(1<<6); put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x+910, (int)y, 0, 0); y+=135.0f; if(lock_fileman) title_color=0xd0808080; else {title_color=0xffc0c0c0;oflags|=(1<<1);put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x-50, (int)y, 0, 0); } print_label_ex( (x/1920.f), (y/1080.f), 1.5f, title_color, (char*) STR_MM_FILEMAN, 1.04f, 0.0f, _menu_font, x_scale*2.f, y_scale*1.85f, 0); title_color=0xffc0c0c0; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, title_color, (char*) STR_MM_SHOW_ST, 1.04f, 0.0f, _menu_font, x_scale*2.f, y_scale*1.85f, 0); oflags|=(1<<7); put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x+910, (int)y, 0, 0); y+=135.0f; title_color=0xffc0c0c0; put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x-50, (int)y, 0, 0); oflags|=(1<<2); print_label_ex( (x/1920.f), (y/1080.f), 1.5f, title_color, (char*)STR_MM_NTFS, 1.04f, 0.0f, _menu_font, x_scale*2.f, y_scale*1.85f, 0); print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, title_color, (char*) STR_MM_SHOW_LK, 1.04f, 0.0f, _menu_font, x_scale*2.f, y_scale*1.85f, 0); oflags|=(1<<8); put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x+910, (int)y, 0, 0); y+=135.0f; if(cover_mode==3 or cover_mode==4) title_color=0xd0808080; else {title_color=0xffc0c0c0;oflags|=(1<<3);put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x-50, (int)y, 0, 0); } print_label_ex( (x/1920.f), (y/1080.f), 1.5f, title_color, (char*) STR_MM_SCRSHOT, 1.04f, 0.0f, _menu_font, x_scale*2.f, y_scale*1.85f, 0); title_color=0xffc0c0c0; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, title_color, (char*)STR_MM_SCRSAVE, 1.04f, 0.0f, _menu_font, x_scale*2.f, y_scale*1.85f, 0); oflags|=(1<<9); put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x+910, (int)y, 0, 0); title_color=0xffc0c0c0; y+=135.0f; oflags|=(1<<4); print_label_ex( (x/1920.f), (y/1080.f), 1.5f, title_color, (char*)STR_MM_RESTART, 1.04f, 0.0f, _menu_font, x_scale*2.f, y_scale*1.85f, 0); put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x-50, (int)y, 0, 0); print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, title_color, (char*)STR_MM_SETUP, 1.04f, 0.0f, _menu_font, x_scale*2.f, y_scale*1.85f, 0); oflags|=(1<<10); put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x+910, (int)y, 0, 0); // title_color=0xd0808080; y+=135.0f; title_color=0xffc0c0c0; put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x-50, (int)y, 0, 0); oflags|=(1<<5); print_label_ex( (x/1920.f), (y/1080.f), 1.5f, title_color, (char*)STR_MM_QUIT, 1.04f, 0.0f, _menu_font, x_scale*2.f, y_scale*1.85f, 0); print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, title_color, (char*)STR_MM_HELP, 1.04f, 0.0f, _menu_font, x_scale*2.f, y_scale*1.85f, 0); oflags|=(1<<11); put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, (int)x+910, (int)y, 0, 0); u32 info_color=0xffa0a0a0; time ( &rawtime ); timeinfo = localtime ( &rawtime ); if(date_format==0) sprintf(label,"%d/%d %s:%02d", timeinfo->tm_mday, timeinfo->tm_mon+1, tmhour(timeinfo->tm_hour), timeinfo->tm_min); else sprintf(label,"%d/%d %s:%02d", timeinfo->tm_mon+1, timeinfo->tm_mday, tmhour(timeinfo->tm_hour), timeinfo->tm_min); print_label_ex( (1690.f/1920.f), ((top_o+50.f)/1080.f), 1.5f, info_color, label, 1.00f, 0.00f, _menu_font, 0.5f, y_scale, 0); sprintf(label, "multiMAN %s", current_version); label[17]=0; print_label_ex( (70.f/1920.f), ((top_o+50.f)/1080.f), 1.5f, info_color, label, 1.00f, 0.00f, _menu_font, 0.5f, y_scale, 0); sprintf(label, " %s", (char*) STR_BUT_NAV); print_label_ex( ((70.f+dox_pad_w)/1920.f), (981.f/1080.f), 1.5f, info_color, label, 1.00f, 0.00f, _menu_font, 0.5f, y_scale, 0); sprintf(label, " %s", (char*) STR_BUT_SELECT); print_label_ex( ((1450.f+dox_cross_w)/1920.f), (980.f/1080.f), 1.5f, info_color, label, 1.00f, 0.00f, _menu_font, 0.5f, y_scale, 0); sprintf(label, " %s", (char*) STR_BUT_BACK); print_label_ex( ((1700.f+dox_circle_w)/1920.f), (980.f/1080.f), 1.5f, info_color, label, 1.00f, 0.00f, _menu_font, 0.5f, y_scale, 0); info_color=0xffa0a0a0; x+=20; info_color=0xffa0a0a0; y=top_o+(135.0f * 1.0f); print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_UPDATE_L1, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_UPDATE_L2, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_UPDATE_L3, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_UPDATE_L4, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y-=60.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_REFRESH_L1, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_REFRESH_L2, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_REFRESH_L3, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_REFRESH_L4, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; y=top_o+(135.0f * 2.0f); if(lock_fileman) info_color=0xc0707070; else info_color=0xffa0a0a0; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*)STR_MM_FILEMAN_L1, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*)STR_MM_FILEMAN_L2, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*)STR_MM_FILEMAN_L3, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*)STR_MM_FILEMAN_L4, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y-=60.0f; info_color=0xffa0a0a0; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*)STR_MM_SHOW_ST_L1, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*)STR_MM_SHOW_ST_L2, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*)STR_MM_SHOW_ST_L3, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*)STR_MM_SHOW_ST_L4, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; y=top_o+(135.0f * 3.0f); print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_NTFS_L1, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_NTFS_L2, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_NTFS_L3, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_NTFS_L4, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y-=60.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*)STR_MM_SHOW_LK_L1, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*)STR_MM_SHOW_LK_L2, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*)STR_MM_SHOW_LK_L3, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*)STR_MM_SHOW_LK_L4, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; y=top_o+(135.0f * 4.0f); if(cover_mode==3 or cover_mode==4) info_color=0xc0707070; else info_color=0xffa0a0a0; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_SCRSHOT_L1, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_SCRSHOT_L2, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_SCRSHOT_L3, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_SCRSHOT_L4, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y-=60.0f; info_color=0xffa0a0a0; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*)STR_MM_SCRSAVE_L1, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*)STR_MM_SCRSAVE_L2, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*)STR_MM_SCRSAVE_L3, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*)STR_MM_SCRSAVE_L4, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; info_color=0xffa0a0a0; y=top_o+(135.0f * 5.0f); print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_RESTART_L1, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_RESTART_L2, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_RESTART_L3, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_RESTART_L4, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y-=60.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_SETUP_L1, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_SETUP_L2, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_SETUP_L3, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_SETUP_L4, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; // info_color=0xc0707070; y=top_o+(135.0f * 6.0f); print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_QUIT_L1, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_QUIT_L2, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_QUIT_L3, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( (x/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_QUIT_L4, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y-=60.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_HELP_L1, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_HELP_L2, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_HELP_L3, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; print_label_ex( ((x+960)/1920.f), (y/1080.f), 1.5f, info_color, (char*) STR_MM_HELP_L4, 1.00f, 0.05f, _menu_font, x_scale, y_scale, 0); y+=20.0f; flush_ttf(text_FONT, 1920, 1080); if(V_WIDTH<1280) blur_texture(text_FONT, 1920, 1080, 0, 0, 1920, 1080, 0, 0, 1, 1); for(m=200; m>100; m-=10) { ClearSurface(); set_texture( text_FONT, 1920, 1080); display_img((1920-1920*m/100)/2, (1080-1080*m/100)/2, 1920*m/100, 1080*m/100, 1920, 1080, -0.5f, 1920, 1080); setRenderColor(); flip(); } int result=0; int main_options=1; //1-main 2-gameboot, 3-gamereq int x_icon=(int)(100); int y_icon=(int) (top_o + 95.0f); int option_number=0; int c_option_number=0; while (1) { pad_read(); if ( (new_pad & BUTTON_TRIANGLE) || (new_pad & BUTTON_CIRCLE) ) {result=0; break;} //quit sub-menu if(main_options==1) { if ( (new_pad & BUTTON_UP) || (new_pad & BUTTON_DOWN) || (new_pad & BUTTON_LEFT) || (new_pad & BUTTON_RIGHT)) { x_icon=100; c_option_number=option_number; if(option_number>5) { c_option_number=option_number-6; x_icon=1060;} put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_b_x*4 + dox_arrow_b_y * dox_width*4), dox_arrow_b_w, dox_arrow_b_h, dox_width, x_icon, (int)(y_icon + (135.f * (c_option_number))), 0, 0); } if ( (new_pad & BUTTON_DOWN)) { int oloop; for(oloop=option_number; oloop<12; oloop++) { option_number++; if(oflags & (1<<option_number)) break; } if(option_number>11) option_number=0; } if ( (new_pad & BUTTON_RIGHT)) { int oloop; option_number+=5; for(oloop=option_number; oloop<12; oloop++) { option_number++; if(oflags & (1<<option_number)) break; } if(option_number>11) option_number=0; } if ( (new_pad & BUTTON_UP)) { int oloop; if(option_number==0) option_number=12; for(oloop=option_number; oloop>=0; oloop--) { option_number--; if(oflags & (1<<option_number)) break; } if(option_number<0) option_number=0; } if ( (new_pad & BUTTON_LEFT)) { int oloop; option_number-=5; for(oloop=option_number; oloop>=0; oloop--) { option_number--; if(oflags & (1<<option_number)) break; } if(option_number<0) option_number=0; } if ( (new_pad & BUTTON_UP) || (new_pad & BUTTON_DOWN) || (new_pad & BUTTON_LEFT) || (new_pad & BUTTON_RIGHT)) { x_icon=100; c_option_number=option_number; if(option_number>5) { c_option_number=option_number-6; x_icon=1060;} put_texture_with_alpha( text_FONT, text_DOX+(dox_arrow_w_x*4 + dox_arrow_w_y * dox_width*4), dox_arrow_w_w, dox_arrow_w_h, dox_width, x_icon, (int)(y_icon + (135.f * (c_option_number))), 0, 0); } } if ( (new_pad & BUTTON_CROSS)){ result=option_number+1; break; } ClearSurface(); set_texture( text_FONT, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, -0.5f, 1920, 1080); flip(); } old_fi=-1; game_last_page=-1; new_pad=0; counter_png=0; if(result==4) //take screenshot { char string1[64]; ClearSurface(); set_texture( buffer, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, -0.5f, 1920, 1080); flip(); sys_timer_usleep(250000); time ( &rawtime ); timeinfo = localtime ( &rawtime ); char video_mem[64]; sprintf(video_mem, "/dev_hdd0/%04d%02d%02d-%02d%02d%02d-SCREENSHOT.RAW", timeinfo->tm_year+1900, timeinfo->tm_mon+1, timeinfo->tm_mday, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); FILE *fpA; remove(video_mem); fpA = fopen ( video_mem, "wb" ); uint64_t c_pos=0; for(c_pos=0;c_pos<video_buffer;c_pos+=4){ fwrite((uint8_t*)(color_base_addr)+c_pos+1, 3, 1, fpA); } fclose(fpA); if(exist((char*)"/dev_usb000")) { sprintf(string1, "/dev_usb000/%s", video_mem+10); file_copy(video_mem, string1, 0); remove(video_mem); } else if(exist((char*)"/dev_usb001")) { sprintf(string1, "/dev_usb001/%s", video_mem+10); file_copy(video_mem, string1, 0); remove(video_mem); } } ss_timer=0; return result; } /****************************************************/ /* UTILS */ /****************************************************/ void fix_perm_recursive(const char* start_path) { new_pad=0; old_pad=0; if(abort_rec==1) return; if(strstr(start_path,"/pvd_usb")!=NULL) return; int dir_fd; uint64_t nread; char f_name[CELL_FS_MAX_FS_FILE_NAME_LENGTH+1]; CellFsDirent dir_ent; CellFsErrno err; cellFsChmod(start_path, 0777); flip(); if (cellFsOpendir(start_path, &dir_fd) == CELL_FS_SUCCEEDED) { cellFsChmod(start_path, 0777); while (1) { pad_read(); if ( (old_pad & BUTTON_CIRCLE) || (old_pad & BUTTON_TRIANGLE) || dialog_ret==3) { abort_rec=1; new_pad=0; old_pad=0; break; } // err = cellFsReaddir(dir_fd, &dir_ent, &nread); if (nread != 0) { if (!strcmp(dir_ent.d_name, ".") || !strcmp(dir_ent.d_name, "..")) continue; sprintf(f_name, "%s/%s", start_path, dir_ent.d_name); if (dir_ent.d_type == CELL_FS_TYPE_DIRECTORY) { cellFsChmod(f_name, CELL_FS_S_IFDIR | 0777); fix_perm_recursive(f_name); if(abort_rec==1) break; } else if (dir_ent.d_type == CELL_FS_TYPE_REGULAR) { cellFsChmod(f_name, 0666); } } else { break; } } err = cellFsClosedir(dir_fd); } } int parse_ps3_disc(char *path, char * id) { FILE *fp; int n; fp = fopen(path, "rb"); if (fp != NULL) { unsigned len; unsigned char *mem=NULL; fseek(fp, 0, SEEK_END); len=ftell(fp); mem= (unsigned char *) malloc(len+16); if(!mem) {fclose(fp);return -2;} memset(mem, 0, len+16); fseek(fp, 0, SEEK_SET); fread((void *) mem, len, 1, fp); fclose(fp); for(n=0x20;n<0x200;n+=0x20) { if(!strcmp((char *) &mem[n], "TITLE_ID")) { n= (mem[n+0x12]<<8) | mem[n+0x13]; memcpy(id, &mem[n], 16); id[4]=id[5];id[5]=id[6];id[6]=id[7];id[7]=id[8];id[8]=id[9];id[9]=0; return 0; } } } return -1; } static double get_system_version(void) { FILE *fp; float base=3.41f; fp = fopen("/dev_flash/vsh/etc/version.txt", "rb"); if (fp != NULL) { char bufs[1024]; fgets(bufs, 1024, fp); fclose(fp); base = strtod(bufs + 8, NULL); // this is either the spoofed or actual version } fp = fopen("/dev_flash/sys/external/libfs.sprx", "rb"); if (fp != NULL) { fseek(fp, 0, SEEK_END); uint32_t len = ftell(fp); unsigned char *mem = NULL; mem= (unsigned char *) memalign(16, len+16); fseek(fp, 0, SEEK_SET); fread((void *) mem, len, 1, fp); fclose(fp); uint32_t crc=0, crc_c; for(crc_c=0; crc_c<len; crc_c++) crc+=mem[crc_c]; // sprintf(status_info, "%x", crc); if(crc==0x416bbaULL) base=3.15; else //ignore spoofers by crcing libfs if(crc==0x41721eULL) base=3.41; else if(crc==0x41655eULL) base=3.55; free(mem); } return base; } void change_param_sfo_field(char *file, char *field, char *value) { if(!exist(file) || strstr(file, "/dev_bdvd")!=NULL) return; FILE *fp; cellFsChmod(file, 0666); fp = fopen(file, "rb"); if (fp != NULL) { unsigned len, pos, str; unsigned char *mem = NULL; fseek(fp, 0, SEEK_END); len = ftell(fp); mem = (unsigned char *) malloc(len + 16); if (!mem) { fclose(fp); return; } memset(mem, 0, len + 16); fseek(fp, 0, SEEK_SET); fread((void *) mem, len, 1, fp); fclose(fp); str = (mem[8] + (mem[9] << 8)); pos = (mem[0xc] + (mem[0xd] << 8)); int indx = 0; while (str < len) { if (mem[str] == 0) break; if (!strcmp((char *) &mem[str], field) && mem[str+strlen(field)]==0) { memcpy(&mem[pos], value, strlen(value)); mem[pos+strlen(value)]=0; fp = fopen(file, "wb"); fwrite(mem, len, 1, fp); fclose(fp); } while (mem[str]) str++; str++; pos += (mem[0x1c + indx] + (mem[0x1d + indx] << 8)); indx += 16; } if (mem) free(mem); } } int get_param_sfo_field(char *file, char *field, char *value) { if(!exist(file)) return 0; // || strstr(file, "/dev_bdvd")!=NULL FILE *fp; cellFsChmod(file, 0666); fp = fopen(file, "rb"); if (fp != NULL) { unsigned len, pos, str; unsigned char *mem = NULL; fseek(fp, 0, SEEK_END); len = ftell(fp); mem = (unsigned char *) malloc(len + 16); if (!mem) { fclose(fp); return 0; } memset(mem, 0, len + 16); fseek(fp, 0, SEEK_SET); fread((void *) mem, len, 1, fp); fclose(fp); str = (mem[8] + (mem[9] << 8)); pos = (mem[0xc] + (mem[0xd] << 8)); int indx = 0; while (str < len) { if (mem[str] == 0) break; if (!strcmp((char *) &mem[str], field) && mem[str+strlen(field)]==0) { // memcpy(&mem[pos], value, strlen(value)); memcpy(value, &mem[pos], strlen(field)); value[strlen(field)]=0; free(mem); return 1; } while (mem[str]) str++; str++; pos += (mem[0x1c + indx] + (mem[0x1d + indx] << 8)); indx += 16; } if (mem) free(mem); } return 0; } void change_param_sfo_version(const char *file) //parts from drizzt { if(!exist_c(file) || strstr(file, "/dev_bdvd")!=NULL) return; FILE *fp; cellFsChmod(file, 0666); fp = fopen(file, "rb"); if (fp != NULL) { unsigned len, pos, str; unsigned char *mem = NULL; fseek(fp, 0, SEEK_END); len = ftell(fp); mem = (unsigned char *) malloc(len + 16); if (!mem) { fclose(fp); return; } memset(mem, 0, len + 16); fseek(fp, 0, SEEK_SET); fread((void *) mem, len, 1, fp); fclose(fp); str = (mem[8] + (mem[9] << 8)); pos = (mem[0xc] + (mem[0xd] << 8)); int indx = 0; while (str < len) { if (mem[str] == 0) break; if (!strcmp((char *) &mem[str], "ATTRIBUTE")) { if ( (mem[pos] & 0x25) != 0x25) { mem[pos] |= 0x25; fp = fopen(file, "wb"); if (fp != NULL) { fwrite(mem, len, 1, fp); fclose(fp); } } } if (!strcmp((char *) &mem[str], "PS3_SYSTEM_VER")) { float ver; ver = strtod((char *) &mem[pos], NULL); if (c_firmware < ver) { char msg[170]; snprintf(msg, sizeof(msg), (const char*) STR_PARAM_VER, ver, c_firmware); int t_dialog_ret=dialog_ret; dialog_ret = 0; cellMsgDialogAbort(); cellMsgDialogOpen2(type_dialog_yes_no, msg, dialog_fun1, (void *) 0x0000aaaa, NULL); wait_dialog(); if (dialog_ret == 1) { char ver_patch[10]; //format the version to be patched so it is xx.xxx snprintf(ver_patch, sizeof(ver_patch), "%06.3f", c_firmware); memcpy(&mem[pos], ver_patch, 6); fp = fopen(file, "wb"); if (fp != NULL) { fwrite(mem, len, 1, fp); fclose(fp); } } dialog_ret=t_dialog_ret; } break; } while (mem[str]) str++; str++; pos += (mem[0x1c + indx] + (mem[0x1d + indx] << 8)); indx += 16; } if (mem) free(mem); } } int parse_param_sfo(char *file, char *title_name, char *title_id, int *par_level) { // if(strstr(file, "/pvd_usb")!=NULL) return -1; *par_level=0; FILE *fp = NULL; unsigned len, pos, str; unsigned char *mem = NULL; #if (CELL_SDK_VERSION>0x210001) int pfsm=0; if(strstr(file, "/pvd_usb")!=NULL) pfsm=1; PFS_HFILE fh = PFS_FILE_INVALID; if (pfsm) { uint64_t size; if ((fh = PfsFileOpen(file)) == PFS_FILE_INVALID) return -1; if (PfsFileGetSizeFromHandle(fh, &size) != 0) { PfsFileClose(fh); return -1; } len = (unsigned)size; } else #endif { if ((fp = fopen(file, "rb")) == NULL) return -1; fseek(fp, 0, SEEK_END); len = ftell(fp); } mem = (unsigned char *) malloc(len + 16); if (!mem) { #if (CELL_SDK_VERSION>0x210001) if (pfsm) { PfsFileClose(fh); } else #endif { fclose(fp); } return -2; } memset(mem, 0, len+16); #if (CELL_SDK_VERSION>0x210001) if (pfsm) { int32_t r; r = PfsFileRead(fh, mem, len, NULL); PfsFileClose(fh); if (r != 0) return -1; } else #endif { fseek(fp, 0, SEEK_SET); fread((void *) mem, len, 1, fp); fclose(fp); } str= (mem[8]+(mem[9]<<8)); pos=(mem[0xc]+(mem[0xd]<<8)); int indx=0; while(str<len) { if(mem[str]==0) break; if(!strcmp((char *) &mem[str], "TITLE")) { memset(title_name, 0, 63); strncpy(title_name, (char *) &mem[pos], 63); // free(mem); goto scan_for_PL; } while(mem[str]) str++;str++; pos+=(mem[0x1c+indx]+(mem[0x1d+indx]<<8)); indx+=16; } scan_for_PL: str= (mem[8]+(mem[9]<<8)); pos=(mem[0xc]+(mem[0xd]<<8)); indx=0; while(str<len) { if(mem[str]==0) break; if(!strcmp((char *) &mem[str], "PARENTAL_LEVEL")) { (*par_level)=mem[pos]; goto scan_for_id; } while(mem[str]) str++;str++; pos+=(mem[0x1c+indx]+(mem[0x1d+indx]<<8)); indx+=16; } scan_for_id: str= (mem[8]+(mem[9]<<8)); pos=(mem[0xc]+(mem[0xd]<<8)); indx=0; while(str<len) { if(mem[str]==0) break; if(!strcmp((char *) &mem[str], "TITLE_ID")) { memset(title_id, 0, 10); strncpy(title_id, (char *) &mem[pos], 10); title_id[9]=0; free(mem); return 0; } while(mem[str]) str++;str++; pos+=(mem[0x1c+indx]+(mem[0x1d+indx]<<8)); indx+=16; } if(mem) free(mem); return -1; } void sort_pane(t_dir_pane *list, int *max) { int n,m; int fi= (*max); if(fi<2) return; t_dir_pane swap; for(n=0; n< (fi -1);n++) for(m=n+1; m< fi ;m++) { if(strcasecmp(list[n].entry, list[m].entry)>0) { swap=list[n];list[n]=list[m];list[m]=swap; } } } /* void delete_entries_content(t_menu_list *list, int *max, char *content_type) { int n; n=0; while(n<(*max) ) { if(list[n].content == content_type) { if((*max) >1) { list[n].flags=0; list[n]=list[(*max) -1]; (*max) --; } else {if((*max) == 1)(*max) --; break;} } else n++; } } */ int ps3_home_scan(char *path, t_dir_pane *list, int *max) { if((*max)>=MAX_PANE_SIZE || strlen(path)>sizeof(list[0].path) || strlen(path)>512) return 0; DIR *dir; char *f= NULL; struct CellFsStat s; dir=opendir (path); if(!dir) return -1; while(1) { struct dirent *entry=readdir (dir); if(!entry) break; if(entry->d_name[0]=='.' && entry->d_name[1]==0) continue; if(entry->d_name[0]=='.' && entry->d_name[1]=='.' && entry->d_name[2]==0) continue; if(strstr(entry->d_name, ".MTH")!=NULL || strstr(entry->d_name, ".STH")!=NULL) continue; if((entry->d_type & DT_DIR)) { char *d1f= (char *) malloc(512); if(!d1f) {closedir (dir);return -1;} sprintf(d1f,"%s/%s", path, entry->d_name); ps3_home_scan(d1f, list, max); free(d1f); } else { f=(char *) malloc(512); if(!f) {return -1;} sprintf(f,"%s/%s", path, entry->d_name); if( (search_mmiso==1 && strstr(f, ".mmiso.")!=NULL) || search_mmiso==0) { sprintf(list[*max ].name, "%s", entry->d_name); sprintf(list[*max ].path, "%s", f); sprintf(list[*max ].entry, "__1%s", entry->d_name); list[*max ].time=time(NULL); list[*max ].size=0; list[*max ].type=1; if(cellFsStat(list[*max ].path, &s)==CELL_FS_SUCCEEDED) { list[*max].size=s.st_size; list[*max].time=s.st_ctime; } (*max) ++; } if(f) free(f); } } closedir (dir); return 0; } int ps3_home_scan_ext(char *path, t_dir_pane *list, int *max, char *_ext) { if((*max)>=MAX_PANE_SIZE || strlen(path)>sizeof(list[0].path) || strlen(path)>512) return 0; DIR *dir; char *f= NULL; dir=opendir (path); if(!dir) return -1; while(1) { struct dirent *entry=readdir (dir); if(!entry) break; if(entry->d_name[0]=='.' && entry->d_name[1]==0) continue; if(entry->d_name[0]=='.' && entry->d_name[1]=='.' && entry->d_name[2]==0) continue; if((entry->d_type & DT_DIR)) { char *d1f= (char *) malloc(512); if(!d1f) {closedir (dir);return -1;} sprintf(d1f,"%s/%s", path, entry->d_name); ps3_home_scan_ext(d1f, list, max, _ext); free(d1f); } else { // f=(char *) malloc(512); // if(!f) {return -1;} // sprintf(f,"%s/%s", path, entry->d_name); if(strstr(entry->d_name, _ext)==NULL) continue; sprintf(list[*max ].name, "%s", entry->d_name); sprintf(list[*max ].path, "%s", path); (*max) ++; if(f) free(f); if((*max)>=MAX_PANE_SIZE) break; } } closedir (dir); return 0; } int ps3_home_scan_ext_bare(char *path, t_dir_pane_bare *list, int *max, char *_ext) { if((*max)>=MAX_PANE_SIZE_BARE || strlen(path)>sizeof(list[0].path) || strlen(path)>512) return 0; DIR *dir; char *f= NULL; dir=opendir (path); if(!dir) return -1; while(1) { struct dirent *entry=readdir (dir); if(!entry) break; if(entry->d_name[0]=='.' && entry->d_name[1]==0) continue; if(entry->d_name[0]=='.' && entry->d_name[1]=='.' && entry->d_name[2]==0) continue; if((entry->d_type & DT_DIR)) { char *d1f= (char *) malloc(512); if(!d1f) {closedir (dir);return -1;} sprintf(d1f,"%s/%s", path, entry->d_name); ps3_home_scan_ext_bare(d1f, list, max, _ext); free(d1f); } else { // f=(char *) malloc(512); // if(!f) {return -1;} // sprintf(f,"%s/%s", path, entry->d_name); if(strstr(entry->d_name, _ext)==NULL) continue; sprintf(list[*max ].name, "%s", entry->d_name); sprintf(list[*max ].path, "%s", path); (*max) ++; if(f) free(f); if((*max)>=MAX_PANE_SIZE_BARE) break; } } closedir (dir); return 0; } int ps3_home_scan_bare(char *path, t_dir_pane_bare *list, int *max) { if((*max)>=MAX_PANE_SIZE_BARE || strlen(path)>sizeof(list[0].path) || strlen(path)>512) return 0; DIR *dir; char *f= NULL; dir=opendir (path); if(!dir) return -1; while(1) { struct dirent *entry=readdir (dir); if(!entry) break; if(entry->d_name[0]=='.' && entry->d_name[1]==0) continue; if(entry->d_name[0]=='.' && entry->d_name[1]=='.' && entry->d_name[2]==0) continue; if(strstr(entry->d_name, ".MTH")!=NULL || strstr(entry->d_name, ".STH")!=NULL) continue; if((entry->d_type & DT_DIR)) { char *d1f= (char *) malloc(512); if(!d1f) {closedir (dir);return -1;} sprintf(d1f,"%s/%s", path, entry->d_name); ps3_home_scan_bare(d1f, list, max); free(d1f); } else { // f=(char *) malloc(512); // if(!f) {return -1;} // sprintf(f,"%s/%s", path, entry->d_name); sprintf(list[*max ].name, "%s", entry->d_name); sprintf(list[*max ].path, "%s", path); (*max) ++; if(f) free(f); if((*max)>=MAX_PANE_SIZE_BARE) break; } } closedir (dir); return 0; } int ps3_home_scan_bare2(char *path, t_dir_pane *list, int *max) { if((*max)>=MAX_PANE_SIZE) return 0; DIR *dir; char *f= NULL; dir=opendir (path); if(!dir) return -1; while(1) { struct dirent *entry=readdir (dir); if(!entry) break; if(entry->d_name[0]=='.' && entry->d_name[1]==0) continue; if(entry->d_name[0]=='.' && entry->d_name[1]=='.' && entry->d_name[2]==0) continue; if(strstr(entry->d_name, ".MTH")!=NULL || strstr(entry->d_name, ".STH")!=NULL) continue; if((entry->d_type & DT_DIR)) { char *d1f= (char *) malloc(512); if(!d1f) {closedir (dir);return -1;} sprintf(d1f,"%s/%s", path, entry->d_name); ps3_home_scan_bare2(d1f, list, max); free(d1f); } else { // f=(char *) malloc(512); // if(!f) {return -1;} // sprintf(f,"%s/%s", path, entry->d_name); sprintf(list[*max ].name, "%s", entry->d_name); sprintf(list[*max ].path, "%s", path); (*max) ++; if(f) free(f); if((*max)>=MAX_PANE_SIZE) break; } } closedir (dir); return 0; } void read_dir(char *path, t_dir_pane *list, int *max) { // DIR *dir; struct CellFsStat s; *max =0; FILE *fp; int n=0, foundslash=0, slashpos=0; char net_host_file[512], net_host_file2[512], tempname[512], tempname2[512], tempname3[8]; char net_path_bare [512], title[512], date2[10], timeC[10], type[1], net_path[512], parent[512]; char path2[512], path3[512], path4[512]; char temp[3], length[128]; time_t c_time = time(NULL); if(strstr(path,"/net_host")==NULL) goto regular_FS_PS; sprintf(net_host_file2, "%s", path); net_host_file2[10]=0; // strncpy(net_host_file2, path, 10); net_host_file2[10]=0; sprintf(net_host_file,"%s%s", app_usrdir, net_host_file2); // add root shortcut to regular file system // in case something is wrong with the net_host list[*max].type=0; sprintf(list[*max ].name, "/"); sprintf(list[*max ].path, "/"); sprintf(list[*max ].entry, " "); list[*max].size=0; list[*max].time=time(NULL); timeinfo = localtime ( &c_time ); if(date_format==0) sprintf(list[*max].datetime, "%02d/%02d/%04d", timeinfo->tm_mday, timeinfo->tm_mon+1, timeinfo->tm_year+1900); else if(date_format==1) sprintf(list[*max].datetime, "%02d/%02d/%04d", timeinfo->tm_mon+1, timeinfo->tm_mday, timeinfo->tm_year+1900); else if(date_format==2) sprintf(list[*max].datetime, "%04d/%02d/%02d", timeinfo->tm_year+1900, timeinfo->tm_mon+1, timeinfo->tm_mday ); (*max) ++; fp = fopen ( net_host_file, "r" ); if ( fp != NULL ) { sprintf(path2, "%s/", path); sprintf(path3, "%s/0", path); while (fscanf(fp,"%[^|]|%[^|]|%[^|]|%[^|]|%[^|]|%[^|]|%[^|]|%s\n", net_path_bare, title, length, timeC, date2, type, parent, tempname3)>=7) { sprintf(net_path, "%s%s", net_host_file2, net_path_bare); sprintf(path4, "%s%s%s", net_host_file2, parent, type); if(strcmp(path3, path4)==0) { list[*max].type=0; strncpy(tempname, net_path_bare+1, strlen(net_path_bare)-2); tempname[strlen(net_path_bare)-2]=0; foundslash=0; slashpos=0; int pl=strlen(tempname); for(n=pl;n>1;n--) { if(tempname[n]==0x2F) { foundslash=n; break; } } for(n=0;n<pl;n++) { if(n>foundslash && foundslash>0) { tempname2[slashpos]=tempname[n]; slashpos++; tempname2[slashpos]=0; } } if(foundslash==0) sprintf(tempname2, "%s%c", tempname, 0); // utf8_to_ansi(tempname2, list[*max ].name, 128); sprintf(list[*max ].name, "%s", tempname2); strncpy(list[*max ].path, net_path, strlen(net_path)-1); list[*max ].path[strlen(net_path)-1]=0; sprintf(list[*max ].entry, "__0%s", net_path_bare); list[*max].size=0; list[*max].time=0; list[*max].mode=0; list[*max].selected=0; sprintf(list[*max].datetime, "%s%c", " ", 0); (*max) ++; if(*max >=2048) break; } //subfolder if(strcmp(net_path, path2)==0) { list[*max].type=strtol(type, NULL, 10); // utf8_to_ansi(title, list[*max ].name, 128); sprintf(list[*max ].name, "%s%c", title, 0); // strncpy(list[*max ].name, title, 128); list[*max ].name[128]=0; sprintf(list[*max ].path, "%s/%s", path, title); temp[0]=0x2e; temp[1]=0x2e; temp[2]=0; if(strcmp(temp, title)==0) { sprintf(list[*max ].path, "%s", path); char *pch=list[*max ].path; char *pathpos=strrchr(pch,'/'); int lastO=pathpos-pch; list[*max ].path[lastO]=0; } sprintf(list[*max ].entry, "__%i%s", list[*max].type, title); list[*max].size=strtoull(length, NULL, 10); list[*max].time=0; list[*max].mode=0; list[*max].selected=0; sprintf(list[*max].datetime, "%s", date2); if(strlen(date2)>9 && date_format>0) { if(date_format==1) // 01/34/6789 sprintf(list[*max].datetime, "%c%c/%c%c/%c%c%c%c", date2[3], date2[4], date2[0], date2[1], date2[6], date2[7], date2[8], date2[9]); else if(date_format==2) // 01/34/6789 sprintf(list[*max].datetime, "%c%c%c%c/%c%c/%c%c", date2[6], date2[7], date2[8], date2[9], date2[3], date2[4], date2[0], date2[1]); } // sprintf(filename, "Path: [%s]\nInfo [%f] [%s] [%f]", list[*max].path, list[*max].size/1.0f, length, strtol(length, NULL, 10)/1.0f); dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL );wait_dialog(); (*max) ++; if(*max >=2048) break; } } //while fclose(fp); } goto finalize; regular_FS_PS: if(strstr(path,"/ps3_home")==NULL) goto regular_FS_NTFS; if(strcmp(path,"/ps3_home")==0){ sprintf(list[*max ].name, ".."); sprintf(list[*max ].path, "/"); list[*max].mode=0;list[*max].selected=0; sprintf(list[*max ].entry, " "); list[*max ].time=time(NULL); list[*max ].size=0; list[*max ].type=0; (*max) ++; sprintf(list[*max ].name, "music"); sprintf(list[*max ].path, "/ps3_home/music"); list[*max].mode=0;list[*max].selected=0; sprintf(list[*max ].entry, "__0music"); list[*max ].time=time(NULL); list[*max ].size=0; list[*max ].type=0; (*max) ++; sprintf(list[*max ].name, "photo"); sprintf(list[*max ].path, "/ps3_home/photo"); list[*max].mode=0;list[*max].selected=0; sprintf(list[*max ].entry, "__0photo"); list[*max ].time=time(NULL); list[*max ].size=0; list[*max ].type=0; (*max) ++; sprintf(list[*max ].name, "video"); sprintf(list[*max ].path, "/ps3_home/video"); list[*max].mode=0;list[*max].selected=0; sprintf(list[*max ].entry, "__0video"); list[*max ].time=time(NULL); list[*max ].size=0; list[*max ].type=0; (*max) ++; sprintf(list[*max ].name, "archive"); sprintf(list[*max ].path, "/ps3_home/mmiso"); list[*max].mode=0;list[*max].selected=0; sprintf(list[*max ].entry, "__0archive"); list[*max ].time=time(NULL); list[*max ].size=0; list[*max ].type=0; (*max) ++; } if(strstr(path,"/ps3_home/")!=NULL){ sprintf(list[*max ].name, ".."); sprintf(list[*max ].path, "/ps3_home"); list[*max].mode=0;list[*max].selected=0; sprintf(list[*max ].entry, " "); list[*max ].time=time(NULL); list[*max ].size=0; list[*max ].type=0; (*max) ++; } search_mmiso=0; if(strstr(path,"/ps3_home/music")!=NULL) ps3_home_scan((char *)"/dev_hdd0/music", list, max); if(strstr(path,"/ps3_home/video")!=NULL) ps3_home_scan((char *)"/dev_hdd0/video", list, max); if(strstr(path,"/ps3_home/photo")!=NULL) ps3_home_scan((char *)"/dev_hdd0/photo", list, max); if(strstr(path,"/ps3_home/mmiso")!=NULL) {search_mmiso=1; ps3_home_scan((char *)"/dev_hdd0/video", list, max); search_mmiso=0;} goto finalize; regular_FS_NTFS: char *pch; char *pathpos; int lastO; #if (CELL_SDK_VERSION>0x210001) if(strstr(path,"/pvd_usb")==NULL) goto regular_FS; PFS_HFIND dir; PFS_FIND_DATA entryP; sprintf(list[*max ].path, "%s", path); pch=list[*max ].path; pathpos=strrchr(pch,'/'); lastO=pathpos-pch; list[*max ].path[lastO]=0; sprintf(list[*max ].entry, " "); sprintf(list[*max ].name, ".."); list[*max].type=0; (*max) ++; dir = PfsFileFindFirst(path, &entryP); if (!dir) goto regular_FS; do { if (!strcmp(entryP.FileName, ".") || !strcmp(entryP.FileName, "..")) continue; if (entryP.FileAttributes & PFS_FIND_DIR) list[*max].type=0; else list[*max].type=1; strncpy(list[*max ].name, entryP.FileName, 128); list[*max ].name[128]=0; if(strlen(path)==1) sprintf(list[*max ].path, "/%s", entryP.FileName); else sprintf(list[*max ].path, "%s/%s", path, entryP.FileName); sprintf(list[*max ].entry, "__%i%s", list[*max].type, entryP.FileName); list[*max].time=time(NULL);; list[*max].size=entryP.FileSize; list[*max].mode=entryP.FileAttributes; list[*max].selected=0; /* if (list[*max].type==1) { PFS_HFILE fh = PFS_FILE_INVALID; uint64_t size; list[*max].size=0; if ((fh = PfsFileOpen(list[*max].path)) != PFS_FILE_INVALID) { if (PfsFileGetSizeFromHandle(fh, &size) == 0) { list[*max].size=size; } } if (fh != PFS_FILE_INVALID) PfsFileClose(fh); } */ //list[*max].time=s.st_ctime; //if(s.st_mtime>0) list[*max].time=s.st_mtime; if(list[*max ].name[0]!=0x24 && strstr(list[*max ].name, "System Volume")==NULL) (*max) ++; if(*max >=2048) break; } while (PfsFileFindNext(dir, &entryP) == 0); PfsFileFindClose(dir); goto finalize; regular_FS: #endif int dir_fd; uint64_t nread; CellFsDirent entry; // dir=opendir (path); if (cellFsOpendir(path, &dir_fd) == CELL_FS_SUCCEEDED){ while(1) { // while(dir) { // struct dirent *entry=readdir (dir); cellFsReaddir(dir_fd, &entry, &nread); if(nread==0) break; // if(!entry) break; if(entry.d_name[0]=='.' && entry.d_name[1]==0) continue; if(strstr(entry.d_name,"host_root")!=NULL) continue; if(!(entry.d_type & DT_DIR)) { list[*max].type=1; } else { list[*max].type=0; } list[*max].mode=0; list[*max].selected=0; // utf8_to_ansi(entry.d_name, list[*max ].name, 128); strncpy(list[*max ].name, entry.d_name, 128); list[*max ].name[128]=0; if(strlen(path)==1) sprintf(list[*max ].path, "/%s", entry.d_name); else sprintf(list[*max ].path, "%s/%s", path, entry.d_name); if(entry.d_name[0]=='.' && entry.d_name[1]=='.' && entry.d_name[2]==0) { sprintf(list[*max ].path, "%s", path); pch=list[*max ].path; pathpos=strrchr(pch,'/'); lastO=pathpos-pch; list[*max ].path[lastO]=0; sprintf(list[*max ].entry, " "); } else sprintf(list[*max ].entry, "__%i%s", list[*max].type, entry.d_name); /* if(entry->d_name[0]=='.' && entry->d_name[1]==0) continue; if(!(entry->d_type & DT_DIR)) { list[*max].type=1; } else { list[*max].type=0; } strncpy(list[*max ].name, entry->d_name, 128); list[*max ].name[128]=0; if(strlen(path)==1) sprintf(list[*max ].path, "/%s", entry->d_name); else sprintf(list[*max ].path, "%s/%s", path, entry->d_name); if(entry->d_name[0]=='.' && entry->d_name[1]=='.' && entry->d_name[2]==0) { sprintf(list[*max ].path, "%s", path); char *pch=list[*max ].path; char *pathpos=strrchr(pch,'/'); int lastO=pathpos-pch; list[*max ].path[lastO]=0; sprintf(list[*max ].entry, " "); } else sprintf(list[*max ].entry, "__%i%s", list[*max].type, entry->d_name); */ if(cellFsStat(list[*max ].path, &s)==CELL_FS_SUCCEEDED) { list[*max].size=s.st_size; list[*max].time=s.st_ctime; if(s.st_mtime>0) list[*max].time=s.st_mtime; list[*max].mode=s.st_mode; } (*max) ++; if(*max >=2048) break; } //while } // closedir(dir); cellFsClosedir(dir_fd); finalize: if(*max==0) { sprintf(list[*max ].name, "/"); sprintf(list[*max ].path, "/"); sprintf(list[*max ].entry, " "); list[*max ].time=0; list[*max ].size=0; list[*max ].type=0; (*max) ++; } temp[0]=0x2f; temp[1]=0x00; temp[2]=0; if(strcmp(temp, path)==0) { for(n=0;n<max_hosts;n++) { sprintf(list[*max ].name, "net_host%i %s - %s:%i", n, host_list[n].friendly, host_list[n].host, host_list[n].port); sprintf(list[*max ].path, "/net_host%i",n); sprintf(list[*max ].entry, "__0net_host%i", n); list[*max ].time=time(NULL); list[*max ].size=0; timeinfo = localtime ( &c_time ); if(date_format==0) sprintf(list[*max].datetime, "%02d/%02d/%04d", timeinfo->tm_mday, timeinfo->tm_mon+1, timeinfo->tm_year+1900); else if(date_format==1) sprintf(list[*max].datetime, "%02d/%02d/%04d", timeinfo->tm_mon+1, timeinfo->tm_mday, timeinfo->tm_year+1900); else if(date_format==2) sprintf(list[*max].datetime, "%04d/%02d/%02d", timeinfo->tm_year+1900, timeinfo->tm_mon+1, timeinfo->tm_mday ); list[*max ].type=0; (*max) ++; } sprintf(list[*max ].name, "ps3_home"); sprintf(list[*max ].path, "/ps3_home"); sprintf(list[*max ].entry, "__0ps3_home"); list[*max ].time=time(NULL); list[*max ].size=0; list[*max ].type=0; (*max) ++; #if (CELL_SDK_VERSION>0x210001) if(pfs_enabled) { int fsVol=0; for(fsVol=0;fsVol<(max_usb_volumes);fsVol++) { if (PfsmVolStat(fsVol) == 0) { sprintf(list[*max ].name, "pvd_usb%i", fsVol); sprintf(list[*max ].path, "/pvd_usb00%i", fsVol); sprintf(list[*max ].entry, "__0pvd_usb00%i", fsVol); list[*max ].time=time(NULL); list[*max ].size=0; list[*max ].type=0; (*max) ++; } } } #endif /* sprintf(list[*max ].name, "sys_cache"); sprintf(list[*max ].path, "%s", sys_cache); sprintf(list[*max ].entry, "__0sys_cache"); list[*max ].time=time(NULL); list[*max ].size=0; list[*max ].type=0; (*max) ++; */ } sort_pane(list, max ); } #if (CELL_SDK_VERSION>0x210001) void fill_entries_from_device_pfs(char *path, t_menu_list *list, int *max, u32 flag, int sel) { if(!pfs_enabled || is_reloaded) return; is_game_loading=1; if(sel!=2) delete_entries(list, max, flag); load_texture(text_bmpIC, blankBG, 320); //reset_xmb(1); PFS_HFIND dir; PFS_FIND_DATA entry; char file[1024]; int skip_entry=0; char string2[1024]; (void) sel; if ((*max) < 0) *max = 0; // sprintf(string2, "Will check dir: [%s]", path); dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, string2, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); // if (PfsFileGetInfo(path, &info) != 0) return; // sprintf(string2, "Will read dir: [%s]", path); dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, string2, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); dir = PfsFileFindFirst(path, &entry); // sprintf(string2, "READ dir: [%s]", path); dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, string2, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); if (!dir) { is_game_loading=0; return; } do { if (!strcmp(entry.FileName, ".") || !strcmp(entry.FileName, "..")) continue; if (!(entry.FileAttributes & PFS_FIND_DIR)) continue; if(skip_entry==0 && cover_mode!=8) { sprintf(string2, "Scanning, please wait!\n\n[%s/%s]",path, entry.FileName); ClearSurface(); set_texture( text_FMS, 1920, 48); display_img(0, 47, 1920, 60, 1920, 48, -0.15f, 1920, 48); display_img(0, 952, 1920, 76, 1920, 48, -0.15f, 1920, 48);time ( &rawtime ); timeinfo = localtime ( &rawtime ); cellDbgFontPrintf( 0.83f, 0.89f, 0.7f ,0xc0a0a0a0, "%02d/%02d/%04d\n %s:%02d:%02d ", timeinfo->tm_mday, timeinfo->tm_mon+1, timeinfo->tm_year+1900, tmhour(timeinfo->tm_hour), timeinfo->tm_min, timeinfo->tm_sec); set_texture( text_bmpIC, 320, 320); display_img(800, 200, 320, 176, 320, 176, 0.0f, 320, 320); cellDbgFontPrintf( 0.3f, 0.45f, 0.8f, 0xc0c0c0c0, string2); //if(first_launch) cellDbgFontPrintf( 0.30f, 0.80f, 1.0f, 0x90909090, multi_loading); flip(); } skip_entry++; if( skip_entry>10) skip_entry=0; //(first_launch && skip_entry>3 ) || list[*max].flags = flag; strncpy(list[*max].title, entry.FileName, 63); list[*max].title[63] = 0; sprintf(list[*max].path, "%s/%s", path, entry.FileName); sprintf(list[*max ].content, "%s", "PS3"); sprintf(list[*max ].title_id, "%s", "NO_ID"); list[*max ].split=0; list[*max ].user=IS_PS3; sprintf(file, "%s/PS3_GAME/PARAM.SFO", list[*max].path); parse_param_sfo(file, list[*max ].title+1*(list[*max ].title[0]=='_'), list[*max ].title_id, &list[*max ].plevel); // move +1 with '_' list[*max ].title[63]=0; sprintf(file, "%s/PS3_GAME/PIC1.PNG", list[*max].path); sprintf(string2, "%s/%s_320.PNG", cache_dir, list[*max ].title_id); if(!exist(string2)) {cache_png(file, list[*max ].title_id);} (*max)++; if (*max >= MAX_LIST) break; } while (PfsFileFindNext(dir, &entry) == 0); PfsFileFindClose(dir); //reset_xmb(1); is_game_loading=0; } #endif void check_usb_ps3game(const char *path) { if(strstr(path,"/dev_usb")!=NULL) { //check for PS3_GAME mount on external USB char usb_mount1[512], usb_mount2[512], path_bup[512], tempname[512]; int pl, n; FILE *fpA; strncpy(tempname, path, 11); tempname[11]=0; sprintf(usb_mount1, "%s/PS3_GAME", tempname); if(exist(usb_mount1)) { //restore PS3_GAME back to USB game folder sprintf(path_bup, "%s/PS3PATH.BUP", usb_mount1); if(exist(path_bup)) { fpA = fopen ( path_bup, "r" ); if(fpA==NULL) goto continue_scan; if(fgets ( usb_mount2, 512, fpA )==NULL) goto cancel_move; fclose(fpA); strncpy(usb_mount2, path, 11); //always use current device if(!exist(usb_mount2)) { pl=strlen(usb_mount2); for(n=0;n<pl;n++) { tempname[n]=usb_mount2[n]; tempname[n+1]=0; if(usb_mount2[n]==0x2F && !exist(tempname)) { mkdir(tempname, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(tempname, 0777); } } rename (usb_mount1, usb_mount2); } goto continue_scan; cancel_move: fclose(fpA); } } } continue_scan: return; } void fill_entries_from_device(const char *path, t_menu_list *list, int *max, u32 flag, int sel) { is_game_loading=1; check_usb_ps3game(path); is_game_loading=0; if((is_reloaded==2) || (is_reloaded==1 && strstr(path, "/dev_hdd")==NULL) ) return; is_game_loading=1; DIR *dir;//, *dir2, *dir3; char file[1024], string2[1024]; char path2[1024], path3[1024], avchd_path[12], detailsfile[512]; int skip_entry=0; FILE *fp; char BDtype[6]; if(sel!=2) delete_entries(list, max, flag); if((*max) <0) *max =0; char title[256], length[24], video[24], audio[24], web[256]; sprintf(string2, "%s/AVCHD_240.RAW", cache_dir); if(!exist(string2)) { sprintf(string2, "%s", "AVCHD"); cache_png(string2, string2); } if(first_launch) { sprintf(string2, "%s/PRB.PNG", app_usrdir); load_texture(text_FMS, string2, 858);} if(scan_avchd==1 && strstr(path,"/dev_usb")!=NULL && sel==0 && (display_mode==0 || display_mode==2)) { // strncpy(avchd_path, path, 11); avchd_path[11]=0; dir=opendir (avchd_path); while(dir) { if(*max >=MAX_LIST-1) break; pb_step-=10; if(pb_step<1) pb_step=429; if(first_launch) { ClearSurface(); put_texture( text_BOOT, text_FMS+(pb_step*4), 429, 20, 858, 745, 840, 0, 0); set_texture( text_BOOT, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); flip(); } struct dirent *entry=readdir (dir); if(!entry) break; if(entry->d_name[0]=='.') continue; if(!(entry->d_type & DT_DIR)) continue; if(skip_entry==0 && !first_launch) { if(cover_mode!=8) { ClearSurface(); sprintf(string2, "Scanning for AVCHD content, please wait!\n\n[%s/%s]",avchd_path, entry->d_name); set_texture( text_FMS, 1920, 48); display_img(0, 47, 1920, 60, 1920, 48, -0.15f, 1920, 48); display_img(0, 952, 1920, 76, 1920, 48, -0.15f, 1920, 48);time ( &rawtime ); timeinfo = localtime ( &rawtime ); cellDbgFontPrintf( 0.83f, 0.895f, 0.7f ,0xc0a0a0a0, "%02d/%02d/%04d\n %s:%02d:%02d ", timeinfo->tm_mday, timeinfo->tm_mon+1, timeinfo->tm_year+1900, tmhour(timeinfo->tm_hour), timeinfo->tm_min, timeinfo->tm_sec); set_texture( text_bmpIC, 320, 320); display_img(800, 200, 320, 176, 320, 176, 0.0f, 320, 320); cellDbgFontPrintf( 0.3f, 0.45f, 0.8f, 0xc0c0c0c0, string2); cellDbgFontDrawGcm(); flip(); } } skip_entry++; if(skip_entry>20) skip_entry=0; sprintf(path2, "%s/%s", avchd_path, entry->d_name); //dev_usb00x/AVCHD_something sprintf(file, "%s/BDMV/INDEX.BDM", path2); // /dev_usb00x/AVCHD_something/BDMV/INDEX.BDM sprintf(BDtype,"AVCHD"); if(!exist(file)) { sprintf(file, "%s/BDMV/index.bdmv", path2); // /dev_usb00x/something/BDMV/index.bdmv if(exist(file)) sprintf(BDtype,"BDMV");} if(exist(file)) { char is_multiAVCHD[13];is_multiAVCHD[0]=0; sprintf(detailsfile, "%s/multiAVCHD.mpf", path2); if(exist(detailsfile)) sprintf(is_multiAVCHD, "%s", " (multiAVCHD)"); is_multiAVCHD[13]=0; sprintf(path3, "[Video] %s%s", entry->d_name, is_multiAVCHD); path3[63]=0; sprintf(list[*max ].title, "%s", path3); list[*max ].flags=flag; sprintf(list[*max ].title_id, "%s", "AVCHD"); sprintf(list[*max ].path, "%s", path2); sprintf(list[*max ].entry, "%s", entry->d_name); sprintf(list[*max ].content, "%s", BDtype); list[*max ].cover=-1; list[*max ].split=0; list[*max ].user=0; sprintf(detailsfile, "%s/details.txt", path2); fp = fopen ( detailsfile, "r" ); if ( fp != NULL ) { fseek (fp, 0, SEEK_SET); char lines[2048]="/"; lines[1]=0; int cline=0; while (fscanf(fp,"%[^;];%[^;];%[^;];%[^;];%s\n", title, length, video, audio, web)==5) { cline++; if(expand_avchd==1) { sprintf(list[*max].title, "[Video] %s", title); // utf8_to_ansi(string2, list[*max].title, 63); list[*max].title[63]=0; list[*max ].flags=flag; sprintf(list[*max ].title_id, "%s", "AVCHD"); sprintf(list[*max ].path, "%s", path2); sprintf(list[*max ].entry, "%s", entry->d_name); sprintf(list[*max ].content, "%s", BDtype); sprintf(list[*max ].details, "Duration: %s, Video: %s, Audio: %s", length, video, audio); list[*max ].cover=-1; (*max) ++; } else { if(cline==1) { is_multiAVCHD[13]=0; sprintf(string2, "[Video] %s%s", title, is_multiAVCHD); string2[62]=0; sprintf(list[*max].title, "%s", string2); // utf8_to_ansi(string2, list[*max].title, 58);list[*max].title[58]=0; } else sprintf(lines, "%s %s /", lines, title); } if(*max >=MAX_LIST-1) break; } lines[100]=0; if(expand_avchd==0) {lines[90]=0; sprintf(list[*max].details, "%s", lines);} // {utf8_to_ansi(lines, list[*max].details, 90);list[*max].details[90]=0;} else {if(cline>0) (*max) --;} fclose ( fp ); } (*max) ++; if(*max >=MAX_LIST-1) break; } // INDEX.BDM found } // while closedir (dir); } // scan AVCHD dir=opendir (path); if(!dir) {is_game_loading=0; return;} if(sel==2) sel=0; while(1) { if(*max >=MAX_LIST-1) break; pb_step-=10; if(pb_step<1) pb_step=429; if(first_launch) { ClearSurface(); put_texture( text_BOOT, text_FMS+(pb_step*4), 429, 20, 858, 745, 840, 0, 0); set_texture( text_BOOT, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); flip(); } struct dirent *entry=readdir (dir); if(!entry) break; if(entry->d_name[0]=='.') continue; if(!(entry->d_type & DT_DIR)) continue; sprintf(path2, "%s/%s", path, entry->d_name); sprintf(file, "%s/PS3_GAME/ICON0.PNG", path2); if(strcmp(path, "/dev_hdd0/game")==0) { sprintf(file, "%s/ICON0.PNG", path2); } /* if(skip_entry==0 || first_launch) { ClearSurface(); if(first_launch) { put_texture( text_bmpUBG, text_FMS+(pb_step*4), 429, 20, 858, 745, 840, 0, 0); set_texture( text_bmpUBG, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); // sprintf(string2, "Scanning [%s/%s], please wait...", path, entry->d_name); // cellDbgFontPrintf( (1.0f-(strlen(string2)*0.00625f))/2.0f, 0.80f, 0.5f, 0x90909090, string2); // cellDbgFontDrawGcm(); // max_ttf_label=0; // cellDbgFontPrintf( 0.98f, 0.98f, 0.5f, 0x80808080, "G"); // print_label_ex( 0.5f, 0.8, 0.5f, 0x90909090, string2, 1.0f, 0.0f, 15, 1.0f, 1.0f, 1); } else */ if(skip_entry==0 && !first_launch) { if(strstr(path, "/dev_hdd0")!=NULL && exist(file) && cover_mode!=8) load_texture(text_bmpIC, file, 320); if(cover_mode!=8) //draw_whole_xmb(1); //draw_xmb_bare(xmb_icon, 2, 0, 0); //max_ttf_label+=0; //else { sprintf(string2, "Scanning, please wait!\n\n[%s/%s]", path, entry->d_name); ClearSurface(); set_texture( text_FMS, 1920, 48); display_img(0, 47, 1920, 60, 1920, 48, -0.15f, 1920, 48); display_img(0, 952, 1920, 76, 1920, 48, -0.15f, 1920, 48);time ( &rawtime ); timeinfo = localtime ( &rawtime ); cellDbgFontPrintf( 0.83f, 0.895f, 0.7f ,0xc0a0a0a0, "%02d/%02d/%04d\n %s:%02d:%02d ", timeinfo->tm_mday, timeinfo->tm_mon+1, timeinfo->tm_year+1900, tmhour(timeinfo->tm_hour), timeinfo->tm_min, timeinfo->tm_sec); set_texture( text_bmpIC, 320, 320); display_img(800, 200, 320, 176, 320, 176, 0.0f, 320, 320); cellDbgFontPrintf( 0.3f, 0.45f, 0.8f, 0xc0c0c0c0, string2); //if(first_launch) cellDbgFontPrintf( 0.30f, 0.80f, 1.0f, 0x90909090, multi_loading); cellDbgFontDrawGcm(); flip(); } } skip_entry++; if(skip_entry>10) skip_entry=0; // (first_launch && skip_entry>3 ) || // sprintf(file, "%s/PS3_GAME/USRDIR/EBOOT.BIN", path2); sprintf(file, "%s/PS3_GAME/PARAM.SFO", path2); if(strcmp(path, "/dev_hdd0/game")==0) { // sprintf(file, "%s/USRDIR/MM_NON_NPDRM_EBOOT.BIN", path2); // if(stat(file, &s)>=0) sprintf(file, "%s/PARAM.SFO", path2); // else // { sprintf(file, "%s/USRDIR/RELOAD.SELF", path2); if(exist(file) && strstr(file, app_usrdir)==NULL) sprintf(file, "%s/PARAM.SFO", path2); else continue; // } } /* if(sel==1) { sprintf(file, "%s/EBOOT.BIN", path2); if(stat(file, &s)<0) sprintf(file, "%s/USRDIR/EBOOT.BIN", path2); if(stat(file, &s)<0) continue; } */ // if(display_mode==0 || display_mode==1) if(display_mode!=2 && exist(file)) { list[*max ].flags=flag; strncpy(list[*max ].title, entry->d_name, 63); list[*max ].title[63]=0; list[*max ].cover=0; sprintf(list[*max ].path, "%s/%s", path, entry->d_name); sprintf(list[*max ].entry, "%s", entry->d_name); sprintf(list[*max ].content, "%s", "PS3"); sprintf(list[*max ].title_id, "%s", "NO_ID"); list[*max ].split=0; list[*max ].user=IS_PS3; if(sel==0) { parse_param_sfo(file, list[*max ].title+1*(list[*max ].title[0]=='_'), list[*max ].title_id, &list[*max ].plevel); // move +1 with '_' list[*max ].title[63]=0; if(strcmp(path, "/dev_hdd0/game")==0) sprintf(file, "%s/PIC1.PNG", path2); else sprintf(file, "%s/PS3_GAME/PIC1.PNG", path2); sprintf(string2, "%s/%s_320.PNG", cache_dir, list[*max ].title_id); if(!exist(string2)) {cache_png(file, list[*max ].title_id);} } get_game_flags((*max)); (*max) ++; continue; } else // check for PS2 games { list[*max ].split=0; sprintf(file, "%s/SYSTEM.CNF", path2); if(!exist(file)) sprintf(file, "%s/system.cnf", path2); if(exist(file)) { list[*max ].flags=flag; sprintf(file, "[PS2] %s", entry->d_name); strncpy(list[*max ].title, file, 63); list[*max ].title[63]=0; list[*max ].cover=-1; sprintf(list[*max ].path, "%s", path2); sprintf(list[*max ].entry, "%s", entry->d_name); sprintf(list[*max ].content, "%s", "PS2"); sprintf(list[*max ].title_id, "%s", "NO_ID"); (*max) ++; continue; } else { sprintf(file, "%s/VIDEO_TS/VIDEO_TS.IFO", path2); if(display_mode!=1 && exist(file)) { list[*max ].flags=flag; sprintf(file, "[DVD Video] %s", entry->d_name); strncpy(list[*max ].title, file, 63); list[*max ].title[63]=0; list[*max ].cover=-1; sprintf(file, "%s/VIDEO_TS", path2); sprintf(list[*max ].path, "%s", file); sprintf(list[*max ].entry, "%s", entry->d_name); sprintf(list[*max ].content, "%s", "DVD"); sprintf(list[*max ].title_id, "%s", "NO_ID"); (*max) ++; continue; } else //check for AVCHD on internal HDD { char ext_int[5]; ext_int[0]=0; if(strstr(path2, "dev_hdd0")!=NULL) sprintf(ext_int, "%s", "HDD "); sprintf(file, "%s/BDMV/INDEX.BDM", path2); // /dev_usb00x/AVCHD_something/BDMV/INDEX.BDM sprintf(BDtype,"AVCHD"); if(!exist(file)) { sprintf(file, "%s/BDMV/index.bdmv", path2); // /dev_usb00x/something/BDMV/index.bdmv if(exist(file)) sprintf(BDtype,"BDMV");} if(display_mode!=1 && exist(file)) { char is_multiAVCHD[13];is_multiAVCHD[0]=0; sprintf(detailsfile, "%s/multiAVCHD.mpf", path2); if(exist(detailsfile)) sprintf(is_multiAVCHD,"%s", " (multiAVCHD)"); is_multiAVCHD[13]=0; sprintf(path3, "[%sVideo] %s%s", ext_int, entry->d_name, is_multiAVCHD); path3[64]=0; sprintf(list[*max ].title, "%s", path3); list[*max ].flags=flag; list[*max ].title[63]=0; sprintf(list[*max ].title_id, "%s", "AVCHD"); sprintf(list[*max ].path, "%s", path2); sprintf(list[*max ].entry, "%s", entry->d_name); sprintf(list[*max ].content, "%s", BDtype); list[*max ].cover=-1; sprintf(detailsfile, "%s/details.txt", path2); fp = fopen ( detailsfile, "r" ); if ( fp != NULL ) { fseek (fp, 0, SEEK_SET); char lines[2048]="/"; lines[1]=0; int cline=0; while (fscanf(fp,"%[^;];%[^;];%[^;];%[^;];%s\n", title, length, video, audio, web)==5) { cline++; if(expand_avchd==1) { sprintf(string2, "[%sVideo] %s", ext_int, title); string2[63]=0; sprintf(list[*max].title, "%s", string2); // utf8_to_ansi(string2, list[*max].title, 63); list[*max].title[63]=0; list[*max ].flags=flag; sprintf(list[*max ].title_id, "%s", "AVCHD"); sprintf(list[*max ].path, "%s", path2); sprintf(list[*max ].entry, "%s", entry->d_name); sprintf(list[*max ].content, "%s", BDtype); sprintf(list[*max ].details, "Duration: %s, Video: %s, Audio: %s", length, video, audio); list[*max ].cover=-1; (*max) ++; } else { if(cline==1) { is_multiAVCHD[13]=0; sprintf(string2, "[%sVideo] %s%s", ext_int, title, is_multiAVCHD); string2[58]=0; sprintf(list[*max].title, "%s", string2); // utf8_to_ansi(string2, list[*max].title, 58);list[*max].title[58]=0; } else sprintf(lines, "%s %s /", lines, title); } if(*max >=MAX_LIST) break; } lines[100]=0; if(expand_avchd==0) { lines[90]=0; sprintf(list[*max].details, "%s", lines); //utf8_to_ansi(lines, list[*max].details, 90);list[*max].details[90]=0; } else { if(cline>0) (*max) --;} fclose ( fp ); } (*max) ++; } // INDEX.BDM found } } } if(*max >=MAX_LIST) break; } closedir (dir); load_texture(text_bmpIC, blankBG, 320); is_game_loading=0; } /****************************************************/ /* FILE UTILS */ /****************************************************/ //char string1[1024]; int copy_mode=0; // 0- normal 1-> pack files >= 4GB int copy_is_split=0; // return 1 if files is split //uint64_t global_device_bytes=0; typedef struct _t_fast_files { int64_t readed; // global bytes readed int64_t writed; // global bytes writed int64_t off_readed; // offset correction for bigfiles_mode == 2 (joining) int64_t len; // global len of the file (value increased in the case of bigfiles_ mode == 2) int giga_counter; // counter for split files to 1GB for bigfiles_mode == 1 (split) u32 fl; // operation control int bigfile_mode; int pos_path; // filename position used in bigfiles char pathr[1024]; // read path char pathw[1024]; // write path int use_doublebuffer; // if files >= 4MB use_doblebuffer =1; void *mem; // buffer for read/write files ( x2 if use_doublebuffer is fixed) int size_mem; // size of the buffer for read int number_frag; // used to count fragments files i bigfile_mode CellFsAio t_read; // used for async read CellFsAio t_write; // used for async write } t_fast_files __attribute__((aligned(8))); t_fast_files *fast_files=NULL; int fast_num_files=0; int fast_used_mem=0; int current_fast_file_r=0; int current_fast_file_w=0; int fast_read=0, fast_writing=0; int files_opened=0; int fast_copy_async(char *pathr, char *pathw, int enable) { fast_num_files=0; fast_read=0; fast_writing=0; fast_used_mem=0; files_opened=0; current_fast_file_r= current_fast_file_w= 0; if(enable) { if(cellFsAioInit(pathr)!=CELL_FS_SUCCEEDED) return -1; if(cellFsAioInit(pathw)!=CELL_FS_SUCCEEDED) return -1; fast_files = (t_fast_files *) memalign(8, sizeof(t_fast_files)*MAX_FAST_FILES); // fast_files = (t_fast_files *) fast_files_mem; if(!fast_files) return -2; return 0; } else { if(fast_files) free(fast_files); fast_files=NULL; cellFsAioFinish(pathr); cellFsAioFinish(pathw); } return 0; } int fast_copy_process(); int fast_copy_add(char *pathr, char *pathw, char *file) { int size_mem; int strl= strlen(file); struct stat s; if(fast_num_files>=MAX_FAST_FILES || fast_used_mem>=0x2000000)//1000000)//C00000)//800000) { int ret=fast_copy_process(); if(ret<0 || abort_copy) return ret; } if(fast_num_files>= MAX_FAST_FILES) {return -1;} fast_files[fast_num_files].bigfile_mode=0; if(strl>6)// && strstr(pathw, "/dev_hdd0")!=NULL) { char *p= file; p+= strl-6; // adjust for .666xx .x.part if(p[0]== '.' && p[1]== '6' && p[2]== '6' && p[3]== '6') { if(p[4]!='0' || p[5]!='0') {return 0;} // ignore this file fast_files[fast_num_files].bigfile_mode=2; // joining split files } /* else if(strl>7) { p+= strl-7; // adjust for .666xx .x.part if(p[0]== '.' && p[1]!='1' && p[2]== '.' && p[3]== 'p' && p[4]== 'a' && p[5]== 'r' && p[6]== 't') fast_files[fast_num_files].bigfile_mode=2; // joining split files else return 0; // ignore } */ } sprintf(fast_files[fast_num_files].pathr, "%s/%s", pathr, file); if(stat(fast_files[fast_num_files].pathr, &s)<0) {abort_copy=1;return -1;} sprintf(fast_files[fast_num_files].pathw, "%s/%s", pathw, file); // zero files if((int64_t) s.st_size==0LL) { int fdw; if(cellFsOpen(fast_files[fast_num_files].pathw, CELL_FS_O_CREAT | CELL_FS_O_TRUNC | CELL_FS_O_WRONLY, &fdw, 0,0)!=CELL_FS_SUCCEEDED) { DPrintf("Error Opening (write):\n%s\n\n", fast_files[current_fast_file_r].pathw); abort_copy=1; return -1; } cellFsClose(fdw); cellFsChmod(fast_files[fast_num_files].pathw, CELL_FS_S_IFMT | 0777); DPrintf("Copying:\n%s\nwWritten: 0 B\n", fast_files[current_fast_file_r].pathr); file_counter++; return 0; } if(fast_files[fast_num_files].bigfile_mode==2) { /* if(fast_files[fast_num_files].pathw[strlen(fast_files[fast_num_files].pathw)-1]=='t') { fast_files[fast_num_files].pathw[strlen(fast_files[fast_num_files].pathw)-7]=0; // truncate the .x.part extension fast_files[fast_num_files].pos_path=strlen(fast_files[fast_num_files].pathr)-7; } else { */ fast_files[fast_num_files].pathw[strlen(fast_files[fast_num_files].pathw)-6]=0; // truncate the .666xx extension fast_files[fast_num_files].pos_path=strlen(fast_files[fast_num_files].pathr)-6; // } fast_files[fast_num_files].pathr[fast_files[fast_num_files].pos_path]=0; // truncate the extension } if(copy_mode==1) { if(((uint64_t) s.st_size)>= 0x100000000ULL) { fast_files[fast_num_files].bigfile_mode=1; fast_files[fast_num_files].pos_path= strlen(fast_files[fast_num_files].pathw); fast_files[fast_num_files].giga_counter=0; copy_is_split=1; } } fast_files[fast_num_files].number_frag=0; fast_files[fast_num_files].fl=1; fast_files[fast_num_files].len= (int64_t) s.st_size; fast_files[fast_num_files].use_doublebuffer=0; fast_files[fast_num_files].readed= 0LL; fast_files[fast_num_files].writed= 0LL; fast_files[fast_num_files].t_read.fd= -1; fast_files[fast_num_files].t_write.fd= -1; if(((uint64_t) s.st_size)>=MAX_FAST_FILE_SIZE) { size_mem= MAX_FAST_FILE_SIZE; fast_files[fast_num_files].use_doublebuffer=1; } else size_mem= ((int) s.st_size); fast_files[fast_num_files].mem = memalign(32, size_mem + size_mem*(fast_files[fast_num_files].use_doublebuffer!=0)+1024); fast_files[fast_num_files].size_mem = size_mem; if(!fast_files[fast_num_files].mem) {abort_copy=1;return -1;} fast_used_mem+= size_mem; fast_num_files++; return 0; } void fast_func_read(CellFsAio *xaio, CellFsErrno error, int , uint64_t size) { t_fast_files* fi = (t_fast_files *) xaio->user_data; if(error!=0 || size!= xaio->size) { fi->readed=-1;return; } else fi->readed+=(int64_t) size; fast_read=0;fi->fl=3; } void fast_func_write(CellFsAio *xaio, CellFsErrno error, int , uint64_t size) { t_fast_files* fi = (t_fast_files *) xaio->user_data; if(error!=0 || size!= xaio->size) { fi->writed=-1; } else { fi->writed+=(int64_t) size; fi->giga_counter+= (int) size; global_device_bytes+=(int64_t) size; } fast_writing=2; } int fast_copy_process() { int n; int seconds2= (int) time(NULL); int fdr, fdw; char string1[1024]; static int id_r=-1, id_w=-1; int error=0; int i_reading=0; int64_t write_end=0, write_size=0; while(current_fast_file_w<fast_num_files || fast_writing) { if(abort_copy) break; // open read if(current_fast_file_r<fast_num_files && fast_files[current_fast_file_r].fl==1 && !i_reading && !fast_read) { fast_files[current_fast_file_r].readed= 0LL; fast_files[current_fast_file_r].writed= 0LL; fast_files[current_fast_file_r].off_readed= 0LL; fast_files[current_fast_file_r].t_read.fd= -1; fast_files[current_fast_file_r].t_write.fd= -1; if(fast_files[current_fast_file_r].bigfile_mode==1) { DPrintf("Split file >= 4GB\n %s\n", fast_files[current_fast_file_r].pathr); sprintf(&fast_files[current_fast_file_r].pathw[fast_files[current_fast_file_r].pos_path],".666%2.2i", fast_files[current_fast_file_r].number_frag); } if(fast_files[current_fast_file_r].bigfile_mode==2) { DPrintf("Joining file >= 4GB\n %s\n", fast_files[current_fast_file_r].pathw); sprintf(&fast_files[current_fast_file_r].pathr[fast_files[current_fast_file_r].pos_path],".666%2.2i", fast_files[current_fast_file_r].number_frag); } if(cellFsOpen(fast_files[current_fast_file_r].pathr, CELL_FS_O_RDONLY, &fdr, 0,0)!=CELL_FS_SUCCEEDED) { DPrintf("Error Opening (read):\n%s\n\n", fast_files[current_fast_file_r].pathr); error=-1; break; }else files_opened++; if(cellFsOpen(fast_files[current_fast_file_r].pathw, CELL_FS_O_CREAT | CELL_FS_O_TRUNC | CELL_FS_O_WRONLY, &fdw, 0,0)!=CELL_FS_SUCCEEDED) { DPrintf("Error Opening (write):\n%s\n\n", fast_files[current_fast_file_r].pathw); error=-2; break; }else files_opened++; if(fast_files[current_fast_file_r].bigfile_mode==0) { DPrintf("Copying %s\n", fast_files[current_fast_file_r].pathr); file_counter++;} if(fast_files[current_fast_file_r].bigfile_mode) { DPrintf(" -> Split part #%i\n", fast_files[current_fast_file_r].number_frag);} //file_counter++; fast_files[current_fast_file_r].t_read.fd= fdr; fast_files[current_fast_file_r].t_read.offset= 0LL; fast_files[current_fast_file_r].t_read.buf= fast_files[current_fast_file_r].mem; fast_files[current_fast_file_r].t_read.size=fast_files[current_fast_file_r].len-fast_files[current_fast_file_r].readed; if((int64_t) fast_files[current_fast_file_r].t_read.size> fast_files[current_fast_file_r].size_mem) fast_files[current_fast_file_r].t_read.size=fast_files[current_fast_file_r].size_mem; fast_files[current_fast_file_r].t_read.user_data= (uint64_t )&fast_files[current_fast_file_r]; fast_files[current_fast_file_r].t_write.fd= fdw; fast_files[current_fast_file_r].t_write.user_data= (uint64_t )&fast_files[current_fast_file_r]; fast_files[current_fast_file_r].t_write.offset= 0LL; if(fast_files[current_fast_file_r].use_doublebuffer) fast_files[current_fast_file_r].t_write.buf= ((char *) fast_files[current_fast_file_r].mem) + fast_files[current_fast_file_r].size_mem; else fast_files[current_fast_file_r].t_write.buf= fast_files[current_fast_file_r].mem; fast_read=1;fast_files[current_fast_file_r].fl=2; if(cellFsAioRead(&fast_files[current_fast_file_r].t_read, &id_r, fast_func_read)!=0) { id_r=-1; error=-3; DPrintf("Fail to perform Async Read\n\n"); fast_read=0; break; } i_reading=1; } // fast read end if(current_fast_file_r<fast_num_files && fast_files[current_fast_file_r].fl==3 && !fast_writing) { id_r=-1; //fast_read=0; if(fast_files[current_fast_file_r].readed<0LL) { DPrintf("Error Reading %s\n", fast_files[current_fast_file_r].pathr); error=-3; break; } // double buffer if(fast_files[current_fast_file_r].use_doublebuffer) { //DPrintf("Double Buff Write\n"); current_fast_file_w=current_fast_file_r; memcpy(((char *) fast_files[current_fast_file_r].mem)+fast_files[current_fast_file_r].size_mem, fast_files[current_fast_file_r].mem, fast_files[current_fast_file_r].size_mem); fast_files[current_fast_file_w].t_write.size= fast_files[current_fast_file_r].t_read.size; if(fast_files[current_fast_file_w].bigfile_mode==1) fast_files[current_fast_file_w].t_write.offset= (int64_t) fast_files[current_fast_file_w].giga_counter; else fast_files[current_fast_file_w].t_write.offset= fast_files[current_fast_file_w].writed; fast_writing=1; if(cellFsAioWrite(&fast_files[current_fast_file_w].t_write, &id_w, fast_func_write)!=0) { id_w=-1; error=-4; DPrintf("Fail to perform Async Write\n\n"); fast_writing=0; break; } if(fast_files[current_fast_file_r].readed<fast_files[current_fast_file_r].len) { fast_files[current_fast_file_r].t_read.size=fast_files[current_fast_file_r].len-fast_files[current_fast_file_r].readed; if((int64_t) fast_files[current_fast_file_r].t_read.size> fast_files[current_fast_file_r].size_mem) fast_files[current_fast_file_r].t_read.size=fast_files[current_fast_file_r].size_mem; fast_files[current_fast_file_r].fl=2; fast_files[current_fast_file_r].t_read.offset= fast_files[current_fast_file_r].readed-fast_files[current_fast_file_r].off_readed; fast_read=1; if(cellFsAioRead(&fast_files[current_fast_file_r].t_read, &id_r, fast_func_read)!=0) { id_r=-1; error=-3; DPrintf("Fail to perform Async Read\n\n"); fast_read=0; break; } } else { if(fast_files[current_fast_file_r].bigfile_mode==2) { struct stat s; fast_files[current_fast_file_r].number_frag++; fast_files[current_fast_file_r].off_readed= fast_files[current_fast_file_r].readed; DPrintf(" -> .666%2.2i\n", fast_files[current_fast_file_r].number_frag); sprintf(&fast_files[current_fast_file_r].pathr[fast_files[current_fast_file_r].pos_path],".666%2.2i", fast_files[current_fast_file_r].number_frag); /* if(stat(fast_files[current_fast_file_r].pathr, &s)<0) sprintf(&fast_files[current_fast_file_r].pathr[fast_files[current_fast_file_r].pos_path],".%i.part", fast_files[current_fast_file_r].number_frag); */ if(stat(fast_files[current_fast_file_r].pathr, &s)<0) {current_fast_file_r++;i_reading=0;} else { if(fast_files[current_fast_file_r].t_read.fd>=0) {cellFsClose(fast_files[current_fast_file_r].t_read.fd);files_opened--;}fast_files[current_fast_file_r].t_read.fd=-1; if(cellFsOpen(fast_files[current_fast_file_r].pathr, CELL_FS_O_RDONLY, &fdr, 0,0)!=CELL_FS_SUCCEEDED) { DPrintf("Error Opening (read):\n%s\n\n", fast_files[current_fast_file_r].pathr); error=-1; break; }else files_opened++; fast_files[current_fast_file_r].t_read.fd= fdr; fast_files[current_fast_file_r].len += (int64_t) s.st_size; fast_files[current_fast_file_r].t_read.offset= 0LL; fast_files[current_fast_file_r].t_read.buf= fast_files[current_fast_file_r].mem; fast_files[current_fast_file_r].t_read.size=fast_files[current_fast_file_r].len-fast_files[current_fast_file_r].readed; if((int64_t) fast_files[current_fast_file_r].t_read.size> fast_files[current_fast_file_r].size_mem) fast_files[current_fast_file_r].t_read.size=fast_files[current_fast_file_r].size_mem; fast_files[current_fast_file_r].t_read.user_data= (uint64_t )&fast_files[current_fast_file_r]; fast_read=1; if(cellFsAioRead(&fast_files[current_fast_file_r].t_read, &id_r, fast_func_read)!=0) { id_r=-1; error=-3; DPrintf("Fail to perform Async Read\n\n"); fast_read=0; break; } fast_files[current_fast_file_r].fl=2; } } else {fast_files[current_fast_file_r].fl=5;current_fast_file_r++;i_reading=0;} } } else // single buffer { current_fast_file_w=current_fast_file_r; fast_files[current_fast_file_w].t_write.size= fast_files[current_fast_file_r].t_read.size; fast_files[current_fast_file_w].t_write.offset= fast_files[current_fast_file_w].writed; fast_writing=1; if(cellFsAioWrite(&fast_files[current_fast_file_w].t_write, &id_w, fast_func_write)!=0) { id_w=-1; error=-4; DPrintf("Fail to perform Async Write\n\n"); fast_writing=0; break; } current_fast_file_r++; i_reading=0; } } // fast write end if(fast_writing>1) { fast_writing=0; id_w=-1; if(fast_files[current_fast_file_w].writed<0LL) { DPrintf("Error Writing %s\n", fast_files[current_fast_file_w].pathw); error=-4; break; } write_end=fast_files[current_fast_file_w].writed; write_size=fast_files[current_fast_file_w].len; if(fast_files[current_fast_file_w].writed>=fast_files[current_fast_file_w].len) { if(fast_files[current_fast_file_w].t_read.fd>=0) {cellFsClose(fast_files[current_fast_file_w].t_read.fd);files_opened--;}fast_files[current_fast_file_w].t_read.fd=-1; if(fast_files[current_fast_file_w].t_write.fd>=0) {cellFsClose(fast_files[current_fast_file_w].t_write.fd);files_opened--;}fast_files[current_fast_file_w].t_write.fd=-1; cellFsChmod(fast_files[current_fast_file_w].pathw, CELL_FS_S_IFMT | 0777); if(fast_files[current_fast_file_w].bigfile_mode==1) { fast_files[current_fast_file_w].pathw[fast_files[current_fast_file_w].pos_path]=0; } fast_files[current_fast_file_w].fl=4; //end of proccess fast_files[current_fast_file_w].writed=-1LL; current_fast_file_w++; //if(current_fast_file_r<current_fast_file_w) current_fast_file_w=current_fast_file_r; //file_counter++; } else // split big files if(fast_files[current_fast_file_w].bigfile_mode==1 && fast_files[current_fast_file_w].giga_counter>=0x40000000) { if(fast_files[current_fast_file_w].t_write.fd>=0) {cellFsClose(fast_files[current_fast_file_w].t_write.fd);files_opened--;}fast_files[current_fast_file_w].t_write.fd=-1; cellFsChmod(fast_files[current_fast_file_w].pathw, CELL_FS_S_IFMT | 0777); fast_files[current_fast_file_w].giga_counter=0; fast_files[current_fast_file_w].number_frag++; sprintf(&fast_files[current_fast_file_w].pathw[fast_files[current_fast_file_w].pos_path],".666%2.2i", fast_files[current_fast_file_w].number_frag); DPrintf(" -> .666%2.2i\n", fast_files[current_fast_file_w].number_frag); if(cellFsOpen(fast_files[current_fast_file_w].pathw, CELL_FS_O_CREAT | CELL_FS_O_TRUNC | CELL_FS_O_WRONLY, &fdw, 0,0)!=CELL_FS_SUCCEEDED) { DPrintf("Error Opening2 (write):\n%s\n\n", fast_files[current_fast_file_w].pathw); error=-2; break; }else files_opened++; fast_files[current_fast_file_w].t_write.fd=fdw; } } int seconds= (int) (time(NULL)-time_start); int eta=0; lastINC3=0; if(use_symlinks==1 || no_real_progress==1) { eta=(copy_file_counter-file_counter)/(file_counter/seconds); if( ( ((int)(file_counter*100ULL/copy_file_counter)) - lastINC2)>0) { lastINC2=(int) (file_counter*100ULL / copy_file_counter); if(lastINC<lastINC2) {lastINC3=lastINC2-lastINC; lastINC=lastINC2;} // if(lastINC3>0) cellMsgDialogProgressBarInc(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE,lastINC3); } } else { eta=(copy_global_bytes-global_device_bytes)/(global_device_bytes/seconds); if( ( ((int)(global_device_bytes*100ULL/copy_global_bytes)) - lastINC2)>0) { lastINC2=(int) (global_device_bytes*100ULL / copy_global_bytes); if(lastINC<lastINC2) {lastINC3=lastINC2-lastINC; lastINC=lastINC2;} } } if(lastINC3>0 || (time(NULL)-seconds2)!=0 || use_symlinks==1) { if(join_copy==1) sprintf(string1,"Installed %.0f of %.0f MB. Remaining: %i:%2.2i min", ((double) global_device_bytes)/(1024.0*1024.0),((double) copy_global_bytes)/(1024.0*1024.0), (eta/60), eta % 60); else { if(use_symlinks==1) { if(no_real_progress==1) sprintf(string1,"Files linked: %i. Elapsed time: %i:%2.2i min", file_counter, (seconds/60), seconds % 60); else sprintf(string1,"Files linked: %i/%i. Remaining: %i:%2.2i min", file_counter, copy_file_counter, (eta/60), eta % 60); } else { if(no_real_progress==1) sprintf(string1,"Copied %.0f MB (%i of %i files). Elapsed: %2.2i:%2.2i min",((double) global_device_bytes)/(1024.0*1024.0), file_counter+1, copy_file_counter, (seconds/60), seconds % 60); else sprintf(string1,"Copied %.0f / %.0f MB (%i/%i) Remaining: %i:%2.2i min", ((double) global_device_bytes)/(1024.0*1024.0),((double) copy_global_bytes)/(1024.0*1024.0), file_counter+1, copy_file_counter, (eta/60), eta % 60); } } ClearSurface(); draw_square(-1.0f, 1.0f, 2.0f, 2.0f, 0.0f, 0x101010ff); cellDbgFontPrintf( 0.07f, 0.07f, 1.2f, 0xc0c0c0c0, string1); cellDbgFontPrintf( 0.5f-0.15f, 1.0f-0.07*2.0f, 1.2f, 0xc0c0c0c0, "Press /\\ to abort"); if(lastINC3>0) cellMsgDialogProgressBarInc(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE,lastINC3); cellMsgDialogProgressBarSetMsg(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE, string1); cellDbgFontDrawGcm(); seconds2= (int) (time(NULL)); flip(); } pad_read(); if ( new_pad & BUTTON_TRIANGLE ) { abort_copy=1; DPrintf("Copy process aborted by user. \n"); error=-666; break; } } if(error && error!=-666) { DPrintf("Error!\nFiles Opened %i\n Waiting 2 seconds to display fatal error\n", files_opened); ClearSurface(); cellDbgFontPrintf( 0.07f, 0.07f, 1.2f, 0xffffffff, string1); cellDbgFontPrintf( 0.5f-0.15f, 1.0f-0.07*2.0f, 1.2f, 0xffffffff, "Press /\\ to abort"); cellDbgFontDrawGcm(); flip(); sys_timer_usleep(2*1000000); } if(fast_writing==1 && id_w>=0) { cellFsAioCancel(id_w); id_w=-1; sys_timer_usleep(200000); } fast_writing=0; if(fast_read==1 && id_r>=0) { cellFsAioCancel(id_r); id_r=-1; sys_timer_usleep(200000); } fast_read=0; for(n=0;n<fast_num_files;n++) { if(fast_files[n].t_read.fd>=0) { cellFsClose(fast_files[n].t_read.fd);fast_files[n].t_read.fd=-1; files_opened--; } if(fast_files[n].t_write.fd>=0) { cellFsClose(fast_files[n].t_write.fd);fast_files[n].t_write.fd=-1; files_opened--; } if(fast_files[n].mem) free(fast_files[n].mem); fast_files[n].mem=NULL; } fast_num_files=0; fast_writing=0; fast_used_mem=0; current_fast_file_r= current_fast_file_w= 0; if(error) abort_copy=666+100+error; return error; } void file_copy(char *path, char *path2, int progress) { if((strstr(path, "/pvd_usb")!=NULL && !pfs_enabled) || (strstr(path2, "/pvd_usb")!=NULL)) return; if(progress){ ClearSurface(); flip(); ClearSurface(); flip(); } dialog_ret=0; char rdr[255]; time_start=time(NULL); int fs; int fd; uint64_t fsiz = 0; uint64_t msiz = 0; sprintf(rdr, "%s", path); int seconds2=0; char string1[1024]; #if (CELL_SDK_VERSION>0x210001) PFS_HFILE fdr = PFS_FILE_INVALID; if(strstr(path, "/pvd_usb")!=NULL) { if ((fdr = PfsFileOpen(path)) == PFS_FILE_INVALID) return; if (PfsFileGetSizeFromHandle(fdr, &msiz) != 0) { PfsFileClose(fdr); return; } } else #endif { cellFsOpen(path, CELL_FS_O_RDONLY, &fs, NULL, 0); cellFsLseek(fs, 0, CELL_FS_SEEK_END, &msiz); cellFsClose(fs); } // uint64_t chunk = 16*1024; uint64_t chunk = BUF_SIZE; if(msiz<chunk && msiz>0) chunk=msiz; // char w[chunk]; lastINC2=0;lastINC=0; uint64_t written=0; remove(path2); abort_copy=0; #if (CELL_SDK_VERSION>0x210001) fdr = PFS_FILE_INVALID; uint32_t size; if (strstr(path, "/pvd_usb")!=NULL) { if((fdr = PfsFileOpen(path)) == PFS_FILE_INVALID) {return;} } else #endif cellFsOpen(rdr, CELL_FS_O_RDONLY, &fs, NULL, 0); copy_file_counter=1; copy_global_bytes=msiz; lastINC=0; lastINC3=0; lastINC2=0; void* buf = (void *) memalign(128, chunk+16); sprintf(rdr, "%s", path2); cellFsOpen(rdr, CELL_FS_O_CREAT|CELL_FS_O_RDWR|CELL_FS_O_APPEND, &fd, NULL, 0); while(fsiz < msiz && abort_copy==0) { //if(to_reboot) {abort_copy=1; break;} if((fsiz+chunk) > msiz) { chunk = (msiz-fsiz); #if (CELL_SDK_VERSION>0x210001) if (strstr(path, "/pvd_usb")!=NULL) { if(PfsFileRead(fdr, buf, chunk, &size) != 0) {abort_copy=1;break;} } else #endif { if(cellFsRead(fs, (void *)buf, chunk, NULL)!=CELL_FS_SUCCEEDED) {abort_copy=1;break;} } { if(cellFsWrite(fd, (const void *)buf, chunk, &written)!=CELL_FS_SUCCEEDED){abort_copy=1;break;}; if(written!=chunk){abort_copy=1;break;} global_device_bytes+=chunk; break; } } else { #if (CELL_SDK_VERSION>0x210001) if (strstr(path, "/pvd_usb")!=NULL) { if(PfsFileRead(fdr, buf, chunk, &size) != 0) {abort_copy=1;break;} } else #endif { if(cellFsRead(fs, (void *)buf, chunk, NULL)!=CELL_FS_SUCCEEDED){abort_copy=1;break;} } if(cellFsWrite(fd, (const void *)buf, chunk, &written)!=CELL_FS_SUCCEEDED){abort_copy=1;break;} if(written!=chunk){abort_copy=1;break;} fsiz = fsiz + chunk; global_device_bytes=fsiz; } int seconds= (int) (time(NULL)-time_start); lastINC3=0; int eta=(copy_global_bytes-global_device_bytes)/(global_device_bytes/seconds); if( ( ( ((int)(global_device_bytes*100ULL/copy_global_bytes)) - lastINC2)>0 || (time(NULL)-seconds2)>0) && progress!=0) { // sprintf(string1,"%1.3f of %1.3f MB copied (elapsed: %2.2i:%2.2i:%2.2i) Remaining: %imin %2.2isec",((double) global_device_bytes)/(1024.0*1024.0),((double) copy_global_bytes)/(1024.0*1024.0), seconds/3600, (seconds/60) % 60, seconds % 60, (eta/60), eta % 60); sprintf(string1,"Copied %1.2f of %1.2f MB. Remaining: %i:%2.2i min",((double) global_device_bytes)/(1024.0*1024.0),((double) copy_global_bytes)/(1024.0*1024.0), (eta/60), eta % 60); cellMsgDialogProgressBarSetMsg( CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE, string1); lastINC2=(int) (global_device_bytes*100ULL / copy_global_bytes); if(lastINC<lastINC2) {lastINC3=lastINC2-lastINC; lastINC=lastINC2;} if(lastINC3>0) cellMsgDialogProgressBarInc(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE,lastINC3); seconds2= (int) (time(NULL)); flip(); } pad_read(); if ( old_pad & BUTTON_TRIANGLE || new_pad & BUTTON_CIRCLE || dialog_ret==3) {abort_copy=1; new_pad=0; old_pad=0; break;} } cellFsClose(fd); #if (CELL_SDK_VERSION>0x210001) if(strstr(path, "/pvd_usb")==NULL) cellFsClose(fs); else PfsFileClose(fdr); #else cellFsClose(fs); #endif cellFsChmod(rdr, 0666); if( global_device_bytes != copy_global_bytes) abort_copy=1; if(abort_copy==1) remove(path2); if(progress!=0){ cellMsgDialogAbort();sys_timer_usleep(100000); flip(); } free(buf); } void write_last_play( const char *gamebin, const char *path, const char *tname, const char *tid, int dboot) { (void) tid; (void) tname; char last_play[128]; char last_play_dir[128]; char last_play_sfo[128]; char last_play_id[10]; last_play_id[0]=0x42; //B last_play_id[1]=0x4C; //L last_play_id[2]=0x45; //E last_play_id[3]=0x53; //S last_play_id[4]=0x38; last_play_id[5]=0x30; last_play_id[6]=0x36; last_play_id[7]=0x31; last_play_id[8]=0x30; last_play_id[9]=0x00; sprintf(last_play, "/dev_hdd0/game/%s/LASTPLAY.BIN", last_play_id); sprintf(last_play_dir, "/dev_hdd0/game/%s", last_play_id); sprintf(last_play_sfo, "/dev_hdd0/game/%s/PARAM.SFO", last_play_id); if(!exist(last_play_dir)) return; dialog_ret=0; cellMsgDialogOpen2( type_dialog_no, (const char*) STR_LP_DATA, dialog_fun2, (void*)0x0000aaab, NULL ); flipc(60); char org_param_sfo[512], sldir[512];//, dldir[512]; char PIC1[512], PIC0[512], ICON0[512], ICON1_PAM[512], EBOOT[512];; char _PIC1[512], _PIC0[512], _ICON0[512], _ICON1_PAM[512], _EBOOT[512]; if(strstr( gamebin, "/PS3_GAME/")!=NULL){ sprintf( org_param_sfo, "%s/PS3_GAME/PARAM.SFO", path); sprintf( EBOOT, "%s/PS3_GAME/USRDIR/EBOOT.BIN", path); // PIC1.PNG PIC0.PNG ICON0.PNG ICON1.PAM sprintf( PIC0, "%s/PS3_GAME/PIC0.PNG", path); sprintf( PIC1, "%s/PS3_GAME/PIC1.PNG", path); sprintf( ICON0, "%s/PS3_GAME/ICON0.PNG", path); sprintf( ICON1_PAM, "%s/PS3_GAME/ICON1.PAM", path); sprintf (sldir, "%s/PS3_GAME/USRDIR", path); if(dboot&1) { char s_source[512]; char s_destination[512]; sprintf(s_source, "%s/PS3_GAME/TROPDIR", path); sprintf(s_destination, "%s/TROPDIR", last_play_dir); mkdir(s_destination, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(s_destination, 0777); sprintf(s_destination, "%s/TROPDIR", last_play_dir); my_game_copy((char*)s_source, (char*)s_destination); sprintf(s_source, "%s/PS3_GAME/LICDIR/LIC.DAT", path); sprintf(s_destination, "%s/LICDIR", last_play_dir); mkdir(s_destination, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(s_destination, 0777); sprintf(s_destination, "%s/LICDIR/LIC.DAT", last_play_dir); file_copy((char*)s_source, (char*)s_destination, 0); } } else { sprintf( org_param_sfo, "%s/PARAM.SFO", path); sprintf( EBOOT, "%s/USRDIR/EBOOT.BIN", path); sprintf( PIC0, "%s/PIC0.PNG", path); sprintf( PIC1, "%s/PIC1.PNG", path); sprintf( ICON0, "%s/ICON0.PNG", path); sprintf( ICON1_PAM, "%s/ICON1.PAM", path); sprintf (sldir, "%s/USRDIR", path); } /* if(strstr(path, "/dev_hdd0")!=NULL && (c_firmware>3.54f || payload==0)){ //create shadow copy sprintf (dldir, "%s/USRDIR", last_play_dir); use_symlinks=1; my_game_copy(sldir, dldir); } */ sprintf( _PIC0, "%s/PIC0.PNG", last_play_dir); sprintf( _PIC1, "%s/PIC1.PNG", last_play_dir); sprintf( _ICON0, "%s/ICON0.PNG", last_play_dir); sprintf( _EBOOT, "%s/USRDIR/MM_EBOOT.BIN", last_play_dir); sprintf( _ICON1_PAM, "%s/ICON1.PAM", last_play_dir); if(exist(PIC0)) file_copy( PIC0, _PIC0, 0); else remove(_PIC0); if(exist(PIC1)) file_copy( PIC1, _PIC1, 0); else remove(_PIC1); if(exist(EBOOT)) file_copy( EBOOT, _EBOOT, 0); if(exist(ICON0)) file_copy( ICON0, _ICON0, 0); flip(); if(exist(ICON1_PAM)) file_copy( ICON1_PAM, _ICON1_PAM, 0); else remove(_ICON1_PAM); char LASTGAME[512], SELF_NAME[512], SELF_PATH[512], SELF_USBP[16], SELF_BOOT[8]; sprintf(LASTGAME, "%s/LASTPLAY.BIN", last_play_dir); sprintf(SELF_NAME, "SELF=%s", gamebin); sprintf(SELF_PATH, "PATH=%s", path); sprintf(SELF_USBP, "USBP=%i", patchmode); if(c_firmware==3.55f) sprintf(SELF_BOOT, "BOOT=%i", dboot+2); else sprintf(SELF_BOOT, "BOOT=%i", dboot); char CrLf[2]; CrLf [0]=13; CrLf [1]=10; CrLf[2]=0; FILE *fpA; remove(LASTGAME); fpA = fopen ( LASTGAME, "w" ); fputs (SELF_NAME, fpA );fputs ( CrLf, fpA ); fputs (SELF_PATH, fpA );fputs ( CrLf, fpA ); fputs (SELF_USBP, fpA );fputs ( CrLf, fpA ); fputs (SELF_BOOT, fpA );fputs ( CrLf, fpA ); fclose(fpA); flip(); // change_param_sfo_field( last_play_sfo, (char*)"TITLE", tname); flip(); // change_param_sfo_field( last_play_sfo, (char*)"TITLE_ID", tid); flip(); file_copy( org_param_sfo, last_play_sfo, 0); change_param_sfo_field( last_play_sfo, (char*)"CATEGORY", (char*)"HG"); cellMsgDialogAbort(); } void cache_png(char *path, char *title_id) { char src[512], dst[255], tmp1[512], tmp2[512]; if(strstr (title_id, "AVCHD")!=NULL || strstr (title_id,"NO_ID")!=NULL) sprintf(src, "%s/BOOT.PNG", app_usrdir); else sprintf(src, "%s", path); mkdir(cache_dir, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); FILE *fpA; char raw_texture[512]; sprintf(raw_texture, "%s/%s_320.PNG", cache_dir, title_id); if(exist(raw_texture)) return; if(!(strstr (title_id, "AVCHD")!=NULL || strstr (title_id,"NO_ID")!=NULL)) { sprintf(tmp1, "%s", path); tmp1[strlen(tmp1)-9]=0; sprintf(tmp2, "%s/ICON0.PNG", tmp1); sprintf(dst, "%s/%s_320.PNG", cache_dir, title_id); file_copy((char *)tmp2, (char*)dst, 0); } memset(text_bmp, 0x50, FB(1)); if(strstr(path, "/pvd_usb")!=NULL) { sprintf(dst, "%s/%s_1920.PNG", cache_dir, title_id); file_copy((char *)src, (char*)dst, 0); if(strstr(src, "/PIC1.PNG")!=NULL && !exist(dst)) { src[strlen(src)-5]=0x30; file_copy((char *)src, (char*)dst, 0); } if(exist(dst) && strstr(src, "/PIC0.PNG")!=NULL) { load_texture( text_FONT, dst, 1000); put_texture( text_bmp, text_FONT, 1000, 560, 1000, 460, 260, 0, 0); } else load_texture( text_bmp, dst, 1920); //remove(dst); } else { if(strstr(src, "/PIC1.PNG")!=NULL && !exist(src)) { src[strlen(src)-5]=0x30; if(exist(src)) { load_texture( text_FONT, src, 1000); put_texture( text_bmp, text_FONT, 1000, 560, 1000, 460, 260, 0, 0); } else { src[strlen(src)-5]=0x32; if(exist(src)) { load_texture( text_bmp, src, 310); mip_texture( text_FONT, text_bmp, 310, 250, 2); //scale to 620x500 memset(text_bmp, 0x00, FB(1)); put_texture( text_bmp, text_FONT, 620, 500, 620, 650, 290, 0, 0); } else { // goto just_leave; sprintf(src, "%s/AVCHD.JPG", app_usrdir); load_texture( text_bmp, src, 1920); } } } else { if(exist(src)) { sprintf(dst, "%s/%s_1920.PNG", cache_dir, title_id); file_copy((char *)src, (char*)dst, 0); load_texture( text_bmp, dst, 1920); } else memset(text_bmp, 0x50, FB(1)); src[strlen(src)-5]=0x30; if(exist(src)) { // use_png_alpha=1; load_texture( text_FONT, src, 1000); put_texture_with_alpha( text_bmp, text_FONT, 1000, 560, 1000, 640, 380, 0, 0); } } } sprintf(raw_texture, "%s/%s_960.RAW", cache_dir, title_id); remove(raw_texture); /* if(stat(raw_texture, &s3)<0) { blur_texture(text_bmp, 1920, 1080, 0, 0, 1920, 1080, 0, 0, 1, 1); mip_texture( text_FONT, text_bmp, 1920, 1080, -2); //scale to 960x540 blur_texture(text_FONT, 960, 540, 0, 0, 960, 540, 90, 0, 1, 1); fpA = fopen ( raw_texture, "wb" ); fwrite(text_FONT, (960*540*4), 1, fpA); fclose(fpA); } */ sprintf(raw_texture, "%s/%s_640.RAW", cache_dir, title_id); if(!exist(raw_texture)) { //remove(raw_texture); mip_texture( text_FONT, text_bmp, 1920, 1080, -3); //scale to 640x360 fpA = fopen ( raw_texture, "wb" ); fwrite(text_FONT, (640*360*4), 1, fpA); fclose(fpA); } /* sprintf(raw_texture, "%s/%s_480.RAW", cache_dir, title_id); remove(raw_texture); mip_texture( text_FONT, text_bmp, 1920, 1080, -4); //scale to 480x270 fpA = fopen ( raw_texture, "wb" ); fwrite(text_FONT, (480*270*4), 1, fpA); fclose(fpA); */ sprintf(raw_texture, "%s/%s_320.RAW", cache_dir, title_id); if(!exist(raw_texture)) { //remove(raw_texture); mip_texture( text_FONT, text_bmp, 1920, 1080, -6); //scale to 320x180 fpA = fopen ( raw_texture, "wb" ); fwrite(text_FONT, (320*180*4), 1, fpA); fclose(fpA); } sprintf(raw_texture, "%s/%s_240.RAW", cache_dir, title_id); if(!exist(raw_texture)) { //remove(raw_texture); mip_texture( text_FONT, text_bmp, 1920, 1080, -8); //scale to 240x135 fpA = fopen ( raw_texture, "wb" ); fwrite(text_FONT, (240*135*4), 1, fpA); fclose(fpA); } sprintf(raw_texture, "%s/%s_160.RAW", cache_dir, title_id); if(!exist(raw_texture)) { //remove(raw_texture); mip_texture( text_FONT, text_bmp, 1920, 1080, -12); //scale to 160x90 fpA = fopen ( raw_texture, "wb" ); fwrite(text_FONT, (160*90*4), 1, fpA); fclose(fpA); } sprintf(raw_texture, "%s/%s_80.RAW", cache_dir, title_id); if(!exist(raw_texture)) { //remove(raw_texture); mip_texture( text_FONT, text_bmp, 1920, 1080, -24); //scale to 80x45 fpA = fopen ( raw_texture, "wb" ); fwrite(text_FONT, (80*45*4), 1, fpA); fclose(fpA); } //just_leave: return; } static void del_temp(char *path) { DIR *dir; char tr[512]; dir=opendir (path); if(!dir) return; while(1) { struct dirent *entry=readdir (dir); if(!entry) break; if(entry->d_name[0]=='.' && entry->d_name[1]==0) continue; if(entry->d_name[0]=='.' && entry->d_name[1]=='.' && entry->d_name[2]==0) continue; if(!(entry->d_type & DT_DIR)) { sprintf(tr, "%s/%s", path, entry->d_name); remove(tr); } } closedir(dir); return; } #if (CELL_SDK_VERSION>0x210001) static int my_game_test_pfsm(char *path, int to_abort) { PFS_HFIND dir; PFS_FIND_DATA entry; dir = PfsFileFindFirst(path, &entry); if (!dir) return -1; do { if (!strcmp(entry.FileName, ".") || !strcmp(entry.FileName, "..")) continue; if ((entry.FileAttributes & PFS_FIND_DIR)) { char *d1f= (char *) malloc(512); if (!d1f) { PfsFileFindClose(dir); DPrintf("malloc() Error!!!\n\n"); abort_copy = 2; return -1; } sprintf(d1f, "%s/%s", path, entry.FileName); num_directories++; my_game_test_pfsm(d1f, to_abort); free(d1f); } else { PFS_HFILE fdr; uint64_t write_size; sprintf(d1, "%s/%s", path, entry.FileName); if(to_abort!=2){ if ((fdr = PfsFileOpen(d1)) == PFS_FILE_INVALID) { DPrintf("Error Opening (read):\n%s\n\n", d1); abort_copy = 1; PfsFileFindClose(dir); return -1; } PfsFileGetSizeFromHandle(fdr, &write_size); if(write_size>=0x100000000LL) {num_files_big++;} global_device_bytes += write_size; PfsFileClose(fdr); } file_counter++; int seconds= (int) (time(NULL)-time_start); if((seconds>10) && to_abort==1) {abort_copy=1; break;}//if(f) free(f); //file_counter>4000 || pad_read(); if (new_pad & BUTTON_TRIANGLE) { abort_copy = 1; DPrintf("Aborted by user \n"); break; } } pad_read(); if (new_pad & BUTTON_TRIANGLE) { abort_copy = 1; DPrintf("Aborted by user \n"); break; } } while (PfsFileFindNext(dir, &entry) == 0); PfsFileFindClose(dir); return 0; } static int _my_game_copy_pfsm(char *path, char *path2) { PFS_HFIND dir; PFS_FIND_DATA entry; int seconds2=0; dir = PfsFileFindFirst(path, &entry); if (!dir) return -1; do { if (!strcmp(entry.FileName, ".") || !strcmp(entry.FileName, "..")) continue; if ((entry.FileAttributes & PFS_FIND_DIR)) { char *d1f= (char *) malloc(512); char *d2f= (char *) malloc(512); if (!d1f || !d2f) { if (d1f) free(d1f); if (d2f) free(d2f); PfsFileFindClose(dir); DPrintf("malloc() Error!!!\n\n"); abort_copy = 2; return -1; } sprintf(d1f, "%s/%s", path, entry.FileName); sprintf(d2f, "%s/%s", path2, entry.FileName); mkdir(d2f, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); _my_game_copy_pfsm(d1f, d2f); free(d1f); free(d2f); } else { PFS_HFILE fdr; uint64_t write_size, write_end = 0; uint32_t size; int fdw; char *f1 = (char *) malloc(1024); char *f2 = (char *) malloc(1024); if (!f1 || !f2) { if (f1) free(f1); if (f2) free(f2); DPrintf("malloc() Error!!!\n\n"); abort_copy = 2; PfsFileFindClose(dir); return -1; } sprintf(f1, "%s/%s", path, entry.FileName); sprintf(f2, "%s/%s", path2, entry.FileName); char *string1 = (char *) malloc(1024); if (cellFsOpen(f2, CELL_FS_O_CREAT | CELL_FS_O_TRUNC | CELL_FS_O_WRONLY, &fdw, 0, 0) != CELL_FS_SUCCEEDED) { DPrintf("Error Opening (write):\n%s\n\n", f2); abort_copy = 1; free(f1); free(f2); free(string1); PfsFileFindClose(dir); return -1; } if ((fdr = PfsFileOpen(f1)) == PFS_FILE_INVALID) { DPrintf("Error Opening (read):\n%s\n\n", f1); abort_copy = 1; free(f1); free(f2); free(string1); cellFsClose(fdw); PfsFileFindClose(dir); return -1; } PfsFileGetSizeFromHandle(fdr, &write_size); file_counter++; DPrintf("Copying %s\n\n", f1); while (write_end < write_size) { if (PfsFileRead(fdr, buf2, BUF_SIZE2, &size) != 0) { DPrintf("Error Read:\n%s\n\n", f1); abort_copy = 1; } else if (cellFsWrite(fdw, buf2, size, NULL) != CELL_FS_SUCCEEDED) { DPrintf("Error Write:\n%s\n\n", f1); abort_copy = 1; } if (abort_copy) { free(f1); free(f2); cellFsClose(fdw); PfsFileClose(fdr); PfsFileFindClose(dir); free(string1); return -1; } pad_read(); if (new_pad & BUTTON_TRIANGLE) { abort_copy = 1; DPrintf("Aborted by user \n"); break; } global_device_bytes += size; write_end += size; int seconds = (int) (time(NULL) - time_start); int eta=(copy_global_bytes-global_device_bytes)/(global_device_bytes/seconds); lastINC3=0; if(no_real_progress==1) { eta=(copy_file_counter-file_counter)/(file_counter/seconds); if( ( ((int)(file_counter*100ULL/copy_file_counter)) - lastINC2)>0) { lastINC2=(int) (file_counter*100ULL / copy_file_counter); if(lastINC<lastINC2) {lastINC3=lastINC2-lastINC; lastINC=lastINC2;} } } else { if( ( ((int)(global_device_bytes*100ULL/copy_global_bytes)) - lastINC2)>0) { lastINC2=(int) (global_device_bytes*100ULL / copy_global_bytes); if(lastINC<lastINC2) {lastINC3=lastINC2-lastINC; lastINC=lastINC2;} } } if(lastINC3>0) cellMsgDialogProgressBarInc(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE,lastINC3); if(lastINC3>0 || (time(NULL)-seconds2)!=0 ) { if(no_real_progress==1) //sprintf(string1,"Copied %1.2f MB (file %i). Elapsed: %i %2.2i min",((double) global_device_bytes)/(1024.0*1024.0), file_counter, (seconds/60), seconds % 60); sprintf(string1,"Copied %.0f MB (%i of %i files). Elapsed: %i:%2.2i min",((double) global_device_bytes)/(1024.0*1024.0), file_counter, copy_file_counter, (seconds/60), seconds % 60); else sprintf(string1,"Copied %1.2f of %1.2f MB. Remaining: %i:%2.2i min",((double) global_device_bytes)/(1024.0*1024.0),((double) copy_global_bytes)/(1024.0*1024.0), (eta/60), eta % 60); cellMsgDialogProgressBarSetMsg(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE, string1); ClearSurface(); draw_square(-1.0f, 1.0f, 2.0f, 2.0f, 0.0f, 0x101010ff); cellDbgFontPrintf( 0.07f, 0.07f, 1.2f, 0xc0c0c0c0, string1); cellDbgFontPrintf( 0.5f-0.15f, 1.0f-0.07*2.0f, 1.2f, 0xc0c0c0c0, "Press /\\ to abort"); cellDbgFontDrawGcm(); seconds2= (int) (time(NULL)); flip(); } } cellFsClose(fdw); cellFsChmod(f2, CELL_FS_S_IFMT | 0777); PfsFileClose(fdr); free(f1); free(f2); free(string1); } if (abort_copy) break; pad_read(); if (new_pad & BUTTON_TRIANGLE) { abort_copy = 1; DPrintf("Aborted by user \n"); break; } } while (PfsFileFindNext(dir, &entry) == 0); PfsFileFindClose(dir); return 0; } int my_game_copy_pfsm(char *path, char *path2) { global_device_bytes=0x00ULL; lastINC=0, lastINC3=0, lastINC2=0; BUF_SIZE2=(MAX_FAST_FILES)*MAX_FAST_FILE_SIZE; buf2 = (u8*)memalign(128, BUF_SIZE2); _my_game_copy_pfsm(path, path2); free(buf2); return 0; } #endif static int _my_game_copy(char *path, char *path2) { DIR *dir; dir=opendir (path); if(!dir) {abort_copy=7;return -1;} while(1) { //if(to_reboot) {abort_copy=1; break;} struct dirent *entry=readdir (dir); if(!entry) break; if(entry->d_name[0]=='.' && entry->d_name[1]==0) continue; if(entry->d_name[0]=='.' && entry->d_name[1]=='.' && entry->d_name[2]==0) continue; if((entry->d_type & DT_DIR)) { if(abort_copy) break; char *d1f= (char *) malloc(512); char *d2f= (char *) malloc(512); if(!d1f || !d2f) {if(d1f) free(d1f); if(d2f) free(d2f);closedir (dir);DPrintf("malloc() Error!!!\n\n");abort_copy=2;return -1;} sprintf(d1f,"%s/%s", path, entry->d_name); sprintf(d2f,"%s/%s", path2, entry->d_name); mkdir(path2, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); mkdir(d2f, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); _my_game_copy(d1f, d2f); free(d1f);free(d2f); if(abort_copy) break; } else { // char *d1= (char *) malloc(512); // char *d2= (char *) malloc(512); sprintf(d1,"%s/%s", path, entry->d_name); sprintf(d2,"%s/%s", path2, entry->d_name); if(use_symlinks==1) { if(strstr(d1, "/dev_hdd0/game/")!=NULL && strstr(d2, "/dev_hdd0/G/")!=NULL) { if(strstr(entry->d_name, "MM_NPDRM_")!=NULL) { sprintf(d1, "%s", entry->d_name); sprintf(d2, "%s/%s", path2, d1+9); sprintf(d1, "%s/%s", path, entry->d_name); remove(d2); rename(d1, d2); } file_counter++; } else { if(strstr(entry->d_name, ".PNG")==NULL && strstr(entry->d_name, "ICON1")==NULL && strstr(entry->d_name, "PIC1")==NULL && strstr(entry->d_name, ".PAM")==NULL && strstr(entry->d_name, "SND0.AT3")==NULL && strstr(entry->d_name, "ICON0")==NULL && strstr(entry->d_name, "PIC0")==NULL) { // if(strstr(entry->d_name, "EBOOT.BIN")!=NULL) sprintf(d2,"%s/MM_EBOOT.BIN", path2); // else if(strstr(entry->d_name, ".self")!=NULL) sprintf(d2,"%s/MM_%s", path2, entry->d_name); if(strstr(entry->d_name, "EBOOT.BIN")==NULL && strstr(entry->d_name, ".SELF")==NULL && strstr(entry->d_name, ".self")==NULL && strstr(entry->d_name, ".SPRX")==NULL && strstr(entry->d_name, ".sprx")==NULL && strstr(entry->d_name, "PARAM.SFO")==NULL) { unlink(d2); remove(d2); link(d1, d2); } file_counter++; } else { if(fast_copy_add(path, path2, entry->d_name)<0) {abort_copy=666; closedir(dir);return -1;} } } } else { if(join_copy==0 || (join_copy==1 && strstr(entry->d_name, ".666")!=NULL)) { if(strstr(entry->d_name, ".66600")!=NULL && max_joined<10) { sprintf(file_to_join[max_joined].split_file, "%s/%s", path2, entry->d_name); file_to_join[max_joined].split_file[strlen(file_to_join[max_joined].split_file)-6]=0; max_joined++; } if(fast_copy_add(path, path2, entry->d_name)<0) {abort_copy=666; closedir(dir);return -1;}//free(d1);free(d2); } } // free(d1);free(d2); } if(abort_copy) break; } closedir(dir); if(abort_copy) return -1; return 0; } // test if files >= 4GB int my_game_test(char *path, int to_abort) { struct stat s3; #if (CELL_SDK_VERSION>0x210001) if(strstr (path,"/pvd_usb")!=NULL && pfs_enabled) { my_game_test_pfsm(path, to_abort); return 0; } #endif DIR *dir; if(abort_copy==1) return -1; dir=opendir (path); if(!dir) return -1; while(1) { struct dirent *entry=readdir (dir); if(!entry) break; if(entry->d_name[0]=='.' && entry->d_name[1]==0) continue; if(entry->d_name[0]=='.' && entry->d_name[1]=='.' && entry->d_name[2]==0) continue; if((entry->d_type & DT_DIR)) { char *d1f= (char *) malloc(512); num_directories++; if(!d1f) {closedir (dir);abort_copy=2;return -1;} sprintf(d1f,"%s/%s", path, entry->d_name); my_game_test((char*)d1f, to_abort); free(d1f); if(abort_copy) break; } else { // char *f= (char *) malloc(512); // struct stat s; // off64_t size=0LL; // if(!f) {abort_copy=2;closedir (dir);return -1;} sprintf(df,"%s/%s", path, entry->d_name); if(strlen(entry->d_name)>6 && to_abort!=3) { char *p= df; p+= strlen(df)-6; // adjust for .666xx if(p[0]== '.' && p[1]== '6' && p[2]== '6' && p[3]== '6') { num_files_split++; if(p[4]=='0' && p[5]=='0') num_files_big++; if(to_abort==2 || join_copy==1) { if(stat(df, &s3)>=0) { if(s3.st_size>=0x100000000LL) num_files_big++; global_device_bytes+=s3.st_size; } if(strstr(df, ".66600")!=NULL && join_copy==1 && max_joined<10) { sprintf(file_to_join[max_joined].split_file, "%s", df); file_to_join[max_joined].split_file[strlen(file_to_join[max_joined].split_file)-6]=0; max_joined++; //abort_copy=1; break; } if(to_abort==2 && join_copy==0) {abort_copy=1; break;} } } } if(to_abort!=2 && to_abort!=3 && join_copy==0){ if(stat(df, &s3)<0) {abort_copy=3;break;}//if(f) free(f);break;} if(s3.st_size>=0x100000000LL) num_files_big++; global_device_bytes+=s3.st_size; } file_counter++; int seconds= (int) (time(NULL)-time_start); if((seconds>10) && to_abort==1) {abort_copy=1; break;}//if(f) free(f); //file_counter>4000 || pad_read(); if (new_pad & BUTTON_TRIANGLE) abort_copy=1; if(abort_copy) break; } } closedir (dir); return 0; } int my_game_copy(char *path, char *path2) { int ret3, flipF; disable_sc36(); char string1[1024]; if(progress_bar==1) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_no, "Verifying source data, please wait...", dialog_fun2, (void*)0x0000aaab, NULL ); flipc(60); } else { for(flipF = 0; flipF<60; flipF++) { sprintf(string1, "Preparing, please wait!");ClearSurface(); cellDbgFontPrintf( 0.3f, 0.45f, 0.8f, 0xc0c0c0c0, string1); cellDbgFontDrawGcm(); flip(); } } file_counter=0; global_device_bytes=0ULL;abort_copy=0; #if (CELL_SDK_VERSION>0x210001) if(strstr (path,"/pvd_usb")!=NULL && pfs_enabled) { my_game_test_pfsm(path, 1); if(abort_copy==1) { abort_copy=0; file_counter=0; my_game_test_pfsm(path, 2); abort_copy=1; } } else #endif { abort_copy=0; if(strstr(path,"/dev_hdd0")!=NULL) my_game_test(path, 0); else { max_joined=0; time_start= time(NULL); my_game_test(path, 1); if(abort_copy==1) { abort_copy=0; file_counter=0; max_joined=0; time_start= time(NULL); my_game_test(path, 3); abort_copy=1; } } } if(progress_bar==1) cellMsgDialogAbort(); char just_drive[16]; just_drive[0]=0; char *pathpos=strchr(path2+1,'/'); if(pathpos!=NULL) { strncpy(just_drive, path2, 15); just_drive[pathpos-path2]=0; } else sprintf(just_drive, "%s", path2); cellFsGetFreeSize(just_drive, &blockSize, &freeSize); freeSpace = ( (uint64_t) (blockSize * freeSize) ); if((uint64_t)global_device_bytes>(uint64_t)freeSpace && use_symlinks!=1 && freeSpace!=0) { sprintf(string1, (const char*) STR_ERR_NOSPACE1, (double) ((freeSpace)/1048576.00f), (double) ((global_device_bytes-freeSpace)/1048576.00f) ); dialog_ret=0;cellMsgDialogOpen2( type_dialog_ok, string1, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); abort_copy=1; goto return_error; } copy_file_counter=file_counter; if(copy_file_counter==0) copy_file_counter=1; file_counter=0; copy_global_bytes=global_device_bytes; lastINC=0; lastINC3=0; lastINC2=0; if(join_copy==1) sprintf(string1, "%s", STR_COPY3); else { if(abort_copy==1) sprintf(string1, (const char*) STR_COPY1, copy_file_counter); else { if(use_symlinks==1) sprintf(string1, (const char*) STR_COPY2, copy_file_counter, (double)(copy_global_bytes/(1024.0*1024.0*1024.0))); else sprintf(string1, (const char*)STR_COPY0, copy_file_counter, (double)(copy_global_bytes/(1024.0*1024.0*1024.0))); } } if(progress_bar==1) // && abort_copy==0 { ret3=cellMsgDialogOpen2(CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL |CELL_MSGDIALOG_TYPE_BUTTON_TYPE_NONE |CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_OFF |CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NONE |CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE, string1, NULL, NULL, NULL); flipc(60); } no_real_progress=0; if(abort_copy==1) no_real_progress=1; abort_copy=0; global_device_bytes=0; time_start= time(NULL); #if (CELL_SDK_VERSION>0x210001) if(strstr (path,"/pvd_usb")!=NULL && pfs_enabled){ my_game_copy_pfsm(path, path2); } else #endif { if(fast_copy_async(path, path2, 1)<0) {abort_copy=665;goto return_error;}//ret3=cellMsgDialogAbort(); int ret=_my_game_copy(path, path2); int ret2= fast_copy_process(); fast_copy_async(path, path2, 0); if(ret<0 || ret2<0) goto return_error; } join_copy=0; if(progress_bar==1) cellMsgDialogClose(60.0f);//cellMsgDialogAbort(); enable_sc36(); flip(); return 0; return_error: join_copy=0; if(progress_bar==1) cellMsgDialogClose(60.0f); //cellMsgDialogAbort(); enable_sc36(); flip(); return -1; } int my_game_delete(char *path) { DIR *dir; // char *f= NULL; char string1[1024]; dir=opendir (path); if(!dir) return -1; while(1) { struct dirent *entry=readdir (dir); if(!entry) break; if(entry->d_name[0]=='.' && entry->d_name[1]==0) continue; if(entry->d_name[0]=='.' && entry->d_name[1]=='.' && entry->d_name[2]==0) continue; if((entry->d_type & DT_DIR)) { char *f= (char *) malloc(512); if(!f) {closedir (dir);DPrintf("malloc() Error!!!\n\n");abort_copy=2;return -1;} sprintf(f,"%s/%s", path, entry->d_name); my_game_delete(f); // DPrintf("Deleting <%s>\n\n", path); if(rmdir(f)) {abort_copy=3;DPrintf("Delete error!\n -> <%s>\n\n", entry->d_name);}//break; if(d1) free(d1); free(f); if(abort_copy) break; file_counter--; goto display_message; } else { // f=(char *) malloc(512); // if(!f) {DPrintf("malloc() Error!!!\n\n");abort_copy=2;closedir (dir);return -1;} sprintf(df,"%s/%s", path, entry->d_name); remove(df);//if(remove(f)) {abort_copy=3;DPrintf("Delete error!\n -> %s\n\n", f);break;} //if(f) free(f); // free(f); // DPrintf("Deleted: %s\n\n", f); // if(f) free(f); display_message: int seconds= (int) (time(NULL)-time_start); file_counter++; if(file_counter % 32==0) { sprintf(string1,"Deleting files: %i [Elapsed: %2.2i:%2.2i:%2.2i]\n", file_counter, seconds/3600, (seconds/60) % 60, seconds % 60); ClearSurface(); // draw_square(-1.0f, 1.0f, 2.0f, 2.0f, 0.0f, 0x200020ff); cellDbgFontPrintf( 0.07f, 0.07f, 1.2f, 0xc0c0c0c0, string1); cellDbgFontPrintf( 0.5f-0.15f, 1.0f-0.07*2.0f, 1.2f, 0xc0c0c0c0, "Hold /\\ to Abort"); cellDbgFontDrawGcm(); flip(); } pad_read(); if (new_pad & BUTTON_TRIANGLE) abort_copy=1; if(abort_copy) break; } } closedir (dir); return 0; } static int _copy_nr(char *path, char *path2, char *path_name) { DIR *dir; dir=opendir (path); if(!dir) return -1; while(1) { struct dirent *entry=readdir (dir); if(!entry) break; if(entry->d_name[0]=='.' && entry->d_name[1]==0) continue; if(entry->d_name[0]=='.' && entry->d_name[1]=='.' && entry->d_name[2]==0) continue; if((entry->d_type & DT_DIR)) { if(abort_copy) break; char *f= (char *) malloc(512); if(!d1) {closedir (dir); abort_copy=2; return -1;} sprintf(f,"%s/%s", path, entry->d_name); _copy_nr(f, path2, path_name); free(f); if(abort_copy) break; } else { int seconds2= (int) (time(NULL)); char rdr[255], pathTO[512]; int fs; int fd; uint64_t fsiz = 0; uint64_t msiz = 0; sprintf(rdr, "%s/%s", path, entry->d_name); sprintf(pathTO, "%s/%s", path2, entry->d_name); cellFsOpen(rdr, CELL_FS_O_RDONLY, &fs, NULL, 0); cellFsLseek(fs, 0, CELL_FS_SEEK_END, &msiz); cellFsClose(fs); uint64_t chunk = 16*1024; if(msiz<chunk && msiz>0) chunk=msiz; if(msiz<1) continue; char w[chunk]; uint64_t written=0; cellFsOpen(rdr, CELL_FS_O_RDONLY, &fs, NULL, 0); remove(pathTO); abort_copy=0; lastINC3=0; lastINC=lastINC2; cellFsOpen(pathTO, CELL_FS_O_CREAT|CELL_FS_O_RDWR|CELL_FS_O_APPEND, &fd, NULL, 0); char *string1= (char *) malloc(512); while(fsiz < msiz && abort_copy==0) { if((fsiz+chunk) > msiz) { chunk = (msiz-fsiz); char x[chunk]; cellFsLseek(fs,fsiz,CELL_FS_SEEK_SET, NULL); if(cellFsRead(fs, (void *)x, chunk, NULL)!=CELL_FS_SUCCEEDED) {abort_copy=1;break;} else { if(cellFsWrite(fd, (const void *)x, chunk, &written)!=CELL_FS_SUCCEEDED){abort_copy=1;break;}; if(written!=chunk){abort_copy=1;break;} global_device_bytes+=chunk; break; } } else { cellFsLseek(fs,fsiz,CELL_FS_SEEK_SET, NULL); if(cellFsRead(fs, (void *)w, chunk, NULL)!=CELL_FS_SUCCEEDED){abort_copy=1;break;}; if(cellFsWrite(fd, (const void *)w, chunk, &written)!=CELL_FS_SUCCEEDED){abort_copy=1;break;}; if(written!=chunk){abort_copy=1;break;} fsiz = fsiz + chunk; global_device_bytes+=chunk; } int seconds= (int) (time(NULL)-time_start); int eta=(copy_global_bytes-global_device_bytes)/(global_device_bytes/seconds); lastINC3=0; if( ( ((int)(global_device_bytes*100ULL/copy_global_bytes)) - lastINC2)>0) { lastINC2=(int) (global_device_bytes*100ULL / copy_global_bytes); if(lastINC<lastINC2) {lastINC3=lastINC2-lastINC; lastINC=lastINC2;} if(lastINC3>0) cellMsgDialogProgressBarInc(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE,lastINC3); } if(lastINC3>0 || (time(NULL)-seconds2)!=0 ) { if(no_real_progress==1) sprintf(string1,"Copied %1.2fMB. Elapsed time: %i:%2.2i min",((double) global_device_bytes)/(1024.0*1024.0), (seconds/60), seconds % 60); else sprintf(string1,"Copied %1.2f of %1.2f MB. Remaining: %i:%2.2i min",((double) global_device_bytes)/(1024.0*1024.0),((double) copy_global_bytes)/(1024.0*1024.0), (eta/60), eta % 60); cellMsgDialogProgressBarSetMsg(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE, string1); ClearSurface(); draw_square(-1.0f, 1.0f, 2.0f, 2.0f, 0.0f, 0x101010ff); cellDbgFontPrintf( 0.07f, 0.07f, 1.2f, 0xc0c0c0c0, string1); cellDbgFontPrintf( 0.5f-0.15f, 1.0f-0.07*2.0f, 1.2f, 0xc0c0c0c0, "Press /\\ to abort"); cellDbgFontDrawGcm(); flip(); seconds2= (int) (time(NULL)); } pad_read(); if ( old_pad & BUTTON_TRIANGLE || new_pad & BUTTON_CIRCLE) {abort_copy=1; new_pad=0; old_pad=0; break;} } free(string1); cellFsClose(fd); cellFsClose(fs); cellFsChmod(pathTO, 0666); if(abort_copy) break; } } closedir(dir); if(abort_copy) return -1; return 0; } int copy_nr(char *path, char *path_new, char *path_name) // recursive to single folder copy { int ret3; char path2[512]; char string1[1024]; if(strstr(path_new,"/ps3_home/video")!=NULL || strstr(path_new,"/ps3_home/music")!=NULL || strstr(path_new,"/ps3_home/photo")!=NULL) { sprintf(path2, "%s", app_temp); del_temp(app_temp); } else sprintf(path2, "%s", path_new); sprintf(string1, "Preparing, please wait!"); ClearSurface(); cellDbgFontPrintf( 0.3f, 0.45f, 0.8f, 0xc0c0c0c0, string1); cellDbgFontDrawGcm(); flip(); file_counter=0; global_device_bytes=0;abort_copy=0; if(strstr(path,"/dev_hdd0")!=NULL) my_game_test(path, 0); else my_game_test(path, 1); copy_file_counter=file_counter; copy_global_bytes=global_device_bytes; lastINC=0; lastINC3=0; lastINC2=0; if(abort_copy==1) sprintf(string1, (const char*)STR_COPY4, copy_file_counter, (double)(copy_global_bytes/(1024.0*1024.0*1024.0))); else sprintf(string1, (const char*)STR_COPY0, copy_file_counter, (double)(copy_global_bytes/(1024.0*1024.0*1024.0))); ret3=cellMsgDialogOpen2( CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL |CELL_MSGDIALOG_TYPE_BUTTON_TYPE_NONE |CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_OFF |CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NONE |CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE, string1, NULL, NULL, NULL); flip(); no_real_progress=0; if(abort_copy==1) no_real_progress=1; abort_copy=0; global_device_bytes=0; lastINC=0; lastINC3=0; lastINC2=0; time_start= time(NULL); file_counter=0; _copy_nr((char*)path, (char*)path2, (char*)path_name); ret3=cellMsgDialogAbort(); flip(); if(strstr(path_new, "/ps3_home")!=NULL) { DIR *dir; char tr[512]; int n=0; for (n=0;n<256;n++ ) { dir=opendir (app_temp); if(!dir) return -1; while(1) { struct dirent *entry=readdir (dir); if(!entry) break; if(!(entry->d_type & DT_DIR)) { sprintf(tr, "%s", entry->d_name); cellDbgFontDrawGcm(); ClearSurface(); set_texture( text_FMS, 1920, 48); display_img(0, 47, 1920, 60, 1920, 48, -0.15f, 1920, 48); display_img(0, 952, 1920, 76, 1920, 48, -0.15f, 1920, 48);time ( &rawtime ); timeinfo = localtime ( &rawtime ); cellDbgFontPrintf( 0.83f, 0.895f, 0.7f ,0xc0a0a0a0, "%02d/%02d/%04d\n %s:%02d:%02d ", timeinfo->tm_mday, timeinfo->tm_mon+1, timeinfo->tm_year+1900, tmhour(timeinfo->tm_hour), timeinfo->tm_min, timeinfo->tm_sec); set_texture( text_bmpIC, 320, 320); display_img(800, 200, 320, 176, 320, 176, 0.0f, 320, 320); if((strstr(tr, ".avi")!=NULL || strstr(tr, ".AVI")!=NULL || strstr(tr, ".m2ts")!=NULL || strstr(tr, ".M2TS")!=NULL || strstr(tr, ".mts")!=NULL || strstr(tr, ".MTS")!=NULL || strstr(tr, ".m2t")!=NULL || strstr(tr, ".M2T")!=NULL || strstr(tr, ".divx")!=NULL || strstr(tr, ".DIVX")!=NULL || strstr(tr, ".mpg")!=NULL || strstr(tr, ".MPG")!=NULL || strstr(tr, ".mpeg")!=NULL || strstr(tr, ".MPEG")!=NULL || strstr(tr, ".mp4")!=NULL || strstr(tr, ".MP4")!=NULL || strstr(tr, ".vob")!=NULL || strstr(tr, ".VOB")!=NULL || strstr(tr, ".wmv")!=NULL || strstr(tr, ".WMV")!=NULL || strstr(tr, ".ts")!=NULL || strstr(tr, ".TS")!=NULL || strstr(tr, ".mov")!=NULL || strstr(tr, ".MOV")!=NULL) ) { cellDbgFontPrintf( 0.35f, 0.45f, 0.8f, 0xc0c0c0c0, "Adding files to video library...\n\nPlease wait!\n\n[ %s ]",tr); cellDbgFontDrawGcm(); flip(); video_export(tr, path_name, 0); } if(strstr(tr, ".mp3")!=NULL || strstr(tr, ".MP3")!=NULL || strstr(tr, ".wav")!=NULL || strstr(tr, ".WAV")!=NULL || strstr(tr, ".aac")!=NULL || strstr(tr, ".AAC")!=NULL) { cellDbgFontPrintf( 0.35f, 0.45f, 0.8f, 0xc0c0c0c0, "Adding files to music library...\n\nPlease wait!\n\n[ %s ]",tr); cellDbgFontDrawGcm(); flip(); music_export(tr, path_name, 0); } if(strstr(tr, ".jpg")!=NULL || strstr(tr, ".JPG")!=NULL || strstr(tr, ".jpeg")!=NULL || strstr(tr, ".JPEG")!=NULL || strstr(tr, ".png")!=NULL || strstr(tr, ".PNG")!=NULL) { cellDbgFontPrintf( 0.35f, 0.45f, 0.8f, 0xc0c0c0c0, "Adding files to photo library...\n\nPlease wait!\n\n[ %s ]",tr); cellDbgFontDrawGcm(); flip(); photo_export(tr, path_name, 0); } sprintf(tr, "%s/%s", app_temp, entry->d_name); if(exist(tr)) remove(tr); } } closedir(dir); } video_finalize(); music_finalize(); photo_finalize(); del_temp(app_temp); } return 0; } void open_osk(int for_what, char *init_text) { char orig[512]; if(for_what==1) sprintf(orig, (const char*) STR_RENAMETO, init_text); if(for_what==2) sprintf(orig, "%s", (const char*) STR_CREATENEW); if(for_what==3) sprintf(orig, "%s", init_text); if(for_what==4) sprintf(orig, "%s", init_text); wchar_t my_message[((strlen(orig) + 1)*2)]; mbstowcs(my_message, orig, (strlen(orig) + 1)); wchar_t INIT_TEXT[((strlen(init_text) + 1)*2)]; mbstowcs(INIT_TEXT, init_text, (strlen(init_text) + 1)); if(for_what==2 || for_what==3) INIT_TEXT[0]=0; inputFieldInfo.message = (uint16_t*)my_message; inputFieldInfo.init_text = (uint16_t*)INIT_TEXT; inputFieldInfo.limit_length = 128; CellOskDialogPoint pos; pos.x = 0.0; pos.y = 0.5; int32_t LayoutMode = CELL_OSKDIALOG_LAYOUTMODE_X_ALIGN_CENTER; CellOskDialogParam dialogParam; if(for_what==3) { inputFieldInfo.limit_length = 4; cellOskDialogSetKeyLayoutOption (CELL_OSKDIALOG_10KEY_PANEL); cellOskDialogAddSupportLanguage (CELL_OSKDIALOG_PANELMODE_PASSWORD | CELL_OSKDIALOG_PANELMODE_NUMERAL); dialogParam.allowOskPanelFlg = ( CELL_OSKDIALOG_PANELMODE_NUMERAL | CELL_OSKDIALOG_PANELMODE_PASSWORD); dialogParam.firstViewPanel = CELL_OSKDIALOG_PANELMODE_NUMERAL; } else { cellOskDialogSetKeyLayoutOption (CELL_OSKDIALOG_10KEY_PANEL | CELL_OSKDIALOG_FULLKEY_PANEL); cellOskDialogAddSupportLanguage (CELL_OSKDIALOG_PANELMODE_ALPHABET | CELL_OSKDIALOG_PANELMODE_NUMERAL | CELL_OSKDIALOG_PANELMODE_ENGLISH | CELL_OSKDIALOG_PANELMODE_DEFAULT | CELL_OSKDIALOG_PANELMODE_SPANISH | CELL_OSKDIALOG_PANELMODE_FRENCH | CELL_OSKDIALOG_PANELMODE_RUSSIAN | CELL_OSKDIALOG_PANELMODE_JAPANESE | CELL_OSKDIALOG_PANELMODE_CHINA_TRADITIONAL); dialogParam.allowOskPanelFlg = (CELL_OSKDIALOG_PANELMODE_ALPHABET | CELL_OSKDIALOG_PANELMODE_NUMERAL | CELL_OSKDIALOG_PANELMODE_ENGLISH | CELL_OSKDIALOG_PANELMODE_DEFAULT | CELL_OSKDIALOG_PANELMODE_SPANISH | CELL_OSKDIALOG_PANELMODE_FRENCH | CELL_OSKDIALOG_PANELMODE_RUSSIAN | CELL_OSKDIALOG_PANELMODE_JAPANESE | CELL_OSKDIALOG_PANELMODE_CHINA_TRADITIONAL); dialogParam.firstViewPanel = CELL_OSKDIALOG_PANELMODE_ALPHABET_FULL_WIDTH; } cellOskDialogSetLayoutMode( LayoutMode ); dialogParam.controlPoint = pos; dialogParam.prohibitFlgs = CELL_OSKDIALOG_NO_RETURN; cellOskDialogSetInitialInputDevice(CELL_OSKDIALOG_INPUT_DEVICE_PAD ); osk_dialog=0; cellOskDialogLoadAsync(memory_container, &dialogParam, &inputFieldInfo); osk_open=for_what; }; //register photo void cb_export_finish_p( int result, void *userdata) //export callback { // int callback_type = (int)userdata; (void) userdata; // sprintf(filename, "CALLBACK [%i]", result ); dialog_ret=0;cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); pe_result = result; sys_timer_usleep (1000 * 1000); } void cb_export_finish2_p( int result, void *userdata) { pe_result = result; (void) userdata; } int photo_initialize( void ) { int ret = 0; int callback_type = CALLBACK_TYPE_INITIALIZE; if(pe_initialized==0) ret = cellSysmoduleLoadModule(CELL_SYSMODULE_PHOTO_EXPORT); ret = cellPhotoExportInitialize( CELL_PHOTO_EXPORT_UTIL_VERSION_CURRENT, memory_container, cb_export_finish2_p, (void*)callback_type ); return ret; } int photo_register( int callback_type, char* filenape_v, const char* album) { // sprintf(filename, "REGISTER INITATED [%s] [%s]", filenape_v, album ); dialog_ret=0;cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); int ret = 0; int fnl = strlen(filenape_v); char filenape_v2[256]; char temp_vf[256], temp_vf2[256], temp_vf0[256]; sprintf(temp_vf0, "%s", "PEXPORT.ext"); temp_vf0[10]=filenape_v[fnl-1]; temp_vf0[ 9]=filenape_v[fnl-2]; temp_vf0[ 8]=filenape_v[fnl-3]; temp_vf0[ 7]=filenape_v[fnl-4]; if(temp_vf0[7]==0x2e && temp_vf0[6]==0x2e) temp_vf0[6]=0x54; if(temp_vf0[10]==0x20) temp_vf0[10]=0x00; sprintf(temp_vf, "%s/%s", app_temp, temp_vf0); remove(temp_vf); sprintf(temp_vf2, "%s/%s", app_temp, filenape_v); rename(temp_vf2, temp_vf); CellPhotoExportSetParam param; sprintf(filenape_v2, "%s", filenape_v); filenape_v2[128]=0; char *pch=filenape_v2; char *pathpos=strrchr(pch,'.'); if(pathpos!=NULL) filenape_v2[pathpos-pch]=0; //remove extension param.photo_title = (char*)filenape_v2; param.game_title = (char*)album; param.game_comment = (char*)"Transferred by multiMAN"; param.reserved = NULL; ret = cellPhotoExportFromFile( app_temp, temp_vf0,//filenape_v &param, cb_export_finish2_p, (void*)callback_type ); return ret; } int photo_finalize( void ) { int ret = 0; int callback_type = CALLBACK_TYPE_FINALIZE; if(pe_initialized==1) ret = cellPhotoExportFinalize( cb_export_finish_p, (void*)callback_type ); pe_initialized=0; return ret; } void photo_export( char *filenape_v, char *album, int to_unregister ) { int ret = 0; pe_result = 0xDEAD; if(pe_initialized==0) { ret = photo_initialize(); while (1) { if(pe_result < 1) break; if(pe_result == CELL_PHOTO_EXPORT_UTIL_RET_OK || pe_result == CELL_PHOTO_EXPORT_UTIL_RET_CANCEL || pe_result == CELL_OK) break; } if(pe_result != CELL_PHOTO_EXPORT_UTIL_RET_CANCEL) pe_initialized=1; } if(pe_result == CELL_PHOTO_EXPORT_UTIL_RET_OK || pe_result == CELL_OK || pe_result==0 || pe_initialized==1) { const int callback_type1 = CALLBACK_TYPE_REGIST_1; pe_result = 0xDEAD; ret = photo_register(callback_type1, filenape_v, album); // else { while (1) { if(pe_result < 1) break; if(pe_result == CELL_PHOTO_EXPORT_UTIL_RET_OK || pe_result == CELL_PHOTO_EXPORT_UTIL_RET_CANCEL || pe_result == CELL_OK) break; sys_timer_usleep (500 * 1000); // flip(); } } if(to_unregister==1) { pe_result = 0xDEAD; ret = photo_finalize(); while (1) { if(pe_result < 1) break; if(pe_result == CELL_PHOTO_EXPORT_UTIL_RET_OK || pe_result == CELL_PHOTO_EXPORT_UTIL_RET_CANCEL || pe_result == CELL_OK) break; sys_timer_usleep (50 * 1000); // flip(); } } } } //register music void cb_export_finish_m( int result, void *userdata) //export callback { // int callback_type = (int)userdata; (void) userdata; // sprintf(filename, "CALLBACK [%i]", result ); dialog_ret=0;cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); me_result = result; sys_timer_usleep (1000 * 1000); } void cb_export_finish2_m( int result, void *userdata) { me_result = result; (void) userdata; } int music_initialize( void ) { int ret = 0; int callback_type = CALLBACK_TYPE_INITIALIZE; if(me_initialized==0) ret = cellSysmoduleLoadModule(CELL_SYSMODULE_MUSIC_EXPORT); ret = cellMusicExportInitialize( CELL_MUSIC_EXPORT_UTIL_VERSION_CURRENT, memory_container, cb_export_finish2_m, (void*)callback_type ); return ret; } int music_register( int callback_type, char* filename_v, const char* album) { // sprintf(filename, "REGISTER INITATED [%s] [%s]", filename_v, album ); dialog_ret=0;cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); int ret = 0; int fnl = strlen(filename_v); char filename_v2[256]; char temp_vf[256], temp_vf2[256], temp_vf0[256]; sprintf(temp_vf0, "%s", "MEXPORT.ext"); temp_vf0[10]=filename_v[fnl-1]; temp_vf0[ 9]=filename_v[fnl-2]; temp_vf0[ 8]=filename_v[fnl-3]; temp_vf0[ 7]=filename_v[fnl-4]; if(temp_vf0[7]==0x2e && temp_vf0[6]==0x2e) temp_vf0[6]=0x54; if(temp_vf0[10]==0x20) temp_vf0[10]=0x00; sprintf(temp_vf, "%s/%s", app_temp, temp_vf0); remove(temp_vf); sprintf(temp_vf2, "%s/%s", app_temp, filename_v); rename(temp_vf2, temp_vf); // sprintf(filename, "REGISTER INIT [%s] [%s]", temp_vf, temp_vf0 ); dialog_ret=0;cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); CellMusicExportSetParam param; sprintf(filename_v2, "%s", filename_v); filename_v2[128]=0; char *pch=filename_v2; char *pathpos=strrchr(pch,'.'); if(pathpos!=NULL) filename_v2[pathpos-pch]=0; //remove extension /* for(ret = 0; ret<fnl; ret++) { if(filename_v[ret]==0x2e) filename_v2[ret]=0x20; else filename_v2[ret]=filename_v[ret]; if(filename_v2[ret]==0x20) filename_v2[ret]=0x5f; filename_v2[ret+1]=0; } filename_v2[fnl]=0; */ param.title = (char*)filename_v2;//(char*)"Test music sample"; param.artist = NULL; param.genre = NULL; param.game_title = (char*)album;//filename_v;//NULL; param.game_comment = (char*)"Transferred by multiMAN"; //#if (CELL_SDK_VERSION<=0x210001) param.reserved1 = NULL; //#else // param.editable = 1; //#endif param.reserved2 = NULL; ret = cellMusicExportFromFile( app_temp, temp_vf0,//filename_v &param, cb_export_finish2_m, (void*)callback_type ); // sprintf(filename, "REGISTER INITATED [%i]", ret ); dialog_ret=0;cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); /* if( ret != CELL_MUSIC_EXPORT_UTIL_RET_OK && ret != CELL_OK) { ret = sys_memory_container_destroy( memory_container ); }*/ return ret; } int music_finalize( void ) { int ret = 0; int callback_type = CALLBACK_TYPE_FINALIZE; if(me_initialized==1) ret = cellMusicExportFinalize( cb_export_finish_m, (void*)callback_type ); me_initialized=0; return ret; } void music_export( char *filename_v, char *album, int to_unregister ) { int ret = 0; me_result = 0xDEAD; if(me_initialized==0) { ret = music_initialize(); while (1) { cellSysutilCheckCallback(); sys_timer_usleep (500 * 1000); if(me_result < 1) break; if(me_result == CELL_MUSIC_EXPORT_UTIL_RET_OK || me_result == CELL_MUSIC_EXPORT_UTIL_RET_CANCEL || me_result == CELL_OK) break; } if(me_result != CELL_MUSIC_EXPORT_UTIL_RET_CANCEL) me_initialized=1; } if(me_result == CELL_MUSIC_EXPORT_UTIL_RET_OK || me_result == CELL_OK || me_result==0 || me_initialized==1) { const int callback_type1 = CALLBACK_TYPE_REGIST_1; me_result = 0xDEAD; ret = music_register(callback_type1, filename_v, album); // else { while (1) { cellSysutilCheckCallback(); if(me_result < 1) break; if(me_result == CELL_MUSIC_EXPORT_UTIL_RET_OK || me_result == CELL_MUSIC_EXPORT_UTIL_RET_CANCEL || me_result == CELL_OK) break; sys_timer_usleep (500 * 1000); // flip(); } } if(to_unregister==1) { me_result = 0xDEAD; ret = music_finalize(); while (1) { cellSysutilCheckCallback(); if(me_result < 1) break; if(me_result == CELL_MUSIC_EXPORT_UTIL_RET_OK || me_result == CELL_MUSIC_EXPORT_UTIL_RET_CANCEL || me_result == CELL_OK) break; sys_timer_usleep (50 * 1000); // flip(); } } } } //register video void cb_export_finish( int result, void *userdata) //export callback { int callback_type = (int)userdata; // sprintf(filename, "CALLBACK [%i]", result ); dialog_ret=0;cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); ve_result = result; sys_timer_usleep (1000 * 1000); switch(result) { case CELL_VIDEO_EXPORT_UTIL_RET_OK: break; case CELL_VIDEO_EXPORT_UTIL_RET_CANCEL: // ret = sys_memory_container_destroy( memory_container ); break; default: break; } if( callback_type == CALLBACK_TYPE_FINALIZE ) { // ret = sys_memory_container_destroy( memory_container ); } } void cb_export_finish2( int result, void *userdata) { ve_result = result; (void) userdata; } int video_initialize( void ) { int ret = 0; int callback_type = CALLBACK_TYPE_INITIALIZE; if(ve_initialized==0) ret = cellSysmoduleLoadModule(CELL_SYSMODULE_VIDEO_EXPORT); ret = cellVideoExportInitialize( CELL_VIDEO_EXPORT_UTIL_VERSION_CURRENT, memory_container, cb_export_finish2, (void*)callback_type ); // if( ret != CELL_VIDEO_EXPORT_UTIL_RET_OK ) { // sys_memory_container_destroy( memory_container ); // } return ret; } int video_register( int callback_type, char* filename_v, const char* album) { // sprintf(filename, "REGISTER INITATED [%s] [%s]", filename_v, album ); dialog_ret=0;cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); int ret = 0; int fnl = strlen(filename_v); char filename_v2[256]; char temp_vf[256], temp_vf2[256], temp_vf0[256]; sprintf(temp_vf0, "%s", "VEXPOR..ext"); temp_vf0[10]=filename_v[fnl-1]; temp_vf0[ 9]=filename_v[fnl-2]; temp_vf0[ 8]=filename_v[fnl-3]; temp_vf0[ 7]=filename_v[fnl-4]; if(temp_vf0[7]==0x2e && temp_vf0[6]==0x2e) temp_vf0[6]=0x54; if(temp_vf0[10]==0x20) temp_vf0[10]=0x00; sprintf(temp_vf, "%s/%s", app_temp, temp_vf0); remove(temp_vf); sprintf(temp_vf2, "%s/%s", app_temp, filename_v); rename(temp_vf2, temp_vf); // sprintf(filename, "REGISTER INIT [%s] [%s]", temp_vf, temp_vf0 ); dialog_ret=0;cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); CellVideoExportSetParam param; sprintf(filename_v2, "%s", filename_v); filename_v2[128]=0; char *pch=filename_v2; char *pathpos=strrchr(pch,'.'); if(pathpos!=NULL) filename_v2[pathpos-pch]=0; //remove extension /* for(ret = 0; ret<fnl; ret++) { if(filename_v[ret]==0x2e) filename_v2[ret]=0x20; else filename_v2[ret]=filename_v[ret]; if(filename_v2[ret]==0x20) filename_v2[ret]=0x5f; filename_v2[ret+1]=0; } filename_v2[fnl]=0; */ param.title = (char*)filename_v2;//(char*)"Test video sample"; param.game_title = (char*)album;//filename_v;//NULL; param.game_comment = (char*)"Transferred by multiMAN"; #if (CELL_SDK_VERSION<=0x210001) param.reserved1 = NULL; #else param.editable = 1; #endif param.reserved2 = NULL; /* param.title = (char*)filename_v;//(char*)"Test video sample"; param.game_title = (char*)album;//filename_v;//NULL; param.game_comment = (char*)"Transferred by multiMAN"; param.editable = 0; param.reserved2 = NULL; */ ret = cellVideoExportFromFile( app_temp, temp_vf0,//filename_v &param, cb_export_finish2, (void*)callback_type ); // sprintf(filename, "REGISTER INITATED [%i]", ret ); dialog_ret=0;cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); /* if( ret != CELL_VIDEO_EXPORT_UTIL_RET_OK && ret != CELL_OK) { ret = sys_memory_container_destroy( memory_container ); }*/ return ret; } int video_finalize( void ) { int ret = 0; int callback_type = CALLBACK_TYPE_FINALIZE; if(ve_initialized==1) ret = cellVideoExportFinalize( cb_export_finish, (void*)callback_type ); ve_initialized=0; // if( ret != CELL_VIDEO_EXPORT_UTIL_RET_OK ) // { // ret = sys_memory_container_destroy( memory_container ); // } return ret; } void video_export( char *filename_v, char *album, int to_unregister ) { int ret = 0; ve_result = 0xDEAD; if(ve_initialized==0) { ret = video_initialize(); while (1) { cellSysutilCheckCallback(); if(ve_result < 1) break; if(ve_result == CELL_VIDEO_EXPORT_UTIL_RET_OK || ve_result == CELL_VIDEO_EXPORT_UTIL_RET_CANCEL || ve_result == CELL_OK) break; sys_timer_usleep (500 * 1000); } if(ve_result != CELL_VIDEO_EXPORT_UTIL_RET_CANCEL) ve_initialized=1; } if(ve_result == CELL_VIDEO_EXPORT_UTIL_RET_OK || ve_result == CELL_OK || ve_result==0 || ve_initialized==1) { const int callback_type1 = CALLBACK_TYPE_REGIST_1; ve_result = 0xDEAD; ret = video_register(callback_type1, filename_v, album); // sys_timer_usleep (2 * 1000 * 1000); //2sec wait // if(ve_result == CELL_VIDEO_EXPORT_UTIL_RET_OK || ve_result == CELL_OK) // ret = video_finalize(); // else { while (1) { cellSysutilCheckCallback(); if(ve_result < 1) break; if(ve_result == CELL_VIDEO_EXPORT_UTIL_RET_OK || ve_result == CELL_VIDEO_EXPORT_UTIL_RET_CANCEL || ve_result == CELL_OK) break; sys_timer_usleep (500 * 1000); // flip(); } } if(to_unregister==1) { ve_result = 0xDEAD; ret = video_finalize(); while (1) { cellSysutilCheckCallback(); if(ve_result < 1) break; if(ve_result == CELL_VIDEO_EXPORT_UTIL_RET_OK || ve_result == CELL_VIDEO_EXPORT_UTIL_RET_CANCEL || ve_result == CELL_OK) break; sys_timer_usleep (500 * 1000); } } } } //MP3 void set_channel_vol(int Channel, float vol, float vol2) { cellMSCoreSetVolume1(Channel, CELL_MS_DRY, CELL_MS_SPEAKER_FL, CELL_MS_CHANNEL_0, vol); cellMSCoreSetVolume1(Channel, CELL_MS_DRY, CELL_MS_SPEAKER_FR, CELL_MS_CHANNEL_1, vol); cellMSCoreSetVolume1(Channel, CELL_MS_DRY, CELL_MS_SPEAKER_FC, CELL_MS_CHANNEL_0, vol); cellMSCoreSetVolume1(Channel, CELL_MS_DRY, CELL_MS_SPEAKER_RL, CELL_MS_CHANNEL_0, vol-vol2); cellMSCoreSetVolume1(Channel, CELL_MS_DRY, CELL_MS_SPEAKER_RR, CELL_MS_CHANNEL_1, vol-vol2); cellMSCoreSetVolume1(Channel, CELL_MS_DRY, CELL_MS_SPEAKER_LFE, CELL_MS_CHANNEL_1, vol2); } void stop_audio(float attn) { while(audio_sub_proc); audio_sub_proc=true; if(mm_is_playing) { if(attn) // attentuate softly { for(float vstep=0; vstep<(attn*30); vstep++) { set_channel_vol(nChannel, mp3_volume-(mp3_volume/(attn*30))*vstep, 0); sys_timer_usleep(3336); } } cellMSStreamClose(nChannel); cellMSCoreStop(nChannel, 0); } mm_is_playing=false; audio_sub_proc=false; xmb_info_drawn=0; } void stop_mp3(float _attn) { stop_audio(_attn); current_mp3=0; max_mp3=0; xmb_info_drawn=0; } void prev_mp3() { if(max_mp3!=0){ current_mp3--; if(current_mp3==0) current_mp3=max_mp3; main_mp3((char*) mp3_playlist[current_mp3].path); } xmb_info_drawn=0; } void next_mp3() { if(max_mp3!=0){ current_mp3++; if(current_mp3>max_mp3 || current_mp3>=MAX_MP3) current_mp3=1; main_mp3((char*) mp3_playlist[current_mp3].path); } xmb_info_drawn=0; } sys_ppu_thread_t ms_thread; static void MS_update_thread(uint64_t param) { (void)param; while(!mm_shutdown) { sys_timer_usleep(50); if(mm_is_playing && update_ms) cellMSSystemSignalSPU(); cellMSSystemGenerateCallbacks(); //sprintf(status_info, "%i", (int)time(NULL)); } cellAudioPortStop(portNum); sys_ppu_thread_exit(0); } int StartMultiStream() { float fBusVols[64] = {1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; InitialiseAudio(MAX_STREAMS, MAX_SUBS, portNum, audioParam, portConfig); sizeNeeded=cellMSMP3GetNeededMemorySize(4); // Maximum 256 mono MP3's playing at one time mp3Memory=(int*)malloc(sizeNeeded); if(mp3Memory==NULL) return -1; if((cellMSMP3Init(4, (void*)mp3Memory)) != 0 ) return -1; cellMSCoreSetVolume64(CELL_MS_BUS_FLAG | 1, CELL_MS_WET, fBusVols); cellMSCoreSetVolume64(CELL_MS_MASTER_BUS, CELL_MS_DRY, fBusVols); cellMSSystemConfigureLibAudio(&audioParam, &portConfig); cellAudioPortStart(portNum); sys_ppu_thread_create(&ms_thread, MS_update_thread, NULL, 50, 0x4000, 0, "MultiStream PU Thread"); (void) cellMSSystemSetGlobalCallbackFunc(mp3_callback); return 1; } /********************************************************************************** Starts the streaming of the passed sample data as a one shot sfx. nFrequency Required playback frequency (in Hz) Returns: nChannel Stream channel number **********************************************************************************/ long TriggerStream(const long nFrequency) { CellMSInfo MS_Info; MS_Info.SubBusGroup = CELL_MS_MASTER_BUS; MS_Info.FirstBuffer = pDataB; //64KB buffer split in two 32KB chunks MS_Info.FirstBufferSize = KB(MP3_BUF); MS_Info.SecondBuffer = pDataB+KB(MP3_BUF); MS_Info.SecondBufferSize = KB(MP3_BUF); // Set pitch and number of channels MS_Info.Pitch = nFrequency; MS_Info.numChannels = 2; MS_Info.flags = 0; // Initial delay (in samples) before playback starts. Allows for sample accurate playback MS_Info.initialOffset = 0; MS_Info.inputType = CELL_MS_MP3; int nCh = cellMSStreamOpen(); cellMSCoreInit(nCh); cellMSStreamSetInfo(nCh, &MS_Info); cellMSStreamPlay(nCh); return nCh; } int LoadMP3(const char *mp3filename, int *_mp3_freq, float skip) { unsigned int tSize=0; // total size float tTime=0; // total time (void) skip; CellMSMP3FrameHeader Hdr; pData=pDataB; if(force_mp3_fd!=-1) cellFsClose(force_mp3_fd); if(CELL_FS_SUCCEEDED!=cellFsOpen (mp3filename, CELL_FS_O_RDONLY, &force_mp3_fd, NULL, 0)) return -1; cellFsLseek(force_mp3_fd, 0, CELL_FS_SEEK_END, &force_mp3_size); cellFsLseek(force_mp3_fd, 0, CELL_FS_SEEK_SET, &force_mp3_offset); if(CELL_FS_SUCCEEDED!=cellFsRead(force_mp3_fd, pDataB, (force_mp3_size<_mp3_buffer?force_mp3_size:_mp3_buffer), &force_mp3_offset)) { force_mp3_offset=0; force_mp3_size=0; cellFsClose (force_mp3_fd); force_mp3_fd=-1; return -1; } if(!force_mp3_offset) force_mp3_offset=_mp3_buffer; pData=pDataB; while(1) { if(-1==cellMSMP3GetFrameInfo(pData,&Hdr)) return (-1); // Invalid MP3 header tSize+=Hdr.PacketSize; // Update total file size if ((Hdr.ID3==0)&&(Hdr.Tag==0)) tTime+=Hdr.PacketTime; // Update total playing time (in seconds) pData+=Hdr.PacketSize; // Move forward to next packet if (tSize>=_mp3_buffer || tSize>=force_mp3_size) { *_mp3_freq=Hdr.Frequency; mp3_durr=(int)tTime; mp3_packet=Hdr.PacketSize; mp3_packet_time=Hdr.PacketTime+0.001f; return 1; } } } //sprintf(mp3_now_playing,"%d Hz, (%imin %2.2isec) [%s]", Hdr.Frequency, ((int) tTime / 60), ((int) tTime % 60), mp3filename); // ** Display packet information ** // Using the packet size and packet time information, it is possible to build "Seek Tables". // Then, by knowing approximately what time (in seconds) you require to playback from, // you can start playback from the closest data packet by searching for the closest record in the table. /* if (Hdr.ID3!=0) { printf("Found ID3 Info\n"); printf("Version: %x.%x\n",Hdr.ID3>>8, Hdr.ID3&255); } else if (Hdr.Tag!=0) { printf("Found Tag info\n"); } else { printf("Sync: 0x%x\n",Hdr.Sync); printf("ID: 0x%x\n",Hdr.ID); printf("Layer: 0x%x\n",Hdr.Layer); printf("ProtBit: 0x%x\n",Hdr.ProtBit); printf("BitRate: %d\n",Hdr.BitRate); printf("Frequency: %d\n",Hdr.Frequency); printf("PadBit: 0x%x\n",Hdr.PadBit); printf("PrivBit: 0x%x\n",Hdr.PrivBit); printf("Mode: 0x%x\n",Hdr.Mode); printf("Copy: 0x%x\n",Hdr.Copy); printf("Home: 0x%x\n",Hdr.Home); printf("Emphasis: 0x%x\n",Hdr.Emphesis); printf("Packet Time (secs): %f\n",Hdr.PacketTime); } */ //printf("Packet Size (bytes): 0x%x\n",Hdr.PacketSize); void main_mp3( char *temp_mp3) { if(force_mp3_fd!=-1) cellFsClose (force_mp3_fd); force_mp3_fd=-1; sprintf(force_mp3_file, "%s", temp_mp3); force_mp3=true; is_theme_playing=false; if(strstr(temp_mp3, "SOUND.BIN")!=NULL) { is_theme_playing=true; max_mp3=1; current_mp3=1; sprintf(mp3_playlist[max_mp3].path, "%s", temp_mp3); } } int main_mp3_th( char *temp_mp3, float skip) { char my_mp3[1024]; sprintf (my_mp3, "%s", temp_mp3); if(strstr(my_mp3, "/pvd_usb")!=NULL) { sprintf(my_mp3, "%s/TEMP/MUSIC.TMP", app_usrdir); file_copy(temp_mp3, my_mp3, 0); } mp3_freq=44100; stop_audio(5); update_ms=false; memset(pDataB, 0, _mp3_buffer); if(1 == LoadMP3((char*) my_mp3, &mp3_freq, skip)) { nChannel = TriggerStream(mp3_freq); mm_is_playing=true; update_ms=true; float attn=5.0f; for(float vstep=(attn*20); vstep>0; vstep--) { set_channel_vol(nChannel, mp3_volume-(mp3_volume/(attn*20))*vstep, 0); sys_timer_usleep(3336); } set_channel_vol(nChannel, mp3_volume, 0.1f); return 1; } else mp3_skip=0.0f; //if(cellMSStreamGetStatus(nChannel)==CELL_MS_STREAM_OFF); return 0; } int readmem(unsigned char *_x, uint64_t _fsiz, uint64_t _chunk) //read lv2 memory chunk { uint64_t n, m; uint64_t val; for(n = 0; n < _chunk; n += 8) { if((_fsiz + n)>0x7ffff8ULL) return (int)(n-8); val = peekq(0x8000000000000000ULL + _fsiz + n); for(m = 0; m<8; m++) { _x[n+7-m] = (unsigned char) ((val >> (m*8)) & 0x00000000000000ffULL); } } return _chunk; } //replacemem( 0x6170705F686F6D65UUL, 0x6465765F62647664UUL); //app_home -> dev_bdvd /*void replacemem(uint64_t _val_search1, uint64_t _val_replace1) { uint64_t n; for(n = 0; n < 0x7ffff8ULL; n ++) { if( peekq(0x8000000000000000ULL + n) == _val_search1 ) { pokeq(0x8000000000000000ULL + n, _val_replace1); n+=8; } } return; } */ int mod_mount_table(const char *new_path, int _mode) //mode 0/1 = reset/change { if(c_firmware!=3.41f && c_firmware!=3.55f && c_firmware!=3.15f) return 0; uint64_t dev_table; // mount table vector uint64_t c_addr; if(c_firmware==3.15f) dev_table=peekq(0x80000000002ED750ULL); if(c_firmware==3.41f) dev_table=peekq(0x80000000002EDEF0ULL); if(c_firmware==3.55f) dev_table=peekq(0x80000000002DFC60ULL); int dev_table_len = 0x1400, n=0, found=0; uint64_t dev_bdvd_val=0x6465765F62647664ULL; // dev_bdvd uint64_t tmp_bdvd_val=0x746D705F62647664ULL; // tmp_bdvd uint64_t bdvd_val =0x765F626476640000ULL; // v_bdvd // uint64_t host_root_val0=0x686F73745F726F6FULL; // host_roo // uint64_t host_root_val1=0x7400000000000000ULL; // t // uint64_t app_home_val=0x6170705F686F6D65ULL; // app_home uint64_t dev_usb0_val_0=0x6465765F75736230ULL; // dev_usb000 uint64_t dev_usb0_val_1=0x0000000000000000ULL; if(_mode==0) //reset mount table { for(n=0; n < dev_table_len; n++) { c_addr = dev_table + (uint64_t) n; if(peekq( c_addr ) == tmp_bdvd_val) { pokeq( c_addr, dev_bdvd_val ); //restore dev_bdvd n+=8; found=1; } else if(peekq( c_addr ) == dev_bdvd_val && peekq ( c_addr + 16 ) == dev_usb0_val_0) { pokeq( c_addr , peekq ( c_addr + 16 ) ); //restore dev_usb pokeq( c_addr + 8, peekq ( c_addr + 24 ) ); pokeq( c_addr + 16, 0x00ULL ); //Clear dev_usb backup string pokeq( c_addr + 24, 0x00ULL ); n+=32; found=1; } /* else if(peekq( c_addr ) == dev_bdvd_val && peekq ( c_addr + 16 ) == app_home_val) { pokeq( c_addr , app_home_val ); //restore app_home pokeq( c_addr + 16, 0x00ULL); n+=24; found=1; } */ //else if(peekq( c_addr ) == dev_bdvd_val) found=1; } return 1;//found; } if(_mode==1) //change mount table { unsigned char v1, v2; v1 = new_path[9]; v2 = new_path[10]; dev_usb0_val_1 = 0x0000000000000000ULL | ( ((uint64_t) v1 ) << 56 ) | ( (uint64_t) v2 << 48 ); for(n=0; n < dev_table_len; n++) { c_addr = dev_table + (uint64_t) n; if( (peekq( c_addr ) == dev_usb0_val_0) && (peekq( c_addr + 8ULL ) == dev_usb0_val_1)) { pokeq( c_addr + 2ULL, bdvd_val ); //change v_usb00x to v_bdvd pokeq( c_addr + 16ULL, dev_usb0_val_0 ); // and backup dev_usb pokeq( c_addr + 24ULL, dev_usb0_val_1 ); // for later restore n+=32; if(peekq( c_addr + 2ULL) != bdvd_val ) found=0; else found=1; } else if(peekq( c_addr ) == dev_bdvd_val) { pokeq( c_addr , tmp_bdvd_val ); // map dev_bdvd to tmp_bdvd n+=8; found=1; } } return found; } /* if(_mode==2) //change app_home to dev_bdvd only { for(n=0; n < dev_table_len; n++) { c_addr = dev_table + (uint64_t) n; if( (peekq( c_addr ) == app_home_val) ) { pokeq( c_addr , dev_bdvd_val ); // change app_home to dev_bdvd pokeq( c_addr + 8ULL, 0x0ULL ); pokeq( c_addr + 16ULL, app_home_val ); // for later restore n+=24; found=1; return found; } } } */ return 1; } void draw_dir_pane( t_dir_pane *list, int pane_size, int first_to_show, int max_lines, float x_offset) { float y_offset=0.12f+0.025f; int e=first_to_show; float e_size=0.0f; char str[128], e_stype[8], e_name[256], e_sizet[16], this_dev[128], other_dev[128], e_date[16], str_date[16], temp_pane[1024], entry_name[512], e_attributes[16], e_attributes2[48]; char filename[1024]; char string1[1024]; u32 color=0xc0c0c0c0; if(x_offset>=0.54f) { sprintf(this_pane, "%s", current_right_pane); sprintf(other_pane, "%s", current_left_pane);} else { sprintf(this_pane, "%s", current_left_pane); sprintf(other_pane, "%s", current_right_pane);} char temp[256]="*"; sprintf(temp, "%s/", this_pane); temp[0]=0x30; char *pch=strchr(temp,'/'); if(pch!=NULL) {temp[pch-temp]=0; temp[0]=0x2f;} temp[127]=0; strncpy(this_dev, temp, 128); sprintf(temp, "%s/", other_pane); temp[0]=0x30; pch=strchr(temp,'/'); if(pch!=NULL) {temp[pch-temp]=0; temp[0]=0x2f;} temp[127]=0; strncpy(other_dev, temp, 128); if(first_to_show>pane_size || first_to_show<0) first_to_show=0; for(e=first_to_show; (e<pane_size && (e-first_to_show)<max_lines);e++) { if(list[e].size<2048) {e_size=list[e].size; sprintf(e_stype, "%s", "B ");} if(list[e].size>=2048 && list[e].size<2097152) {e_size=list[e].size/1024.f; sprintf(e_stype, "%s", "KB");} //KB if(list[e].size>=2097152 && list[e].size<2147483648U) {e_size=list[e].size/1048576.f; sprintf(e_stype, "%s", "MB");}//MB if(list[e].size>=2147483648U) {e_size=list[e].size/1073741824.f; sprintf(e_stype, "%s", "GB");} //GB strncpy(e_name, list[e].path, 10); if(strstr (e_name,"/net_host")!=NULL) sprintf(e_date, "%s", list[e].datetime); else { timeinfo = localtime ( &list[e].time ); if(date_format==0) sprintf(e_date,"%02d/%02d/%04d", timeinfo->tm_mday, timeinfo->tm_mon+1, timeinfo->tm_year+1900); else if(date_format==1) sprintf(e_date, "%02d/%02d/%04d", timeinfo->tm_mon+1, timeinfo->tm_mday, timeinfo->tm_year+1900); else if(date_format==2) sprintf(e_date, "%04d/%02d/%02d", timeinfo->tm_year+1900, timeinfo->tm_mon+1, timeinfo->tm_mday ); } //utf8_to_ansi(list[e].name, entry_name, 128); strncpy(entry_name, list[e].name, 128); entry_name[128]=0; // if(user_font<2) // { if(x_offset>=0.54f) { sprintf(e_name,"%s", entry_name); e_name[55]=0;} else { sprintf(e_name,"%s", entry_name); e_name[60]=0; } // } // else // { // if(x_offset>=0.54f) // { sprintf(e_name,"%-24s", entry_name); e_name[24]=0;} // else // { sprintf(e_name,"%-42s", entry_name); e_name[42]=0; } // } if(list[e].type==0) sprintf(e_sizet, "%s", " <dir>"); else { if(e_stype[0]=='B') sprintf(e_sizet,"%.0f %s", e_size, e_stype); else sprintf(e_sizet,"%.2f %s", e_size, e_stype); } e_sizet[11]=0; //sprintf(str, "%s %s %s", e_name, e_sizet, e_date); //((list[e].type==0) ? "D" : "F"), sprintf(str, "%s", e_name); sprintf(str_date, "%s", e_date); //str[49]=0; color=((list[e].type==0) ? (COL_FMDIR) : (COL_FMFILE)); if(strstr(list[e].name, ".mp3")!=NULL || strstr(list[e].name, ".MP3")!=NULL) color=COL_FMMP3; else if(strstr(list[e].name, ".ac3")!=NULL || strstr(list[e].name, ".AC3")!=NULL || strstr(list[e].name, ".FLAC")!=NULL || strstr(list[e].name, ".flac")!=NULL) color=COL_FMMP3; else if(strstr(list[e].name, ".jpg")!=NULL || strstr(list[e].name, ".jpeg")!=NULL || strstr(list[e].name, ".png")!=NULL || strstr(list[e].name, ".JPG")!=NULL || strstr(list[e].name, ".JPEG")!=NULL || strstr(list[e].name, ".PNG")!=NULL) color=COL_FMJPG;//1133cc; else if(strstr(list[e].name, "EBOOT.BIN")!=NULL || strstr(list[e].name, "INDEX.BDM")!=NULL || strstr(list[e].name, "index.bdmv")!=NULL || strstr(list[e].name, ".self")!=NULL || strstr(list[e].name, ".SELF")!=NULL || strstr(list[e].name, ".pkg") || strstr(list[e].name, ".PKG")!=NULL) color=COL_FMEXE; else if(strstr(list[e].name, ".MMT")!=NULL || strstr(list[e].name, ".mmt")!=NULL) color=0xffe0d0c0; else if(is_video(list[e].name)) color=0xff1070f0; color=( (color & 0x00ffffff) | (c_opacity2<<24)); if(list[e].selected)// && x_offset>=0.54f) //c_opacity2>0x20 && { if(x_offset>=0.54f) draw_square((x_offset-0.015f-0.5f)*2.0f, (0.5f-y_offset)*2.0f, 0.82f, 0.048f, 0.5f, 0x1080ff30); else draw_square((x_offset-0.015f-0.5f)*2.0f, (0.5f-y_offset)*2.0f, 0.92f, 0.048f, 0.5f, 0x1080ff30); } if(mouseX>=x_offset && mouseX<=x_offset+0.430f && mouseY>=y_offset && mouseY<=y_offset+0.026f) { e_attributes2[0]=0; if(list[e].mode>0){ //012 456 789 sprintf(e_attributes, "%s", "--- --- ---"); if(list[e].type==1) { if(list[e].mode & S_IXOTH) e_attributes[0]='x'; if(list[e].mode & S_IXGRP) e_attributes[4]='x'; if(list[e].mode & S_IXUSR) e_attributes[8]='x'; } else { e_attributes[0]='d'; e_attributes[4]='d'; e_attributes[8]='d'; } if(list[e].mode & S_IWOTH) e_attributes[1]='w'; if(list[e].mode & S_IROTH) e_attributes[2]='r'; if(list[e].mode & S_IWGRP) e_attributes[5]='w'; if(list[e].mode & S_IRGRP) e_attributes[6]='r'; if(list[e].mode & S_IWUSR) e_attributes[9]='w'; if(list[e].mode & S_IRUSR) e_attributes[10]='r'; sprintf(e_attributes2," | Attr: %s", e_attributes); } u32 select_color=0x0080ff60; // if(c_opacity2<0x80) { select_color=select_color & 0xffffff00 | c_opacity2;} //if(c_opacity2>0x20) { if(x_offset>=0.54f) draw_square((x_offset-0.015f-0.5f)*2.0f, (0.5f-y_offset)*2.0f, 0.82f, 0.048f, 0.5f, select_color); else draw_square((x_offset-0.015f-0.5f)*2.0f, (0.5f-y_offset)*2.0f, 0.92f, 0.048f, 0.5f, select_color); } if((strlen(list[e].name)>25 || strlen(e_attributes2)>0) && !(strlen(list[e].name)==2 && list[e].name[0]==0x2e && list[e].name[1]==0x2e) ) { //display hint if(list[e].type==0) sprintf(e_name,"Dir : %s", list[e].name); else sprintf(e_name,"File: %s", list[e].name); e_name[86]=0; cellDbgFontPrintf( 0.04f+0.025f, 0.895f, 0.7f , COL_HEXVIEW, e_name); sprintf(e_name,"Date: %s %s:%02d:%02d%s", e_date, tmhour(timeinfo->tm_hour), timeinfo->tm_min, timeinfo->tm_sec, e_attributes2); cellDbgFontPrintf( 0.04f+0.025f, 0.916f, 0.7f , COL_HEXVIEW, e_name); } //color=0xc01010a0; sprintf(fm_func, "%s", "none"); if ((new_pad & BUTTON_CIRCLE)) { int fmret=-1; int m_copy_total=0; for(int m_copy=0; m_copy<pane_size; m_copy++) m_copy_total+=list[m_copy].selected; if(m_copy_total>1) { if(list[e].type==0) fmret=context_menu((char*) STR_CM_MULDIR, list[e].type, this_pane, other_pane); else fmret=context_menu((char*) STR_CM_MULFILE, list[e].type, this_pane, other_pane); } else fmret=context_menu(list[e].name, list[e].type, this_pane, other_pane); new_pad=0; if(fmret!=-1) { sprintf(fm_func, "%s", opt_list[fmret].value); } } if ( !strcmp(fm_func, "test") && viewer_open==0 ) { sprintf(my_txt_file, "%s/%s", this_pane, list[e].name); sprintf(fm_func, "%s", "none"); time_start= time(NULL); abort_copy=0; initConsole(); file_counter=0; new_pad=0; global_device_bytes=0; num_directories= file_counter= num_files_big= num_files_split= 0; sprintf(string1,"Checking, please wait...\n\n%s", my_txt_file); ClearSurface(); draw_square(-1.0f, 1.0f, 2.0f, 2.0f, 0.0f, 0x10101080); cellDbgFontPrintf( 0.07f, 0.07f, 1.2f, 0xc0c0c0c0, string1); cellDbgFontPrintf( 0.5f-0.15f, 1.0f-0.07*2.0f, 1.2f, 0xc0c0c0c0, "Hold /\\ to Abort"); cellDbgFontDrawGcm(); flip(); my_game_test( my_txt_file, 0); DPrintf("Directories: %i Files: %i\nBig files: %i Split files: %i\n\n", num_directories, file_counter, num_files_big, num_files_split); int seconds= (int) (time(NULL)-time_start); int vflip=0; while(1){ if(abort_copy==2) sprintf(string1,"Aborted! Time: %2.2i:%2.2i:%2.2i\n", seconds/3600, (seconds/60) % 60, seconds % 60); else if(abort_copy==1) sprintf(string1,"Folder contains over %i files. Time: %2.2i:%2.2i:%2.2i Vol: %1.2f GB+\n", file_counter, seconds/3600, (seconds/60) % 60, seconds % 60, ((double) global_device_bytes)/(1024.0*1024.*1024.0)); else sprintf(string1,"Files tested: %i Time: %2.2i:%2.2i:%2.2i Size: %1.2f GB\nActual size : %.f bytes", file_counter, seconds/3600, (seconds/60) % 60, seconds % 60, ((double) global_device_bytes)/(1024.0*1024.*1024.0),(double) global_device_bytes); ClearSurface(); draw_square(-1.0f, 1.0f, 2.0f, 2.0f, 0.0f, 0x10101080); cellDbgFontPrintf( 0.07f, 0.07f, 1.2f,0xc0c0c0c0,string1); if(vflip & 32) cellDbgFontPrintf( 0.5f-0.15f, 1.0f-0.07*2.0f, 1.2f, 0xffffffff, "Press [ ] to continue"); vflip++; cellDbgFontDrawGcm(); flip(); pad_read(); if (new_pad & BUTTON_SQUARE) { new_pad=0; break; } } termConsole(); } // if ( ((new_pad & BUTTON_R3) && (list[e].type==1)) && viewer_open==0 ) if ( !strcmp(fm_func, "view") && viewer_open==0 ) { //fm HEX view sprintf(fm_func, "%s", "none"); sprintf(my_txt_file, "%s", list[e].path); new_pad=0; old_pad=0; if(strstr(list[e].path,"/net_host")!=NULL) //network copy { char cpath[1024], cpath2[1024]; int chost=0; int pl=strlen(list[e].path); chost=list[e].path[9]-0x30; for(int n=11;n<pl;n++) {cpath[n-11]=list[e].path[n]; cpath[n-10]=0;} sprintf(cpath2, "/%s", cpath); //host_list[chost].root, sprintf(my_txt_file, "%s/TEMP/hex_view.bin", app_usrdir); network_com((char*)"GET", (char*)host_list[chost].host, host_list[chost].port, (char*) cpath2, (char*) my_txt_file, 0); } if(strstr(list[e].path,"/pvd_usb")!=NULL) //ntfs { sprintf(my_txt_file, "%s/TEMP/hex_view.bin", app_usrdir); file_copy(list[e].path, my_txt_file, 0); } viewer_open=1; //txt viewer uint64_t fsiz = 0, readb=0; uint64_t msiz = 0; uint64_t msiz1 = 0; uint64_t msiz2 = 0x800000; FILE *fp; unsigned int chunk = 512; int view_mode=0; // 0=file 1=mem fp = fopen(my_txt_file, "rb"); if(fp==NULL) goto quit_viewer; fseek(fp, 0, SEEK_END); msiz=ftell(fp); msiz1=msiz; if(msiz<chunk && msiz>0) chunk=msiz; unsigned char x[chunk]; fseek(fp, 0, SEEK_SET); readb=fread((void *) x, 1, chunk, fp); if(readb<1) goto close_viewer; else { memset(text_bmpUPSR, 0x50, V_WIDTH*V_HEIGHT*4); unsigned int li, chp, cfp, hp; char cchar[512]; char clin[512]; char clintxt[32]; while(1) { pad_read(); if ((old_pad & BUTTON_START) && view_mode==1) //dump lv2 { //old_pad=0; new_pad=0; time ( &rawtime ); timeinfo = localtime ( &rawtime ); char lv2file[64]; sprintf(lv2file, "/dev_hdd0/%04d%02d%02d-%02d%02d%02d-LV2-FW%1.2f.BIN", timeinfo->tm_year+1900, timeinfo->tm_mon+1, timeinfo->tm_mday, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec, c_firmware); sprintf(string1, "Exporting GameOS memory to file:\n\n%s\n\nPlease wait...", lv2file); dialog_ret=0; cellMsgDialogOpen2( type_dialog_no, string1, dialog_fun2, (void*)0x0000aaab, NULL ); flipc(60); FILE *fpA; remove(lv2file); fpA = fopen ( lv2file, "wb" ); readb=readmem((unsigned char *) text_FONT, 0, msiz2); fwrite(text_FONT, readb, 1, fpA); fclose(fpA); //load_texture(text_bmpBG, userBG, 1920); cellMsgDialogAbort(); sprintf(string1, "GameOS memory exported successfully to file:\n\n%s", lv2file); dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, string1, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } if ((new_pad & BUTTON_SELECT)) { //old_pad=0;// new_pad=0; view_mode = 1-view_mode; if(view_mode==0) { msiz=msiz1; if(msiz<chunk && msiz>0) chunk=msiz; fsiz=0; fseek(fp, fsiz, SEEK_SET); readb=fread((void *) x, 1, chunk, fp); if(readb<1) goto close_viewer; } else { msiz=msiz2; chunk=512; fsiz=0; readb=readmem((unsigned char *) x, fsiz, chunk); } } if (view_mode==1) //view mem { if ((new_pad & BUTTON_L1)) { new_pad=0; fsiz=0; readb=readmem((unsigned char *) x, fsiz, chunk); if(readb<1) goto close_viewer; } if ((new_pad & BUTTON_R1) && msiz>=512) { new_pad=0; fsiz=msiz-512; readb=readmem((unsigned char *) x, fsiz, chunk); if(readb<1) goto close_viewer; } if ((new_pad & BUTTON_L2) && fsiz>=16) { //old_pad=0; fsiz-=16; readb=readmem((unsigned char *) x, fsiz, chunk); if(readb<1) goto close_viewer; } if ((new_pad & BUTTON_R2) && ((fsiz+16)<msiz) ) { //old_pad=0; fsiz+=16; readb=readmem((unsigned char *) x, fsiz, chunk); if(readb<1) goto close_viewer; } if ((new_pad & BUTTON_UP)) { //old_pad=0; if(fsiz>=512) fsiz-=512; else fsiz=0; readb=readmem((unsigned char *) x, fsiz, chunk); if(readb<1) goto close_viewer; } if ((new_pad & BUTTON_DOWN) && ((fsiz+512)<msiz) ) { //old_pad=0; fsiz+=512; readb=readmem((unsigned char *) x, fsiz, chunk); if(readb<1) goto close_viewer; } if ((new_pad & BUTTON_LEFT)) { //old_pad=0; if(fsiz>=8192) fsiz-=8192; else fsiz=0; readb=readmem((unsigned char *) x, fsiz, chunk); if(readb<1) goto close_viewer; } if ((new_pad & BUTTON_RIGHT) && ( (fsiz+8192)<msiz) ) { //old_pad=0; fsiz+=8192; readb=readmem((unsigned char *) x, fsiz, chunk); if(readb<1) goto close_viewer; } } //view mem if (view_mode==0) //view file { if ((new_pad & BUTTON_L1)) { //old_pad=0; fsiz=0; fseek(fp, fsiz, SEEK_SET); readb=fread((void *) x, 1, chunk, fp); if(readb<1) goto close_viewer; } if ((new_pad & BUTTON_R1) && msiz>=512) { //old_pad=0; fsiz=msiz-512; fseek(fp, fsiz, SEEK_SET); readb=fread((void *) x, 1, chunk, fp); if(readb<1) goto close_viewer; } if ((new_pad & BUTTON_L2) && fsiz>=16) { //old_pad=0; fsiz-=16; fseek(fp, fsiz, SEEK_SET); readb=fread((void *) x, 1, chunk, fp); if(readb<1) goto close_viewer; } if ((new_pad & BUTTON_R2) && ((fsiz+16)<msiz) ) { //old_pad=0; fsiz+=16; fseek(fp, fsiz, SEEK_SET); readb=fread((void *) x, 1, chunk, fp); if(readb<1) goto close_viewer; } if ((new_pad & BUTTON_UP)) { //old_pad=0; if(fsiz>=512) fsiz-=512; else fsiz=0; fseek(fp, fsiz, SEEK_SET); readb=fread((void *) x, 1, chunk, fp); if(readb<1) goto close_viewer; } if ((new_pad & BUTTON_DOWN) && ((fsiz+512)<msiz) ) { //old_pad=0; fsiz+=512; fseek(fp, fsiz, SEEK_SET); readb=fread((void *) x, 1, chunk, fp); if(readb<1) goto close_viewer; } if ((new_pad & BUTTON_LEFT)) { //old_pad=0; if(fsiz>=8192) fsiz-=8192; else fsiz=0; fseek(fp, fsiz, SEEK_SET); readb=fread((void *) x, 1, chunk, fp); if(readb<1) goto close_viewer; } if ((new_pad & BUTTON_RIGHT) && ( (fsiz+8192)<msiz) ) { //old_pad=0; fsiz+=8192; fseek(fp, fsiz, SEEK_SET); readb=fread((void *) x, 1, chunk, fp); if(readb<1) goto close_viewer; } } ClearSurface(); mouseX+=mouseXD; mouseY+=mouseYD; if(mouseX>0.995f) {mouseX=0.995f;mouseXD=0.0f;} if(mouseX<0.0f) {mouseX=0.0f;mouseXD=0.0f;} if(mouseY>0.990f) {mouseY=0.990f;mouseYD=0.0f;} if(mouseY<0.0f) {mouseY=0.0f;mouseYD=0.0f;} time ( &rawtime ); timeinfo = localtime ( &rawtime ); if(date_format==0) sprintf(string1, "%02d/%02d/%04d", timeinfo->tm_mday, timeinfo->tm_mon+1, timeinfo->tm_year+1900); else if(date_format==1) sprintf(string1, "%02d/%02d/%04d", timeinfo->tm_mon+1, timeinfo->tm_mday, timeinfo->tm_year+1900); else if(date_format==2) sprintf(string1, "%04d/%02d/%02d", timeinfo->tm_year+1900, timeinfo->tm_mon+1, timeinfo->tm_mday ); cellDbgFontPrintf( 0.83f, 0.895f, 0.7f , COL_HEXVIEW, "%s\n %s:%02d:%02d ", string1, tmhour(timeinfo->tm_hour), timeinfo->tm_min, timeinfo->tm_sec); if(view_mode==1) sprintf(e_name,"GameOS memory | Press [START] to export GameOS memory to file"); else sprintf(e_name,"File: %s", list[e].name); e_name[86]=0; cellDbgFontPrintf( 0.04f+0.025f, 0.895f, 0.7f , COL_HEXVIEW, e_name); if(view_mode==1) sprintf(e_name,"Memory offset: 0x%08X / 0x%08X | [SELECT] for file view", (int)fsiz, (int)msiz); else sprintf(e_name,"Offset: 0x%X (%.0f) / 0x%X (%.0f) | [SELECT] for LV2 view", (int)fsiz, (double)fsiz, (int)msiz, (double)msiz); //Date: %s | e_date, cellDbgFontPrintf( 0.04f+0.025f, 0.916f, 0.7f , COL_HEXVIEW, e_name); for(li=0; li<32; li++) { chp=0; sprintf(clin, "%-48s | -16%s", " ", " "); clin[0]=0; clintxt[0]=0; clintxt[16]=0; for(hp=0; hp<16; hp++) { cfp = li*16+hp; clintxt[hp]=0; clin[chp]=0; clin[chp+(hp*3)]=0; if( (cfp) < readb) { sprintf(cchar, "%02X", x[cfp]); if(x[cfp]>0x19 && x[cfp]<0x7f) clintxt[hp]=x[cfp]; else clintxt[hp]=0x2e; clin[chp+0]=cchar[0]; clin[chp+1]=cchar[1]; clin[chp+2]=0x20; clin[chp+3]=0x00; chp+=3; } else break; } if(strlen(clintxt)==0 || chp==0) break; sprintf(clin, "%-48s | %-16s", clin, clintxt); if(mouseX>=0.11f && mouseX<=0.89f && mouseY>=(0.07f+li*0.024f) && mouseY<=(0.07f+li*0.024f)+0.026f) { draw_square((0.11f+0.025f-0.015f-0.5f)*2.0f, (0.5f-(0.07f+li*0.024f))*2.0f, 1.52f, 0.048f, 0.0f, 0x0080ff80); select_color=0xc0e0e0e0; } else select_color=COL_HEXVIEW; cellDbgFontPrintf( 0.11f+0.025f, 0.07f+li*0.024f, 0.7f ,select_color, "0x%04X%04X: %s |", (unsigned int)((fsiz+li*16)/0x10000), (unsigned int)((fsiz+li*16)%0x10000), clin, clintxt); } set_texture( text_FMS, 1920, 48); // display_img(0, 47, 1920, 60, 1920, 48, -0.15f); display_img(0, 952, 1920, 76, 1920, 48, -0.15f, 1920, 48); if(animation==2 || animation==3) { BoffX-=1; if(BoffX<= -3840) BoffX=0; set_texture( text_bmpUPSR, 1920, 1080); if(BoffX>= -1920) { display_img((int)BoffX, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); } display_img(1920+(int)BoffX, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); if(BoffX<= -1920) { display_img(3840+(int)BoffX, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); } } else { set_texture( text_bmpUPSR, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); } cellDbgFontDrawGcm(); draw_mouse_pointer(0); flip(); if ( (new_pad & BUTTON_TRIANGLE) || (new_pad & BUTTON_CIRCLE)) break; } } close_viewer: fclose(fp); quit_viewer: viewer_open=0; new_pad=0; state_draw=1; state_read=1; } // if ( ((new_pad & BUTTON_L3) || osk_open==2) && strstr(this_pane,"/ps3_home")==NULL) if ( (!strcmp(fm_func, "newfolder") || osk_open==2) )// && strstr(this_pane,"/ps3_home")==NULL) { //fm new folder new_pad=0; old_pad=0; if(osk_open!=2) { OutputInfo.result = CELL_OSKDIALOG_INPUT_FIELD_RESULT_OK; OutputInfo.numCharsResultString = 128; OutputInfo.pResultString = Result_Text_Buffer; open_osk(2, (char*) list[e].name); } if(osk_dialog!=0) { sprintf(new_file_name, "%S", (wchar_t*)OutputInfo.pResultString); if(strlen(new_file_name)>0) { sprintf(new_file_name, "%s/%S", this_pane, (wchar_t*)OutputInfo.pResultString); if(strstr(this_pane, "/net_host")!=NULL){ char cpath2[1024]; int chost=0; chost=this_pane[9]-0x30; if(this_pane[10]==0) sprintf(cpath2, "/%S/", (wchar_t*)OutputInfo.pResultString); else sprintf(cpath2, "/%s/%S/", this_pane+11, (wchar_t*)OutputInfo.pResultString); network_del((char*)"PUT", (char*)host_list[chost].host, host_list[chost].port, (char*) cpath2, (char*) "blank", 3); network_com((char*)"GET!",(char*)host_list[chost].host, host_list[chost].port, (char*)"/", (char*) host_list[chost].name, 1); } else mkdir(new_file_name, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(new_file_name, 0777); if(x_offset>=0.54f) state_read=3; else state_read=2; } osk_open=0; } } // if ( ((old_pad & BUTTON_SELECT) && (new_pad & BUTTON_CROSS) && (list[e].name[0]!=0x2e) && strlen(list[e].path)>8 && strstr(this_pane, "/ps3_home")==NULL) || osk_open==1) if ( (!strcmp(fm_func, "nethost"))) { int n=0; // if SELECT-X for network file - perform HOST file update n=list[e].path[9]-0x30; network_com((char*)"GET!", (char*)host_list[n].host, host_list[n].port, (char*)"/", (char*) host_list[n].name, 1);//host_list[n].root if(x_offset>=0.54f) state_read=3; else state_read=2; } if (!strcmp(fm_func, "rename") || osk_open==1) { //fm rename join_copy=0; new_pad=0; old_pad=0; //osk_rename: if(osk_open!=1) { OutputInfo.result = CELL_OSKDIALOG_INPUT_FIELD_RESULT_OK; /* Result on-screen keyboard dialog termination */ OutputInfo.numCharsResultString = 128; /* Specify number of characters for returned text */ OutputInfo.pResultString = Result_Text_Buffer; /* Buffer storing returned text */ ; open_osk(1, (char*) list[e].name); } if(osk_dialog!=0) { sprintf(new_file_name, "%S", (wchar_t*)OutputInfo.pResultString); if(strlen(new_file_name)>0) { sprintf(new_file_name, "%s/%S", this_pane, (wchar_t*)OutputInfo.pResultString); rename(list[e].path, new_file_name); if(x_offset>=0.54f) state_read=3; else state_read=2; if(!strcmp(this_pane, other_pane)) state_read=1; } osk_open=0; } //osk_end: } if (((new_pad & BUTTON_CROSS) && (list[e].type==0)) || ((new_pad & BUTTON_TRIANGLE) && strcmp(list[0].path, "/app_home"))) { //open_folder: if((new_pad & BUTTON_TRIANGLE)) e=0; first_to_show=0; mouseY=0.12f+0.025f+0.013f; //move mouse to top of folder list if(strstr (list[e].path,"/net_host")!=NULL) { int n=list[e].path[9]-0x30; if(!exist(host_list[n].name)) network_com((char*)"GET", (char*)host_list[n].host, host_list[n].port, (char*)"/", (char*) host_list[n].name, 1);//host_list[n].root } state_draw=1; if(x_offset>=0.54f) { first_right=0; sprintf(current_right_pane, "%s", list[e].path); state_read=3; } else { first_left=0; sprintf(current_left_pane, "%s", list[e].path); state_read=2; } new_pad=0; } if (( (new_pad & BUTTON_CROSS) || !strcmp(fm_func, "view")) && (list[e].type==1)) { //fm execute view sprintf(fm_func, "%s", "none"); join_copy=0; new_pad=0; sprintf(my_mp3_file, "%s", list[e].path); char just_path[256], just_title[128], just_title_id[16]; if(strstr(list[e].name, ".CNF")!=NULL || strstr(list[e].name, ".cnf")!=NULL) { strncpy(just_path, list[e].path, 11); just_path[11]=0; mod_mount_table(just_path, 1); dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*)STR_PS2DISC, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); unload_modules(); sys_process_exit(1); } if(strstr(list[e].name, ".pkg")!=NULL || strstr(list[e].name, ".PKG")!=NULL) { syscall_mount(this_pane, mount_bdvd); dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_no, (const char*)STR_PKGXMB, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret!=1) {reset_mount_points(); goto cancel_exit;} unload_modules(); sys_process_exit(1); } if(strstr(my_mp3_file, "/USRDIR/EBOOT.BIN")!=NULL && strstr(my_mp3_file, "/net_host")==NULL) { sprintf(just_path, "%s", my_mp3_file); pch=just_path; if(strstr(my_mp3_file, "/PS3_GAME/USRDIR/EBOOT.BIN")!=NULL) { char *pathpos=strstr(pch,"/PS3_GAME/USRDIR/EBOOT.BIN"); just_path[pathpos-pch]=0; sprintf(filename, "%s/PS3_GAME/PARAM.SFO", just_path); } else { char *pathpos=strstr(pch,"/USRDIR/EBOOT.BIN"); just_path[pathpos-pch]=0; sprintf(filename, "%s/PARAM.SFO", just_path); } change_param_sfo_version(filename); int plevel=0; parse_param_sfo(filename, just_title, just_title_id, &plevel); num_files_split=0; abort_copy=0; my_game_test(just_path, 2); if(num_files_split && payload!=1){ dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*)STR_NOSPLIT1, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); goto cancel_exit; } if(parental_level<plevel && parental_level>0) { sprintf(string1, (const char*) STR_GAME_PIN, plevel ); OutputInfo.result = CELL_OSKDIALOG_INPUT_FIELD_RESULT_OK; OutputInfo.numCharsResultString = 128; OutputInfo.pResultString = Result_Text_Buffer; open_osk(3, (char*) string1); while(1){ sprintf(string1, "::: %s :::\n\n\nSelected game is restricted with parental level %i.\n\nPlease enter four alphanumeric parental password code:", just_title, plevel); ClearSurface(); draw_square(-1.0f, 1.0f, 2.0f, 2.0f, 0.9f, 0xd0000080); cellDbgFontPrintf( 0.10f, 0.10f, 1.0f, 0xffffffff, string1); setRenderColor(); cellDbgFontDrawGcm(); flip(); if(osk_dialog==1 || osk_dialog==-1) break; } ClearSurface(); flip(); ClearSurface(); flipc(60); osk_open=0; if(osk_dialog!=0) { char pin_result[32]; wchar_t *pin_result2; pin_result2 = (wchar_t*)OutputInfo.pResultString; wcstombs(pin_result, pin_result2, 4); if(strlen(pin_result)==4) { if(strcmp(pin_result, parental_pass)==0) { goto pass_ok_2; } } } dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_PIN_ERR, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); goto cancel_exit; } pass_ok_2: if(payload==0 && sc36_path_patch==0 && !exist((char*)"/dev_bdvd")) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_PS3DISC, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } else if(payload==0 && sc36_path_patch==1 && !exist((char*)"/dev_bdvd")) { //dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, "Start your game from [* /app_home] menu.\n\nShould you run into problems - insert an original Playstation(R)3 game disc next time!", dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); poke_sc36_path( (char *) "/app_home" ); } dialog_ret=0; if(direct_launch==1) { cellMsgDialogOpen2( type_dialog_yes_no, (const char*) STR_TO_DBOOT, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); } if(dialog_ret==3) {reset_mount_points(); goto cancel_exit;} if(dialog_ret==1) { write_last_play( my_mp3_file, just_path, just_title, (char *) just_title_id, 1); unload_modules(); // if(payload==0) syscall_mount(just_path, mount_bdvd); sys_game_process_exitspawn2((char *) my_mp3_file, NULL, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_128K); // else sys_game_process_exitspawn2((char *) "/app_home/PS3_GAME/USRDIR/EBOOT.BIN", NULL, NULL, NULL, 0, 3071, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } write_last_play( my_mp3_file, just_path, just_title, (char *) just_title_id, 0); unload_modules(); syscall_mount(just_path, mount_bdvd); sys_process_exit(1); break; } else if( (strstr(my_mp3_file, "/BDMV/INDEX.BDM")!=NULL || strstr(my_mp3_file, "/BDMV/index.bdmv")!=NULL) && strstr(my_mp3_file, "/net_host")==NULL)// && strstr(my_mp3_file, "/dev_hdd0")!=NULL) { sprintf(just_path, "%s", my_mp3_file); pch=just_path; char *pathpos; if(strstr(my_mp3_file, "/BDMV/INDEX.BDM")!=NULL) { pathpos=strstr(pch,"/BDMV/INDEX.BDM"); just_path[pathpos-pch]=0; } else if(strstr(my_mp3_file, "/BDMV/index.bdmv")!=NULL) { pathpos=strstr(pch,"/BDMV/index.bdmv"); just_path[pathpos-pch]=0; sprintf(filename, (const char*) STR_BD2AVCHD, just_path); dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaab, NULL ); wait_dialog(); if(dialog_ret==1) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_no, (const char*) STR_BD2AVCHD2, dialog_fun2, (void*)0x0000aaab, NULL ); flipc(60); DIR *dir; char path[512], cfile[512], ffile[512], cfile0[16];int n; for(n=0;n<64;n++){ sprintf(path, "%s/BDMV/CLIPINF", just_path); dir=opendir (path); while(dir) { struct dirent *entry=readdir (dir); if(!entry) break; sprintf(cfile0, "%s", entry->d_name); if(strstr (cfile0,".clpi")!=NULL) {cfile0[5]=0; sprintf(cfile, "%s/%s.CPI", path, cfile0); sprintf(ffile, "%s/%s", path, entry->d_name); remove(cfile); rename(ffile, cfile);}}closedir(dir); sprintf(path, "%s/BDMV/BACKUP/CLIPINF", just_path); dir=opendir (path); while(dir) { struct dirent *entry=readdir (dir); if(!entry) break; sprintf(cfile0, "%s", entry->d_name); if(strstr (cfile0,".clpi")!=NULL) {cfile0[5]=0; sprintf(cfile, "%s/%s.CPI", path, cfile0); sprintf(ffile, "%s/%s", path, entry->d_name); remove(cfile); rename(ffile, cfile);}}closedir(dir); sprintf(path, "%s/BDMV/PLAYLIST", just_path); dir=opendir (path); while(dir) { struct dirent *entry=readdir (dir); if(!entry) break; sprintf(cfile0, "%s", entry->d_name); if(strstr (cfile0,".mpls")!=NULL) {cfile0[5]=0; sprintf(cfile, "%s/%s.MPL", path, cfile0); sprintf(ffile, "%s/%s", path, entry->d_name); remove(cfile); rename(ffile, cfile);}}closedir(dir); sprintf(path, "%s/BDMV/BACKUP/PLAYLIST", just_path); dir=opendir (path); while(1) { struct dirent *entry=readdir (dir); if(!entry) break; sprintf(cfile0, "%s", entry->d_name); if(strstr (cfile0,".mpls")!=NULL) {cfile0[5]=0; sprintf(cfile, "%s/%s.MPL", path, cfile0); sprintf(ffile, "%s/%s", path, entry->d_name); remove(cfile); rename(ffile, cfile);}}closedir(dir); sprintf(path, "%s/BDMV/STREAM", just_path); dir=opendir (path); while(dir) { struct dirent *entry=readdir (dir); if(!entry) break; sprintf(cfile0, "%s", entry->d_name); if(strstr (cfile0,".m2ts")!=NULL) {cfile0[5]=0; sprintf(cfile, "%s/%s.MTS", path, cfile0); sprintf(ffile, "%s/%s", path, entry->d_name); remove(cfile); rename(ffile, cfile);}}closedir(dir); sprintf(path, "%s/BDMV/STREAM/SSIF", just_path); dir=opendir (path); while(dir) { struct dirent *entry=readdir (dir); if(!entry) break; sprintf(cfile0, "%s", entry->d_name); if(strstr (cfile0,".ssif")!=NULL) {cfile0[5]=0; sprintf(cfile, "%s/%s.SSI", path, cfile0); sprintf(ffile, "%s/%s", path, entry->d_name); remove(cfile); rename(ffile, cfile);}}closedir(dir); } sprintf(path, "%s/BDMV/index.bdmv", just_path); if(exist(path)) {sprintf(cfile, "%s/BDMV/INDEX.BDM", just_path); remove(cfile); rename(path, cfile);} sprintf(path, "%s/BDMV/BACKUP/index.bdmv", just_path); if(exist(path)) {sprintf(cfile, "%s/BDMV/BACKUP/INDEX.BDM", just_path); remove(cfile); rename(path, cfile);} sprintf(path, "%s/BDMV/MovieObject.bdmv", just_path); if(exist(path)) {sprintf(cfile, "%s/BDMV/MOVIEOBJ.BDM", just_path); remove(cfile); rename(path, cfile);} sprintf(path, "%s/BDMV/BACKUP/MovieObject.bdmv", just_path); if(exist(path)) {sprintf(cfile, "%s/BDMV/BACKUP/MOVIEOBJ.BDM", just_path); remove(cfile); rename(path, cfile);} cellMsgDialogAbort(); } else goto skip_BD; } dialog_ret=0; sprintf(string1, (const char*) STR_ACT_AVCHD, just_path); cellMsgDialogOpen2( type_dialog_yes_no, string1, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_no, (const char*) STR_ACT_AVCHD2, dialog_fun2, (void*)0x0000aaab, NULL ); flipc(60); char usb_save[32]="/none"; usb_save[5]=0; sprintf(filename, "/dev_sd"); if(exist(filename)) { sprintf(usb_save, "/dev_sd/PRIVATE"); if(!exist(usb_save)) mkdir(usb_save, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); } if(!exist(usb_save)) { sprintf(filename, "/dev_ms"); if(exist(filename)) { sprintf(usb_save, "/dev_ms"); } } if(!exist(usb_save)) { for(int n=0;n<9;n++){ sprintf(filename, "/dev_usb00%i", n); if(exist(filename)) { sprintf(usb_save, "%s", filename); break; } } } if(exist(usb_save)) { sprintf(filename, "%s/AVCHD", usb_save); if(!exist(filename)) mkdir(filename, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sprintf(filename, "%s/AVCHD/BDMV", usb_save); if(!exist(filename)) mkdir(filename, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sprintf(filename, "%s/AVCHD/BDMV/INDEX.BDM", usb_save); if(!exist(filename)) file_copy((char *) avchdIN, (char *) filename, 0); sprintf(filename, "%s/AVCHD/BDMV/MOVIEOBJ.BDM", usb_save); if(!exist(filename)) file_copy((char *) avchdMV, (char *) filename, 0); sprintf(filename, "%s/AVCHD", usb_save); sprintf(usb_save, "%s", filename); cellMsgDialogAbort(); syscall_mount2((char *)usb_save, (char *)just_path); unload_modules(); sys_process_exit(1); break; } else { cellMsgDialogAbort(); dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_ATT_USB, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } } } else if( (is_video(my_mp3_file) || strstr(my_mp3_file, ".self")!=NULL || strstr(my_mp3_file, ".SELF")!=NULL || strstr(my_mp3_file, ".FLAC")!=NULL || strstr(my_mp3_file, ".flac")!=NULL || strstr(my_mp3_file, ".DTS")!=NULL || strstr(my_mp3_file, ".dts")!=NULL || strstr(my_mp3_file, "EBOOT.BIN")!=NULL) && strstr(my_mp3_file, "/net_host")==NULL && strstr(my_mp3_file, ".jpg")==NULL && strstr(my_mp3_file, ".JPG")==NULL && net_used_ignore() ) { if(strstr(my_mp3_file, ".SELF")==NULL && strstr(my_mp3_file, ".self")==NULL && strstr(my_mp3_file, "EBOOT.BIN")==NULL) { retry_showtime: sprintf(filename, "%s/SHOWTIME.SELF", app_usrdir); if(exist(filename)) { FILE *flist; sprintf(string1, "%s/TEMP/SHOWTIME.TXT", app_usrdir); remove(string1); flist = fopen(string1, "w"); sprintf(filename, "file://%s", my_mp3_file);fputs (filename, flist ); fclose(flist); // sprintf(filename, "%s/SHOWTIME.SELF", app_usrdir); // sys_game_process_exitspawn2((char *) filename, NULL, NULL, NULL, 0, 3070, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); cellFsGetFreeSize(app_usrdir, &blockSize, &freeSize); freeSpace = ( ((uint64_t)blockSize * freeSize)); if(strstr(my_mp3_file,"/pvd_usb")!=NULL && (uint64_t)list[e].size<freeSpace) { // && stat((char*)"/dev_hdd1", &s3)>=0 && sprintf(string1, "%s", (const char*) STR_CACHE_FILE); cellMsgDialogOpen2( CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL |CELL_MSGDIALOG_TYPE_BUTTON_TYPE_NONE|CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_OFF|CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NONE|CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE,string1,NULL,NULL,NULL); cellFsGetFreeSize((char*)"/dev_hdd1", &blockSize, &freeSize); freeSpace = ( ((uint64_t)blockSize * freeSize)); if((uint64_t)list[e].size<freeSpace) { sprintf(filename, "%s", "/dev_hdd1/multiMAN"); file_copy(my_mp3_file, filename, 1); if(my_mp3_file[strlen(my_mp3_file)-4]=='.') my_mp3_file[strlen(my_mp3_file)-4]=0; else if(my_mp3_file[strlen(my_mp3_file)-5]=='.') my_mp3_file[strlen(my_mp3_file)-5]=0; char imgfile2[512]; sprintf(imgfile2, "%s.srt", my_mp3_file); {sprintf(filename, "%s", "/dev_hdd1/multiMAN.srt");file_copy(imgfile2, filename, 0);} sprintf(imgfile2, "%s.SRT", my_mp3_file); {sprintf(filename, "%s", "/dev_hdd1/multiMAN.srt");file_copy(imgfile2, filename, 0);} sprintf(imgfile2, "%s.ssa", my_mp3_file); {sprintf(filename, "%s", "/dev_hdd1/multiMAN.ssa");file_copy(imgfile2, filename, 0);} sprintf(imgfile2, "%s.SSA", my_mp3_file); {sprintf(filename, "%s", "/dev_hdd1/multiMAN.ssa");file_copy(imgfile2, filename, 0);} sprintf(imgfile2, "%s.ass", my_mp3_file); {sprintf(filename, "%s", "/dev_hdd1/multiMAN.ass");file_copy(imgfile2, filename, 0);} sprintf(imgfile2, "%s.ASS", my_mp3_file); {sprintf(filename, "%s", "/dev_hdd1/multiMAN.ass");file_copy(imgfile2, filename, 0);} sprintf(my_mp3_file, "%s", "/dev_hdd1/multiMAN"); } else { sprintf(filename, "%s/TEMP/multiMAN", app_usrdir); file_copy(my_mp3_file, filename, 1); if(my_mp3_file[strlen(my_mp3_file)-4]=='.') my_mp3_file[strlen(my_mp3_file)-4]=0; else if(my_mp3_file[strlen(my_mp3_file)-5]=='.') my_mp3_file[strlen(my_mp3_file)-5]=0; char imgfile2[512]; sprintf(imgfile2, "%s.srt", my_mp3_file); {sprintf(filename, "%s/TEMP/multiMAN.srt", app_usrdir);file_copy(imgfile2, filename, 0);} sprintf(imgfile2, "%s.SRT", my_mp3_file); {sprintf(filename, "%s/TEMP/multiMAN.srt", app_usrdir);file_copy(imgfile2, filename, 0);} sprintf(imgfile2, "%s.ssa", my_mp3_file); {sprintf(filename, "%s/TEMP/multiMAN.ssa", app_usrdir);file_copy(imgfile2, filename, 0);} sprintf(imgfile2, "%s.SSA", my_mp3_file); {sprintf(filename, "%s/TEMP/multiMAN.ssa", app_usrdir);file_copy(imgfile2, filename, 0);} sprintf(imgfile2, "%s.ass", my_mp3_file); {sprintf(filename, "%s/TEMP/multiMAN.ass", app_usrdir);file_copy(imgfile2, filename, 0);} sprintf(imgfile2, "%s.ASS", my_mp3_file); {sprintf(filename, "%s/TEMP/multiMAN.ass", app_usrdir);file_copy(imgfile2, filename, 0);} sprintf(my_mp3_file, "%s/TEMP/multiMAN", app_usrdir); } cellMsgDialogAbort(); sprintf(string1, "%s/TEMP/SHOWTIME.TXT", app_usrdir); remove(string1); flist = fopen(string1, "w"); sprintf(filename, "file://%s", my_mp3_file);fputs (filename, flist ); fclose(flist); } if(!exist(my_mp3_file)) { cellMsgDialogAbort(); dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_NOTSUPPORTED2, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } else { unload_modules(); sprintf(filename, "%s/SHOWTIME.SELF", app_usrdir); sys_game_process_exitspawn2(filename, NULL, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } } else { cellMsgDialogAbort(); dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_no, (const char*) STR_DL_ST, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) { sprintf(filename, "%s/SHOWTIME.SELF", app_usrdir); sprintf(string1, "%s/SHOWTIME.SELF", url_base); download_file(string1, filename, 1); goto retry_showtime; } } } else { unload_modules(); sys_game_process_exitspawn2((char *) my_mp3_file, NULL, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_128K); sys_process_exit(1); } } else if(is_snes9x(my_mp3_file) && strstr(my_mp3_file, "/net_host")==NULL) { launch_snes_emu(my_mp3_file); } else if(is_genp(my_mp3_file) && strstr(my_mp3_file, "/net_host")==NULL) { launch_genp_emu(my_mp3_file); } else if(is_fceu(my_mp3_file) && strstr(my_mp3_file, "/net_host")==NULL) { launch_fceu_emu(my_mp3_file); } else if(is_vba(my_mp3_file) && strstr(my_mp3_file, "/net_host")==NULL) { launch_vba_emu(my_mp3_file); } else if(is_fba(my_mp3_file) && strstr(my_mp3_file, "/net_host")==NULL) { launch_fba_emu(my_mp3_file); } else if(strstr(my_mp3_file, ".mmt")!=NULL || strstr(my_mp3_file, ".MMT")!=NULL && strstr(my_mp3_file, "/net_host")==NULL) { apply_theme(my_mp3_file, this_pane); } skip_BD: if(strstr(my_mp3_file, ".mp3")!=NULL || strstr(my_mp3_file, ".MP3")!=NULL || strstr(my_mp3_file, "SOUND.BIN")!=NULL) { if(strstr(list[e].path,"/net_host")!=NULL) //network copy { char cpath[1024], cpath2[1024]; int chost=0; int pl=strlen(list[e].path); chost=list[e].path[9]-0x30; for(int n=11;n<pl;n++) {cpath[n-11]=list[e].path[n]; cpath[n-10]=0;} sprintf(cpath2, "/%s", cpath); //host_list[chost].root, sprintf(my_mp3_file, "%s/TEMP/%s", app_usrdir, list[e].name); network_com((char*)"GET", (char*)host_list[chost].host, host_list[chost].port, (char*) cpath2, (char*) my_mp3_file, 0); main_mp3((char*) my_mp3_file); max_mp3=0; current_mp3=0; remove(my_mp3_file); } else { int ci2=e+1; max_mp3=1; current_mp3=1; sprintf(mp3_playlist[max_mp3].path, "%s", my_mp3_file); //add the rest of the files as a playlist for(ci2=e+1; ci2<pane_size; ci2++) { sprintf(my_mp3_file, "%s", list[ci2].path); if(strstr(my_mp3_file, ".mp3")!=NULL || strstr(my_mp3_file, ".MP3")!=NULL) { if(max_mp3>=MAX_MP3) break; max_mp3++; sprintf(mp3_playlist[max_mp3].path, "%s", my_mp3_file); } } for(ci2=1; ci2<(e-1); ci2++) { sprintf(my_mp3_file, "%s", list[ci2].path); if(strstr(my_mp3_file, ".mp3")!=NULL || strstr(my_mp3_file, ".MP3")!=NULL) { if(max_mp3>=MAX_MP3) break; max_mp3++; sprintf(mp3_playlist[max_mp3].path, "%s", my_mp3_file); } } main_mp3((char*) mp3_playlist[1].path); } } sprintf(my_mp3_file, "%s", list[e].path); int current_image=e; long slide_time=0; int slide_show=0; int show_info=0; sprintf(my_mp3_file, "%s", list[current_image].path); if(strstr(my_mp3_file, ".jpg")!=NULL || strstr(my_mp3_file, ".JPG")!=NULL || strstr(my_mp3_file, ".jpeg")!=NULL || strstr(my_mp3_file, ".JPEG")!=NULL || strstr(my_mp3_file, ".png")!=NULL || strstr(my_mp3_file, ".PNG")!=NULL) { int to_break=0, slide_dir=0; float pic_zoom=1.0f; int pic_reload=1, pic_posY=0, pic_posX=0, pic_X=0, pic_Y=0; char pic_info[512]; use_analog=1; mouseYDR=mouseXDR=mouseYDL=mouseXDL=0.0000f; while(1) { // Picture Viewer Mode sprintf(my_mp3_file, "%s", list[current_image].path); if(strstr(my_mp3_file, ".jpg")!=NULL || strstr(my_mp3_file, ".JPG")!=NULL || strstr(my_mp3_file, ".jpeg")!=NULL || strstr(my_mp3_file, ".JPEG")!=NULL) { //cellDbgFontDrawGcm(); ClearSurface(); if(pic_reload!=0){ cellDbgFontDrawGcm(); pic_zoom=-1.0f; if(strstr(list[current_image].path,"/net_host")!=NULL) //network copy { char cpath[1024], cpath2[1024]; int chost=0; int pl=strlen(list[current_image].path); chost=list[current_image].path[9]-0x30; for(int n=11;n<pl;n++) {cpath[n-11]=list[current_image].path[n]; cpath[n-10]=0;} sprintf(cpath2, "/%s", cpath); //host_list[chost].root,, sprintf(my_mp3_file, "%s/TEMP/net_view.bin", app_usrdir); network_com((char*)"GET", (char*)host_list[chost].host, host_list[chost].port, (char*) cpath2, (char*) my_mp3_file, 0); } if(strstr(list[current_image].path,"/pvd_usb")!=NULL) //ntfs { sprintf(my_mp3_file, "%s/TEMP/net_view.bin", app_usrdir); file_copy(list[current_image].path, my_mp3_file, 0); } load_jpg_texture(text_FONT, my_mp3_file, 1920); slide_time=0; } png_w2=png_w; png_h2=png_h; if(pic_zoom==-1.0f){ pic_zoom=1.0f; //if(png_w==1280 && png_h==720) pic_zoom=1920.0f/1280.0f; //if(png_w==640 && png_h==360) pic_zoom=3.0f; if(png_h!=0 && png_h>=png_w && (float)png_h/(float)png_w>=1.77f) pic_zoom=float (1080.0f / png_h); if(png_h!=0 && png_h>=png_w && (float)png_h/(float)png_w<1.77f) pic_zoom=float (1920.0f / png_h); else if(png_w!=0 && png_h!=0 && png_w>png_h && (float)png_w/(float)png_h>=1.77f) pic_zoom=float (1920.0f / png_w); else if(png_w!=0 && png_h!=0 && png_w>png_h && (float)png_w/(float)png_h<1.77f) pic_zoom=float (1080.0f / png_h); } if(pic_zoom>4.f) pic_zoom=4.f; png_h2=(int) (png_h2*pic_zoom); png_w2=(int) (png_w2*pic_zoom); if(pic_reload!=0) { if(slide_dir==0) for(int slide_in=1920; slide_in>=0; slide_in-=128) { flip(); ClearSurface(); set_texture( text_FONT, 1920, 1080); display_img((int)((1920-png_w2)/2)+pic_posX+slide_in, (int)((1080-png_h2)/2)+pic_posY, png_w2, png_h2, png_w, png_h, 0.0f, 1920, 1080); } else for(int slide_in=-1920; slide_in<=0; slide_in+=128) { flip(); ClearSurface(); set_texture( text_FONT, 1920, 1080); display_img((int)((1920-png_w2)/2)+pic_posX+slide_in, (int)((1080-png_h2)/2)+pic_posY, png_w2, png_h2, png_w, png_h, 0.0f, 1920, 1080); } } else { ClearSurface(); set_texture( text_FONT, 1920, 1080); display_img((int)((1920-png_w2)/2)+pic_posX, (int)((1080-png_h2)/2)+pic_posY, png_w2, png_h2, png_w, png_h, 0.0f, 1920, 1080); } } if(strstr(my_mp3_file, ".png")!=NULL || strstr(my_mp3_file, ".PNG")!=NULL) { cellDbgFontDrawGcm(); if(pic_reload!=0){ if(strstr(list[current_image].path,"/net_host")!=NULL) //network copy { char cpath[1024], cpath2[1024]; int chost=0; int pl=strlen(list[current_image].path); chost=list[current_image].path[9]-0x30; for(int n=11;n<pl;n++) {cpath[n-11]=list[current_image].path[n]; cpath[n-10]=0;} sprintf(cpath2, "/%s", cpath); //host_list[chost].root, sprintf(my_mp3_file, "%s/TEMP/net_view.bin", app_usrdir); network_com((char*)"GET", (char*)host_list[chost].host, host_list[chost].port, (char*) cpath2, (char*) my_mp3_file, 0); } if(strstr(list[current_image].path,"/pvd_usb")!=NULL) //ntfs { sprintf(my_mp3_file, "%s/TEMP/net_view.bin", app_usrdir); file_copy(list[current_image].path, my_mp3_file, 0); } load_png_texture(text_FONT, my_mp3_file, 1920); slide_time=0; //if(png_w>1920 || png_h>1080) goto cancel_exit; } png_w2=png_w; png_h2=png_h; if(pic_zoom==-1.0f){ pic_zoom=1.0f; //if(png_w==1280 && png_h==720) pic_zoom=1920.0f/1280.0f; //if(png_w==640 && png_h==360) pic_zoom=3.0f; if(png_h!=0 && png_h>=png_w && (float)png_h/(float)png_w>=1.77f) pic_zoom=float (1080.0f / png_h); if(png_h!=0 && png_h>=png_w && (float)png_h/(float)png_w<1.77f) pic_zoom=float (1920.0f / png_h); else if(png_w!=0 && png_h!=0 && png_w>png_h && (float)png_w/(float)png_h>=1.77f) pic_zoom=float (1920.0f / png_w); else if(png_w!=0 && png_h!=0 && png_w>png_h && (float)png_w/(float)png_h<1.77f) pic_zoom=float (1080.0f / png_h); } if(pic_zoom>4.f) pic_zoom=4.f; png_h2=(int) (png_h2*pic_zoom); png_w2=(int) (png_w2*pic_zoom); pic_X=(int)((1920-png_w2)/2)+pic_posX; pic_Y=(int)((1080-png_h2)/2)+pic_posY; if(pic_reload!=0) { if(slide_dir==0) for(int slide_in=1920; slide_in>=0; slide_in-=128) { flip(); ClearSurface(); set_texture( text_FONT, 1920, 1080); display_img((int)((1920-png_w2)/2)+pic_posX+slide_in, (int)((1080-png_h2)/2)+pic_posY, png_w2, png_h2, png_w, png_h, 0.0f, 1920, 1080); } else for(int slide_in=-1920; slide_in<=0; slide_in+=128) { flip(); ClearSurface(); set_texture( text_FONT, 1920, 1080); display_img((int)((1920-png_w2)/2)+pic_posX+slide_in, (int)((1080-png_h2)/2)+pic_posY, png_w2, png_h2, png_w, png_h, 0.0f, 1920, 1080); } } else { ClearSurface(); set_texture( text_FONT, 1920, 1080); display_img(pic_X, pic_Y, png_w2, png_h2, png_w, png_h, 0.0f, 1920, 1080); } } //flip(); int ci=current_image; to_break=0; char ss_status[8]; while(1){ pad_read(); ClearSurface(); set_texture( text_FONT, 1920, 1080); if(strstr(my_mp3_file, ".png")!=NULL || strstr(my_mp3_file, ".PNG")!=NULL) display_img(pic_X, pic_Y, png_w2, png_h2, png_w, png_h, 0.0f, 1920, 1080); else display_img((int)((1920-png_w2)/2)+pic_posX, (int)((1080-png_h2)/2)+pic_posY, png_w2, png_h2, png_w, png_h, 0.0f, 1920, 1080); if(show_info==1){ if(slide_show) sprintf(ss_status, "%s", "Stop"); else sprintf(ss_status, "%s", "Start"); sprintf(pic_info," Name: %s", list[current_image].name); pic_info[95]=0; draw_text_stroke( 0.04f+0.025f, 0.867f, 0.7f ,0xc0a0a0a0, pic_info); timeinfo = localtime ( &list[current_image].time ); if(strstr(my_mp3_file, ".png")!=NULL || strstr(my_mp3_file, ".PNG")!=NULL) sprintf(pic_info," Info: PNG %ix%i (Zoom: %3.0f)\n Date: %02d/%02d/%04d\n[START]: %s slideshow", png_w, png_h, pic_zoom*100.0f, timeinfo->tm_mday, timeinfo->tm_mon+1, timeinfo->tm_year+1900, ss_status); else sprintf(pic_info," Info: JPEG %ix%i (Zoom: %3.0f)\n Date: %02d/%02d/%04d\n[START]: %s slideshow", png_w, png_h, pic_zoom*100.0f, timeinfo->tm_mday, timeinfo->tm_mon+1, timeinfo->tm_year+1900, ss_status); draw_text_stroke( 0.04f+0.025f, 0.89f, 0.7f ,0xc0a0a0a0, pic_info); cellDbgFontDrawGcm(); } flip(); if ( new_pad & BUTTON_SELECT ) {show_info=1-show_info; pic_reload=0; break;}// new_pad=0; old_pad=0; if ( new_pad & BUTTON_START ) { slide_time=0; //new_pad=0; old_pad=0; slide_show=1-slide_show; slide_dir=0; } if(slide_show==1) slide_time++; if ( ( new_pad & BUTTON_TRIANGLE ) || ( new_pad & BUTTON_CIRCLE ) ) {new_pad=0; to_break=1;break;} if ( ( new_pad & BUTTON_RIGHT ) || ( new_pad & BUTTON_R1 ) || ( new_pad & BUTTON_CROSS ) || (slide_show==1 && slide_time>600) ) { //find next image in the list int one_time3=1; check_from_start3: for(ci=current_image+1; ci<pane_size; ci++) { sprintf(my_mp3_file, "%s", list[ci].path); if(strstr(my_mp3_file, ".jpg")!=NULL || strstr(my_mp3_file, ".JPG")!=NULL || strstr(my_mp3_file, ".jpeg")!=NULL || strstr(my_mp3_file, ".JPEG")!=NULL || strstr(my_mp3_file, ".png")!=NULL || strstr(my_mp3_file, ".PNG")!=NULL) { current_image=ci; pic_zoom=1.0f; pic_reload=1; pic_posX=pic_posY=0; slide_time=0; slide_dir=0; break; } } if((current_image>pane_size || ci>=pane_size) && one_time3) {one_time3=0; current_image=-1; goto check_from_start3;}//to_break=1; // || current_image==e break; } if ( ( new_pad & BUTTON_LEFT ) || ( new_pad & BUTTON_L1 ) ) { //find previous image in the list if(current_image==0) current_image=pane_size; int one_time=1; check_from_start: for(ci=current_image-1; ci>=0; ci--) { sprintf(my_mp3_file, "%s", list[ci].path); if(strstr(my_mp3_file, ".jpg")!=NULL || strstr(my_mp3_file, ".JPG")!=NULL || strstr(my_mp3_file, ".jpeg")!=NULL || strstr(my_mp3_file, ".JPEG")!=NULL || strstr(my_mp3_file, ".png")!=NULL || strstr(my_mp3_file, ".PNG")!=NULL) { current_image=ci; pic_zoom=1.0f; pic_reload=1; pic_posX=pic_posY=0; slide_show=0; slide_dir=1; break; } } if((current_image<0 || ci<0) && one_time) {one_time=0; current_image=pane_size; goto check_from_start;}// to_break=1; // || current_image==e break; } if (( new_pad & BUTTON_L3 ) || ( new_pad & BUTTON_DOWN )) { if(png_w!=0 && pic_zoom==1.0f) pic_zoom=float (1920.0f / png_w); else pic_zoom=1.0f; pic_reload=0; pic_posX=pic_posY=0; new_pad=0; break; } if (( new_pad & BUTTON_R3 ) || ( new_pad & BUTTON_UP )) { if(png_h!=0 && pic_zoom==1.0f) pic_zoom=float (1080.0f / png_h); else pic_zoom=1.0f; pic_reload=0; pic_posX=pic_posY=0; new_pad=0; break; } if (mouseXDL!=0.0f && png_w2>1920) { pic_posX-=(int) (mouseXDL*1920.0f); pic_reload=0; if( pic_posX<(int)((1920-png_w2)/2) ) pic_posX=(int)((1920-png_w2)/2); if( ((int)((1920-png_w2)/2)+pic_posX)>0 ) pic_posX=0-(int)((1920-png_w2)/2); break; } if (mouseYDL!=0.0f && png_h2>1080) { pic_posY-=(int) (mouseYDL*1080.0f); if( pic_posY<(int)((1080-png_h2)/2) ) pic_posY=(int)((1080-png_h2)/2); if( ((int)((1080-png_h2)/2)+pic_posY)>0 ) pic_posY=0-(int)((1080-png_h2)/2); pic_reload=0; break; } if (( new_pad & BUTTON_L2 ) || mouseXDR> 0.003f || mouseYDR> 0.003f) { if ( new_pad & BUTTON_L2 ) pic_zoom-=0.045f; else pic_zoom-=0.010f; if(pic_zoom<1.0f) pic_zoom=1.000f; pic_reload=0; png_h2=(int) (png_h2*pic_zoom); png_w2=(int) (png_w2*pic_zoom); if( pic_posX<(int)((1920-png_w2)/2) ) pic_posX=(int)((1920-png_w2)/2); if( ((int)((1920-png_w2)/2)+pic_posX)>0 ) pic_posX=0; if( pic_posY<(int)((1080-png_h2)/2) ) pic_posY=(int)((1080-png_h2)/2); if( ((int)((1080-png_h2)/2)+pic_posY)>0 ) pic_posY=0; break; } if (( new_pad & BUTTON_R2 ) || mouseXDR< -0.003f || mouseYDR< -0.003f) { if (new_pad & BUTTON_R2) pic_zoom+=0.045f; else pic_zoom+=0.010f; pic_reload=0; png_h2=(int) (png_h2*pic_zoom); png_w2=(int) (png_w2*pic_zoom); if( pic_posX<(int)((1920-png_w2)/2) ) pic_posX=(int)((1920-png_w2)/2); if( ((int)((1920-png_w2)/2)+pic_posX)>0 ) pic_posX=0; if( pic_posY<(int)((1080-png_h2)/2) ) pic_posY=(int)((1080-png_h2)/2); if( ((int)((1080-png_h2)/2)+pic_posY)>0 ) pic_posY=0; break; } } new_pad=0;//old_pad=0; if(to_break==1) break; } //picture viewer new_pad=0; use_analog=0; // load_texture(text_MSC_5, iconMSC, 320); } state_draw=1; } cancel_exit: // if ((new_pad & BUTTON_SQUARE) && (list[e].type==1) && strstr(this_pane,"/ps3_home")==NULL) if (!strcmp(fm_func, "delete") && (list[e].type==1)) { //fm delete file int m_copy; int m_copy_total=0; for(m_copy=0; m_copy<pane_size; m_copy++) if(list[m_copy].type==1) m_copy_total+=list[m_copy].selected; if (m_copy_total==0) {list[e].selected=1; m_copy_total=1;} new_pad=0; old_pad=0; if(m_copy_total==1) sprintf(filename, (const char*) STR_DEL_FILE, list[e].path); else sprintf(filename, (const char*) STR_DEL_FILES, m_copy_total); dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) { for(m_copy=0; m_copy<pane_size; m_copy++) if(list[m_copy].selected && list[m_copy].type==1) { if(strstr(this_pane, "/net_host")!=NULL){ char cpath2[1024]; int chost=0; chost=list[m_copy].path[9]-0x30; if(strlen(list[m_copy].path)>11) { sprintf(cpath2, "/%s", list[e].path+11); network_del((char*)"DEL", (char*)host_list[chost].host, host_list[chost].port, (char*) cpath2, (char*) "blank", 3); network_com((char*)"GET!",(char*)host_list[chost].host, host_list[chost].port, (char*)"/", (char*) host_list[chost].name, 1); } } else remove(list[m_copy].path); } if(x_offset>=0.54f) state_read=3; else state_read=2; if(!strcmp(this_pane, other_pane)) state_read=1; } } // if ((new_pad & BUTTON_SQUARE) && (list[e].type==0) && (list[e].name[0]!=0x2e) && strlen(list[e].path)>12 && strstr(this_pane, "/ps3_home")==NULL && disable_options!=1 && disable_options!=3) if (!strcmp(fm_func, "delete") && (list[e].type==0) && strstr(list[e].path, "net_host")==NULL) { //fm delete folder sprintf(fm_func, "%s", "none"); new_pad=0; old_pad=0; int m_copy; int m_copy_total=0; for(m_copy=0; m_copy<pane_size; m_copy++) if(list[m_copy].type==0) m_copy_total+=list[m_copy].selected; if (m_copy_total==0) {list[e].selected=1; m_copy_total=1;} if(m_copy_total==1) sprintf(filename, (const char*) STR_DEL_DIR, list[e].path); else sprintf(filename, (const char*) STR_DEL_DIRS, m_copy_total); dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) { for(m_copy=0; m_copy<pane_size; m_copy++) if(list[m_copy].selected && list[m_copy].type==0) { if(strstr(this_pane, "/net_host")!=NULL){ char cpath2[1024]; int chost=0; chost=list[m_copy].path[9]-0x30; if(strlen(list[m_copy].path)>11) { sprintf(cpath2, "/%s/", list[m_copy].path+11); network_del((char*)"DEL", (char*)host_list[chost].host, host_list[chost].port, (char*) cpath2, (char*) "blank", 3); network_com((char*)"GET!",(char*)host_list[chost].host, host_list[chost].port, (char*)"/", (char*) host_list[chost].name, 1); } } else { abort_copy=0; time_start= time(NULL); file_counter=0; my_game_delete((char *) list[m_copy].path); rmdir((char *) list[m_copy].path); if(strstr(list[m_copy].path, "/dev_hdd")!=NULL) forcedevices|=0x0001; if(strstr(list[m_copy].path, "/dev_usb")!=NULL) forcedevices|=0xFFFE; } if(x_offset>=0.54f) state_read=3; else state_read=2; } } } // if ( ((new_pad & BUTTON_CIRCLE) || (new_pad & BUTTON_R3)) && (list[e].type==0) && (list[e].name[0]!=0x2e) && ((strlen(other_pane)>5 && strcmp(this_pane, other_pane)!=0) || ((new_pad & BUTTON_R3) && strstr(list[e].name, "PS3_GAME")!=NULL) ) && (!(strstr(other_pane, "/net_host")!=NULL && strstr(this_pane, "/net_host")!=NULL)) && (strstr(other_pane, "/ps3_home")==NULL || strstr(other_pane, "/ps3_home/video")!=NULL || strstr(other_pane, "/ps3_home/music")!=NULL || strstr(other_pane, "/ps3_home/photo")!=NULL)) if (!strcmp(fm_func, "shortcut") && (list[e].type==1)) { sprintf(fm_func, "%s", "none"); //fm shortcut file sprintf(filename, "%s/%s", other_pane, list[e].name); sprintf(string1, "%s", list[e].path); unlink(filename); link(string1, filename); state_read=1; state_draw=1; } if ( (!strcmp(fm_func, "copy") || !strcmp(fm_func, "move") || !strcmp(fm_func, "bdmirror") || !strcmp(fm_func, "pkgshortcut") || !strcmp(fm_func, "shortcut")) && (list[e].type==0)) { //fm copy folder use_symlinks=0; do_move=0; int ret, net_copy=0; // if((old_pad & BUTTON_SELECT)) do_move=1; // if(new_pad & BUTTON_R3) { use_symlinks=1; do_move=0; } if(!strcmp(fm_func, "move")) do_move=1; if(!strcmp(fm_func, "shortcut") || !strcmp(fm_func, "pkgshortcut") || !strcmp(fm_func, "bdmirror")) { use_symlinks=1; do_move=0; } if(strstr(list[e].path, "/net_host")!=NULL) {do_move=0; net_copy=1;} if(strstr(this_pane, "/ps3_home")!=NULL) do_move=0; int m_copy; int m_copy_total=0; for(m_copy=0; m_copy<pane_size; m_copy++) if(list[m_copy].type==0) m_copy_total+=list[m_copy].selected; if (m_copy_total==0) {list[e].selected=1; m_copy_total=1;} new_pad=0; old_pad=0; if(do_move==1) sprintf(filename, (const char*) STR_MOVE0, list[e].path, other_pane); else { if(use_symlinks==1) { if(strstr(list[e].name, "PS3_GAME")!=NULL && strstr(list[e].path, "/dev_hdd0")!=NULL && !strcmp(fm_func, "pkgshortcut")) sprintf(filename, (const char*) STR_COPY7, list[e].path); else if(strstr(list[e].name, "PS3_GAME")!=NULL && strstr(list[e].path, "/dev_usb")!=NULL && (c_firmware==3.41f || c_firmware==3.55f || c_firmware==3.15f) && !strcmp(fm_func, "bdmirror")) sprintf(filename, (const char*) STR_COPY10, list[e].path); else sprintf(filename, (const char*) STR_COPY8, list[e].path, other_pane, list[e].name); } else sprintf(filename, (const char*) STR_COPY9, list[e].path, other_pane); } dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); // if(strstr(list[e].name, "PS3_GAME")!=NULL && strstr(list[e].path, "/dev_usb")!=NULL && dialog_ret==1 && use_symlinks==1) if(!strcmp(fm_func, "bdmirror") && dialog_ret==1 && use_symlinks==1) { sprintf(fm_func, "%s", "none"); if(c_firmware!=3.55f && c_firmware!=3.41f && c_firmware!=3.15f) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_NOTSUPPORTED, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); goto cancel_mount; } char just_drive[32]; char usb_mount0[512], usb_mount1[512], usb_mount2[512]; char path_backup[512], path_bup[512]; FILE *fpA; strncpy(just_drive, list[e].path, 11); just_drive[11]=0; ret = mod_mount_table(just_drive, 0); //restore if(ret) { sprintf(usb_mount1, "%s/PS3_GAME", just_drive); if(exist(usb_mount1)) { //restore PS3_GAME back to USB game folder sprintf(path_bup, "%s/PS3PATH.BUP", usb_mount1); if(exist(path_bup)) { fpA = fopen ( path_bup, "r" ); if(fgets ( usb_mount2, 512, fpA )==NULL) sprintf(usb_mount2, "%s/PS3_GAME_OLD", just_drive); fclose(fpA); strncpy(usb_mount2, just_drive, 11); //always use current device } else sprintf(usb_mount2, "%s/PS3_GAME_OLD", just_drive); int pl, n; char tempname[512]; pl=strlen(usb_mount2); for(n=0;n<pl;n++) { tempname[n]=usb_mount2[n]; tempname[n+1]=0; if(usb_mount2[n]==0x2F && !exist(tempname)) { mkdir(tempname, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(tempname, 0777); } } if(!exist(usb_mount2)) rename (usb_mount1, usb_mount2); } if(!exist(usb_mount1)) { sprintf(usb_mount0, "%s", list[e].path); sprintf(path_backup, "%s/PS3PATH.BUP", usb_mount0); remove(path_backup); fpA = fopen ( path_backup, "w" ); fputs ( list[e].path, fpA ); fclose(fpA); rename (usb_mount0, usb_mount1); if(!exist((char*)"/dev_bdvd/PS3_GAME/PARAM.SFO")) sprintf(string1, "%s", (const char*) STR_START_BD1); else sprintf(string1, "%s", (const char*) STR_START_BD2); ret = mod_mount_table(just_drive, 1); //modify if(ret) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, string1, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); unload_modules(); sys_process_exit(1); } else { ret = mod_mount_table((char *) "reset", 0); //reset rename (usb_mount1, usb_mount0); dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_ERR_MNT, dialog_fun2, (void*)0x0000aaab, NULL );; wait_dialog(); goto cancel_mount; } } else { ret = mod_mount_table((char *) "reset", 0); //reset dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_ERR_MVGAME, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } } else { dialog_ret=0; ret = mod_mount_table((char *) "reset", 0); //reset ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_ERR_MNT, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } cancel_mount: dialog_ret=0; } if(dialog_ret==1) { char m_other_pane[512]; sprintf(m_other_pane, "%s", other_pane); for(m_copy=0; m_copy<pane_size; m_copy++) if(list[m_copy].selected && list[m_copy].type==0) { time_start= time(NULL); abort_copy=0; initConsole(); file_counter=0; new_pad=0; if(strstr(other_pane,"/dev_usb")!=NULL || strstr(other_pane,"/dev_sd")!=NULL || strstr(other_pane,"/dev_ms")!=NULL || strstr(other_pane,"/dev_cf")!=NULL) copy_mode=1; // break files >= 4GB else copy_mode=0; copy_is_split=0; sprintf(temp_pane, "%s", other_pane); sprintf(other_pane,"%s/%s", m_other_pane, list[m_copy].name); if(strstr(list[m_copy].name, "PS3_GAME")!=NULL && !strcmp(fm_func, "pkgshortcut") && use_symlinks==1) { sprintf(fm_func, "%s", "none"); sprintf(filename, "%s/PARAM.SFO", list[m_copy].path); char just_title[128], just_title_id[64]; just_title[0]=0; just_title_id[0]=0; int plevel; parse_param_sfo(filename, just_title, just_title_id, &plevel); // sprintf(other_pane,"%s/%s", temp_pane, just_title_id); sprintf(other_pane,"/dev_hdd0/G"); mkdir(other_pane, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(other_pane, 0777); char just_title_id2[7]; //just_title_id[0]=0x5A;//Z just_title_id2[0]=just_title_id[2]; if(just_title_id[1]!=0x4C) just_title_id2[0] = (just_title_id[2] | 0x20); just_title_id2[1]=just_title_id[4]; just_title_id2[2]=just_title_id[5]; just_title_id2[3]=just_title_id[6]; just_title_id2[4]=just_title_id[7]; just_title_id2[5]=just_title_id[8]; just_title_id2[6]=0; sprintf(other_pane,"/dev_hdd0/game/%s", just_title_id); /* if(stat(other_pane, &s3)>=0) { dialog_ret=0; sprintf(filename, "Destination already contains folder with the same name!\n\nContinue and overwrite?\n\n[%s]", other_pane ); cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret!=1) goto overwrite_cancel_3; } */ mkdir(other_pane, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(other_pane, 0777); my_game_copy((char *) list[m_copy].path, (char *) other_pane); cellMsgDialogAbort(); sprintf(other_pane,"/dev_hdd0/G/%s", just_title_id2); mkdir(other_pane, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(other_pane, 0777); my_game_copy((char *) list[m_copy].path, (char *) other_pane); sprintf(filename, "/dev_hdd0/game/%s", just_title_id); sprintf(other_pane, "/dev_hdd0/G/%s", just_title_id2); my_game_copy((char *) filename, (char *) other_pane); sprintf(filename, "/dev_hdd0/game/%s/USRDIR/MM_NON_NPDRM_EBOOT.BIN", just_title_id); sprintf(other_pane, "/dev_hdd0/G/%s/USRDIR/EBOOT.BIN", just_title_id2); if(exist(filename)) { unlink(other_pane); remove(other_pane); rename(filename, other_pane); //file_copy(filename, other_pane, 0); } // sprintf(filename, "%s/PARAM.SFO", list[m_copy].path); // sprintf(string1 ,"/dev_hdd0/game/%s/PARAM.SFO", just_title_id); // file_copy(filename, string1, 0); // sprintf(filename, "%s/PARAM.SFO", list[m_copy].path); // sprintf(string1,"/dev_hdd0/G/%s/PARAM.SFO", just_title_id2); // file_copy(filename, string1, 0); cellMsgDialogAbort(); sprintf(fm_func, "%s", "none"); goto all_prompts_done; } if(strcmp(other_dev, this_dev)==0 && do_move==1 && !strcmp(fm_func, "move")) rename ( list[m_copy].path, other_pane ); else { sprintf(fm_func, "%s", "none"); if(strstr(other_pane,"/net_host")!=NULL){ mkdir(other_pane, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(other_pane, 0777); net_folder_copy_put((char *) list[m_copy].path, (char *) temp_pane, (char *) list[m_copy].name); } else if(net_copy==1){ mkdir(other_pane, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(other_pane, 0777); net_folder_copy((char *) list[m_copy].path, (char *) temp_pane, (char *) list[m_copy].name); } else { char tmp_path[512]; sprintf(tmp_path, "%s", list[m_copy].path); if(strstr("/ps3_home", tmp_path)!=NULL) {mkdir(other_pane, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(other_pane, 0777);} if(strstr("/ps3_home/music", tmp_path)!=NULL) sprintf(tmp_path, "/dev_hdd0/music"); if(strstr("/ps3_home/video", tmp_path)!=NULL) sprintf(tmp_path, "/dev_hdd0/video"); if(strstr("/ps3_home/photo", tmp_path)!=NULL) sprintf(tmp_path, "/dev_hdd0/photo"); if(strstr(other_pane, "/ps3_home/video")!=NULL) copy_nr( (char *)tmp_path, (char *) other_pane, (char *) list[m_copy].name); // recursive to single folder copy else if(strstr(other_pane, "/ps3_home/music")!=NULL) copy_nr( (char *)tmp_path, (char *) other_pane, (char *) list[m_copy].name); else if(strstr(other_pane, "/ps3_home/photo")!=NULL) copy_nr( (char *)tmp_path, (char *) other_pane, (char *) list[m_copy].name); else { dialog_ret=1; if(exist(other_pane)) { dialog_ret=0; sprintf(filename, (const char*) STR_OVERWRITE, other_pane ); cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); } if(dialog_ret!=1) goto overwrite_cancel_3; mkdir(other_pane, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(other_pane, 0777); my_game_copy((char *) tmp_path, (char *) other_pane); } } ret=cellMsgDialogAbort(); if(do_move==1 && abort_copy==0) { my_game_delete((char *) list[m_copy].path); rmdir((char *) list[m_copy].path); } } all_prompts_done: if(x_offset>=0.54f) state_read=2; else state_read=3; if(do_move==1) state_read=1; termConsole(); cellMsgDialogAbort(); if( (do_move==1 && strstr(list[m_copy].path, "/dev_hdd")!=NULL) || (strstr(other_pane, "/dev_hdd")!=NULL)) forcedevices|=0x0001; if( (do_move==1 && strstr(list[m_copy].path, "/dev_usb")!=NULL) || (strstr(other_pane, "/dev_usb")!=NULL)) forcedevices|=0xFFFE; if(abort_copy!=0) break; } sprintf(fm_func, "%s", "none"); } sprintf(fm_func, "%s", "none"); } overwrite_cancel_3: // if ((new_pad & BUTTON_CIRCLE) && (list[e].type==1) && (list[e].name[0]!=0x2e) && strlen(other_pane)>5 && strcmp(this_pane, other_pane)!=0 && (!(strstr(other_pane, "/net_host")!=NULL && strstr(this_pane,"/net_host")!=NULL)) && (strstr(other_pane, "/ps3_home")==NULL || strstr(other_pane, "/ps3_home/video")!=NULL || strstr(other_pane, "/ps3_home/music")!=NULL || strstr(other_pane, "/ps3_home/photo")!=NULL) && disable_options!=2 && disable_options!=3) if ((!strcmp(fm_func, "copy") || !strcmp(fm_func, "move")) && (list[e].type==1) && (!(strstr(other_pane, "/net_host")!=NULL && strstr(this_pane,"/net_host")!=NULL)) && (strstr(other_pane, "/ps3_home")==NULL || strstr(other_pane, "/ps3_home/video")!=NULL || strstr(other_pane, "/ps3_home/music")!=NULL || strstr(other_pane, "/ps3_home/photo")!=NULL)) { //fm copy file do_move=0; // if((old_pad & BUTTON_SELECT)) do_move=1; if(!strcmp(fm_func, "move")) do_move=1; sprintf(fm_func, "%s", "none"); if(strstr(list[e].path, "/net_host")!=NULL) do_move=0; if(strstr(this_pane, "/ps3_home")!=NULL) do_move=0; int m_copy; int m_copy_total=0; for(m_copy=0; m_copy<pane_size; m_copy++) if(list[m_copy].type==1) m_copy_total+=list[m_copy].selected; if (m_copy_total==0) {list[e].selected=1; m_copy_total=1;} new_pad=0; old_pad=0; if(m_copy_total==1) { if(do_move==1) sprintf(filename, (const char*) STR_MOVE1, list[e].path, other_pane, list[e].name); else sprintf(filename, (const char*) STR_COPY11, list[e].path, other_pane, list[e].name); } else { if(do_move==1) sprintf(filename, (const char*) STR_MOVE2, m_copy_total, this_pane, other_pane); else sprintf(filename, (const char*) STR_COPY12, m_copy_total, this_pane, other_pane); } dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) { time_start= time(NULL); abort_copy=0; file_counter=0; new_pad=0; if(strstr(other_pane,"/dev_usb")!=NULL || strstr(other_pane,"/dev_sd")!=NULL || strstr(other_pane,"/dev_ms")!=NULL || strstr(other_pane,"/dev_cf")!=NULL) copy_mode=1; // break files >= 4GB else copy_mode=0; copy_is_split=0; char m_other_pane[512]; sprintf(m_other_pane, "%s", other_pane); for(m_copy=0; m_copy<pane_size; m_copy++) if(list[m_copy].selected && list[m_copy].type==1) { list[m_copy].selected=0; sprintf(other_pane,"%s/%s", m_other_pane, list[m_copy].name); if(strcmp(other_dev, this_dev)==0 && do_move==1) rename ( list[m_copy].path, other_pane ); else { if(do_move==1) sprintf(string1, "%s", STR_MOVE3); else sprintf(string1, "%s", STR_COPY5); ClearSurface(); cellDbgFontPrintf( 0.3f, 0.45f, 0.8f, 0xc0c0c0c0, string1); cellDbgFontDrawGcm(); if(do_move==1) sprintf(string1, "%s", STR_MOVE4); else sprintf(string1, "%s", STR_COPY6); if(strstr(other_pane, "/net_host")!=NULL){ char cpath2[1024]; int chost=0; chost=other_pane[9]-0x30; if(strlen(other_pane)>11) sprintf(cpath2, "/%s", other_pane+11); else sprintf(cpath2, "/%s", list[m_copy].name); char put_cmd[1024]; sprintf(put_cmd, "PUT-%.f", (double) list[m_copy].size); network_put((char*)put_cmd, (char*)host_list[chost].host, host_list[chost].port, (char*) cpath2, (char*) list[m_copy].path, 3); network_com((char*)"GET!",(char*)host_list[chost].host, host_list[chost].port, (char*)"/", (char*) host_list[chost].name, 1); // network_put(char *command, char *server_name, int server_port, char *net_file, char *save_path, int show_progress ) } else if(strstr(list[m_copy].path,"/net_host")!=NULL) //network copy { char cpath[1024], cpath2[1024]; int chost=0; int pl=strlen(list[m_copy].path); chost=list[m_copy].path[9]-0x30; for(int n=11;n<pl;n++) {cpath[n-11]=list[m_copy].path[n]; cpath[n-10]=0;} sprintf(cpath2, "/%s", cpath); //host_list[chost].root, if(strstr(other_pane, "/ps3_home/video")!=NULL && (strstr(list[m_copy].path, ".avi")!=NULL || strstr(list[m_copy].path, ".AVI")!=NULL || strstr(list[m_copy].path, ".m2ts")!=NULL || strstr(list[m_copy].path, ".M2TS")!=NULL || strstr(list[m_copy].path, ".mts")!=NULL || strstr(list[m_copy].path, ".MTS")!=NULL || strstr(list[m_copy].path, ".m2t")!=NULL || strstr(list[m_copy].path, ".M2T")!=NULL || strstr(list[m_copy].path, ".divx")!=NULL || strstr(list[m_copy].path, ".DIVX")!=NULL || strstr(list[m_copy].path, ".mpg")!=NULL || strstr(list[m_copy].path, ".MPG")!=NULL || strstr(list[m_copy].path, ".mpeg")!=NULL || strstr(list[m_copy].path, ".MPEG")!=NULL || strstr(list[m_copy].path, ".mp4")!=NULL || strstr(list[m_copy].path, ".MP4")!=NULL || strstr(list[m_copy].path, ".vob")!=NULL || strstr(list[m_copy].path, ".VOB")!=NULL || strstr(list[m_copy].path, ".wmv")!=NULL || strstr(list[m_copy].path, ".WMV")!=NULL || strstr(list[m_copy].path, ".ts")!=NULL || strstr(list[m_copy].path, ".TS")!=NULL || strstr(list[m_copy].path, ".mov")!=NULL || strstr(list[m_copy].path, ".MOV")!=NULL) ) { sprintf(other_pane,"%s/%s", app_temp, list[m_copy].name); network_com((char*)"GET", (char*)host_list[chost].host, host_list[chost].port, (char*) cpath2, (char*) other_pane, 3); if(exist(other_pane)) video_export((char *) list[m_copy].name, (char*) "My video", 1); } else if(strstr(other_pane, "/ps3_home/music")!=NULL && (strstr(list[m_copy].path, ".mp3")!=NULL || strstr(list[m_copy].path, ".MP3")!=NULL || strstr(list[m_copy].path, ".wav")!=NULL || strstr(list[m_copy].path, ".WAV")!=NULL || strstr(list[m_copy].path, ".aac")!=NULL || strstr(list[m_copy].path, ".AAC")!=NULL) ) { sprintf(other_pane,"%s/%s", app_temp, list[m_copy].name); network_com((char*)"GET", (char*)host_list[chost].host, host_list[chost].port, (char*) cpath2, (char*) other_pane, 3); if(exist(other_pane)) music_export((char *) list[m_copy].name, (char*) "My music", 1); } else if(strstr(other_pane, "/ps3_home/photo")!=NULL && (strstr(list[m_copy].path, ".jpg")!=NULL || strstr(list[m_copy].path, ".JPG")!=NULL || strstr(list[m_copy].path, ".jpeg")!=NULL || strstr(list[m_copy].path, ".JPEG")!=NULL || strstr(list[m_copy].path, ".png")!=NULL || strstr(list[m_copy].path, ".PNG")!=NULL) ) { sprintf(other_pane,"%s/%s", app_temp, list[m_copy].name); network_com((char*)"GET", (char*)host_list[chost].host, host_list[chost].port, (char*) cpath2, (char*) other_pane, 3); if(exist(other_pane)) photo_export((char *) list[m_copy].name, (char*) "My photos", 1); } else if(strstr(other_pane, "/ps3_home")==NULL) network_com((char*)"GET", (char*)host_list[chost].host, host_list[chost].port, (char*) cpath2, (char*) other_pane, 3); } else { cellMsgDialogOpen2( CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL |CELL_MSGDIALOG_TYPE_BUTTON_TYPE_NONE|CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_OFF|CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NONE|CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE,string1,NULL,NULL,NULL); flip(); if(strstr(other_pane, "/ps3_home/video")!=NULL && (strstr(list[m_copy].path, ".avi")!=NULL || strstr(list[m_copy].path, ".AVI")!=NULL || strstr(list[m_copy].path, ".m2ts")!=NULL || strstr(list[m_copy].path, ".M2TS")!=NULL || strstr(list[m_copy].path, ".mts")!=NULL || strstr(list[m_copy].path, ".MTS")!=NULL || strstr(list[m_copy].path, ".m2t")!=NULL || strstr(list[m_copy].path, ".M2T")!=NULL || strstr(list[m_copy].path, ".divx")!=NULL || strstr(list[m_copy].path, ".DIVX")!=NULL || strstr(list[m_copy].path, ".mpg")!=NULL || strstr(list[m_copy].path, ".MPG")!=NULL || strstr(list[m_copy].path, ".mpeg")!=NULL || strstr(list[m_copy].path, ".MPEG")!=NULL || strstr(list[m_copy].path, ".mp4")!=NULL || strstr(list[m_copy].path, ".MP4")!=NULL || strstr(list[m_copy].path, ".vob")!=NULL || strstr(list[m_copy].path, ".VOB")!=NULL || strstr(list[m_copy].path, ".wmv")!=NULL || strstr(list[m_copy].path, ".WMV")!=NULL || strstr(list[m_copy].path, ".ts")!=NULL || strstr(list[m_copy].path, ".TS")!=NULL || strstr(list[m_copy].path, ".mov")!=NULL || strstr(list[m_copy].path, ".MOV")!=NULL) ) { sprintf(other_pane,"%s/%s", app_temp, list[m_copy].name); file_copy((char *) list[m_copy].path, (char *) other_pane, 1); if(exist(other_pane)) video_export((char *) list[m_copy].name, (char*) "My video", 1); } else if(strstr(other_pane, "/ps3_home/music")!=NULL && (strstr(list[m_copy].path, ".mp3")!=NULL || strstr(list[m_copy].path, ".MP3")!=NULL || strstr(list[m_copy].path, ".wav")!=NULL || strstr(list[m_copy].path, ".WAV")!=NULL || strstr(list[m_copy].path, ".aac")!=NULL || strstr(list[m_copy].path, ".AAC")!=NULL) ) { sprintf(other_pane,"%s/%s", app_temp, list[m_copy].name); file_copy((char *) list[m_copy].path, (char *) other_pane, 1); if(exist(other_pane)) music_export((char *) list[m_copy].name, (char*) "My music", 1); } else if(strstr(other_pane, "/ps3_home/photo")!=NULL && (strstr(list[m_copy].path, ".jpg")!=NULL || strstr(list[m_copy].path, ".JPG")!=NULL || strstr(list[m_copy].path, ".jpeg")!=NULL || strstr(list[m_copy].path, ".JPEG")!=NULL || strstr(list[m_copy].path, ".png")!=NULL || strstr(list[m_copy].path, ".PNG")!=NULL) ) { sprintf(other_pane,"%s/%s", app_temp, list[m_copy].name); file_copy((char *) list[m_copy].path, (char *) other_pane, 1); if(exist(other_pane)) photo_export((char *) list[m_copy].name, (char*) "My photos", 1); } else if(strstr(other_pane, "/ps3_home")==NULL) { file_copy((char *) list[m_copy].path, (char *) other_pane, 1); if(do_move==1 && abort_copy==0) remove(list[m_copy].path); cellMsgDialogAbort(); } } } } if(x_offset>=0.54f) state_read=2; else state_read=3; if(do_move==1) state_read=1; } sprintf(fm_func, "%s", "none"); } if( ((new_pad & BUTTON_SQUARE)) && (list[e].name[0]!=0x2e) && (!(strstr(other_pane, "/net_host")!=NULL && strstr(this_pane,"/net_host")!=NULL)) && (strstr(other_pane, "/ps3_home")==NULL || strstr(other_pane, "/ps3_home/video")!=NULL || strstr(other_pane, "/ps3_home/music")!=NULL || strstr(other_pane, "/ps3_home/photo")!=NULL)) //&& strlen(other_pane)>5 && strcmp(this_pane, other_pane)!=0 { list[e].selected=1-list[e].selected; //new_pad=0; } } // if(c_opacity2>0x20) { if(x_offset>=0.54f) { print_label_width( x_offset, y_offset, 0.7f, color, str, 1.0f, 0.0f, 0, 0.225f); // print_label( x_offset+0.240f, y_offset, 0.7f, color, e_sizet, 1.0f, 0.0f, 0); print_label_ex( x_offset+0.295f, y_offset, 0.7f, color, e_sizet, 1.0f, 0.0f, 0, 1.0f, 1.0f, 2); print_label( x_offset+0.305f, y_offset, 0.7f, color, str_date, 1.0f, 0.0f, 0); } else { // print_label( x_offset+0.290f, y_offset, 0.7f, color, e_sizet, 1.0f, 0.0f, 0); print_label_width( x_offset, y_offset, 0.7f, color, str, 1.0f, 0.0f, 0, 0.27f); print_label_ex( x_offset+0.345f, y_offset, 0.7f, color, e_sizet, 1.0f, 0.0f, 0, 1.0f, 1.0f, 2); print_label( x_offset+0.355f, y_offset, 0.7f, color, str_date, 1.0f, 0.0f, 0); } } // cellDbgFontPrintf( x_offset, y_offset, 0.7f, color, str); y_offset+=0.026f; } } void parse_color_ini() { FILE *fp; th_device_list=1; th_device_separator=1; th_device_separator_y=956; th_legend=1; th_legend_y=853; th_drive_icon=1; th_drive_icon_x=1790; th_drive_icon_y=964; if(exist(color_ini)) { char col[16], line[128]; int len=0, i=0; fp = fopen ( color_ini, "r" ); while ( fgets ( line, sizeof line, fp ) != NULL ) /* read a line */ { if(line[0]==35) continue; if(strstr (line,"PS3DISC=")!=NULL) { len = strlen(line)-2; for(i = 8; i < len; i++) {col[i-8] = line[i];} col[i-8]=0; COL_PS3DISC=strtoul(col, NULL, 16); } if(strstr (line,"PS3DISCSEL=")!=NULL) { len = strlen(line)-2; for(i = 11; i < len; i++) {col[i-11] = line[i];} col[i-11]=0; COL_PS3DISCSEL=strtoul(col, NULL, 16); } if(strstr (line,"SEL=")!=NULL) { len = strlen(line)-2; for(i = 4; i < len; i++) {col[i-4] = line[i];} col[i-4]=0; COL_SEL=strtoul(col, NULL, 16); } if(strstr (line,"PS3=")!=NULL) { len = strlen(line)-2; for(i = 4; i < len; i++) {col[i-4] = line[i];} col[i-4]=0; COL_PS3=strtoul(col, NULL, 16); } if(strstr (line,"PS2=")!=NULL) { len = strlen(line)-2; for(i = 4; i < len; i++) {col[i-4] = line[i];} col[i-4]=0; COL_PS2=strtoul(col, NULL, 16); } if(strstr (line,"DVD=")!=NULL) { len = strlen(line)-2; for(i = 4; i < len; i++) {col[i-4] = line[i];} col[i-4]=0; COL_DVD=strtoul(col, NULL, 16); } if(strstr (line,"BDMV=")!=NULL) { len = strlen(line)-2; for(i = 5; i < len; i++) {col[i-5] = line[i];} col[i-5]=0; COL_BDMV=strtoul(col, NULL, 16); } if(strstr (line,"AVCHD=")!=NULL) { len = strlen(line)-2; for(i = 6; i < len; i++) {col[i-6] = line[i];} col[i-6]=0; COL_AVCHD=strtoul(col, NULL, 16); } if(strstr (line,"LEGEND=")!=NULL) { len = strlen(line)-2; for(i = 7; i < len; i++) {col[i-7] = line[i];} col[i-7]=0; COL_LEGEND=strtoul(col, NULL, 16); } if(strstr (line,"FMFILE=")!=NULL) { len = strlen(line)-2; for(i = 7; i < len; i++) {col[i-7] = line[i];} col[i-7]=0; COL_FMFILE=strtoul(col, NULL, 16); } if(strstr (line,"FMDIR=")!=NULL) { len = strlen(line)-2; for(i = 6; i < len; i++) {col[i-6] = line[i];} col[i-6]=0; COL_FMDIR=strtoul(col, NULL, 16); } if(strstr (line,"FMJPG=")!=NULL) { len = strlen(line)-2; for(i = 6; i < len; i++) {col[i-6] = line[i];} col[i-6]=0; COL_FMJPG=strtoul(col, NULL, 16); } if(strstr (line,"FMMP3=")!=NULL) { len = strlen(line)-2; for(i = 6; i < len; i++) {col[i-6] = line[i];} col[i-6]=0; COL_FMMP3=strtoul(col, NULL, 16); } if(strstr (line,"FMEXE=")!=NULL) { len = strlen(line)-2; for(i = 6; i < len; i++) {col[i-6] = line[i];} col[i-6]=0; COL_FMEXE=strtoul(col, NULL, 16); } if(strstr (line,"HEXVIEW=")!=NULL) { len = strlen(line)-2; for(i = 8; i < len; i++) {col[i-8] = line[i];} col[i-8]=0; COL_HEXVIEW=strtoul(col, NULL, 16); } if(strstr (line,"SPLIT=")!=NULL) { len = strlen(line)-2; for(i = 6; i < len; i++) {col[i-6] = line[i];} col[i-6]=0; COL_SPLIT=strtoul(col, NULL, 16); } if(strstr (line,"XMB_CLOCK=")!=NULL) { len = strlen(line)-2; for(i = 10; i < len; i++) {col[i-10] = line[i];} col[i-10]=0; COL_XMB_CLOCK=strtoul(col, NULL, 16); } if(strstr (line,"XMB_COLUMN=")!=NULL) { len = strlen(line)-2; for(i = 11; i < len; i++) {col[i-11] = line[i];} col[i-11]=0; COL_XMB_COLUMN=strtoul(col, NULL, 16); } if(strstr (line,"XMB_TITLE=")!=NULL) { len = strlen(line)-2; for(i = 10; i < len; i++) {col[i-10] = line[i];} col[i-10]=0; COL_XMB_TITLE=strtoul(col, NULL, 16); } if(strstr (line,"XMB_SUBTITLE=")!=NULL) { len = strlen(line)-2; for(i = 13; i < len; i++) {col[i-13] = line[i];} col[i-13]=0; COL_XMB_SUBTITLE=strtoul(col, NULL, 16); } if(strstr (line,"XMB_SPARK_SIZE=")!=NULL) { len = strlen(line)-2; for(i = 15; i < len; i++) {col[i-15] = line[i];} col[i-15]=0; XMB_SPARK_SIZE=strtoul(col, NULL, 10); } if(strstr (line,"XMB_SPARK_COLOR=")!=NULL) { len = strlen(line)-2; for(i = 16; i < len; i++) {col[i-16] = line[i];} col[i-16]=0; XMB_SPARK_COLOR=strtoul(col, NULL, 16); } if(strstr (line,"device_list=0")!=NULL) th_device_list=0; if(strstr (line,"device_separator=0")!=NULL) th_device_separator=0; if(strstr (line,"legend=0")!=NULL) th_legend=0; if(strstr (line,"drive_icon=0")!=NULL) th_drive_icon=0; if(strstr (line,"device_separator_y=")!=NULL) { len = strlen(line)-2; for(i = 19; i < len; i++) {col[i-19] = line[i];} col[i-19]=0; th_device_separator_y=strtoul(col, NULL, 10); } if(strstr (line,"legend_y=")!=NULL) { len = strlen(line)-2; for(i = 9; i < len; i++) {col[i-9] = line[i];} col[i-9]=0; th_legend_y=strtoul(col, NULL, 10); } if(strstr (line,"drive_icon_x=")!=NULL) { len = strlen(line)-2; for(i = 13; i < len; i++) {col[i-13] = line[i];} col[i-13]=0; th_drive_icon_x=strtoul(col, NULL, 10); } if(strstr (line,"drive_icon_y=")!=NULL) { len = strlen(line)-2; for(i = 13; i < len; i++) {col[i-13] = line[i];} col[i-13]=0; th_drive_icon_y=strtoul(col, NULL, 10); } if(strstr (line,"user_font=")!=NULL && !mm_locale) { len = strlen(line)-2; for(i = 10; i < len; i++) {col[i-10] = line[i];} col[i-10]=0; if(strtoul(col, NULL, 10)!=0) user_font=strtoul(col, NULL, 10); if(user_font<0 || user_font>19) user_font=1; } if(strstr (line,"game_bg_overlay=0")!=NULL) game_bg_overlay=0; if(strstr (line,"game_bg_overlay=1")!=NULL) game_bg_overlay=1; } fclose(fp); } } void write_last_state() { char filename2[1024], filename3[64]; sprintf(app_usrdir, "/dev_hdd0/game/%s/USRDIR",app_path); sprintf(filename2, "%s/STATE.BIN", app_usrdir); if(!exist(app_usrdir)) return; FILE *fpA; // remove(filename2); fpA = fopen ( filename2, "w" ); char CrLf[2]; CrLf [0]=13; CrLf [1]=10; CrLf[2]=0; filename3[0]=0; sprintf(filename3, "game_sel=%i\r\n", game_sel); fputs (filename3, fpA ); sprintf(filename3, "user_font=%i\r\n", user_font); fputs (filename3, fpA ); fclose(fpA); } void parse_last_state() { char string1[1024]; char filename2[1024]; sprintf(filename2, "%s/STATE.BIN", app_usrdir); if(!exist(filename2)) return; FILE *fp = fopen ( filename2, "r" ); int i; if ( fp != NULL ) { char line [1024]; while ( fgets ( line, sizeof line, fp ) != NULL ) /* read a line */ { if(line[0]==35) continue; if(strstr (line,"user_font=")!=NULL) { int len = strlen(line)-2; for(i = 10; i < len; i++) {string1[i-10] = line[i];} string1[i-10]=0; user_font=strtol(string1, NULL, 10); if(game_sel<0 || game_sel>19) user_font=1; } if(strstr (line,"game_sel=")!=NULL) { int len = strlen(line)-2; for(i = 9; i < len; i++) {string1[i-9] = line[i];} string1[i-9]=0; game_sel=strtol(string1, NULL, 10); if(game_sel<0 || game_sel>max_menu_list-1) game_sel=0; } } fclose ( fp ); } } int parse_ini(char * file, int skip_bin) { int i; max_hosts=0; game_last_page=-1; old_fi=-1; char line [ 256 ]; FILE *fp; if(!exist(file)) goto op_bin; fp = fopen ( file, "r" ); if ( fp != NULL ) { while ( fgets ( line, sizeof line, fp ) != NULL ) /* read a line */ { if(line[0]==35) continue; if(strstr (line,"hdd_dir=")!=NULL) { int len = strlen(line)-2; for(i = 8; i < len; i++) {ini_hdd_dir[i-8] = line[i];} ini_hdd_dir[i-8]=0; // DPrintf("Game backup folder (HDD): [%s]\n", ini_hdd_dir); } if(strstr (line,"usb_dir=")!=NULL) { int len = strlen(line)-2; for(i = 8; i < len; i++) {ini_usb_dir[i-8] = line[i];} ini_usb_dir[i-8]=0; // DPrintf("Game backup folder (USB): [%s]\n", ini_usb_dir); } if(strstr (line,"hdd_home=")!=NULL) { int len = strlen(line)-2; for(i = 9; i < len; i++) {hdd_home[i-9] = line[i];} hdd_home[i-9]=0; // DPrintf("Game search folder (HDD): [%s]\n", hdd_home); } if(strstr (line,"hdd_home2=")!=NULL) { int len = strlen(line)-2; for(i = 10; i < len; i++) {hdd_home_2[i-10] = line[i];} hdd_home_2[i-10]=0; // DPrintf("Game search folder (HDD) (aux#1): [%s]\n", hdd_home_2); } if(strstr (line,"hdd_home3=")!=NULL) { int len = strlen(line)-2; for(i = 10; i < len; i++) {hdd_home_3[i-10] = line[i];} hdd_home_3[i-10]=0; // DPrintf("Game search folder (HDD) (aux#2): [%s]\n", hdd_home_3); } if(strstr (line,"hdd_home4=")!=NULL) { int len = strlen(line)-2; for(i = 10; i < len; i++) {hdd_home_4[i-10] = line[i];} hdd_home_4[i-10]=0; // DPrintf("Game search folder (HDD) (aux#3): [%s]\n", hdd_home_4); } if(strstr (line,"hdd_home5=")!=NULL) { int len = strlen(line)-2; for(i = 10; i < len; i++) {hdd_home_5[i-10] = line[i];} hdd_home_5[i-10]=0; // DPrintf("Game search folder (HDD) (aux#4): [%s]\n", hdd_home_5); } if(strstr (line,"usb_home=")!=NULL) { int len = strlen(line)-2; for(i = 9; i < len; i++) {usb_home[i-9] = line[i];} usb_home[i-9]=0; // DPrintf("Game search folder (USB): [%s]\n", usb_home); } if(strstr (line,"usb_home2=")!=NULL) { int len = strlen(line)-2; for(i = 10; i < len; i++) {usb_home_2[i-10] = line[i];} usb_home_2[i-10]=0; // DPrintf("Game search folder (USB) (aux#1): [%s]\n", usb_home_2); } if(strstr (line,"usb_home3=")!=NULL) { int len = strlen(line)-2; for(i = 10; i < len; i++) {usb_home_3[i-10] = line[i];} usb_home_3[i-10]=0; // DPrintf("Game search folder (USB) (aux#2): [%s]\n", usb_home_3); } if(strstr (line,"usb_home4=")!=NULL) { int len = strlen(line)-2; for(i = 10; i < len; i++) {usb_home_4[i-10] = line[i];} usb_home_4[i-10]=0; // DPrintf("Game search folder (USB) (aux#3): [%s]\n", usb_home_4); } if(strstr (line,"usb_home5=")!=NULL) { int len = strlen(line)-2; for(i = 10; i < len; i++) {usb_home_5[i-10] = line[i];} usb_home_5[i-10]=0; // DPrintf("Game search folder (USB) (aux#4): [%s]\n", usb_home_5); } if(strstr (line,"covers_dir=")!=NULL) { int len = strlen(line)-2; for(i = 11; i < len; i++) {covers_dir[i-11] = line[i];} covers_dir[i-11]=0; // DPrintf("Game covers folder (HDD): [%s]\n", covers_dir); } if(strstr (line,"themes_dir=")!=NULL) { int len = strlen(line)-2; for(i = 11; i < len; i++) {themes_dir[i-11] = line[i];} themes_dir[i-11]=0; // DPrintf("Themes folder: [%s]\n", themes_dir); } if(strstr (line,"themes_web_dir=")!=NULL) { int len = strlen(line)-2; for(i = 15; i < len; i++) {themes_web_dir[i-15] = line[i];} themes_web_dir[i-15]=0; // DPrintf("Themes folder: [%s]\n", themes_dir); } if(strstr (line,"update_dir=")!=NULL) { int len = strlen(line)-2; for(i = 11; i < len; i++) {update_dir[i-11] = line[i];} update_dir[i-11]=0; // DPrintf("Update save folder: [%s]\n", update_dir); } if(strstr (line,"download_dir=")!=NULL) { int len = strlen(line)-2; for(i = 13; i < len; i++) {download_dir[i-13] = line[i];} download_dir[i-13]=0; // DPrintf("Web browser downloads save folder: [%s]\n", download_dir); } if(strstr (line,"snes_roms=")!=NULL) { int len = strlen(line)-2; for(i = 10; i < len; i++) {snes_roms[i-10] = line[i];} snes_roms[i-10]=0; } if(strstr (line,"snes_self=")!=NULL) { int len = strlen(line)-2; for(i = 10; i < len; i++) {snes_self[i-10] = line[i];} snes_self[i-10]=0; } if(strstr (line,"genp_roms=")!=NULL) { int len = strlen(line)-2; for(i = 10; i < len; i++) {genp_roms[i-10] = line[i];} genp_roms[i-10]=0; } if(strstr (line,"genp_self=")!=NULL) { int len = strlen(line)-2; for(i = 10; i < len; i++) {genp_self[i-10] = line[i];} genp_self[i-10]=0; } if(strstr (line,"fceu_roms=")!=NULL) { int len = strlen(line)-2; for(i = 10; i < len; i++) {fceu_roms[i-10] = line[i];} fceu_roms[i-10]=0; } if(strstr (line,"fceu_self=")!=NULL) { int len = strlen(line)-2; for(i = 10; i < len; i++) {fceu_self[i-10] = line[i];} fceu_self[i-10]=0; } if(strstr (line,"vba_roms=")!=NULL) { int len = strlen(line)-2; for(i = 9; i < len; i++) {vba_roms[i-9] = line[i];} vba_roms[i-9]=0; } if(strstr (line,"vba_self=")!=NULL) { int len = strlen(line)-2; for(i = 9; i < len; i++) {vba_self[i-9] = line[i];} vba_self[i-9]=0; } if(strstr (line,"fba_roms=")!=NULL) { int len = strlen(line)-2; for(i = 9; i < len; i++) {fba_roms[i-9] = line[i];} fba_roms[i-9]=0; } if(strstr (line,"fba_self=")!=NULL) { int len = strlen(line)-2; for(i = 9; i < len; i++) {fba_self[i-9] = line[i];} fba_self[i-9]=0; } //nethost:10.20.2.208:11222:/downloads/ char n_prefix[32], n_host[128], n_port[6], n_friendly[64], n_em[64]; if(sscanf(line,"%[^*]*%[^*]*%[^*]*%[^*]*%s\n", n_prefix, n_host, n_port, n_friendly, n_em)>=4) //, n_root //%[^:]: if(strcmp(n_prefix, "nethost")==0 && max_hosts<9) { sprintf(host_list[max_hosts].host, "%s", n_host); host_list[max_hosts].port=strtol(n_port, NULL, 10); // sprintf(host_list[max_hosts].root, "%s", n_root); sprintf(host_list[max_hosts].friendly, "%s", n_friendly); sprintf(host_list[max_hosts].name,"%s/net_host%i", app_usrdir, max_hosts); DPrintf("[Host PC#%i] %s:%s * Friendly name: %s\n", max_hosts+1, n_host, n_port, n_friendly); //, n_root // Serve path: %s max_hosts++; } } fclose ( fp ); // if(strstr(mp3_now_playing, "SOUND.BIN")==NULL) DPrintf("Now playing: %s", mp3_now_playing ); } op_bin: if(skip_bin) goto out_ini; fp = fopen ( options_bin, "r" ); if ( fp != NULL ) { while ( fgets ( line, sizeof line, fp ) != NULL ) /* read a line */ { if(line[0]==35) continue; if(strstr (line,"ftpd_on=1")!=NULL) {ftp_on(); ftp_service=1;} // int bpcm=cover_mode; if(strstr (line,"fullpng=0")!=NULL) cover_mode=0; if(strstr (line,"fullpng=1")!=NULL) cover_mode=1; if(strstr (line,"fullpng=2")!=NULL) cover_mode=2; if(strstr (line,"fullpng=3")!=NULL) cover_mode=3; if(strstr (line,"fullpng=4")!=NULL) cover_mode=4; if(strstr (line,"fullpng=6")!=NULL) cover_mode=6; if(strstr (line,"fullpng=5")!=NULL) cover_mode=5; if(strstr (line,"fullpng=7")!=NULL) cover_mode=7; if(strstr (line,"fullpng=8")!=NULL) cover_mode=8; initial_cover_mode=cover_mode; if(strstr (line,"game_bg_overlay=0")!=NULL) game_bg_overlay=0; if(strstr (line,"game_bg_overlay=1")!=NULL) game_bg_overlay=1; if(strstr (line,"gray_poster=0")!=NULL) gray_poster=0; if(strstr (line,"gray_poster=1")!=NULL) gray_poster=1; if(strstr (line,"confirm_with_x=0")!=NULL) confirm_with_x=0; if(strstr (line,"confirm_with_x=1")!=NULL) confirm_with_x=1; set_xo(); if(strstr (line,"hide_bd=0")!=NULL) hide_bd=0; if(strstr (line,"hide_bd=1")!=NULL) hide_bd=1; if(strstr (line,"theme_sound=0")!=NULL) theme_sound=0; if(strstr (line,"theme_sound=1")!=NULL) theme_sound=1; if(strstr (line,"display_mode=0")!=NULL && line[0]=='d') display_mode=0; if(strstr (line,"display_mode=1")!=NULL && line[0]=='d') display_mode=1; if(strstr (line,"display_mode=2")!=NULL && line[0]=='d') display_mode=2; if(strstr (line,"showdir=0")!=NULL) dir_mode=0; if(strstr (line,"showdir=1")!=NULL) dir_mode=1; if(strstr (line,"showdir=2")!=NULL) dir_mode=2; if(strstr (line,"game_details=0")!=NULL) game_details=0; if(strstr (line,"game_details=1")!=NULL) game_details=1; if(strstr (line,"game_details=2")!=NULL) game_details=2; if(strstr (line,"game_details=3")!=NULL) game_details=3; if(strstr (line,"use_pad_sensor=0")!=NULL) use_pad_sensor=0; if(strstr (line,"use_pad_sensor=1")!=NULL) use_pad_sensor=1; if(strstr (line,"bd_emulator=0")!=NULL) bd_emulator=0; if(strstr (line,"bd_emulator=1")!=NULL) bd_emulator=1; if(strstr (line,"bd_emulator=2")!=NULL) bd_emulator=2; if(c_firmware==3.41f && bd_emulator>1) bd_emulator=1; if(strstr (line,"scan_avchd=0")!=NULL) scan_avchd=0; if(strstr (line,"scan_avchd=1")!=NULL) scan_avchd=1; if(strstr (line,"clear_activity_logs=0")!=NULL) clear_activity_logs=0; if(strstr (line,"clear_activity_logs=1")!=NULL) clear_activity_logs=1; if(strstr (line,"lock_display_mode=0")!=NULL) lock_display_mode=0; if(strstr (line,"lock_display_mode=1")!=NULL) lock_display_mode=1; if(strstr (line,"lock_display_mode=2")!=NULL) lock_display_mode=2; if(strstr (line,"lock_display_mode=3")!=NULL) lock_display_mode=3; if(strstr (line,"lock_display_mode=4")!=NULL) lock_display_mode=4; if(strstr (line,"lock_display_mode=5")!=NULL) lock_display_mode=5; if(strstr (line,"lock_display_mode=6")!=NULL) lock_display_mode=6; if(strstr (line,"lock_display_mode=7")!=NULL) lock_display_mode=7; if(strstr (line,"lock_display_mode=8")!=NULL) lock_display_mode=8; if(strstr (line,"expand_avchd=0")!=NULL) expand_avchd=0; if(strstr (line,"expand_avchd=1")!=NULL) expand_avchd=1; if(strstr (line,"lock_fileman=0")!=NULL) lock_fileman=0; if(strstr (line,"lock_fileman=1")!=NULL) lock_fileman=1; if(strstr (line,"progress_bar=0")!=NULL) progress_bar=0; if(strstr (line,"progress_bar=1")!=NULL) progress_bar=1; if(strstr (line,"verify_data=0")!=NULL) verify_data=0; if(strstr (line,"verify_data=1")!=NULL) verify_data=1; if(strstr (line,"verify_data=2")!=NULL) verify_data=2; if(strstr (line,"scan_for_apps=0")!=NULL) scan_for_apps=0; if(strstr (line,"scan_for_apps=1")!=NULL) scan_for_apps=1; if(strstr (line,"xmb_sparks=0")!=NULL) xmb_sparks=0; if(strstr (line,"xmb_sparks=1")!=NULL) xmb_sparks=1; if(strstr (line,"xmb_sparks=2")!=NULL) xmb_sparks=2; if(strstr (line,"xmb_popup=0")!=NULL) xmb_popup=0; if(strstr (line,"xmb_popup=1")!=NULL) xmb_popup=1; if(strstr (line,"xmb_game_bg=0")!=NULL) xmb_game_bg=0; if(strstr (line,"xmb_game_bg=1")!=NULL) xmb_game_bg=1; if(strstr (line,"xmb_cover=0")!=NULL) xmb_cover=0; if(strstr (line,"xmb_cover=1")!=NULL) xmb_cover=1; if(strstr (line,"xmb_cover_column=0")!=NULL) xmb_cover_column=0; if(strstr (line,"xmb_cover_column=1")!=NULL) xmb_cover_column=1; if(strstr (line,"date_format=0")!=NULL) date_format=0; if(strstr (line,"date_format=1")!=NULL) date_format=1; if(strstr (line,"date_format=2")!=NULL) date_format=2; if(strstr (line,"time_format=0")!=NULL) time_format=0; if(strstr (line,"time_format=1")!=NULL) time_format=1; if(strstr (line,"mount_hdd1=0")!=NULL) mount_hdd1=0; if(strstr (line,"mount_hdd1=1")!=NULL) mount_hdd1=1; if(strstr (line,"animation=0")!=NULL) animation=0; if(strstr (line,"animation=1")!=NULL) animation=1; if(strstr (line,"animation=2")!=NULL) animation=2; if(strstr (line,"animation=3")!=NULL) animation=3; if(strstr (line,"disable_options=0")!=NULL) disable_options=0;// DPrintf("Disable options: [none]\n");} if(strstr (line,"disable_options=1")!=NULL) disable_options=1;// DPrintf("Disable options: [delete]\n");} if(strstr (line,"disable_options=2")!=NULL) disable_options=2;// DPrintf("Disable options: [copy/backup]\n");} if(strstr (line,"disable_options=3")!=NULL) disable_options=3;// DPrintf("Disable options: [copy/backup/delete]\n");} if(strstr (line,"download_covers=0")!=NULL) download_covers=0; if(strstr (line,"download_covers=1")!=NULL) download_covers=1; if(strstr (line,"overscan=")!=NULL) { overscan=(strtod(((char*)line)+9, NULL)/100.f); if(overscan>0.10f) overscan=0.10f; if(overscan<0.00f) overscan=0.00f; } char dimS[8]; if(strstr (line,"dim_titles=")!=NULL) { int len = strlen(line)-2; for(i = 11; i < len; i++) {dimS[i-11] = line[i];} dimS[i-11]=0; dim_setting=strtoul(dimS, NULL, 10); if(dim_setting>10) dim_setting=10; } if(strstr (line,"ss_timeout=")!=NULL) { int len = strlen(line)-2; for(i = 11; i < len; i++) {dimS[i-11] = line[i];} dimS[i-11]=0; ss_timeout=strtoul(dimS, NULL, 10); if(ss_timeout>10) ss_timeout=0; } if(strstr (line,"user_font=")!=NULL) { int len = strlen(line)-2; for(i = 10; i < len; i++) {dimS[i-10] = line[i];} dimS[i-10]=0; user_font=strtoul(dimS, NULL, 10); if(user_font<0 || user_font>19) user_font=1; } if(strstr (line,"mm_locale=")!=NULL) { int len = strlen(line)-2; for(i = 10; i < len; i++) {dimS[i-10] = line[i];} dimS[i-10]=0; mm_locale=strtoul(dimS, NULL, 10); if(mm_locale>=MAX_LOCALES) mm_locale=0; } if(strstr (line,"deadzone_x=")!=NULL) { int len = strlen(line)-2; for(i = 11; i < len; i++) {dimS[i-11] = line[i];} dimS[i-11]=0; xDZ=strtoul(dimS, NULL, 10); if(xDZ>90) xDZ=90; xDZa=(int) (xDZ*128/100); } if(strstr (line,"deadzone_y=")!=NULL) { int len = strlen(line)-2; for(i = 11; i < len; i++) {dimS[i-11] = line[i];} dimS[i-11]=0; yDZ=strtoul(dimS, NULL, 10); if(yDZ>90) yDZ=90; yDZa=(int) (yDZ*128/100); } if(strstr (line,"repeat_init_delay=")!=NULL) { int len = strlen(line)-2; for(i = 18; i < len; i++) {dimS[i-18] = line[i];} dimS[i-18]=0; repeat_init_delay=strtoul(dimS, NULL, 10); } if(strstr (line,"repeat_key_delay=")!=NULL) { int len = strlen(line)-2; for(i = 17; i < len; i++) {dimS[i-17] = line[i];} dimS[i-17]=0; repeat_key_delay=strtoul(dimS, NULL, 10); } if(strstr (line,"parental_level=")!=NULL) { int len = strlen(line)-2; for(i = 15; i < len; i++) {dimS[i-15] = line[i];} dimS[i-15]=0; parental_level=strtoul(dimS, NULL, 10); if(parental_level<0 || parental_level>11) parental_level=0; } if(strstr (line,"parental_pass=")!=NULL) { int len = strlen(line)-2; for(i = 14; i < len; i++) {dimS[i-14] = line[i];} dimS[i-14]=0; strncpy(parental_pass, dimS, 4); parental_pass[4]=0; if(strlen(parental_pass)<4) {sprintf(parental_pass, "0000"); parental_pass[4]=0;} } } fclose ( fp ); } out_ini: return 0; } void get_www_themes(theme_def *list, u8 *max) { int ret=0; (*max)=0; if(cellNetCtlGetInfo(16, &net_info)<0) { //net_avail=-1; dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_WARN_INET, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); return; } //dialog_ret=0; cellMsgDialogOpen2( type_dialog_no, "Please wait...", dialog_fun2, (void*)0x0000aaab, NULL ); //flipc(60); char update_url[128]=" "; char local_file[64]=" "; char line[2048]; char update_server[256]; sprintf(update_server, "%s/themes_web/", url_base); if(c_firmware>3.30f) sprintf(update_url,"%sthemes.bin", update_server); if(c_firmware<3.40f) sprintf(update_url,"%sthemes315.bin", update_server); if(c_firmware>3.54f) sprintf(update_url,"%sthemes355.bin", update_server); sprintf(local_file, "%s/themes_check.bin", app_temp); remove(local_file); ret = download_file(update_url, local_file, 0); cellMsgDialogAbort(); if(ret==0) { dialog_ret=0; //net_avail=-1; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_WARN_INET, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); remove(local_file); // sprintf(local_file, "%s/themes_check.bin", app_temp); // sprintf(line, "%s/THEME.BIN" // remove(local_file); return; } ret=0; fpV = fopen ( local_file, "r" ); if ( fpV != NULL ) { char t_prefix[8], t_name[64], t_pkg[512], t_img[512], t_author[32], t_ver[16], t_free[64], t_em[128]; while ( fgets ( line, sizeof line, fpV ) != NULL ) { if(sscanf(line,"%[^*]*%[^*]*%[^*]*%[^*]*%[^*]*%[^*]*%[^*]*%s\n", t_prefix, t_name, t_pkg, t_img, t_author, t_ver, t_free, t_em)>=7) if(strcmp(t_prefix, "theme")==0 && (*max)< (MAX_WWW_THEMES-1)) { sprintf(list[*max].name, "%s", t_name); sprintf(list[*max].pkg, "%s", t_pkg); sprintf(list[*max].img, "%s", t_img); sprintf(list[*max].author, "%s", t_author); sprintf(list[*max].mmver, "%s", t_ver); sprintf(list[*max].info, "%s", t_free); // dialog_ret=0;cellMsgDialogOpen2( type_dialog_ok, t_name, dialog_fun2, (void*)0x0000aaab, NULL );wait_dialog(); // dialog_ret=0;cellMsgDialogOpen2( type_dialog_ok, t_pkg, dialog_fun2, (void*)0x0000aaab, NULL );wait_dialog(); (*max)++; } } fclose(fpV); } if ((*max)==0) { dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*)STR_ERR_SRV0, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } remove(local_file); } void check_for_update() { int ret=0; force_update_check=0; if(cellNetCtlGetInfo(16, &net_info)<0)//net_avail<0 || { net_avail=-1; dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_WARN_INET, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); return; } dialog_ret=0; cellMsgDialogOpen2( type_dialog_no, (const char*) STR_PLEASE_WAIT, dialog_fun2, (void*)0x0000aaab, NULL ); flipc(60); char filename[1024]; char update_url[128]=" "; char local_file[64]=" "; char line[128]; char usb_save[128]="/skip"; if(exist(update_dir)) sprintf(usb_save, "%s", update_dir); else for(int n=0;n<9;n++){ sprintf(filename, "/dev_usb00%i", n); if(exist(filename)) { sprintf(usb_save, "%s", filename); break; } } // } if(!exist(usb_save) && payload>-1) sprintf(usb_save,"%s/TEMP", app_usrdir); // && c_firmware<3.55f char update_server[256]; sprintf(update_server, "%s/", url_base); if(c_firmware>3.30f) sprintf(update_url,"%sversion.txt", update_server); if(c_firmware<3.40f) sprintf(update_url,"%sversion315.txt", update_server); if(c_firmware>3.54f) sprintf(update_url,"%sversion355.txt", update_server); sprintf(local_file, "%s", versionUP); remove(local_file); ret = download_file(update_url, local_file, 0); cellMsgDialogAbort(); if(ret==0) { dialog_ret=0; net_avail=-1; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_WARN_INET, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); return; } char new_version[9]; ret=0; fpV = fopen ( versionUP, "r" ); if ( fpV != NULL ) { while ( fgets ( line, sizeof line, fpV ) != NULL ) { if(strlen(line)==8) {sprintf(new_version, "%s", line); ret=1;} break; } fclose(fpV); } if (ret==1) { char whatsnew[512]; whatsnew[0]=0; sprintf(local_file, "%s/whatsnew.txt", app_temp); remove(local_file); sprintf(update_url,"%swn.txt", update_server); ret = download_file(update_url, local_file, 0); if (ret==1) { fpV = fopen ( local_file, "r" ); if ( fpV != NULL ) { while ( fgets ( line, sizeof line, fpV ) != NULL ) { sprintf(whatsnew, "%s%s", whatsnew, line); } fclose(fpV); remove(local_file); whatsnew[511]=0; sprintf(filename, (const char*)STR_WHATS_NEW, new_version, whatsnew); dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, filename, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } } if(exist(usb_save)) { if(strcmp(current_version, new_version)!=0) { // if(c_firmware>3.30f) sprintf(filename, "New version found (FW 3.40-3.42): %s\n\nYour current version: %s\n\nDo you want to download the update?", new_version, current_version); // if(c_firmware<3.40f) sprintf(filename, "New version found: %s\n\nYour current version: %s\n\nDo you want to download the update?", new_version, current_version); // if(c_firmware>3.30f) sprintf(filename, (const char*)STR_NEW_VER, new_version, current_version); dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) { if(c_firmware<=3.30f) sprintf(update_url,"%smultiMAN2_315.bin", update_server); if(c_firmware> 3.39f) sprintf(update_url,"%smultiMAN2_340.bin", update_server); if(c_firmware> 3.54f) sprintf(update_url,"%smultiMAN2_355.bin", update_server); sprintf(local_file,"%s/multiMAN_%s.pkg", usb_save, new_version); ret = download_file(update_url, local_file, 1); dialog_ret=0; if(ret==1) { if(strstr(local_file, "USRDIR/TEMP")!=NULL) sprintf(local_file, "/app_home/multiMAN_%s.pkg", new_version); sprintf(filename, (const char*)STR_NEW_VER_DL, local_file, STR_QUIT); ret = cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) if(net_used_ignore()){ syscall_mount2( (char *) "/app_home", (char *) usb_save); unload_modules(); sys_process_exit(1); } } else { ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_ERR_UPD0, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } } } else { sprintf(filename, (const char*)STR_NEW_VER_NN, current_version); dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, filename, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } } else //no usb/card connected { dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*)STR_NEW_VER_USB, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } } else { dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_ERR_UPD1, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } remove(versionUP); } void check_for_game_update(char *game_id, char *game_title) { int ret=0; if(net_avail<0 || cellNetCtlGetInfo(16, &net_info)<0) { dialog_ret=0; net_avail=-1; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*)STR_WARN_INET, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); return; } char filename[1024]; char update_url[256]=" "; char local_file[512]=" "; char line[512]; char usb_save[512]="/skip"; char versionGAME[256]; char temp_val[32]; float param_ver=0.0f; char game_param_sfo[512]; sprintf(game_param_sfo, "/dev_hdd0/game/%s/PARAM.SFO", game_id); if(get_param_sfo_field((char *)game_param_sfo, (char *)"APP_VER", (char *)temp_val)) { param_ver=strtof(temp_val, NULL); } typedef struct { char pkg_ver[8]; uint64_t pkg_size; char ps3_ver[8]; char pkg_url[1024]; } pkg_update; pkg_update pkg_list[32]; int max_pkg=0; if(exist(update_dir)) sprintf(usb_save, "%s", update_dir); else for(int n=0;n<9;n++){ sprintf(filename, "/dev_usb00%i", n); if(exist(filename)) { sprintf(usb_save, "%s", filename); break; } } // } if(!exist(usb_save) && payload>-1) { sprintf(usb_save,"%s/PKG", app_usrdir); mkdir(usb_save, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); } sprintf(versionGAME,"%s/TEMP/%s.UPD", app_usrdir, game_id); sprintf(update_url, "%s/ps3u/?ID=%s", url_base, game_id); remove(versionGAME); ret = download_file(update_url, versionGAME, 0); char new_version[511]; new_version[0]=0; ret=0; char g_title[256], g_ver[256], g_url[1024], g_ps3[8]; sprintf(g_title, "%s", game_title); uint64_t all_pkg=0;//g_size=0, int lc=0, first_pkg=-1; fpV = fopen ( versionGAME, "r" ); if ( fpV != NULL ) { while ( fscanf (fpV, "%[^|]|%[^|]|%[^|]|%s\n", g_ver, line, g_ps3, g_url )>3) { lc++; if(lc==1 && strlen(g_ver)>2) sprintf(g_title, "[%s]: %s", game_id, g_ver); if(lc>1) { sprintf(pkg_list[max_pkg].pkg_ver, "%s", g_ver); sprintf(pkg_list[max_pkg].ps3_ver, "%s", g_ps3); sprintf(pkg_list[max_pkg].pkg_url, "%s", g_url); pkg_list[max_pkg].pkg_size = strtoull(line, NULL, 10); all_pkg+=pkg_list[max_pkg].pkg_size; if(param_ver<strtof(g_ver, NULL) && first_pkg==-1) first_pkg=max_pkg; max_pkg++; } } fclose(fpV); } if (max_pkg>0) { if(param_ver>=strtof(pkg_list[max_pkg-1].pkg_ver, NULL)) first_pkg=max_pkg; if(param_ver==0.0f) first_pkg=-1; if(max_pkg==1) sprintf(filename, (const char*) STR_GAME_UPD1, g_title, pkg_list[0].pkg_ver, max_pkg, (double)(all_pkg/1024/1024)); else sprintf(filename, (const char*) STR_GAME_UPD2, g_title, pkg_list[0].pkg_ver, pkg_list[max_pkg-1].pkg_ver, max_pkg, (double)(all_pkg/1024/1024)); dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if( (first_pkg!=-1) && dialog_ret==1) { sprintf(filename, (const char*) STR_GAME_UPD3, g_title, param_ver ); dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret!=1) first_pkg=0; if(dialog_ret==3) goto just_quit; dialog_ret=1; } if(first_pkg<0) first_pkg=0; if(dialog_ret==1) { if(exist(usb_save)) { int lc2; ret=0; for(lc=first_pkg;lc<max_pkg;lc++) { sprintf(local_file, "%s/%s_[UPDATE_%02i_PS3FW_%s]_VER_%s.pkg", usb_save, game_id, lc+1, pkg_list[lc].ps3_ver, pkg_list[lc].pkg_ver); ret=0; for(lc2=0;lc2<3;lc2++){ ret = download_file(pkg_list[lc].pkg_url, local_file, 1); if(ret>0) break; } if(ret!=1) break; } dialog_ret=0; if(ret==1) { if(max_pkg==1) sprintf(filename, (const char*) STR_NEW_VER_DL, local_file, STR_QUIT); else sprintf(filename, (const char*) STR_GAME_UPD5, usb_save, STR_QUIT); ret = cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) if(net_used_ignore()) { syscall_mount2( (char *) "/app_home", (char *) usb_save); unload_modules(); sys_process_exit(1); } } else { if(first_pkg>=max_pkg) ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_GAME_UPD6, dialog_fun2, (void*)0x0000aaab, NULL ); else ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_ERR_UPD0, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } } else //no usb/card connected { dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*)STR_NEW_VER_USB, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } } } else { dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_GAME_UPD7, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } just_quit: ret=1; } void clean_up() { char cleanup[48]=" "; if(clear_activity_logs==1) { sprintf(cleanup, "/dev_hdd0/vsh/pushlist/patch.dat"); remove(cleanup); sprintf(cleanup, "/dev_hdd0/vsh/pushlist/game.dat"); remove(cleanup); for(int n2=0;n2<20;n2++) {sprintf(cleanup, "/dev_hdd0/home/000000%02i/etc/boot_history.dat", n2); remove(cleanup);} } for(int n2=0;n2<20;n2++) { sprintf(cleanup, "/dev_hdd0/home/000000%02i", n2); cellFsChmod(cleanup, CELL_FS_S_IFDIR | 0777); sprintf(cleanup, "/dev_hdd0/home/000000%02i/savedata", n2); cellFsChmod(cleanup, CELL_FS_S_IFDIR | 0777); } sprintf(cleanup, "%s", "/dev_hdd0/game"); cellFsChmod(cleanup, CELL_FS_S_IFDIR | 0777); } void slide_xmb_left(int _xmb_icon) { xmb_sublevel=0; xmb_slide=0; xmb_slide_step=-15; for(int n=0; n<14; n++) { xmb_slide+=xmb_slide_step; ClearSurface(); if(!use_drops && xmb_sparks!=0) draw_stars(); set_texture( text_bmp, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.9f, 1920, 1080); if(use_drops && xmb_sparks!=0) draw_stars(); draw_xmb_clock(xmb_clock, 0); draw_xmb_icons(xmb, xmb_icon, xmb_slide, xmb_slide_y, 0, xmb_sublevel); flip(); } xmb_sublevel=1; xmb_slide=0; xmb_slide_step=0; draw_xmb_bare(_xmb_icon, 1, 0, 1); } void slide_xmb_right() { xmb_slide=0; xmb_slide_step=15; xmb_sublevel=1; for(int n=0; n<14; n++) { xmb_slide+=xmb_slide_step; ClearSurface(); if(!use_drops && xmb_sparks!=0) draw_stars(); set_texture( text_bmp, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.9f, 1920, 1080); if(use_drops && xmb_sparks!=0) draw_stars(); draw_xmb_clock(xmb_clock, 0); draw_xmb_icons(xmb, xmb_icon, xmb_slide, xmb_slide_y, 0, xmb_sublevel); flip(); } xmb_slide=0; xmb_slide_step=0; xmb_sublevel=0; } void select_theme() { slide_xmb_left(1); t_dir_pane_bare *pane = (t_dir_pane_bare *) memalign(16, sizeof(t_dir_pane_bare)*MAX_PANE_SIZE_BARE); int max_dir=0; ps3_home_scan_ext_bare(themes_dir, pane, &max_dir, (char*)".mmt"); opt_list_max=0; for(int n=0; n<max_dir; n++) { if(pane[n].name[0]=='_') sprintf(opt_list[opt_list_max].label, "%s", pane[n].name+1); else sprintf(opt_list[opt_list_max].label, "%s", pane[n].name); opt_list[opt_list_max].label[strlen(opt_list[opt_list_max].label)-4]=0; sprintf(opt_list[opt_list_max].value, "%s", pane[n].path); opt_list_max++; if(opt_list_max>=MAX_LIST_OPTIONS) break; } if(opt_list_max) { use_analog=1; float b_mX=mouseX; float b_mY=mouseY; mouseX=660.f/1920.f; mouseY=225.f/1080.f; is_any_xmb_column=xmb_icon; int ret_f=open_list_menu((char*) STR_SEL_THEME, 600, opt_list, opt_list_max, 660, 225, 16, 1); is_any_xmb_column=0; use_analog=0; mouseX=b_mX; mouseY=b_mY; if(ret_f!=-1) { char tmp_thm[64]; sprintf(tmp_thm, "skip/_%s.mmt", opt_list[ret_f].label); apply_theme(tmp_thm, opt_list[ret_f].value); free_text_buffers(); for(int n=0; n<xmb[1].size; n++) xmb[1].member[n].data=-1; free_all_buffers(); init_xmb_icons(menu_list, max_menu_list, game_sel ); draw_xmb_clock(xmb_clock, 1); draw_xmb_icon_text(xmb_icon); memset(text_bmp, 0, 8294400); load_texture(text_bmp, xmbbg, 1920); } } slide_xmb_right(); // draw_xmb_bare(1, 1, 0, 1); free(pane); } int select_language() { use_analog=1; float b_mX=mouseX; float b_mY=mouseY; mouseX=660.f/1920.f; mouseY=225.f/1080.f; slide_xmb_left(2); for (int n=0;n<MAX_LOCALES;n++ ) { sprintf(opt_list[n].label, "%s", locales[n].loc_name); sprintf(opt_list[n].value, "%i", locales[n].val); } opt_list_max=MAX_LOCALES; int ret_f=open_select_menu((char*) STR_SEL_LANG, 600, opt_list, opt_list_max, text_FONT, 16, 1); use_analog=0; mouseX=b_mX; mouseY=b_mY; if(ret_f!=-1) { mm_locale = (int)(strtod(opt_list[ret_f].value, NULL)); load_localization(mm_locale); for(int n=0; n<MAX_XMB_ICONS; n++) redraw_column_texts(n); xmb_legend_drawn=0; xmb_info_drawn=0; add_home_column(); mod_xmb_member(xmb[6].member, 0, (char*)STR_XC1_REFRESH, (char*)STR_XC1_REFRESH2); mod_xmb_member(xmb[8].member, 0, (char*)STR_XC1_REFRESH, (char*)STR_XC1_REFRESH3); mod_xmb_member(xmb[5].member, 0, (char*)STR_XC5_LINK, (char*)STR_XC5_LINK1); mod_xmb_member(xmb[5].member, 1, (char*)STR_XC5_ST, (char*)STR_XC5_ST1); draw_xmb_icon_text(xmb_icon); } slide_xmb_right(); return mm_locale; } int delete_game_cache() { t_dir_pane_bare *pane = (t_dir_pane_bare *) memalign(16, sizeof(t_dir_pane_bare)*MAX_PANE_SIZE_BARE); int max_dir=0; int ret_f=-1; slide_xmb_left(2); ; char string1[1024]; ps3_home_scan_ext_bare(game_cache_dir, pane, &max_dir, (char*)"PS3NAME.DAT"); if(max_dir==0) { abort_copy=0; //fix_perm_recursive(game_cache_dir); my_game_delete(game_cache_dir); mkdir(game_cache_dir, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); slide_xmb_right(); return 0; } opt_list_max=0; char tmp_n[512]; FILE *fpA; for(int n=0; n<max_dir; n++) { sprintf(string1, "%s/%s", pane[n].path, pane[n].name); if(exist(string1)) { fpA = fopen ( string1, "r" ); if(fpA!=NULL) { if(fgets( tmp_n, sizeof tmp_n, fpA ) != NULL) { tmp_n[32]=0x2e; tmp_n[33]=0x2e; tmp_n[34]=0x2e; tmp_n[35]=00; sprintf(opt_list[opt_list_max].label, "%s", tmp_n); sprintf(opt_list[opt_list_max].value, "%s", pane[n].path); opt_list_max++; } fclose(fpA); if(opt_list_max>=MAX_LIST_OPTIONS) break; } } } if(opt_list_max) { use_analog=1; float b_mX=mouseX; float b_mY=mouseY; mouseX=660.f/1920.f; mouseY=225.f/1080.f; is_any_xmb_column=xmb_icon; ret_f=open_list_menu((char*) STR_DEL_GAME_CACHE, 600, opt_list, opt_list_max, 660, 225, 16, 0); is_any_xmb_column=0; use_analog=0; mouseX=b_mX; mouseY=b_mY; if(ret_f!=-1) { if(strstr(opt_list[ret_f].value, game_cache_dir)!=NULL) { abort_copy=0; //fix_perm_recursive(opt_list[ret_f].value); my_game_delete(opt_list[ret_f].value); rmdir(opt_list[ret_f].value); } } } slide_xmb_right(); free(pane); return ret_f; } void update_fm_stripe() { if(fm_sel==fm_sel_old) return; fm_sel_old=fm_sel; memcpy(text_FMS+737280, text_FMS, 368640); max_ttf_label=0; print_label_ex( 0.104f, 0.13f, 1.0f, (fm_sel&1 ? 0xffc0c0c0 : COL_FMFILE), (char*)STR_FM_GAMES, 1.04f, 0.0f, mui_font, (fm_sel&1 ? 1.1f : 0.75f), 21.f, 1); print_label_ex( 0.230f, 0.13f, 1.0f, (fm_sel&2 ? 0xffc0c0c0 : COL_FMFILE), (char*)STR_FM_UPDATE, 1.04f, 0.0f, mui_font, (fm_sel&2 ? 1.1f : 0.75f), 21.f, 1); print_label_ex( 0.359f, 0.13f, 1.0f, (fm_sel&4 ? 0xffc0c0c0 : COL_FMFILE), (char*)STR_FM_ABOUT, 1.04f, 0.0f, mui_font, (fm_sel&4 ? 1.1f : 0.75f), 21.f, 1); print_label_ex( 0.479f, 0.13f, 1.0f, (fm_sel&8 ? 0xffc0c0c0 : COL_FMFILE), (char*)STR_FM_HELP, 1.04f, 0.0f, mui_font, (fm_sel&8 ? 1.1f : 0.75f), 21.f, 1); print_label_ex( 0.609f, 0.13f, 1.0f, (fm_sel&16 ? 0xffc0c0c0 : COL_FMFILE), (char*)STR_FM_THEMES, 1.04f, 0.0f, mui_font, (fm_sel&16 ? 1.1f : 0.75f), 21.f, 1); flush_ttf(text_FMS+737280, 1920, 48); } void set_fm_stripes() { fm_sel=0; fm_sel_old=15; load_texture(text_FMS, playBG, 1920); memcpy(text_FMS+368640, text_FMS, 368640); memcpy(text_FMS+737280, text_FMS, 368640); update_fm_stripe(); } void draw_fileman() { //if(c_opacity2<0x01) return; set_texture( text_OFF_2, 320, 320); display_img(1775-(int)(1920.0f*0.025f), 24+(int)(1080.0f*0.025f), 48, 48, 96, 96, -0.2f, 320, 320); update_fm_stripe(); set_texture( text_FMS+737280, 1920, 48); display_img(0, 47, 1920, 60, 1920, 48, 0.0f, 1920, 48); set_texture( text_FMS, 1920, 48); display_img(0, 952, 1920, 76, 1920, 48, 0.0f, 1920, 48); set_texture( text_bmpUPSR+V_WIDTH*4*(int)((107.f/1080.f)*V_HEIGHT), V_WIDTH, V_HEIGHT-(int)((235.f/1080.f)*V_HEIGHT));//V_HEIGHT-); display_img_nr(0, (int)((107.f/1080.f)*V_HEIGHT), V_WIDTH, V_HEIGHT-(int)((235.f/1080.f)*V_HEIGHT), V_WIDTH, V_HEIGHT-(int)((235.f/1080.f)*V_HEIGHT), 0.0f, V_WIDTH, V_HEIGHT-(int)((235.f/1080.f)*V_HEIGHT)); draw_xmb_info(); } int context_menu(char *_capt, int _type, char *c_pane, char *o_pane) { char _cap[512]; sprintf(_cap, "%s", _capt); _cap[32]='.';_cap[33]='.';_cap[34]='.';_cap[35]=0; opt_list_max=0; u8 multiple_entries=0; if(!strcmp(_cap, "..")) goto skip_dd; if(!strcmp(_cap, (const char*) STR_CM_MULDIR) || !strcmp(_cap, (const char*) STR_CM_MULFILE)) multiple_entries=1; if(strstr(o_pane, "/dev_bdvd")==NULL && strstr(o_pane, "/pvd_usb")==NULL && strstr(o_pane, "/app_home")==NULL && strlen(o_pane)>1 && strstr(_cap, "net_host")==NULL && strcmp(c_pane, o_pane)) { if( (strstr(c_pane, "/dev_bdvd")==NULL && strcmp(_cap, "dev_bdvd")) || (strstr(c_pane, "/dev_bdvd")!=NULL && exist((char*)"/dev_bdvd/PS3_GAME"))) { sprintf(opt_list[opt_list_max].label, "%s", STR_CM_COPY); sprintf(opt_list[opt_list_max].value, "%s", "copy"); opt_list_max++; } if(strstr(c_pane, "/dev_bdvd")==NULL && strstr(c_pane, "/pvd_usb")==NULL && strstr(c_pane, "/app_home")==NULL && strstr(c_pane, "/ps3_home")==NULL && strlen(c_pane)>1 && strlen(o_pane)>1 && !(!strcmp(c_pane, "/dev_hdd0") && (!strcmp(_cap, "game") || !strcmp(_cap, "vsh") || !strcmp(_cap, "home") || !strcmp(_cap, "mms") || !strcmp(_cap, "vm") || !strcmp(_cap, "etc") || !strcmp(_cap, "drm"))) ) { sprintf(opt_list[opt_list_max].label, "%s", STR_CM_MOVE); sprintf(opt_list[opt_list_max].value, "%s", "move"); opt_list_max++; } } if(strstr(c_pane, "/dev_bdvd")==NULL && strstr(c_pane, "/pvd_usb")==NULL && strstr(c_pane, "/app_home")==NULL && strstr(c_pane, "/ps3_home")==NULL && strlen(c_pane)>1 && !(!strcmp(c_pane, "/dev_hdd0") && (!strcmp(_cap, "game") || !strcmp(_cap, "vsh") || !strcmp(_cap, "home") || !strcmp(_cap, "mms") || !strcmp(_cap, "vm") || !strcmp(_cap, "etc") || !strcmp(_cap, "drm")))) { if(strstr(c_pane, "/net_host")==NULL && !multiple_entries) { sprintf(opt_list[opt_list_max].label, "%s", STR_CM_RENAME); sprintf(opt_list[opt_list_max].value, "%s", "rename"); opt_list_max++; } if(strstr(c_pane, "/net_host")==NULL || (strstr(c_pane, "/net_host")!=NULL && _type==1)) { sprintf(opt_list[opt_list_max].label, "%s", STR_CM_DELETE); sprintf(opt_list[opt_list_max].value, "%s", "delete"); opt_list_max++; } } if(strcmp(c_pane, o_pane) && strstr(c_pane, "/dev_hdd0")!=NULL && strstr(o_pane, "/dev_hdd0")!=NULL && !multiple_entries) { sprintf(opt_list[opt_list_max].label, "%s", STR_CM_SHORTCUT); sprintf(opt_list[opt_list_max].value, "%s", "shortcut"); opt_list_max++; } if(!strcmp(_cap, "PS3_GAME") && !multiple_entries) { if(strstr(c_pane, "/dev_hdd0")!=NULL) { sprintf(opt_list[opt_list_max].label, "%s", STR_CM_SHADOWPKG); sprintf(opt_list[opt_list_max].value, "%s", "pkgshortcut"); opt_list_max++; } if(strstr(c_pane, "/dev_usb")!=NULL) { sprintf(opt_list[opt_list_max].label, "%s", STR_CM_BDMIRROR); sprintf(opt_list[opt_list_max].value, "%s", "bdmirror"); opt_list_max++; } } if(strstr(c_pane, "/net_host")!=NULL || strstr(_cap, "net_host")!=NULL) { sprintf(opt_list[opt_list_max].label, "%s", STR_CM_NETHOST); sprintf(opt_list[opt_list_max].value, "%s", "nethost"); opt_list_max++; } if(_type==1 && !multiple_entries) { sprintf(opt_list[opt_list_max].label, "%s", STR_CM_HEXVIEW); sprintf(opt_list[opt_list_max].value, "%s", "view"); opt_list_max++; } if(_type==0 && strstr(c_pane, "/ps3_home")==NULL && strstr(c_pane, "/net_host")==NULL && !multiple_entries) { sprintf(opt_list[opt_list_max].label, "%s", STR_CM_PROPS); sprintf(opt_list[opt_list_max].value, "%s", "test"); opt_list_max++; } skip_dd: if(strstr(c_pane, "/dev_bdvd")==NULL && strstr(c_pane, "/pvd_usb")==NULL && strstr(c_pane, "/app_home")==NULL && strstr(c_pane, "/ps3_home")==NULL && strlen(c_pane)>1) { sprintf(opt_list[opt_list_max].label, "%s", STR_CM_NEWDIR); sprintf(opt_list[opt_list_max].value, "%s", "newfolder"); opt_list_max++; } if(opt_list_max) { use_analog=0; //use_depth=0; float b_mX=mouseX; float b_mY=mouseY; if(mouseX>0.84f) mouseX=0.84f; if(mouseY>0.60f) mouseY=0.60f; int ret_f=open_dd_menu( _cap, 300, opt_list, opt_list_max, 660, 225, 16); //use_depth=1; use_analog=0; mouseX=b_mX; mouseY=b_mY; return ret_f; } //just_leave_dd: new_pad=0; return -1; } void apply_theme (const char *theme_file, const char *theme_path) { char theme_name[1024]; sprintf(theme_name, "%s", theme_file); theme_name[strlen(theme_name)-4]=0; char *pch=theme_name; char *pathpos=strrchr(pch,'/'); char temp_text[512]; char filename[1024]; sprintf(temp_text, (const char*) STR_APPLY_THEME, pathpos+(pathpos[1]=='_' ? 2 : 1)); dialog_ret=0; cellMsgDialogOpen2( type_dialog_no, temp_text, dialog_fun2, (void*)0x0000aaab, NULL ); flipc(60); char th_file[32], th2_file[64]; sprintf(th_file, "%s", "AVCHD.JPG"); sprintf(filename, "%s/%s", theme_path, th_file); if(exist(filename)) file_copy(filename, avchdBG, 0); sprintf(th_file, "%s", "PICBG.JPG"); sprintf(filename, "%s/%s", theme_path, th_file); if(exist(filename)) file_copy(filename, userBG, 0); sprintf(th_file, "%s", "ICON0.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); if(exist(filename)) file_copy(filename, blankBG, 0); sprintf(th_file, "%s", "PICPA.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); if(exist(filename)) file_copy(filename, playBGR, 0); sprintf(th_file, "%s", "XMB0.PNG"); sprintf(th2_file, "%s/%s", theme_path, th_file); sprintf(filename, "%s/PIC0.PNG", app_homedir); if(exist(th2_file)) { sprintf(filename, "%s/PIC0.PNG", app_homedir); file_copy(th2_file, filename, 0); } else remove(filename); sprintf(th_file, "%s", "XMB1.PNG"); sprintf(th2_file, "%s/%s", theme_path, th_file); if(exist(th2_file)) { sprintf(filename, "%s/PIC1.PNG", app_homedir); file_copy(th2_file, filename, 0); } sprintf(th_file, "%s", "SND0.AT3"); sprintf(th2_file, "%s/%s", theme_path, th_file); sprintf(filename, "%s/SND0.AT3", app_homedir); if(exist(th2_file)) { file_copy(th2_file, filename, 0); } else remove(filename); sprintf(th_file, "%s", "FMS.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); if(exist(filename)) file_copy(filename, playBG, 0); sprintf(th_file, "%s", "HDD.JPG"); sprintf(filename, "%s/%s", theme_path, th_file); if(exist(filename)) file_copy(filename, iconHDD, 0); sprintf(th_file, "%s", "USB.JPG"); sprintf(filename, "%s/%s", theme_path, th_file); if(exist(filename)) file_copy(filename, iconUSB, 0); sprintf(th_file, "%s", "BLU.JPG"); sprintf(filename, "%s/%s", theme_path, th_file); if(exist(filename)) file_copy(filename, iconBLU, 0); sprintf(th_file, "%s", "NET.JPG"); sprintf(filename, "%s/%s", theme_path, th_file); if(exist(filename)) file_copy(filename, iconNET, 0); sprintf(th_file, "%s", "OFF.JPG"); sprintf(filename, "%s/%s", theme_path, th_file); if(exist(filename)) file_copy(filename, iconOFF, 0); sprintf(th_file, "%s", "CFC.JPG"); sprintf(filename, "%s/%s", theme_path, th_file); if(exist(filename)) file_copy(filename, iconCFC, 0); sprintf(th_file, "%s", "SDC.JPG"); sprintf(filename, "%s/%s", theme_path, th_file); if(exist(filename)) file_copy(filename, iconSDC, 0); sprintf(th_file, "%s", "MSC.JPG"); sprintf(filename, "%s/%s", theme_path, th_file); if(exist(filename)) file_copy(filename, iconMSC, 0); int flipF; for(flipF = 0; flipF<9; flipF++){ sprintf(th_file, "AUR%i.JPG", flipF); sprintf(filename, "%s/%s", theme_path, th_file); if(exist(filename)) {sprintf(th2_file, "%s/%s", app_usrdir, th_file); file_copy(filename, th2_file, 0);} } for(flipF = 0; flipF<9; flipF++){ sprintf(th_file, "font%i.ttf", flipF); sprintf(filename, "%s/%s", theme_path, th_file); if(exist(filename)) {sprintf(th2_file, "%s/fonts/user/%s", app_usrdir, th_file); file_copy(filename, th2_file, 0);} } sprintf(th_file, "%s", "BOOT.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "LEGEND2.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "XMB.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "XMB64.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "XMB2.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "XMBBG.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "DROPS.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "PRB.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "GLO.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); remove(th2_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "GLC.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); remove(th2_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "GLC2.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); remove(th2_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "GLC3.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); remove(th2_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "NOID.JPG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "DOX.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } load_texture(text_DOX, th2_file, dox_width); sprintf(th_file, "%s", "LBOX.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "LBOX2.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "SBOX.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "CBOX.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "CBOX2.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); remove(th2_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "CBOX3.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); remove(th2_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "CBOX4.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); remove(th2_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "GBOX.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "GBOX2.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); remove(th2_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "MP_HR.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } sprintf(th_file, "%s", "MP_LR.PNG"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } if(V_WIDTH>1280) sprintf(filename, "%s/MP_HR.PNG",app_usrdir); else { sprintf(filename, "%s/MP_LR.PNG",app_usrdir); mp_WIDTH=15, mp_HEIGHT=21; //mouse icon LR } if(exist(filename)) {load_texture((unsigned char *) mouse, filename, mp_WIDTH);} sprintf(th_file, "%s", "SOUND.BIN"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); remove(th2_file); if(exist(filename)) { file_copy(filename, th2_file, 0); } if((exist(th2_file) && is_theme_playing) && theme_sound) main_mp3((char*)th2_file); else { if(is_theme_playing) stop_audio(5); } sprintf(th_file, "%s", "COLOR.INI"); sprintf(filename, "%s/%s", theme_path, th_file); sprintf(th2_file, "%s/%s", app_usrdir, th_file); remove(th2_file); if(exist(filename)) file_copy(filename, th2_file, 0); else { sprintf(filename, "%s/COLOR.BIN", app_usrdir); sprintf(th2_file, "%s/COLOR.INI", app_usrdir); if(exist(filename)) file_copy(filename, th2_file, 0) ; } load_texture(text_bmpIC, blankBG, 320); if(cover_mode!=8) { load_texture(text_bmpUBG, avchdBG, 1920); load_texture(text_bmpUPSR, playBGR, 1920); set_fm_stripes(); } load_texture(text_HDD, iconHDD, 320); load_texture(text_USB, iconUSB, 320); load_texture(text_BLU_1, iconBLU, 320); load_texture(text_NET_6, iconNET, 320); load_texture(text_OFF_2, iconOFF, 320); load_texture(text_CFC_3, iconCFC, 320); load_texture(text_SDC_4, iconSDC, 320); load_texture(text_MSC_5, iconMSC, 320); parse_color_ini(); cellMsgDialogAbort(); state_read=1; state_draw=1; } void draw_xmb_title(u8 *buffer, xmbmem *member, int cn, u32 col1, u32 col2, u8 _xmb_col) { memset(buffer, 0, XMB_TEXT_WIDTH*XMB_TEXT_HEIGHT*4); //flush_ttf(buffer, XMB_TEXT_WIDTH, XMB_TEXT_HEIGHT); if((_xmb_col==6 || _xmb_col==7) && xmb_game_bg) { print_label_ex( 0.005f, 0.03f, 0.75f, 0x80101010, member[cn].name, 1.04f, 0.0f, 0, 3.0f, 22.0f, 0); } if(_xmb_col==2 && member[cn].option_size) //settings print_label_ex( 0.93f, 0.2f, 0.45f, col1, member[cn].option[member[cn].option_selected].label, 1.04f, 0.0f, 0, 3.0f, 22.0f, 2); if(!((_xmb_col>3 && _xmb_col<8 && member[cn].type<6) || (_xmb_col==8 && member[cn].type>7))) print_label_ex( 0.0f, 0.57f, 0.5f, col2, member[cn].subname, 1.02f, 0.0f, 0, 3.0f, 23.0f, 0); flush_ttf(buffer, XMB_TEXT_WIDTH, XMB_TEXT_HEIGHT); print_label_ex( 0.004f, 0.02f, 0.75f, col1, member[cn].name, 1.04f, 0.0f, 0, 3.0f, 22.0f, 0); flush_ttf(buffer, XMB_TEXT_WIDTH, XMB_TEXT_HEIGHT); u8 *xmb_dev_icon1=xmb_icon_dev; u8 *xmb_dev_icon2=xmb_icon_dev; if( (_xmb_col>3 && _xmb_col<8 && member[cn].type<6) || (_xmb_col==8 && member[cn].type>7 && member[cn].type<13)) { if(_xmb_col==6 || _xmb_col==7) xmb_dev_icon1=xmb_icon_dev; else if(_xmb_col==5) xmb_dev_icon1=xmb_icon_dev+(1*8192); else if(_xmb_col==4) xmb_dev_icon1=xmb_icon_dev+(2*8192); else if(_xmb_col==8) xmb_dev_icon1=xmb_icon_dev+(16*8192);//retro if(_xmb_col==8) { xmb_dev_icon2=xmb_icon_dev+((17+(member[cn].type-8))*8192); } else { if(strstr(member[cn].file_path, "/dev_hdd")!=NULL) xmb_dev_icon2=xmb_icon_dev+(4*8192); else if(strstr(member[cn].file_path, "/dev_usb")!=NULL) xmb_dev_icon2=xmb_icon_dev+(5*8192); else if(strstr(member[cn].file_path, "/dev_bdvd")!=NULL) xmb_dev_icon2=xmb_icon_dev+(6*8192); else if(strstr(member[cn].file_path, "/pvd_usb")!=NULL) xmb_dev_icon2=xmb_icon_dev+(7*8192); else if(strstr(member[cn].file_path, "/dev_sd")!=NULL) xmb_dev_icon2=xmb_icon_dev+(13*8192); else if(strstr(member[cn].file_path, "/dev_ms")!=NULL) xmb_dev_icon2=xmb_icon_dev+(14*8192); else if(strstr(member[cn].file_path, "/dev_cf")!=NULL) xmb_dev_icon2=xmb_icon_dev+(15*8192); } int nip=0; put_texture_with_alpha_gen( buffer, xmb_dev_icon1, 64, 32, 64, XMB_TEXT_WIDTH, nip, XMB_TEXT_HEIGHT-32); nip+=64; if(_xmb_col==5) { if(!strcmp(member[cn].subname, "AVCHD")) { put_texture_with_alpha_gen( buffer, xmb_icon_dev+(10*8192), 64, 32, 64, XMB_TEXT_WIDTH, nip, XMB_TEXT_HEIGHT-32); nip+=64; } else if(!strcmp(member[cn].subname, "BDMV")) { put_texture_with_alpha_gen( buffer, xmb_icon_dev+(11*8192), 64, 32, 64, XMB_TEXT_WIDTH, nip, XMB_TEXT_HEIGHT-32); nip+=64; } else if(!strcmp(member[cn].subname, "DVD")) { put_texture_with_alpha_gen( buffer, xmb_icon_dev+(12*8192), 64, 32, 64, XMB_TEXT_WIDTH, nip, XMB_TEXT_HEIGHT-32); nip+=64; } } put_texture_with_alpha_gen( buffer, xmb_dev_icon2, 64, 32, 64, XMB_TEXT_WIDTH, nip, XMB_TEXT_HEIGHT-32); nip+=64; if(_xmb_col==6 && member[cn].game_id>=0 && member[cn].game_id<max_menu_list) { if(member[cn].game_user_flags & IS_FAV) {put_texture_with_alpha_gen( buffer, xmb_icon_dev+(8*8192), 64, 32, 64, XMB_TEXT_WIDTH, nip, XMB_TEXT_HEIGHT-32); nip+=64;} } if((_xmb_col==6 || _xmb_col==7) && member[cn].game_id>=0 && member[cn].game_id<max_menu_list) { if(member[cn].game_split==1) {put_texture_with_alpha_gen( buffer, xmb_icon_dev+(9*8192), 64, 32, 64, XMB_TEXT_WIDTH, nip, XMB_TEXT_HEIGHT-32); nip+=64;} } } } void mod_xmb_member(xmbmem *_member, u16 size, char *_name, char *_subname) { snprintf(_member[size].name, sizeof(_member[size].name), "%s", _name); _member[size].name[sizeof(_member[size].name)]=0; snprintf(_member[size].subname, sizeof(_member[size].subname), "%s", _subname); _member[size].subname[sizeof(_member[size].subname)]=0; } void add_xmb_member(xmbmem *_member, u16 *_size, char *_name, char *_subname, /*type*/u8 _type, /*status*/u8 _status, /*game_id*/int _game_id, /*icon*/u8 *_data, u16 _iconw, u16 _iconh, /*f_path*/char *_file_path, /*i_path*/ char *_icon_path, int _u_flags, int _split) { if( (*_size)>=(MAX_XMB_MEMBERS-1) || strlen(_file_path)>sizeof(_member[0].file_path) || strlen(_icon_path)>sizeof(_member[0].icon_path) ) return; u16 size=(*_size); _member[size].is_checked = true; _member[size].type =_type; _member[size].status =_status; _member[size].game_id =_game_id; _member[size].game_user_flags =_u_flags; _member[size].game_split =_split; snprintf(_member[size].name, sizeof(_member[size].name), "%s", _name); _member[size].name[sizeof(_member[size].name)]=0; snprintf(_member[size].subname, sizeof(_member[size].subname), "%s", _subname); _member[size].subname[sizeof(_member[size].subname)]=0; _member[size].option_size=0; _member[size].option_selected=0; _member[size].data=-1; _member[size].icon =_data; _member[size].icon_buf = -1; _member[size].iconw =_iconw; _member[size].iconh =_iconh; snprintf(_member[size].file_path, sizeof(_member[size].file_path), "%s", _file_path); snprintf(_member[size].icon_path, sizeof(_member[size].icon_path), "%s", _icon_path); (*_size)++; } void add_xmb_suboption(xmbopt *_option, u8 *_size, u8 _type, char *_label, char *_value) { (void) _type; if((*_size)>=MAX_XMB_OPTIONS) return; u8 size=(*_size); //_option[size].type = _type; sprintf(_option[size].label, "%s", _label); sprintf(_option[size].value, "%s", _value); (*_size)++; } void add_xmb_option(xmbmem *_member, u16 *_size, char *_name, char *_subname, char *_optionini) { if((*_size)>=(MAX_XMB_MEMBERS-1)) return; u16 size=(*_size); _member[size].type = 7;//option _member[size].status = 2;//loaded _member[size].game_id = -1; _member[size].game_user_flags = 0; _member[size].game_split = 0; snprintf(_member[size].name, sizeof(_member[size].name), "%s", _name); _member[size].name[sizeof(_member[size].name)]=0; snprintf(_member[size].subname, sizeof(_member[size].subname), "%s", _subname); _member[size].subname[sizeof(_member[size].subname)]=0; _member[size].option_size=0; _member[size].option_selected=0; sprintf(_member[size].optionini, "%s", _optionini); _member[size].data=-1; _member[size].icon = xmb_icon_tool; _member[size].icon_buf = -1; _member[size].iconw = 128; _member[size].iconh = 128; sprintf(_member[size].file_path, "%s", (char*)"/"); sprintf(_member[size].icon_path, "%s", (char*)"/"); (*_size)++; } void reset_xmb_checked() { for(int n=0;n<MAX_XMB_ICONS;n++) for(int m=0;m<xmb[n].size;m++) xmb[n].member[m].is_checked=false; } void free_text_buffers() { for(int n=0; n<MAX_XMB_TEXTS; n++) { xmb_txt_buf[n].used=0; xmb_txt_buf[n].data=text_bmpUPSR+(n*XMB_TEXT_WIDTH*XMB_TEXT_HEIGHT*4); } xmb_txt_buf_max=0; for(int c=0; c<MAX_XMB_ICONS; c++) for(int n=0; n<xmb[c].size; n++) xmb[c].member[n].data=-1; } void free_all_buffers() { while(is_decoding_jpg || is_decoding_png){ sys_timer_usleep(3336); cellSysutilCheckCallback();} int n; for(n=0; n<MAX_XMB_THUMBS; n++) xmb_icon_buf[n].used=-1; for(n=((xmb[6].member[1].icon==xmb_icon_blu) ? 2 : 1); n<xmb[6].size; n++) { xmb[6].member[n].icon_buf=-1; xmb[6].member[n].status=0; } for(n=0; n<xmb[7].size; n++) { xmb[7].member[n].icon_buf=-1; xmb[7].member[n].status=0; } for(n=1; n<xmb[8].size; n++) //if(xmb[8].member[n].icon!=xmb_icon_retro)//xmb[8].member[n].icon!=xmb[0].data && { xmb[8].member[n].icon_buf=-1; xmb[8].member[n].status=0; xmb[8].member[n].icon=xmb_icon_retro; } for(n=0; n<xmb[5].size; n++) { if(xmb[5].member[n].icon!=xmb_icon_film && xmb[5].member[n].icon!=xmb_icon_showtime) { xmb[5].member[n].icon_buf=-1; xmb[5].member[n].status=0; xmb[5].member[n].icon=xmb_icon_film; } } for(n=0; n<xmb[3].size; n++) { if(xmb[3].member[n].icon!=xmb_icon_photo) { xmb[3].member[n].icon_buf=-1; xmb[3].member[n].status=0; xmb[3].member[n].icon=xmb_icon_photo; } } } void reset_xmb(u8 _flag) { for(int n=0; n<MAX_XMB_ICONS; n++) { if(_flag && n!=8) //skip retro when resetting xmmb { xmb[n].size=0; xmb[n].first=0; xmb[n].init=0; } xmb[n].data=text_FMS+(n*65536); } xmb[8].data=xmb_icon_retro; xmb[9].data=text_FMS+(8*65536); } int find_free_buffer(const int _col) { (void) _col; int n; for(n=0; n<MAX_XMB_THUMBS; n++) { if(xmb_icon_buf[n].used==-1) return n; } if(xmb_icon==3) { for(n=0; n<xmb[3].size; n++) { if(xmb[3].member[n].icon!=xmb_icon_photo && (n<(xmb[3].first-3) || n>(xmb[3].first+7))) { xmb[3].member[n].icon_buf=-1; xmb[3].member[n].status=0; xmb[3].member[n].icon=xmb_icon_photo; } } for(n=0; n<MAX_XMB_THUMBS; n++) xmb_icon_buf[n].used=-1; return 0; } else free_all_buffers(); return 0; } // Draws the cross MM bar (XMMB) void draw_xmb_icons(xmb_def *_xmb, const int _xmb_icon_, int _xmb_x_offset, int _xmb_y_offset, const bool _recursive, int sub_level) { int _xmb_icon = _xmb_icon_; int first_xmb=_xmb_icon-2; int xpos, _xpos; u8 subicons = (sub_level!=-1); if(sub_level<0) sub_level=0; _xpos=-90+_xmb_x_offset - (200*sub_level); int ypos=0, tw=0, th=0; u16 icon_x=0; u16 icon_y=0; int mo_of=0; float mo_of2=0.0f; bool one_done=false; if(_xmb_icon>3 && _xmb_x_offset>0) {first_xmb--; _xpos-=200;} for(int n=first_xmb; n<MAX_XMB_ICONS; n++) { _xpos+=200; xpos = _xpos; _xmb_icon = _xmb_icon_; if(_xmb_x_offset>=100 && _xmb_icon>1 && !subicons) {_xmb_icon--; } if(_xmb_x_offset<=-100 && _xmb_icon<MAX_XMB_ICONS-1 && !subicons) {_xmb_icon++;} if(n<1) continue; if(sub_level && n!=xmb_icon) continue; set_texture(_xmb[n].data, 128, 128); //icon mo_of=abs((int)(_xmb_x_offset*0.18f)); if(_xmb[_xmb_icon].first>=_xmb[_xmb_icon].size) _xmb[_xmb_icon].first=0; if(n==_xmb_icon_) { /*if(egg) // :) display_img_angle(xpos-(36-mo_of)/2, 230-(36-mo_of), 164-mo_of, 164-mo_of, 128, 128, 0.8f, 128, 128, angle); else*/ display_img(xpos-(36-mo_of)/2, 230-(36-mo_of), 164-mo_of, 164-mo_of, 128, 128, 0.8f, 128, 128); set_texture(xmb_col, 300, 30); //column name display_img(xpos-86, 340, 300, 30, 300, 30, 0.7f, 300, 30); if(_xmb[_xmb_icon].size>0 && subicons && !(key_repeat && ( (old_pad & BUTTON_LEFT) || (old_pad & BUTTON_RIGHT)) && (xmb_icon!=1 && xmb_icon!=MAX_XMB_ICONS-1)) && (abs(_xmb_x_offset)<100 || _xmb_icon != _xmb_icon_)) { xpos = _xpos; if(_xmb_x_offset>=100 && !subicons) xpos-=200; if(_xmb_x_offset<=-100 && !subicons) xpos+=200; int cn; int cn3=1; int first_xmb_mem = _xmb[_xmb_icon].first; int cnmax=3; if(_xmb[_xmb_icon].first>2 && _xmb_y_offset>0) {first_xmb_mem--; cn3--;} for(int m=0;m<4;m++) // make it pleasureable to watch while loading column { if(m==1) { cn3=0; first_xmb_mem = _xmb[_xmb_icon].first-1; cnmax=1; } if(m==2) { cn3=-1; first_xmb_mem = _xmb[_xmb_icon].first-2; cnmax=0; } if(m==3) { cn3=3; first_xmb_mem = _xmb[_xmb_icon].first+2; cnmax=8; } if(_xmb[_xmb_icon].first>2 && _xmb_y_offset>0) {first_xmb_mem--; cn3--;} for(cn=first_xmb_mem; (cn<_xmb[_xmb_icon].size && cn3<cnmax); cn++) { /*if(egg && cn>=0) { if(_xmb[_xmb_icon].member[cn].name[0]!='L') continue; else if(cn3==2) _xmb[_xmb_icon].first=cn; }*/ cn3++; if(cn<0) continue; if(sub_level && cn3!=2) continue; if(!_xmb[_xmb_icon].member[cn].is_checked && !key_repeat) { // check for missing/orphan entries in photo/music/video/retro columns if( ( (_xmb_icon>2 && _xmb_icon<6) || _xmb_icon==8) && (_xmb[_xmb_icon].member[cn].type>7 || (_xmb[_xmb_icon].member[cn].type>1 && _xmb[_xmb_icon].member[cn].type<6) ) && (!exist(_xmb[_xmb_icon].member[cn].file_path)) ) { delete_xmb_member(_xmb[_xmb_icon].member, &_xmb[_xmb_icon].size, cn); if(cn>=_xmb[_xmb_icon].size) break; sort_xmb_col(_xmb[_xmb_icon].member, _xmb[_xmb_icon].size, cn); } else _xmb[_xmb_icon].member[cn].is_checked=true; } tw=_xmb[_xmb_icon].member[cn].iconw; th=_xmb[_xmb_icon].member[cn].iconh; if(tw>320 || th>176) { if(tw>th) {th= (int)((float)th/((float)tw/320.f)); tw=320;} else {tw= (int)((float)tw/((float)th/176.f)); th=176;} if(tw>320) {th= (int)((float)th/((float)tw/320.f)); tw=320;} if(th>176) {tw= (int)((float)tw/((float)th/176.f)); th=176;} } if(cn3!=2) {tw/=2; th/=2;} mo_of2=2.f-(abs(_xmb_y_offset)/90.0f); if( (_xmb_y_offset!=0) ) { if( (_xmb_y_offset>0 && cn3==1) || (_xmb_y_offset<0 && cn3==3) ) { tw=_xmb[_xmb_icon].member[cn].iconw; th=_xmb[_xmb_icon].member[cn].iconh; if(tw>320 || th>176) { if(tw>th) {th= (int)((float)th/((float)tw/320.f)); tw=320;} else {tw= (int)((float)tw/((float)th/176.f)); th=176;} if(tw>320) {th= (int)((float)th/((float)tw/320.f)); tw=320;} if(th>176) {tw= (int)((float)tw/((float)th/176.f)); th=176;} } tw=(int)(tw/mo_of2); th=(int)(th/mo_of2); } else if( (_xmb_y_offset!=0 && cn3==2)) { tw=_xmb[_xmb_icon].member[cn].iconw; th=_xmb[_xmb_icon].member[cn].iconh; if(tw>320 || th>176) { if(tw>th) {th= (int)((float)th/((float)tw/320.f)); tw=320;} else {tw= (int)((float)tw/((float)th/176.f)); th=176;} if(tw>320) {th= (int)((float)th/((float)tw/320.f)); tw=320;} if(th>176) {tw= (int)((float)tw/((float)th/176.f)); th=176;} } tw=(int)(tw/(3.f-mo_of2)); th=(int)(th/(3.f-mo_of2)); } } if(cn3<1) ypos=cn3*90+_xmb_y_offset; else if(cn3==1) ypos=cn3*90 + ( (_xmb_y_offset>0) ? (int)(_xmb_y_offset*3.566f) : (_xmb_y_offset) ); else if(cn3==2) {ypos = 411 + ( (_xmb_y_offset>0) ? (int)(_xmb_y_offset*2.377f) : (int)(_xmb_y_offset*3.566f) );} else if(cn3==3) ypos=(cn3-3)*90 + 625 + ( (_xmb_y_offset>0) ? _xmb_y_offset : (int)(_xmb_y_offset*2.377f) ); else if(cn3 >3) ypos=(cn3-3)*90 + 625 + _xmb_y_offset; if(_xmb[_xmb_icon].member[cn].data==-1 && _xmb_x_offset==0 && !one_done) { one_done=true; if(xmb_txt_buf_max>=MAX_XMB_TEXTS) {redraw_column_texts(_xmb_icon); xmb_txt_buf_max=0;} _xmb[_xmb_icon].member[cn].data=xmb_txt_buf_max; draw_xmb_title(xmb_txt_buf[xmb_txt_buf_max].data, _xmb[_xmb_icon].member, cn, COL_XMB_TITLE, COL_XMB_SUBTITLE, _xmb_icon); xmb_txt_buf_max++; } if(_xmb[_xmb_icon].member[cn].data!=-1 && ((ss_timer<dim_setting && dim_setting) || _xmb[_xmb_icon].first==cn || dim_setting==0) && abs(_xmb_x_offset)<100) { u8 xo1=(_xmb_y_offset>0 ? 1 : 0); u8 xo2=1-xo1; if( ((_xmb_icon==6 || _xmb_icon==7) && ((cn>=_xmb[_xmb_icon].first-xo1 && cn<=_xmb[_xmb_icon].first+xo2 && _xmb_y_offset!=0) || cn==_xmb[_xmb_icon].first) ) || (_xmb_icon!=6 && _xmb_icon!=7)) { set_texture(xmb_txt_buf[_xmb[_xmb_icon].member[cn].data].data, XMB_TEXT_WIDTH, XMB_TEXT_HEIGHT); //text if(_xmb_icon!=6 && _xmb_icon!=7) display_img(xpos+((_xmb_icon==3 || _xmb_icon==5 || _xmb_icon==8)?(230+(((V_WIDTH==720)?60:0))):(128+tw/2)), ypos+th/2-XMB_TEXT_HEIGHT/2, XMB_TEXT_WIDTH, XMB_TEXT_HEIGHT, XMB_TEXT_WIDTH, XMB_TEXT_HEIGHT, 0.5f, XMB_TEXT_WIDTH, XMB_TEXT_HEIGHT); //(int)(XMB_TEXT_WIDTH*(1.f-abs((float)_xmb_x_offset)/200.f)) else display_img(xpos+128+tw/2, ypos+th/2-XMB_TEXT_HEIGHT/2, XMB_TEXT_WIDTH, XMB_TEXT_HEIGHT, XMB_TEXT_WIDTH, XMB_TEXT_HEIGHT, 0.5f, XMB_TEXT_WIDTH, XMB_TEXT_HEIGHT); //(int)(XMB_TEXT_WIDTH*(1.f-abs((float)_xmb_x_offset)/200.f)) } } if((_xmb[_xmb_icon].member[cn].status==1 || _xmb[_xmb_icon].member[cn].status==0) && !_recursive && !key_repeat)// || (c_opacity_delta!=0 && dim==1 && c_opacity2>0x30 && c_opacity2<0x42)) { if(_xmb[_xmb_icon].member[cn].status==0) { _xmb[_xmb_icon].member[cn].status=1; xmb_icon_buf_max=find_free_buffer(_xmb_icon); xmb_icon_buf[xmb_icon_buf_max].used=cn; xmb_icon_buf[xmb_icon_buf_max].column=_xmb_icon; _xmb[_xmb_icon].member[cn].icon = xmb_icon_buf[xmb_icon_buf_max].data; _xmb[_xmb_icon].member[cn].icon_buf=xmb_icon_buf_max; } // load_png_partial( _xmb[_xmb_icon].member[cn].icon, _xmb[_xmb_icon].member[cn].icon_path, _xmb[_xmb_icon].member[cn].iconw, _xmb[_xmb_icon].member[cn].iconh/2, 0); if(_xmb_icon==5 || _xmb_icon==3 || _xmb_icon==8) { if(_xmb_icon==8 && (strstr(_xmb[_xmb_icon].member[cn].icon_path,".png")!=NULL || strstr(_xmb[_xmb_icon].member[cn].icon_path,".PNG")!=NULL)) load_png_threaded( _xmb_icon, cn); else load_jpg_threaded( _xmb_icon, cn); } else { if(strstr(_xmb[_xmb_icon].member[cn].icon_path,".JPG")!=NULL) load_jpg_threaded( _xmb_icon, cn); else load_png_threaded( _xmb_icon, cn); } } if(_xmb[_xmb_icon].member[cn].status==1 || (_xmb[_xmb_icon].member[cn].status==0 && (_recursive || key_repeat))) { tw=128; th=128; if(cn3!=2) {tw/=2; th/=2;} icon_x=xpos+64-tw/2; icon_y=ypos; set_texture(_xmb[0].data, 128, 128); //icon display_img_angle(icon_x, icon_y, tw, th, 128, 128, 0.5f, 128, 128, angle); } if(_xmb[_xmb_icon].member[cn].status==2) { icon_x=xpos+64-tw/2; icon_y=ypos; set_texture(_xmb[_xmb_icon].member[cn].icon, _xmb[_xmb_icon].member[cn].iconw, _xmb[_xmb_icon].member[cn].iconh); if( ((is_video_loading || is_music_loading || is_photo_loading || is_retro_loading || is_game_loading || is_any_xmb_column) && ( (_xmb_icon==1 && cn==2) || (_xmb_icon==6 && cn==0) || (_xmb_icon==8 && cn==0) )) ) display_img_angle(icon_x, icon_y, tw, th, tw, th, 0.5f, tw, th, angle); else { display_img(icon_x, icon_y, tw, th, tw, th, 0.5f, tw, th); if( (_xmb_icon==4 && current_mp3 && current_mp3<MAX_MP3 && !is_theme_playing && !strcmp(mp3_playlist[current_mp3].path, _xmb[_xmb_icon].member[cn].file_path) ) ) { if(update_ms || (!update_ms && (time(NULL)&1))) { set_texture(_xmb[4].data, 128, 128); //icon display_img(icon_x-48, icon_y-16, 32, 32, 128, 128, 0.45f, 128, 128); } set_texture(_xmb[0].data, 128, 128); //icon display_img_angle(icon_x-64, icon_y-32, 64, 64, 128, 128, 0.4f, 128, 128, angle); } } } } } } } else { /*if(egg) { if(n==xmb_icon-1 && _xmb_x_offset>0) display_img_angle(xpos-(mo_of)/2, 230-(mo_of), 128+mo_of, 128+mo_of, 128, 128, 0.0f, 128, 128, angle); else if(n==xmb_icon+1 && _xmb_x_offset<0) display_img_angle(xpos-(mo_of)/2, 230-(mo_of), 128+mo_of, 128+mo_of, 128, 128, 0.0f, 128, 128, angle); else display_img_angle(xpos, 230, 128, 128, 128, 128, 0.0f, 128, 128, angle); } else */ { if(n==xmb_icon-1 && _xmb_x_offset>0) display_img(xpos-(mo_of)/2, 230-(mo_of), 128+mo_of, 128+mo_of, 128, 128, 0.0f, 128, 128); else if(n==xmb_icon+1 && _xmb_x_offset<0) display_img(xpos-(mo_of)/2, 230-(mo_of), 128+mo_of, 128+mo_of, 128, 128, 0.0f, 128, 128); else display_img(xpos, 230, 128, 128, 128, 128, 0.0f, 128, 128); } } } if(is_video_loading || is_music_loading || is_photo_loading || is_retro_loading || is_game_loading || is_any_xmb_column) { if(is_any_xmb_column) set_texture(xmb_icon_help, 128, 128); else set_texture(_xmb[0].data, 128, 128); display_img_angle(1770, 74, 64, 64, 128, 128, 0.6f, 128, 128, angle); if(time(NULL)&1) { if(is_any_xmb_column) set_texture(_xmb[is_any_xmb_column].data, 128, 128); else if(is_game_loading) set_texture(_xmb[6].data, 128, 128); else if(is_video_loading) set_texture(_xmb[5].data, 128, 128); else if(is_music_loading) set_texture(_xmb[4].data, 128, 128); else if(is_photo_loading) set_texture(_xmb[3].data, 128, 128); else if(is_retro_loading) set_texture(_xmb[8].data, 128, 128); display_img(1834, 74, 64, 64, 128, 128, 0.6f, 128, 128); } } else if((ftp_clients && time(NULL)&2) || (http_active && time(NULL)&1) ) { set_texture((http_active?xmb[9].data:xmb_icon_ftp), 128, 128); display_img(1770, 74, 64, 64, 128, 128, 0.0f, 128, 128); /*u8 pZ=32; // icon pulsing if(angle<180.f) pZ=(int)((angle/180.f) * 48.f); else pZ=(int)(((360.f/angle) - 1.f) * 48.f); display_img(1770+(48-pZ)/2, 74+(48-pZ)/2, 16+pZ, 16+pZ, 128, 128, 0.6f, 128, 128);*/ //set_texture(_xmb[0].data, 128, 128); //display_img_angle(1770, 74, 64, 64, 128, 128, 0.0f, 128, 128, angle); } } void load_coverflow_legend() { if(cover_mode!=4 || !xmb[6].init) return; if((xmb_icon==6) && xmb[xmb_icon].member[xmb[xmb_icon].first].game_id!=-1) game_sel=xmb[xmb_icon].member[xmb[xmb_icon].first].game_id; // || xmb_icon==8 int grey=(menu_list[game_sel].title[0]=='_' || menu_list[game_sel].split); u32 color= (menu_list[game_sel].flags && game_sel==0)? COL_PS3DISC : ((grey==0) ? COL_PS3 : COL_SPLIT); if(strstr(menu_list[game_sel].content,"AVCHD")!=NULL) color=COL_AVCHD; if(strstr(menu_list[game_sel].content,"BDMV")!=NULL) color=COL_BDMV; if(strstr(menu_list[game_sel].content,"PS2")!=NULL) color=COL_PS2; if(strstr(menu_list[game_sel].content,"DVD")!=NULL) color=COL_DVD; int tmp_legend_y=legend_y; legend_y=0; memset(text_bmp, 0, 737280); if(xmb[6].first) { if(!key_repeat) { char str[256]; sprintf(str, "%i of %i", xmb[6].first, xmb[6].size-1); if(dir_mode==1) put_label(text_bmp, 1920, 1080, (char*)menu_list[game_sel].title, (char*)str, (char*)menu_list[game_sel].path, color); else put_label(text_bmp, 1920, 1080, (char*)menu_list[game_sel].title, (char*)str, (char*)menu_list[game_sel].title_id, color); } else put_label(text_bmp, 1920, 1080, (char*)menu_list[game_sel].title, (char*)" ", (char*)" ", color); } else put_label(text_bmp, 1920, 1080, (char*)"Refresh Game List", (char*)" ", (char*)" ", COL_PS3); legend_y=tmp_legend_y; xmb_bg_show=0; } void draw_xmb_bare(u8 _xmb_icon, u8 _all_icons, bool recursive, int _sub_level) { ClearSurface(); if(!use_drops && xmb_sparks!=0) draw_stars(); set_texture( text_bmp, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.9f, 1920, 1080); if(use_drops && xmb_sparks!=0) draw_stars(); draw_xmb_clock(xmb_clock, (_all_icons!=2 ? _xmb_icon : -1)); if(_all_icons==1) draw_xmb_icons(xmb, _xmb_icon, xmb_slide, xmb_slide_y, recursive, _sub_level); else if(_all_icons==2) draw_xmb_icons(xmb, _xmb_icon, xmb_slide, xmb_slide_y, recursive, -1); flip(); } void draw_coverflow_icons(xmb_def *_xmb, const int _xmb_icon_, int __xmb_y_offset) { if(is_game_loading) return; int _xmb_icon = _xmb_icon_; u16 xpos=350; int ypos=0, tw=0, th=0; u16 icon_x=0; u16 icon_y=0; int _xmb_y_offset=(int) ((float)__xmb_y_offset*16.0/9.0f); float mo_of=abs((float)_xmb_y_offset)/160.0f; float mo_of2=0.0f; char filename[1024]; u32 pixel, delta2; float delta, delta3; float c_persp=45.f; float c_persp2=35.f; if(xmb_bg_counter>0 && !xmb_bg_show && !key_repeat && _xmb_y_offset==0) xmb_bg_counter--; if(xmb_bg_counter==0 && !xmb_bg_show && _xmb_y_offset==0 && xmb_game_bg==1 && !key_repeat && (_xmb_icon==6 && _xmb[_xmb_icon].first && _xmb[_xmb_icon].member[_xmb[_xmb_icon].first].type==1) && !is_game_loading) //show poster for games only { sprintf(filename, "%s/%s_1920.PNG", cache_dir, menu_list[_xmb[_xmb_icon].member[_xmb[_xmb_icon].first].game_id].title_id); if(exist(filename) && xmb_game_bg==1) { load_png_texture(text_FONT, filename, 1920); if(menu_list[_xmb[_xmb_icon].member[_xmb[_xmb_icon].first].game_id].split==1 || menu_list[_xmb[_xmb_icon].member[_xmb[_xmb_icon].first].game_id].title[0]=='_') gray_texture(text_FONT, 1920, 1080, 0); //change_opacity(text_FONT, -60, 8294400); delta=100.f; delta3=0.f; for(u32 fsr=0; fsr<3840000; fsr+=4) //dim the center of the screen-out { if(fsr%7680==0) {delta-=0.2f; delta3+=0.2f;} pixel=*(uint32_t*) ((uint8_t*)(text_FONT+fsr)); delta2 = ((u32)((float)(pixel&0xff)*((float)abs(delta)/100.f))); pixel= (pixel & 0xffffff00) | delta2; *(uint32_t*) ((uint8_t*)(text_FONT)+fsr)= pixel; pixel=*(uint32_t*) ((uint8_t*)(text_FONT+fsr+3840000)); delta2 = ((u32)((float)(pixel&0xff)*((float)abs(delta3)/100.f))); pixel= (pixel & 0xffffff00) | delta2; *(uint32_t*) ((uint8_t*)(text_FONT)+fsr+3840000)= pixel; } xmb_bg_show=1; } else { xmb_bg_counter=200; xmb_bg_show=0; } } if(_xmb_y_offset!=0) {offX=0; offY=0;} if(xmb_bg_show && _xmb_y_offset==0 && !key_repeat) { set_texture( text_FONT, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.9f, 1920, 1080); } else { //draw sliding background if(animation==2 || animation==3) { BoffX--; if(BoffX<= -1920) BoffX=0; set_texture( text_bmpUPSR, 1920, 1080); if(BoffX>= -1920) display_img((int)BoffX, 0, 1920, 1080, 1920, 1080, 0.9f, 1920, 1080); display_img(1920+(int)BoffX, 0, abs((int)BoffX), 1080, abs((int)BoffX), 1080, 0.9f, 1920, 1080); } else { set_texture( text_bmpUPSR, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.9f, 1920, 1080); } } if(_xmb[_xmb_icon].first>=_xmb[_xmb_icon].size) _xmb[_xmb_icon].first=0; if(_xmb[_xmb_icon].size>0) { int cn; int cn3=-2; int first_xmb_mem = _xmb[_xmb_icon].first-6; int cnmax=10; if(_xmb_y_offset==0) cnmax--; if(_xmb[_xmb_icon].first>4 && _xmb_y_offset>0) {first_xmb_mem--; cn3--;} for(cn=first_xmb_mem; (cn<_xmb[_xmb_icon].size && cn3<cnmax); cn++) { cn3++; if(cn<0) continue; if(!_xmb[_xmb_icon].member[cn].is_checked) { if( ( (_xmb_icon>2 && _xmb_icon<6) || _xmb_icon==8) && (_xmb[_xmb_icon].member[cn].type>7 || (_xmb[_xmb_icon].member[cn].type>1 && _xmb[_xmb_icon].member[cn].type<6) ) && (!exist(_xmb[_xmb_icon].member[cn].file_path)) ) { delete_xmb_member(_xmb[_xmb_icon].member, &_xmb[_xmb_icon].size, cn); if(cn>=_xmb[_xmb_icon].size) break; sort_xmb_col(_xmb[_xmb_icon].member, _xmb[_xmb_icon].size, cn); } else _xmb[_xmb_icon].member[cn].is_checked=true; } tw=_xmb[_xmb_icon].member[cn].iconw; th=_xmb[_xmb_icon].member[cn].iconh; if(tw>320 || th>320) { if(tw>th) {th= (int)((float)th/((float)tw/320.f)); tw=320;} else {tw= (int)((float)tw/((float)th/320.f)); th=320;} if(tw>320) {th= (int)((float)th/((float)tw/320.f)); tw=320;} if(th>320) {tw= (int)((float)tw/((float)th/320.f)); th=320;} } if(cn3!=5) {tw/=2; th/=2;} mo_of2=2.f-mo_of; if( (_xmb_y_offset!=0) ) { if( (_xmb_y_offset>0 && cn3==4) || (_xmb_y_offset<0 && cn3==6) ) { tw=_xmb[_xmb_icon].member[cn].iconw; th=_xmb[_xmb_icon].member[cn].iconh; if(tw>320 || th>320) { if(tw>th) {th= (int)((float)th/((float)tw/320.f)); tw=320;} else {tw= (int)((float)tw/((float)th/320.f)); th=320;} if(tw>320) {th= (int)((float)th/((float)tw/320.f)); tw=320;} if(th>320) {tw= (int)((float)tw/((float)th/320.f)); th=320;} } tw=(int)(tw/mo_of2); th=(int)(th/mo_of2); } else if( (_xmb_y_offset!=0 && cn3==5)) { tw=_xmb[_xmb_icon].member[cn].iconw; th=_xmb[_xmb_icon].member[cn].iconh; if(tw>320 || th>320) { if(tw>th) {th= (int)((float)th/((float)tw/320.f)); tw=320;} else {tw= (int)((float)tw/((float)th/320.f)); th=320;} if(tw>320) {th= (int)((float)th/((float)tw/320.f)); tw=320;} if(th>320) {tw= (int)((float)tw/((float)th/320.f)); th=320;} } tw=(int)(tw/(3.f-mo_of2)); th=(int)(th/(3.f-mo_of2)); } } if(cn3<=1) ypos=cn3*160+ ( (_xmb_y_offset>0) ? _xmb_y_offset : (int)(_xmb_y_offset*1.8125f) ) -130; if(cn3>1 && cn3<4) ypos=cn3*160+_xmb_y_offset-130; else if(cn3==4) ypos=cn3*160 -130 + ( (_xmb_y_offset>0) ? (int)(_xmb_y_offset*1.8125f) : (_xmb_y_offset) ); else if(cn3==5) {ypos = 800 + ( (_xmb_y_offset>0) ? (int)(_xmb_y_offset*1.8125f) : (int)(_xmb_y_offset*1.8125f) );} else if(cn3==6) ypos=(cn3-6)*160 + 1090 + ( (_xmb_y_offset>0) ? _xmb_y_offset : (int)(_xmb_y_offset*1.8125f) ); else if(cn3 >6 && cn3<9) ypos=(cn3-6)*160 + 1090 + _xmb_y_offset; else if(cn3>8) ypos=(cn3-6)*160 + 1090 + ( (_xmb_y_offset<0) ? _xmb_y_offset : (int)(_xmb_y_offset*1.8125f) ); ypos+=30; if((_xmb[_xmb_icon].member[cn].status==1 || _xmb[_xmb_icon].member[cn].status==0) && !key_repeat)// || (c_opacity_delta!=0 && dim==1 && c_opacity2>0x30 && c_opacity2<0x42)) { if(_xmb[_xmb_icon].member[cn].status==0) { _xmb[_xmb_icon].member[cn].status=1; xmb_icon_buf_max=find_free_buffer(_xmb_icon); xmb_icon_buf[xmb_icon_buf_max].used=cn; xmb_icon_buf[xmb_icon_buf_max].column=_xmb_icon; _xmb[_xmb_icon].member[cn].icon = xmb_icon_buf[xmb_icon_buf_max].data; _xmb[_xmb_icon].member[cn].icon_buf=xmb_icon_buf_max; } // load_png_partial( _xmb[_xmb_icon].member[cn].icon, _xmb[_xmb_icon].member[cn].icon_path, _xmb[_xmb_icon].member[cn].iconw, _xmb[_xmb_icon].member[cn].iconh/2, 0); if(_xmb_icon==5 || _xmb_icon==3 || _xmb_icon==8) { if(_xmb_icon==8 && (strstr(_xmb[_xmb_icon].member[cn].icon_path,".png")!=NULL || strstr(_xmb[_xmb_icon].member[cn].icon_path,".PNG")!=NULL)) load_png_threaded( _xmb_icon, cn); else load_jpg_threaded( _xmb_icon, cn); } else { if(strstr(_xmb[_xmb_icon].member[cn].icon_path,".JPG")!=NULL) load_jpg_threaded( _xmb_icon, cn); else load_png_threaded( _xmb_icon, cn); } } if(_xmb[_xmb_icon].member[cn].status==1 || (_xmb[_xmb_icon].member[cn].status==0 && (key_repeat))) { tw=128; th=128; if(cn3!=5) {tw/=2; th/=2;} icon_y=xpos+150-th/2; icon_x=ypos+130-tw/2; set_texture(_xmb[0].data, 128, 128); //icon display_img_angle(icon_x, icon_y, tw, th, 128, 128, 0.5f, 128, 128, angle); } if(_xmb[_xmb_icon].member[cn].status==2) { icon_y=xpos+150-th/2; icon_x=ypos+130-tw/2; set_texture(_xmb[_xmb_icon].member[cn].icon, _xmb[_xmb_icon].member[cn].iconw, _xmb[_xmb_icon].member[cn].iconh); //icon if((is_video_loading || is_music_loading || is_photo_loading || is_retro_loading || is_game_loading || is_any_xmb_column) && ( (_xmb_icon==1 && cn==2) || (_xmb_icon==6 && cn==0) || (_xmb_icon==8 && cn==0)) ) display_img_angle(icon_x, icon_y, tw, th, tw, th, (cn!=5 ? 0.5f : 0.4f), tw, th, angle); else { if( _xmb_y_offset!=0 && ( cn3==5 || (cn3==4 && _xmb_y_offset>0) || (cn3==6 && _xmb_y_offset<0) ) ) { if(cn3==5) { display_img_persp(icon_x, icon_y, tw, th, tw, th, (cn!=5 ? 0.5f : 0.4f), tw, th, (_xmb_y_offset>0 ? ((int)(c_persp2*mo_of)) : ((int)(c_persp*mo_of))), (_xmb_y_offset>0 ? ((int)(c_persp*mo_of)) : ((int)(c_persp2*mo_of))) ); } else if(cn3==4) { display_img_persp(icon_x, icon_y, tw, th, tw, th, (cn!=5 ? 0.5f : 0.4f), tw, th, (int)(c_persp - c_persp*mo_of), (int)(c_persp2 - c_persp2*mo_of) ); } else if(cn3==6) { display_img_persp(icon_x, icon_y, tw, th, tw, th, (cn!=5 ? 0.5f : 0.4f), tw, th, (int)(c_persp2 - c_persp2*mo_of), (int)(c_persp - c_persp*mo_of)); } } else if (cn3==5) { if(offX<0 || offY<0 || offX>31 || animation==0 || animation==2) {offX=0; offY=0;} // offY>31 || if(animation==0 || animation==2) incZ=0; if(tw<320) offY=(float)(offX*1.1538f); else offY=(float)(offX*0.5500f); display_img(icon_x-(int)offX, icon_y-(int)offY, tw+(int)(offX*2.0f), th+(int)(offY*2.0f), tw, th, (cn!=5 ? 0.5f : 0.4f), tw, th); offX+=incZ; if(offX>30) {incZ=-0.3f;};if(offX<1) {incZ=0.6f;}; } else if(cn3<5) { display_img_persp(icon_x, icon_y, tw, th, tw, th, (cn!=5 ? 0.5f : 0.4f), tw, th, (int)c_persp, (int)c_persp2); } else if(cn3>5) { display_img_persp(icon_x, icon_y, tw, th, tw, th, (cn!=5 ? 0.5f : 0.4f), tw, th, (int)c_persp2, (int)c_persp); } } } } if((xmb_icon==6 || xmb_icon==8) && xmb[xmb_icon].member[xmb[xmb_icon].first].game_id!=-1) game_sel=xmb[xmb_icon].member[xmb[xmb_icon].first].game_id; } if(xmb_slide_step_y!=0) //sliding horizontally (inverted XMMB) { xmb_slide_y+=xmb_slide_step_y; if(xmb_slide_y == 10) xmb_slide_step_y = 5; else if(xmb_slide_y ==-10) xmb_slide_step_y =-5; // else if(xmb_slide_y == 50) xmb_slide_step_y = 2; // else if(xmb_slide_y ==-50) xmb_slide_step_y =-2; else if(xmb_slide_y == 80) xmb_slide_step_y = 2; else if(xmb_slide_y ==-80) xmb_slide_step_y =-2; else if(xmb_slide_y >= 90) {xmb_slide_step_y= 0; if(_xmb[_xmb_icon].first>0) _xmb[_xmb_icon].first--; xmb_slide_y=0; load_coverflow_legend();} else if(xmb_slide_y <=-90) {xmb_slide_step_y= 0; if(_xmb[_xmb_icon].first<_xmb[_xmb_icon].size-1) _xmb[_xmb_icon].first++; xmb_slide_y=0;load_coverflow_legend();} if(xmb_slide_step_y==0) xmb_bg_counter=200; } } int open_theme_menu(char *_caption, int _width, theme_def *list, int _max, int _x, int _y, int _max_entries, int _centered) { (void) _x; (void) _y; char filename[1024]; if(_max_entries>16) _max_entries=16; u8 *text_LIST = NULL; u8 *text_LIST2 = NULL; text_LIST = text_FONT; text_LIST2 = text_FONT + 3024000; int line_h = 30; int _height = (_max_entries+5) * line_h; char tdl[512]; int last_sel=-1; int first=0; int sel=0; sprintf(filename, "%s/LBOX.PNG", app_usrdir); load_texture(text_LIST+1512000, filename, 600); change_opacity(text_LIST+1512000, 50, 600*630*4); sprintf(filename, "%s/LBOX2.PNG", app_usrdir); load_texture(text_LIST2+1713600, filename, 680); //4737600 while(1) { pad_read(); if ( (new_pad & BUTTON_TRIANGLE) || (new_pad & BUTTON_CIRCLE) ) return -1; if ( (new_pad & BUTTON_CROSS) ) return sel; if ( (new_pad & BUTTON_DOWN)) { sel++; if(sel>=_max) sel=0; first=sel-_max_entries+2; if(first<0) first=0; } if ( (new_pad & BUTTON_UP)) { sel--; if(sel<0) sel=_max-1; first=sel-_max_entries+2; if(first<0) first=0; } if(last_sel!=sel) { // memset(text_LIST, 0x40, (_width * _height * 4)); // for(int fsr=0; fsr<(_width*_height*4); fsr+=4) *(uint32_t*) ( (u8*)(text_LIST)+fsr )=0x222222a0; memcpy(text_LIST, text_LIST+1512000, 1512000); memcpy(text_LIST2, text_LIST2+1713600, 1713600); max_ttf_label=0; print_label_ex( 0.5f, 0.05f, 1.0f, COL_XMB_COLUMN, _caption, 1.04f, 0.0f, (mm_locale ? mui_font : 15), 1.0f/((float)(_width/1920.f)), 1.0f/((float)(_height/1080.f)), 1); flush_ttf(text_LIST, _width, _height); for(int n=first; (n<(first+_max_entries-1) && n<_max); n++) { if(_centered) { if(n==sel) print_label_ex( 0.5f, ((float)((n-first+3)*line_h)/(float)_height)-0.011f, 1.4f, 0xf0e0e0e0, list[n].name, 1.04f, 0.0f, 15, 1.0f/((float)(_width/1920.f)), 1.0f/((float)(_height/1080.f)), 1); else print_label_ex( 0.5f, ((float)((n-first+3)*line_h)/(float)_height), 1.0f, COL_XMB_SUBTITLE, list[n].name, 1.00f, 0.0f, 15, 1.0f/((float)(_width/1920.f)), 1.0f/((float)(_height/1080.f)), 1 ); } else { if(n==sel) print_label_ex( 0.05f, ((float)((n-first+3)*line_h)/(float)_height)-0.011f, 1.4f, 0xf0e0e0e0, list[n].name, 1.04f, 0.0f, 15, 0.8f/((float)(_width/1920.f)), 1.0f/((float)(_height/1080.f)), 0); else print_label_ex( 0.05f, ((float)((n-first+3)*line_h)/(float)_height), 1.0f, COL_XMB_SUBTITLE, list[n].name, 1.00f, 0.0f, 15, 0.8f/((float)(_width/1920.f)), 1.0f/((float)(_height/1080.f)), 0 ); } flush_ttf(text_LIST, _width, _height); } print_label_ex( 0.7f, ((float)(_height-line_h*2)/(float)_height)+0.01f, 1.5f, 0xf0c0c0c0, (char*)STR_BUT_DOWNLOAD, 1.00f, 0.0f, mui_font, 0.5f/((float)(_width/1920.f)), 0.4f/((float)(_height/1080.f)), 0); flush_ttf(text_LIST, _width, _height); put_texture_with_alpha_gen( text_LIST, text_DOX+(dox_cross_x *4 + dox_cross_y * dox_width*4), dox_cross_w, dox_cross_h, dox_width, _width, (int)((0.7f*_width)-dox_cross_w-5), _height-line_h*2); sprintf(tdl, "%s/%s.jpg", themes_web_dir, list[sel].name); if(!exist(tdl)) download_file(list[sel].img, tdl, 0); if(exist(tdl)) { load_jpg_texture(text_LIST2+20*4+145*680*4, tdl, 680); } print_label_ex( 0.5f, 0.05f, 1.0f, COL_XMB_COLUMN, list[sel].name, 1.04f, 0.0f, 15, 1.0f/((float)(680/1920.f)), 1.0f/((float)(_height/1080.f)), 1); print_label_ex( 0.5f, 0.10f, 1.0f, COL_XMB_SUBTITLE, (char*)"by", 1.00f, 0.0f, 15, 1.0f/((float)(680/1920.f)), 1.0f/((float)(_height/1080.f)), 1); print_label_ex( 0.5f, 0.15f, 1.0f, COL_XMB_SUBTITLE, list[sel].author, 1.00f, 0.0f, 15, 1.0f/((float)(680/1920.f)), 1.0f/((float)(_height/1080.f)), 1); sprintf(tdl, "%s", list[sel].info); if(strlen(tdl)>1) print_label_ex( 0.05f, 0.85f, 1.0f, COL_XMB_SUBTITLE, tdl, 0.50f, 0.0f, 15, 1.0f/((float)(680/1920.f)), 1.0f/((float)(_height/1080.f)), 0); sprintf(tdl, "multiMAN version: %s", list[sel].mmver); print_label_ex( 0.05f, 0.90f, 1.0f, COL_XMB_SUBTITLE, tdl, 0.50f, 0.0f, 15, 1.0f/((float)(680/1920.f)), 1.0f/((float)(_height/1080.f)), 0); flush_ttf(text_LIST2, 680, _height); last_sel=sel; } ClearSurface(); if(!use_drops && xmb_sparks!=0) draw_stars(); set_texture( text_bmp, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.9f, 1920, 1080); if(use_drops && xmb_sparks!=0) draw_stars(); draw_xmb_clock(xmb_clock, 0); draw_xmb_icons(xmb, xmb_icon, xmb_slide, xmb_slide_y, 0, xmb_sublevel); set_texture(text_LIST, _width, _height); display_img((int)(mouseX*1920.f), (int)(mouseY*1080.f), _width, _height, _width, _height, 0.0f, _width, _height); set_texture(text_LIST+3024000, 680, 630); display_img((int)(mouseX*1920.f)+_width+(V_WIDTH==1920?20:70), (int)(mouseY*1080.f), 680, _height, 680, _height, 0.0f, 680, _height); flip(); mouseX+=mouseXD; mouseY+=mouseYD; if(mouseX>0.995f) {mouseX=0.995f;mouseXD=0.0f;} if(mouseX<0.0f) {mouseX=0.0f;mouseXD=0.0f;} if(mouseY>0.990f) {mouseY=0.990f;mouseYD=0.0f;} if(mouseY<0.0f) {mouseY=0.0f;mouseYD=0.0f;} } return -1; } void change_opacity(u8 *buffer, int delta, u32 size) { u32 pixel; u32 delta2; if(delta>0) { for(u32 fsr=0; fsr<size; fsr+=4) { pixel=*(uint32_t*) ((uint8_t*)(buffer)+fsr); delta2 = ((u32)((float)(pixel&0xff)*(1.0f+(float)delta/100.f))); if(delta2>0xff) delta2=0xff; pixel= (pixel & 0xffffff00) | delta2; *(uint32_t*) ((uint8_t*)(buffer)+fsr)= pixel; } } else { for(u32 fsr=0; fsr<size; fsr+=4) { pixel=*(uint32_t*) ((uint8_t*)(buffer)+fsr); delta2 = ((u32)((float)(pixel&0xff)*((float)abs(delta)/100.f))); if(delta2>0xff) delta2=0xff; pixel= (pixel & 0xffffff00) | delta2; *(uint32_t*) ((uint8_t*)(buffer)+fsr)= pixel; } } } int open_select_menu(char *_caption, int _width, t_opt_list *list, int _max, u8 *buffer, int _max_entries, int _centered) { if(_max_entries>16) _max_entries=16; u8 *text_LIST = NULL; text_LIST = text_bmpUBG + (FB(1)); int line_h = 30; int _height = (_max_entries+5) * line_h; int last_sel=-1; int first=0; int sel=0; char filename[1024]; int _menu_font = mui_font; //15; float _y_scale = 0.7f; //1.0f; bool is_lang = (strstr(_caption, (const char*) STR_SEL_LANG)!=NULL); if(is_lang) { sel=mm_locale; first=sel-_max_entries+2; if(first<0) first=0; } sprintf(filename, "%s/LBOX.PNG", app_usrdir); load_texture(text_LIST+1512000, filename, 600); change_opacity(text_LIST+1512000, 50, 600*630*4); while(1) { pad_read(); if ( (new_pad & BUTTON_TRIANGLE) || (new_pad & BUTTON_CIRCLE) ) return -1; if ( (new_pad & BUTTON_CROSS) ) return sel; if ( (new_pad & BUTTON_DOWN)) { sel++; if(sel>=_max) sel=0; first=sel-_max_entries+2; if(first<0) first=0; } if ( (new_pad & BUTTON_UP)) { sel--; if(sel<0) sel=_max-1; first=sel-_max_entries+2; if(first<0) first=0; } if(last_sel!=sel) { // memset(text_LIST, 0x40, (_width * _height * 4)); // for(int fsr=0; fsr<(_width*_height*4); fsr+=4) *(uint32_t*) ( (u8*)(text_LIST)+fsr )=0x222222a0; memcpy(text_LIST, text_LIST+1512000, 1512000); max_ttf_label=0; print_label_ex( 0.5f, 0.05f, 1.0f, COL_XMB_COLUMN, _caption, 1.04f, 0.0f, mui_font, 1.0f/((float)(_width/1920.f)), 1.0f/((float)(_height/1080.f)), 1); for(int n=first; (n<(first+_max_entries-1) && n<_max); n++) { if(is_lang) _menu_font = ( (locales[n].font_id>4 && locales[n].font_id<10) ? (locales[n].font_id+5) : locales[n].font_id); else _menu_font = mui_font; if(_centered) { if(n==sel) print_label_ex( 0.5f, ((float)((n-first+3)*line_h)/(float)_height)-0.011f, 1.4f, 0xffe0e0e0, list[n].label, 1.04f, 0.0f, _menu_font, 1.0f/((float)(_width/1920.f)), _y_scale/((float)(_height/1080.f)), 1); else print_label_ex( 0.5f, ((float)((n-first+3)*line_h)/(float)_height), 1.0f, COL_XMB_SUBTITLE, list[n].label, 1.04f, 0.0f, _menu_font, 1.0f/((float)(_width/1920.f)), _y_scale/((float)(_height/1080.f)), 1 ); } else { if(n==sel) print_label_ex( 0.05f, ((float)((n-first+3)*line_h)/(float)_height)-0.011f, 1.4f, 0xf0e0e0e0, list[n].label, 1.04f, 0.0f, _menu_font, 0.8f/((float)(_width/1920.f)), _y_scale/((float)(_height/1080.f)), 0); else print_label_ex( 0.05f, ((float)((n-first+3)*line_h)/(float)_height), 1.0f, COL_XMB_SUBTITLE, list[n].label, 1.04f, 0.0f, _menu_font, 0.8f/((float)(_width/1920.f)), _y_scale/((float)(_height/1080.f)), 0 ); } if(is_lang) flush_ttf(text_LIST, _width, _height); } print_label_ex( 0.7f, ((float)(_height-line_h*2)/(float)_height)+0.01f, 1.5f, 0xf0c0c0c0, (char*) STR_BUT_APPLY, 1.00f, 0.0f, mui_font, 0.5f/((float)(_width/1920.f)), 0.4f/((float)(_height/1080.f)), 0); flush_ttf(text_LIST, _width, _height); put_texture_with_alpha_gen( text_LIST, text_DOX+(dox_cross_x *4 + dox_cross_y * dox_width*4), dox_cross_w, dox_cross_h, dox_width, _width, (int)((0.7f*_width)-dox_cross_w-5), _height-line_h*2); last_sel=sel; } ClearSurface(); if(cover_mode==8 && xmb_icon==2) { if(!use_drops && xmb_sparks!=0) draw_stars(); set_texture( text_bmp, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.9f, 1920, 1080); if(use_drops && xmb_sparks!=0) draw_stars(); draw_xmb_clock(xmb_clock, 0); draw_xmb_icons(xmb, xmb_icon, xmb_slide, xmb_slide_y, 0, xmb_sublevel); } else { set_texture( buffer, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.9f, 1920, 1080); } set_texture(text_LIST, _width, _height); display_img((int)(mouseX*1920.f), (int)(mouseY*1080.f), _width, _height, _width, _height, 0.0f, _width, _height); flip(); mouseX+=mouseXD; mouseY+=mouseYD; if(mouseX>0.995f) {mouseX=0.995f;mouseXD=0.0f;} if(mouseX<0.0f) {mouseX=0.0f;mouseXD=0.0f;} if(mouseY>0.990f) {mouseY=0.990f;mouseYD=0.0f;} if(mouseY<0.0f) {mouseY=0.0f;mouseYD=0.0f;} } return -1; } int open_list_menu(char *_caption, int _width, t_opt_list *list, int _max, int _x, int _y, int _max_entries, int _centered) { (void) _x; (void) _y; char filename[1024]; if(_max_entries>16) _max_entries=16; u8 *text_LIST = NULL; text_LIST = text_FONT; int line_h = 30; int _height = (_max_entries+5) * line_h; int last_sel=-1; int first=0; int sel=0; sprintf(filename, "%s/LBOX.PNG", app_usrdir); load_texture(text_LIST+1512000, filename, 600); change_opacity(text_LIST+1512000, 50, 600*630*4); float y_scale=1.0f; u8 _menu_font=15; if(mm_locale) { _menu_font=mui_font; y_scale=0.8f; } while(1) { pad_read(); if ( (new_pad & BUTTON_TRIANGLE) || (new_pad & BUTTON_CIRCLE) ) return -1; if ( (new_pad & BUTTON_CROSS) ) return sel; if ( (new_pad & BUTTON_DOWN)) { sel++; if(sel>=_max) sel=0; first=sel-_max_entries+2; if(first<0) first=0; } if ( (new_pad & BUTTON_UP)) { sel--; if(sel<0) sel=_max-1; first=sel-_max_entries+2; if(first<0) first=0; } if(last_sel!=sel) { // memset(text_LIST, 0x40, (_width * _height * 4)); // for(int fsr=0; fsr<(_width*_height*4); fsr+=4) *(uint32_t*) ( (u8*)(text_LIST)+fsr )=0x222222a0; memcpy(text_LIST, text_LIST+1512000, 1512000); max_ttf_label=0; print_label_ex( 0.5f, 0.05f, 1.0f, COL_XMB_COLUMN, _caption, 1.04f, 0.0f, _menu_font, 1.0f/((float)(_width/1920.f)), 1.0f/((float)(_height/1080.f)), 1); for(int n=first; (n<(first+_max_entries-1) && n<_max); n++) { if(_centered) { if(n==sel) print_label_ex( 0.5f, ((float)((n-first+3)*line_h)/(float)_height)-0.011f, 1.4f, 0xf0e0e0e0, list[n].label, 1.04f, 0.0f, _menu_font, 1.0f/((float)(_width/1920.f)), y_scale/((float)(_height/1080.f)), 1); else print_label_ex( 0.5f, ((float)((n-first+3)*line_h)/(float)_height), 1.0f, COL_XMB_SUBTITLE, list[n].label, 1.00f, 0.0f, _menu_font, 1.0f/((float)(_width/1920.f)), y_scale/((float)(_height/1080.f)), 1 ); } else { if(n==sel) print_label_ex( 0.05f, ((float)((n-first+3)*line_h)/(float)_height)-0.011f, 1.4f, 0xf0e0e0e0, list[n].label, 1.04f, 0.0f, _menu_font, 0.8f/((float)(_width/1920.f)), y_scale/((float)(_height/1080.f)), 0); else print_label_ex( 0.05f, ((float)((n-first+3)*line_h)/(float)_height), 1.0f, COL_XMB_SUBTITLE, list[n].label, 1.00f, 0.0f, _menu_font, 0.8f/((float)(_width/1920.f)), y_scale/((float)(_height/1080.f)), 0 ); } } print_label_ex( 0.7f, ((float)(_height-line_h*2)/(float)_height)+0.01f, 1.5f, 0xf0c0c0c0, (char*) STR_BUT_APPLY, 1.00f, 0.0f, _menu_font, 0.5f/((float)(_width/1920.f)), (y_scale/2.f)/((float)(_height/1080.f)), 0); flush_ttf(text_LIST, _width, _height); put_texture_with_alpha_gen( text_LIST, text_DOX+(dox_cross_x *4 + dox_cross_y * dox_width*4), dox_cross_w, dox_cross_h, dox_width, _width, (int)((0.7f*_width)-dox_cross_w-5), _height-line_h*2); last_sel=sel; } ClearSurface(); if(!use_drops && xmb_sparks!=0) draw_stars(); set_texture( text_bmp, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.9f, 1920, 1080); if(use_drops && xmb_sparks!=0) draw_stars(); draw_xmb_clock(xmb_clock, 0); draw_xmb_icons(xmb, xmb_icon, xmb_slide, xmb_slide_y, 0, xmb_sublevel); set_texture(text_LIST, _width, _height); // display_img(_x, _y, _width, _height, _width, _height, 0.0f, _width, _height); display_img((int)(mouseX*1920.f), (int)(mouseY*1080.f), _width, _height, _width, _height, 0.0f, _width, _height); flip(); mouseX+=mouseXD; mouseY+=mouseYD; if(mouseX>0.995f) {mouseX=0.995f;mouseXD=0.0f;} if(mouseX<0.0f) {mouseX=0.0f;mouseXD=0.0f;} if(mouseY>0.990f) {mouseY=0.990f;mouseYD=0.0f;} if(mouseY<0.0f) {mouseY=0.0f;mouseYD=0.0f;} } return -1; } int open_dd_menu(char *_caption, int _width, t_opt_list *list, int _max, int _x, int _y, int _max_entries) { (void) _x; (void) _y; u8 _menu_font=17; float y_scale=0.85f; if(mm_locale) {_menu_font=mui_font; y_scale=0.7f;} if(_max_entries>16) _max_entries=16; u8 *text_LIST = NULL; text_LIST = text_FONT; int line_h = 26; int _height = 315;//(_max_entries+5) * line_h; int last_sel=-1; int first=0; int sel=0; char filename[1024]; char string1[1024]; sprintf(filename, "%s/LBOX.PNG", app_usrdir); load_texture(text_LIST+756000, filename, 600); mip_texture(text_LIST+756000, text_LIST+756000, 600, 630, -2); while(1) { pad_read(); if ( (new_pad & BUTTON_TRIANGLE) || (new_pad & BUTTON_CIRCLE) ) return -1; if ( (new_pad & BUTTON_CROSS) ) return sel; if ( (new_pad & BUTTON_DOWN)) { sel++; if(sel>=_max) sel=0; first=sel-_max_entries+2; if(first<0) first=0; } if ( (new_pad & BUTTON_UP)) { sel--; if(sel<0) sel=_max-1; first=sel-_max_entries+2; if(first<0) first=0; } if(last_sel!=sel) { // memset(text_LIST, 0x40, (_width * _height * 4)); // for(int fsr=0; fsr<(_width*_height*4); fsr+=4) *(uint32_t*) ( (u8*)(text_LIST)+fsr )=0x222222a0; memcpy(text_LIST, text_LIST+756000, 756000); max_ttf_label=0; print_label_ex( 0.5f, 0.05f, 0.7f, COL_XMB_COLUMN, _caption, 1.04f, 0.0f, 0, 1.0f/((float)(_width/1920.f)), 1.0f/((float)(_height/1080.f)), 1); flush_ttf(text_LIST, _width, _height); for(int n=first; (n<(first+_max_entries-1) && n<_max); n++) { if(n==sel) print_label_ex( 0.055f, ((float)((n-first+2.2f)*line_h)/(float)_height)-0.007f, 1.2f, 0xf0e0e0e0, list[n].label, 1.04f, 0.0f, _menu_font, 0.68f/((float)(_width/1920.f)), (y_scale)/((float)(_height/1080.f)), 0); else print_label_ex( 0.120f, ((float)((n-first+2.2f)*line_h)/(float)_height), 0.85f, COL_XMB_SUBTITLE, list[n].label, 1.04f, 0.0f, _menu_font, 0.8f/((float)(_width/1920.f)), (y_scale+0.1f)/((float)(_height/1080.f)), 0 ); flush_ttf(text_LIST, _width, _height); } print_label_ex( 0.6f, ((float)(_height-line_h*2)/(float)_height)+0.0326f, 1.5f, 0xf0c0c0c0, (char*) STR_BUT_CONFIRM, 1.04f, 0.0f, _menu_font, 0.5f/((float)(_width/1920.f)), 0.5f/((float)(_height/1080.f)), 0); flush_ttf(text_LIST, _width, _height); put_texture_with_alpha_gen( text_LIST, text_DOX+(dox_cross_x *4 + dox_cross_y * dox_width*4), dox_cross_w, dox_cross_h, dox_width, _width, (int)((0.6f*_width)-dox_cross_w-5), _height-line_h*2+4); last_sel=sel; } ClearSurface(); // setRenderColor(); draw_fileman(); set_texture(text_LIST, _width, _height); display_img((int)(mouseX*1920.f), (int)(mouseY*1080.f), _width, _height, _width, _height, -0.3f, _width, _height); time ( &rawtime ); timeinfo = localtime ( &rawtime ); if(date_format==0) sprintf(string1, "%02d/%02d/%04d", timeinfo->tm_mday, timeinfo->tm_mon+1, timeinfo->tm_year+1900); else if(date_format==1) sprintf(string1, "%02d/%02d/%04d", timeinfo->tm_mon+1, timeinfo->tm_mday, timeinfo->tm_year+1900); else if(date_format==2) sprintf(string1, "%04d/%02d/%02d", timeinfo->tm_year+1900, timeinfo->tm_mon+1, timeinfo->tm_mday ); cellDbgFontPrintf( 0.83f, 0.895f, 0.70f ,COL_HEXVIEW, "%s\n %s:%02d:%02d ", string1, tmhour(timeinfo->tm_hour), timeinfo->tm_min, timeinfo->tm_sec); flip(); mouseX+=mouseXD; mouseY+=mouseYD; if(mouseX>0.995f) {mouseX=0.995f;mouseXD=0.0f;} if(mouseX<0.0f) {mouseX=0.0f;mouseXD=0.0f;} if(mouseY>0.990f) {mouseY=0.990f;mouseYD=0.0f;} if(mouseY<0.0f) {mouseY=0.0f;mouseYD=0.0f;} } return -1; } static void add_video_column_thread_entry( uint64_t arg ) { (void)arg; if(init_finished && is_video_loading && xmb[5].init) { t_dir_pane_bare *pane = (t_dir_pane_bare *) memalign(16, sizeof(t_dir_pane_bare)*MAX_PANE_SIZE_BARE); int max_dir=0; char linkfile[512]; char imgfile[512]; char imgfile2[512]; char filename[1024]; sprintf(filename, "%s/XMB Video", app_usrdir); if(!exist(filename)) mkdir(filename, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); else del_temp(filename); ps3_home_scan_bare((char*)"/dev_hdd0/video", pane, &max_dir); ps3_home_scan_bare((char*)"/dev_hdd0/VIDEO", pane, &max_dir); ps3_home_scan_bare((char*)"/dev_sd/VIDEO", pane, &max_dir); ps3_home_scan_bare((char*)"/dev_sd/DCIM", pane, &max_dir); ps3_home_scan_bare((char*)"/dev_ms/VIDEO", pane, &max_dir); ps3_home_scan_bare((char*)"/dev_cf/VIDEO", pane, &max_dir); for(int ret_f=0; ret_f<9; ret_f++) { sprintf(linkfile, "/dev_usb00%i/VIDEO", ret_f); ps3_home_scan_bare(linkfile, pane, &max_dir); } for(int ret_f=0; ret_f<max_dir; ret_f++) if(is_video(pane[ret_f].name)) { sprintf(linkfile, "%s/%s", pane[ret_f].path, pane[ret_f].name); if(strstr(linkfile, "/dev_hdd0")!=NULL) { sprintf(filename, "%s/XMB Video/%s", app_usrdir, pane[ret_f].name); link(linkfile, filename); } if(pane[ret_f].name[strlen(pane[ret_f].name)-4]=='.') pane[ret_f].name[strlen(pane[ret_f].name)-4]=0; else if(pane[ret_f].name[strlen(pane[ret_f].name)-5]=='.') pane[ret_f].name[strlen(pane[ret_f].name)-5]=0; sprintf(imgfile2, "%s.jpg", linkfile); if(exist(imgfile2)) goto thumb_ok; sprintf(imgfile2, "%s.JPG", linkfile); if(exist(imgfile2)) goto thumb_ok; sprintf(imgfile, "%s", linkfile); if(imgfile[strlen(imgfile)-4]=='.') imgfile[strlen(imgfile)-4]=0; if(imgfile[strlen(imgfile)-5]=='.') imgfile[strlen(imgfile)-5]=0; sprintf(imgfile2, "%s.STH", imgfile); if(exist(imgfile2)) goto thumb_ok; sprintf(imgfile2, "%s.jpg", imgfile); if(exist(imgfile2)) goto thumb_ok; sprintf(imgfile2, "%s.JPG", imgfile); //if(stat(imgfile2, &s3)>=0) goto thumb_ok; thumb_ok: if(exist(imgfile2)) { add_xmb_member(xmb[5].member, &xmb[5].size, pane[ret_f].name, (strstr(linkfile, "/dev_hdd0")==NULL ? (char*) "Video" : (char*)"HDD Video"), /*type*/3, /*status*/0, /*game_id*/-1, /*icon*/xmb_icon_film, 128, 128, /*f_path*/(char*)linkfile, /*i_path*/(char*)imgfile2, 0, 0); } else add_xmb_member(xmb[5].member, &xmb[5].size, pane[ret_f].name, (strstr(linkfile, "/dev_hdd0")==NULL ? (char*) "Video" : (char*)"HDD Video"), /*type*/3, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_film, 128, 128, /*f_path*/(char*)linkfile, /*i_path*/(char*)"/", 0, 0); //if(xmb[5].size<9) draw_xmb_bare(5, 1, 0, 0); if(xmb[5].size>=MAX_XMB_MEMBERS) break; sort_xmb_col(xmb[5].member, xmb[5].size, 2); delete_xmb_dubs(xmb[5].member, &xmb[5].size); sort_xmb_col(xmb[5].member, xmb[5].size, 2); sys_timer_usleep(250); //let other threads run, too } free_all_buffers(); free(pane); } if(xmb_icon_last==5 && (xmb_icon_last_first<xmb[5].size)) { xmb[5].first=xmb_icon_last_first; xmb_icon_last_first=0;xmb_icon_last=0; } save_xmb_column(5); is_video_loading=0; sys_ppu_thread_exit(0); } static void add_photo_column_thread_entry( uint64_t arg ) { (void)arg; if(init_finished && is_photo_loading && xmb[3].init) { char linkfile[512]; xmb[3].first=0; xmb[3].size=0; xmb[3].init=1; char t_ip[512]; int i_status; t_dir_pane_bare *pane = (t_dir_pane_bare *) memalign(16, sizeof(t_dir_pane_bare)*MAX_PANE_SIZE_BARE); int max_dir=0; ps3_home_scan_bare((char*)"/dev_hdd0/photo", pane, &max_dir); for(int ret_f=0; ret_f<9; ret_f++) { sprintf(linkfile, "/dev_usb00%i/PICTURE", ret_f); ps3_home_scan_bare(linkfile, pane, &max_dir); } ps3_home_scan_bare((char*)"/dev_sd/PICTURE", pane, &max_dir); ps3_home_scan_bare((char*)"/dev_sd/DCIM", pane, &max_dir); ps3_home_scan_bare((char*)"/dev_ms/PICTURE", pane, &max_dir); ps3_home_scan_bare((char*)"/dev_cf/PICTURE", pane, &max_dir); for(int ret_f=0; ret_f<max_dir; ret_f++) { if(strstr(pane[ret_f].name, ".jpg")!=NULL || strstr(pane[ret_f].name, ".JPG")!=NULL || strstr(pane[ret_f].name, ".png")!=NULL || strstr(pane[ret_f].name, ".PNG")!=NULL) { i_status=2; sprintf(linkfile, "%s/%s", pane[ret_f].path, pane[ret_f].name); if(strstr(linkfile, ".JPG")!=NULL || strstr(linkfile, ".JPEG")!=NULL || strstr(linkfile, ".jpg")!=NULL || strstr(linkfile, ".jpeg")!=NULL) {sprintf(t_ip, "%s", linkfile); i_status=0;} else {sprintf(t_ip, "%s", "/");i_status=2;} if(pane[ret_f].name[strlen(pane[ret_f].name)-4]=='.') pane[ret_f].name[strlen(pane[ret_f].name)-4]=0; else if(pane[ret_f].name[strlen(pane[ret_f].name)-5]=='.') pane[ret_f].name[strlen(pane[ret_f].name)-5]=0; add_xmb_member(xmb[3].member, &xmb[3].size, pane[ret_f].name, (strstr(linkfile, "/dev_hdd0")==NULL ? (char*) "Photo" : pane[ret_f].path+16), /*type*/5, /*status*/i_status, /*game_id*/-1, /*icon*/xmb_icon_photo, 128, 128, /*f_path*/(char*)linkfile, /*i_path*/(char*)t_ip, 0, 0); //if(xmb[3].size<12) draw_xmb_bare(3, 1, 0, 0); if(xmb[3].size>=MAX_XMB_MEMBERS) break; sys_timer_usleep(250); //let other threads run, too } } sort_xmb_col(xmb[3].member, xmb[3].size, 0); delete_xmb_dubs(xmb[3].member, &xmb[3].size); sort_xmb_col(xmb[3].member, xmb[3].size, 0); free_all_buffers(); free(pane); } if(xmb_icon_last==3 && (xmb_icon_last_first<xmb[3].size)) { xmb[3].first=xmb_icon_last_first; xmb_icon_last_first=0;xmb_icon_last=0; } save_xmb_column(3); is_photo_loading=0; sys_ppu_thread_exit(0); } static void add_music_column_thread_entry( uint64_t arg ) { (void)arg; if(init_finished && is_music_loading && xmb[4].init) { t_dir_pane_bare *pane = (t_dir_pane_bare *) memalign(16, sizeof(t_dir_pane_bare)*MAX_PANE_SIZE_BARE); int max_dir=0; char linkfile[512]; xmb[4].first=0; xmb[4].size=0; xmb[4].init=1; xmb[4].group=0; u8 skip_first=0; ps3_home_scan_bare((char*)"/dev_hdd0/music", pane, &max_dir); ps3_home_scan_bare((char*)"/dev_hdd0/MUSIC", pane, &max_dir); ps3_home_scan_bare((char*)"/dev_sd/MUSIC", pane, &max_dir); ps3_home_scan_bare((char*)"/dev_ms/MUSIC", pane, &max_dir); ps3_home_scan_bare((char*)"/dev_cf/MUSIC", pane, &max_dir); for(int ret_f=0; ret_f<9; ret_f++) { sprintf(linkfile, "/dev_usb00%i/MUSIC", ret_f); ps3_home_scan_bare(linkfile, pane, &max_dir); } for(int ret_f=0; ret_f<max_dir; ret_f++) { if(strstr(pane[ret_f].name, ".mp3")!=NULL || strstr(pane[ret_f].name, ".MP3")!=NULL || strstr(pane[ret_f].name, ".ac3")!=NULL || strstr(pane[ret_f].name, ".AC3")!=NULL || strstr(pane[ret_f].name, ".FLAC")!=NULL || strstr(pane[ret_f].name, ".flac")!=NULL) { sprintf(linkfile, "%s/%s", pane[ret_f].path, pane[ret_f].name); if(pane[ret_f].name[strlen(pane[ret_f].name)-4]=='.') pane[ret_f].name[strlen(pane[ret_f].name)-4]=0; else if(pane[ret_f].name[strlen(pane[ret_f].name)-5]=='.') pane[ret_f].name[strlen(pane[ret_f].name)-5]=0; skip_first=0; for(u8 c=0; c<strlen(pane[ret_f].name); c++) if(pane[ret_f].name[c]>0x40) {skip_first=c; break;} for(u8 c=skip_first; c<strlen(pane[ret_f].name); c++) if(pane[ret_f].name[c]=='(' || pane[ret_f].name[c]=='[') {pane[ret_f].name[c]=0; break;} for(u8 c=skip_first; c<strlen(pane[ret_f].name); c++) if(pane[ret_f].name[c]=='_') {pane[ret_f].name[c]=0x20;} if(pane[ret_f].name[skip_first]==' ') skip_first++; add_xmb_member(xmb[4].member, &xmb[4].size, pane[ret_f].name+skip_first, (strstr(linkfile, "/dev_hdd0")==NULL ? (char*) "Music" : (char*)"HDD Music"), /*type*/4, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_note, 128, 128, /*f_path*/(char*)linkfile, /*i_path*/(char*)"/", 0, 0); //if(xmb[4].size<9) draw_xmb_bare(4, 1, 0, 0); if(xmb[4].size>=MAX_XMB_MEMBERS) break; sort_xmb_col(xmb[4].member, xmb[4].size, 0); delete_xmb_dubs(xmb[4].member, &xmb[4].size); sort_xmb_col(xmb[4].member, xmb[4].size, 0); sys_timer_usleep(250); //let other threads run, too } } free(pane); } if(xmb_icon_last==4 && (xmb_icon_last_first<xmb[4].size)) { xmb[4].first=xmb_icon_last_first; xmb_icon_last_first=0;xmb_icon_last=0; } save_xmb_column(4); is_music_loading=0; sys_ppu_thread_exit(0); } static void add_retro_column_thread_entry( uint64_t arg ) { (void)arg; if(init_finished && is_retro_loading && xmb[8].init) { t_dir_pane_bare *pane = (t_dir_pane_bare *) memalign(16, sizeof(t_dir_pane_bare)*MAX_PANE_SIZE_BARE); int max_dir=0; xmb[8].size=0; add_xmb_member(xmb[8].member, &xmb[8].size, (char*)STR_XC1_REFRESH, (char*)STR_XC1_REFRESH3, /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb[0].data, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); xmb[8].init=1; xmb[8].group=0; char linkfile[512]; char imgfile[512]; char imgfile2[512]; ps3_home_scan_bare(snes_roms, pane, &max_dir); if(strcmp(snes_roms, "/dev_hdd0/ROMS/snes")) ps3_home_scan_bare((char*)"/dev_hdd0/ROMS/snes", pane, &max_dir); for(int ret_f=0; ret_f<9; ret_f++) { sprintf(linkfile, "/dev_usb00%i/ROMS/snes", ret_f); ps3_home_scan_bare(linkfile, pane, &max_dir); } for(int ret_f=0; ret_f<max_dir; ret_f++) { sprintf(linkfile, "%s/%s", pane[ret_f].path, pane[ret_f].name); if(is_snes9x(linkfile)) { if(pane[ret_f].name[strlen(pane[ret_f].name)-4]=='.') pane[ret_f].name[strlen(pane[ret_f].name)-4]=0; sprintf(imgfile, "%s", linkfile); if(imgfile[strlen(imgfile)-4]=='.') imgfile[strlen(imgfile)-4]=0; sprintf(imgfile2, "%s/snes/%s.jpg", covers_retro, pane[ret_f].name); if(exist(imgfile2)) goto thumb_ok_snes; sprintf(imgfile2, "%s/snes/%s.png", covers_retro, pane[ret_f].name); if(exist(imgfile2)) goto thumb_ok_snes; sprintf(imgfile2, "%s.jpg", imgfile); if(exist(imgfile2)) goto thumb_ok_snes; sprintf(imgfile2, "%s.png", imgfile); //if(stat(imgfile2, &s3)>=0) goto thumb_ok_snes; //sprintf(imgfile2, "%s.JPG", imgfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_snes; //sprintf(imgfile2, "%s.PNG", imgfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_snes; /*sprintf(imgfile2, "%s/snes/%s.JPG", covers_retro, pane[ret_f].name); if(stat(imgfile2, &s3)>=0) goto thumb_ok_snes; sprintf(imgfile2, "%s/snes/%s.PNG", covers_retro, pane[ret_f].name); if(stat(imgfile2, &s3)>=0) goto thumb_ok_snes; sprintf(imgfile2, "%s.jpg", linkfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_snes; sprintf(imgfile2, "%s.JPG", linkfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_snes; sprintf(imgfile2, "%s.png", linkfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_snes; sprintf(imgfile2, "%s.PNG", linkfile);// if(stat(imgfile2, &s3)>=0) goto thumb_ok_snes; sprintf(imgfile2, "%s/snes/NO_COVER.JPG", covers_retro);// if(stat(imgfile2, &s3)>=0) goto thumb_ok_snes; */ thumb_ok_snes: if(exist(imgfile2)) { add_xmb_member(xmb[8].member, &xmb[8].size, pane[ret_f].name, (char*)"SNES9x Game ROM", /*type*/8, /*status*/0, /*game_id*/-1, /*icon*/xmb_icon_retro, 128, 128, /*f_path*/(char*)linkfile, /*i_path*/(char*)imgfile2, 0, 0); } else add_xmb_member(xmb[8].member, &xmb[8].size, pane[ret_f].name, (char*)"SNES9x Game ROM", /*type*/8, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_retro, 128, 128, /*f_path*/(char*)linkfile, /*i_path*/(char*)"/", 0, 0); //if(xmb[8].size<9) draw_xmb_bare(8, 1, 0, 0); if(!(xmb[8].size & 0x0f)) sort_xmb_col(xmb[8].member, xmb[8].size, 1); if(xmb[8].size>=MAX_XMB_MEMBERS) break; } } sort_xmb_col(xmb[8].member, xmb[8].size, 1); //genp max_dir=0; ps3_home_scan_bare(genp_roms, pane, &max_dir); if(strcmp(genp_roms, "/dev_hdd0/ROMS/gen")) ps3_home_scan_bare((char*)"/dev_hdd0/ROMS/gen", pane, &max_dir); for(int ret_f=0; ret_f<9; ret_f++) { sprintf(linkfile, "/dev_usb00%i/ROMS/gen", ret_f); ps3_home_scan_bare(linkfile, pane, &max_dir); } for(int ret_f=0; ret_f<max_dir; ret_f++) { sprintf(linkfile, "%s/%s", pane[ret_f].path, pane[ret_f].name); if(is_genp(linkfile)) { sprintf(linkfile, "%s/%s", pane[ret_f].path, pane[ret_f].name); if(pane[ret_f].name[strlen(pane[ret_f].name)-4]=='.') pane[ret_f].name[strlen(pane[ret_f].name)-4]=0; else if(pane[ret_f].name[strlen(pane[ret_f].name)-3]=='.') pane[ret_f].name[strlen(pane[ret_f].name)-3]=0; sprintf(imgfile, "%s", linkfile); if(imgfile[strlen(imgfile)-4]=='.') imgfile[strlen(imgfile)-4]=0; else if(imgfile[strlen(imgfile)-3]=='.') imgfile[strlen(imgfile)-3]=0; sprintf(imgfile2, "%s/gen/%s.jpg", covers_retro, pane[ret_f].name); if(exist(imgfile2)) goto thumb_ok_genp; sprintf(imgfile2, "%s/gen/%s.png", covers_retro, pane[ret_f].name); if(exist(imgfile2)) goto thumb_ok_genp; sprintf(imgfile2, "%s.jpg", imgfile); if(exist(imgfile2)) goto thumb_ok_genp; sprintf(imgfile2, "%s.png", imgfile);/* if(stat(imgfile2, &s3)>=0) goto thumb_ok_genp; sprintf(imgfile2, "%s.JPG", imgfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_genp; sprintf(imgfile2, "%s.PNG", imgfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_genp; sprintf(imgfile2, "%s/gen/%s.JPG", covers_retro, pane[ret_f].name); if(stat(imgfile2, &s3)>=0) goto thumb_ok_genp; sprintf(imgfile2, "%s/gen/%s.PNG", covers_retro, pane[ret_f].name); if(stat(imgfile2, &s3)>=0) goto thumb_ok_genp; sprintf(imgfile2, "%s.jpg", linkfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_genp; sprintf(imgfile2, "%s.JPG", linkfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_genp; sprintf(imgfile2, "%s.png", linkfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_genp; sprintf(imgfile2, "%s.PNG", linkfile);// if(stat(imgfile2, &s3)>=0) goto thumb_ok_genp; */ thumb_ok_genp: if(xmb[8].size>=MAX_XMB_MEMBERS) break; if(exist(imgfile2)) { add_xmb_member(xmb[8].member, &xmb[8].size, pane[ret_f].name, (char*)"Genesis+ GX Game ROM", /*type*/11, /*status*/0, /*game_id*/-1, /*icon*/xmb_icon_retro, 128, 128, /*f_path*/(char*)linkfile, /*i_path*/(char*)imgfile2, 0, 0); } else add_xmb_member(xmb[8].member, &xmb[8].size, pane[ret_f].name, (char*)"Genesis+ GX Game ROM", /*type*/11, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_retro, 128, 128, /*f_path*/(char*)linkfile, /*i_path*/(char*)"/", 0, 0); //if(xmb[8].size<9) draw_xmb_bare(8, 1, 0, 0); if(!(xmb[8].size & 0x0f)) sort_xmb_col(xmb[8].member, xmb[8].size, 1); if(xmb[8].size>=MAX_XMB_MEMBERS) break; } } sort_xmb_col(xmb[8].member, xmb[8].size, 1); //fceu+ max_dir=0; ps3_home_scan_bare(fceu_roms, pane, &max_dir); if(strcmp(fceu_roms, "/dev_hdd0/ROMS/fceu")) ps3_home_scan_bare((char*)"/dev_hdd0/ROMS/fceu", pane, &max_dir); for(int ret_f=0; ret_f<9; ret_f++) { sprintf(linkfile, "/dev_usb00%i/ROMS/fceu", ret_f); ps3_home_scan_bare(linkfile, pane, &max_dir); } for(int ret_f=0; ret_f<max_dir; ret_f++) { sprintf(linkfile, "%s/%s", pane[ret_f].path, pane[ret_f].name); if(is_fceu(linkfile)) { sprintf(linkfile, "%s/%s", pane[ret_f].path, pane[ret_f].name); if(pane[ret_f].name[strlen(pane[ret_f].name)-4]=='.') pane[ret_f].name[strlen(pane[ret_f].name)-4]=0; else if(pane[ret_f].name[strlen(pane[ret_f].name)-5]=='.') pane[ret_f].name[strlen(pane[ret_f].name)-5]=0; sprintf(imgfile, "%s", linkfile); if(imgfile[strlen(imgfile)-4]=='.') imgfile[strlen(imgfile)-4]=0; else if(imgfile[strlen(imgfile)-5]=='.') imgfile[strlen(imgfile)-5]=0; sprintf(imgfile2, "%s/fceu/%s.jpg", covers_retro, pane[ret_f].name); if(exist(imgfile2)) goto thumb_ok_fceu; sprintf(imgfile2, "%s/fceu/%s.png", covers_retro, pane[ret_f].name); if(exist(imgfile2)) goto thumb_ok_fceu; sprintf(imgfile2, "%s.jpg", imgfile); if(exist(imgfile2)) goto thumb_ok_fceu; sprintf(imgfile2, "%s.png", imgfile); /* if(stat(imgfile2, &s3)>=0) goto thumb_ok_fceu; sprintf(imgfile2, "%s.JPG", imgfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_fceu; sprintf(imgfile2, "%s.PNG", imgfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_fceu; sprintf(imgfile2, "%s/fceu/%s.JPG", covers_retro, pane[ret_f].name); if(stat(imgfile2, &s3)>=0) goto thumb_ok_fceu; sprintf(imgfile2, "%s/fceu/%s.PNG", covers_retro, pane[ret_f].name); if(stat(imgfile2, &s3)>=0) goto thumb_ok_fceu; sprintf(imgfile2, "%s.jpg", linkfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_fceu; sprintf(imgfile2, "%s.JPG", linkfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_fceu; sprintf(imgfile2, "%s.png", linkfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_fceu; sprintf(imgfile2, "%s.PNG", linkfile);// if(stat(imgfile2, &s3)>=0) goto thumb_ok_fceu; */ thumb_ok_fceu: if(xmb[8].size>=MAX_XMB_MEMBERS) break; if(exist(imgfile2)) { add_xmb_member(xmb[8].member, &xmb[8].size, pane[ret_f].name, (char*)"Genesis+ GX Game ROM", /*type*/9, /*status*/0, /*game_id*/-1, /*icon*/xmb_icon_retro, 128, 128, /*f_path*/(char*)linkfile, /*i_path*/(char*)imgfile2, 0, 0); } else add_xmb_member(xmb[8].member, &xmb[8].size, pane[ret_f].name, (char*)"Genesis+ GX Game ROM", /*type*/9, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_retro, 128, 128, /*f_path*/(char*)linkfile, /*i_path*/(char*)"/", 0, 0); //if(xmb[8].size<9) draw_xmb_bare(8, 1, 0, 0); if(!(xmb[8].size & 0x0f)) sort_xmb_col(xmb[8].member, xmb[8].size, 1); if(xmb[8].size>=MAX_XMB_MEMBERS) break; } } sort_xmb_col(xmb[8].member, xmb[8].size, 1); //vba max_dir=0; ps3_home_scan_bare(vba_roms, pane, &max_dir); if(strcmp(vba_roms, "/dev_hdd0/ROMS/vba")) ps3_home_scan_bare((char*)"/dev_hdd0/ROMS/vba", pane, &max_dir); for(int ret_f=0; ret_f<9; ret_f++) { sprintf(linkfile, "/dev_usb00%i/ROMS/vba", ret_f); ps3_home_scan_bare(linkfile, pane, &max_dir); } for(int ret_f=0; ret_f<max_dir; ret_f++) { sprintf(linkfile, "%s/%s", pane[ret_f].path, pane[ret_f].name); if(is_vba(linkfile)) { sprintf(linkfile, "%s/%s", pane[ret_f].path, pane[ret_f].name); if(pane[ret_f].name[strlen(pane[ret_f].name)-4]=='.') pane[ret_f].name[strlen(pane[ret_f].name)-4]=0; else if(pane[ret_f].name[strlen(pane[ret_f].name)-3]=='.') pane[ret_f].name[strlen(pane[ret_f].name)-3]=0; sprintf(imgfile, "%s", linkfile); if(imgfile[strlen(imgfile)-4]=='.') imgfile[strlen(imgfile)-4]=0; else if(imgfile[strlen(imgfile)-3]=='.') imgfile[strlen(imgfile)-3]=0; sprintf(imgfile2, "%s/vba/%s.jpg", covers_retro, pane[ret_f].name); if(exist(imgfile2)) goto thumb_ok_vba; sprintf(imgfile2, "%s/vba/%s.png", covers_retro, pane[ret_f].name); if(exist(imgfile2)) goto thumb_ok_vba; sprintf(imgfile2, "%s.jpg", imgfile); if(exist(imgfile2)) goto thumb_ok_vba; sprintf(imgfile2, "%s.png", imgfile);/* if(stat(imgfile2, &s3)>=0) goto thumb_ok_vba; sprintf(imgfile2, "%s.JPG", imgfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_vba; sprintf(imgfile2, "%s.PNG", imgfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_vba; sprintf(imgfile2, "%s/vba/%s.JPG", covers_retro, pane[ret_f].name); if(stat(imgfile2, &s3)>=0) goto thumb_ok_vba; sprintf(imgfile2, "%s/vba/%s.PNG", covers_retro, pane[ret_f].name); if(stat(imgfile2, &s3)>=0) goto thumb_ok_vba; sprintf(imgfile2, "%s.jpg", linkfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_vba; sprintf(imgfile2, "%s.JPG", linkfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_vba; sprintf(imgfile2, "%s.png", linkfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_vba; sprintf(imgfile2, "%s.PNG", linkfile);// if(stat(imgfile2, &s3)>=0) goto thumb_ok_vba; */ thumb_ok_vba: if(xmb[8].size>=MAX_XMB_MEMBERS) break; if(exist(imgfile2)) { add_xmb_member(xmb[8].member, &xmb[8].size, pane[ret_f].name, (char*)"GameBoy Game ROM", /*type*/10, /*status*/0, /*game_id*/-1, /*icon*/xmb_icon_retro, 128, 128, /*f_path*/(char*)linkfile, /*i_path*/(char*)imgfile2, 0, 0); } else add_xmb_member(xmb[8].member, &xmb[8].size, pane[ret_f].name, (char*)"GameBoy Game ROM", /*type*/10, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_retro, 128, 128, /*f_path*/(char*)linkfile, /*i_path*/(char*)"/", 0, 0); if(!(xmb[8].size & 0x0f)) sort_xmb_col(xmb[8].member, xmb[8].size, 1); if(xmb[8].size>=MAX_XMB_MEMBERS) break; } } sort_xmb_col(xmb[8].member, xmb[8].size, 1); //fba max_dir=0; ps3_home_scan_bare(fba_roms, pane, &max_dir); if(strcmp(fba_roms, "/dev_hdd0/ROMS/fba")) ps3_home_scan_bare((char*)"/dev_hdd0/ROMS/fba", pane, &max_dir); for(int ret_f=0; ret_f<9; ret_f++) { sprintf(linkfile, "/dev_usb00%i/ROMS/fba", ret_f); ps3_home_scan_bare(linkfile, pane, &max_dir); } for(int ret_f=0; ret_f<max_dir; ret_f++) { sprintf(linkfile, "%s/%s", pane[ret_f].path, pane[ret_f].name); if(is_fba(linkfile)) { sprintf(linkfile, "%s/%s", pane[ret_f].path, pane[ret_f].name); if(pane[ret_f].name[strlen(pane[ret_f].name)-4]=='.') pane[ret_f].name[strlen(pane[ret_f].name)-4]=0; else if(pane[ret_f].name[strlen(pane[ret_f].name)-3]=='.') pane[ret_f].name[strlen(pane[ret_f].name)-3]=0; sprintf(imgfile, "%s", linkfile); if(imgfile[strlen(imgfile)-4]=='.') imgfile[strlen(imgfile)-4]=0; else if(imgfile[strlen(imgfile)-3]=='.') imgfile[strlen(imgfile)-3]=0; sprintf(imgfile2, "%s/fba/%s.jpg", covers_retro, pane[ret_f].name); if(exist(imgfile2)) goto thumb_ok_fba; sprintf(imgfile2, "%s/fba/%s.png", covers_retro, pane[ret_f].name); if(exist(imgfile2)) goto thumb_ok_fba; sprintf(imgfile2, "%s.jpg", imgfile); if(exist(imgfile2)) goto thumb_ok_fba; sprintf(imgfile2, "%s.png", imgfile);/* if(stat(imgfile2, &s3)>=0) goto thumb_ok_fba; sprintf(imgfile2, "%s.JPG", imgfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_fba; sprintf(imgfile2, "%s.PNG", imgfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_fba; sprintf(imgfile2, "%s/fba/%s.JPG", covers_retro, pane[ret_f].name); if(stat(imgfile2, &s3)>=0) goto thumb_ok_fba; sprintf(imgfile2, "%s/fba/%s.PNG", covers_retro, pane[ret_f].name); if(stat(imgfile2, &s3)>=0) goto thumb_ok_fba; sprintf(imgfile2, "%s.jpg", linkfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_fba; sprintf(imgfile2, "%s.JPG", linkfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_fba; sprintf(imgfile2, "%s.png", linkfile); if(stat(imgfile2, &s3)>=0) goto thumb_ok_fba; sprintf(imgfile2, "%s.PNG", linkfile);// if(stat(imgfile2, &s3)>=0) goto thumb_ok_fba; */ thumb_ok_fba: if(xmb[8].size>=MAX_XMB_MEMBERS) break; if(exist(imgfile2)) { add_xmb_member(xmb[8].member, &xmb[8].size, pane[ret_f].name, (char*)"FBA Game ROM", /*type*/12, /*status*/0, /*game_id*/-1, /*icon*/xmb_icon_retro, 128, 128, /*f_path*/(char*)linkfile, /*i_path*/(char*)imgfile2, 0, 0); } else add_xmb_member(xmb[8].member, &xmb[8].size, pane[ret_f].name, (char*)"FBA Game ROM", /*type*/12, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_retro, 128, 128, /*f_path*/(char*)linkfile, /*i_path*/(char*)"/", 0, 0); if(!(xmb[8].size & 0x0f)) sort_xmb_col(xmb[8].member, xmb[8].size, 1); if(xmb[8].size>=MAX_XMB_MEMBERS) break; } } sort_xmb_col(xmb[8].member, xmb[8].size, 1); if(xmb[8].size>2) xmb[8].first=1; free_all_buffers(); free(pane); } if(xmb_icon_last==8 && (xmb_icon_last_first<xmb[8].size)) { xmb[8].first=xmb_icon_last_first; xmb_icon_last_first=0;xmb_icon_last=0; } xmb[8].group=0; save_xmb_column(8); is_retro_loading=0; sys_ppu_thread_exit(0); } void add_photo_column() { if(is_photo_loading || xmb[3].init) return; is_photo_loading=1; xmb[3].init=1; sys_ppu_thread_create( &addpic_thr_id, add_photo_column_thread_entry, 0, misc_thr_prio-5, app_stack_size, 0, "multiMAN_add_photo" );//SYS_PPU_THREAD_CREATE_JOINABLE } void add_music_column() { if(is_music_loading || xmb[4].init) return; is_music_loading=1; xmb[4].init=1; sys_ppu_thread_create( &addmus_thr_id, add_music_column_thread_entry, 0, misc_thr_prio-5, app_stack_size, 0, "multiMAN_add_music" );//SYS_PPU_THREAD_CREATE_JOINABLE } void add_video_column() { if(is_video_loading || xmb[5].init || !xmb[6].init) return; // if(is_video_loading || is_music_loading || is_photo_loading || is_retro_loading) return; is_video_loading=1; xmb[5].init=1; sys_ppu_thread_create( &addvid_thr_id, add_video_column_thread_entry, 0, misc_thr_prio-5, app_stack_size, 0, "multiMAN_add_video" );//SYS_PPU_THREAD_CREATE_JOINABLE } void add_emulator_column() { mod_xmb_member(xmb[8].member, 0, (char*)STR_XC1_REFRESH, (char*)STR_XC1_REFRESH3); redraw_column_texts(8); if(is_retro_loading || xmb[8].init) return; is_retro_loading=1; if(is_retro_loading) { xmb[8].init=1; sys_ppu_thread_create( &addret_thr_id, add_retro_column_thread_entry, 0, misc_thr_prio-5, app_stack_size, 0, "multiMAN_add_retro" ); } } void save_options() { seconds_clock=0; remove(options_bin); FILE *fpA; fpA = fopen ( options_bin, "w" ); if(fpA!=NULL) { fprintf(fpA, "download_covers=%i\r\n", download_covers); fprintf(fpA, "date_format=%i\r\n", date_format); fprintf(fpA, "time_format=%i\r\n", time_format); fprintf(fpA, "clear_activity_logs=%i\r\n", clear_activity_logs); fprintf(fpA, "ftpd_on=%i\r\n", ftp_service); fprintf(fpA, "disable_options=%i\r\n", disable_options); fprintf(fpA, "mount_hdd1=%i\r\n", mount_hdd1); fprintf(fpA, "scan_avchd=%i\r\n", scan_avchd); fprintf(fpA, "expand_avchd=%i\r\n", expand_avchd); fprintf(fpA, "xmb_sparks=%i\r\n", xmb_sparks); fprintf(fpA, "xmb_popup=%i\r\n", xmb_popup); fprintf(fpA, "xmb_game_bg=%i\r\n", xmb_game_bg); fprintf(fpA, "xmb_cover=%i\r\n", xmb_cover); fprintf(fpA, "xmb_cover_column=%i\r\n", xmb_cover_column); fprintf(fpA, "verify_data=%i\r\n", verify_data); fprintf(fpA, "scan_for_apps=%i\r\n", scan_for_apps); fprintf(fpA, "fullpng=%i\r\n", initial_cover_mode); fprintf(fpA, "user_font=%i\r\n", user_font); fprintf(fpA, "mm_locale=%i\r\n", mm_locale); fprintf(fpA, "lock_display_mode=%i\r\n", lock_display_mode); fprintf(fpA, "lock_fileman=%i\r\n", lock_fileman); fprintf(fpA, "overscan=%i\r\n", (int)(overscan*100.f)); fprintf(fpA, "display_mode=%i\r\n", display_mode); fprintf(fpA, "showdir=%i\r\n", dir_mode); fprintf(fpA, "game_details=%i\r\n", game_details); fprintf(fpA, "bd_emulator=%i\r\n", bd_emulator); fprintf(fpA, "animation=%i\r\n", animation); fprintf(fpA, "game_bg_overlay=%i\r\n", game_bg_overlay); fprintf(fpA, "progress_bar=%i\r\n", progress_bar); fprintf(fpA, "dim_titles=%i\r\n", dim_setting); fprintf(fpA, "ss_timeout=%i\r\n", ss_timeout); fprintf(fpA, "deadzone_x=%i\r\n", xDZ); fprintf(fpA, "deadzone_y=%i\r\n", yDZ); fprintf(fpA, "use_pad_sensor=%i\r\n", use_pad_sensor); fprintf(fpA, "parental_level=%i\r\n", parental_level); fprintf(fpA, "parental_pass=%s\r\n", parental_pass); fprintf(fpA, "theme_sound=%i\r\n", theme_sound); fprintf(fpA, "gray_poster=%i\r\n", gray_poster); fprintf(fpA, "confirm_with_x=%i\r\n", confirm_with_x); fprintf(fpA, "hide_bd=%i\r\n", hide_bd); fprintf(fpA, "repeat_init_delay=%i\r\n", repeat_init_delay); fprintf(fpA, "repeat_key_delay=%i\r\n", repeat_key_delay); // fprintf(fpA, "%i\n", ); fclose( fpA); } } void parse_settings() { seconds_clock=0; char oini[32]; for(int n=0;n<xmb[2].size;n++ ) { if(!xmb[2].member[n].option_size) continue; sprintf(oini, "%s", xmb[2].member[n].optionini); if(!strcmp(oini, "download_covers")) download_covers =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "date_format")) date_format =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "time_format")) time_format =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "clear_activity_logs")) clear_activity_logs =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "ftpd_on")) ftp_service =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "disable_options")) disable_options =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "mount_hdd1")) mount_hdd1 =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "scan_avchd")) scan_avchd =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "expand_avchd")) expand_avchd =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "xmb_sparks")) xmb_sparks =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "xmb_popup")) xmb_popup =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "xmb_game_bg")) xmb_game_bg =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "xmb_cover")) xmb_cover =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "xmb_cover_column")) xmb_cover_column=(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "verify_data")) verify_data =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "scan_for_apps")) scan_for_apps =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "full_png")) initial_cover_mode =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "user_font")) user_font =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "theme_sound")) theme_sound =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "lock_display_mode")) lock_display_mode =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "lock_fileman")) lock_fileman =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "overscan")) overscan =(float)((float)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10)/100.f); else if(!strcmp(oini, "display_mode")) display_mode =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "showdir")) dir_mode =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "game_details")) game_details =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "animation")) animation =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "game_bg_overlay")) game_bg_overlay =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "gray_poster")) gray_poster =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "confirm_with_x")) confirm_with_x =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "hide_bd")) hide_bd =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "progress_bar")) progress_bar =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "dim_titles")) dim_setting =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "ss_timeout")) ss_timeout =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "deadzone_x")) xDZ =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "deadzone_y")) yDZ =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "use_pad_sensor")) use_pad_sensor =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "parental_level")) parental_level =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "bd_emulator")) bd_emulator =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "repeat_init_delay")) repeat_init_delay =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); else if(!strcmp(oini, "repeat_key_delay")) repeat_key_delay =(int)strtol(xmb[2].member[n].option[xmb[2].member[n].option_selected].value, NULL, 10); // else if(!strcmp(oini, "parental_pass")) sprintf(parental_pass, "%s", xmb[2].member[n].option[xmb[2].member[n].option_selected].value); xDZa=(int) (xDZ*128/100); yDZa=(int) (yDZ*128/100); } // save_options(); } void add_settings_column() { // add_xmb_member(xmb[2].member, &xmb[2].size, (char*)"Edit multiMAN options", (char*)"Not implemented yet", // /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_tool, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); sprintf(xmb[2].name, "%s", xmb_columns[2]); xmb[2].first=0; xmb[2].size=0; add_xmb_member(xmb[2].member, &xmb[2].size, (char*)STR_XC2_SI, (char*)STR_XC2_SI1, /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_tool, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); add_xmb_member(xmb[2].member, &xmb[2].size, (char*)STR_XC2_IL, (char*)STR_XC2_IL1, /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_tool, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); add_xmb_member(xmb[2].member, &xmb[2].size, (char*)STR_XC2_GC, (char*)STR_XC2_GC1, /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_tool, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Download Game Covers", (char*)"Adjusts whether to download missing game covers.", (char*)"download_covers");//, (char*)"Internet connection required.") add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"No", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Auto", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=download_covers; xmb[2].member[xmb[2].size-1].icon=xmb[9].data; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"FTP Service", (char*)"Sets FTP startup mode.", (char*)"ftpd_on"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disabled", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Auto start", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=ftp_service; xmb[2].member[xmb[2].size-1].icon=xmb_icon_ftp; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"XMMB Sparks", (char*)"Changes display setting for sparks overlay in XMMB display mode.", (char*)"xmb_sparks"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Show always", (char*)"1"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Auto hide", (char*)"2"); xmb[2].member[xmb[2].size-1].option_selected=xmb_sparks; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"XMMB Game Poster", (char*)"Changes display setting for game poster images in XMMB mode.", (char*)"xmb_game_bg"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Enable", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=xmb_game_bg; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"XMMB Game Cover", (char*)"Changes display setting for game cover images in XMMB display mode.", (char*)"xmb_cover"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Enable", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=xmb_cover; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"XMMB Game Icon Swap", (char*)"Switches display of icon and cover in Game column.", (char*)"xmb_cover_column"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Show Icon", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Show Cover", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=xmb_cover_column; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"XMMB Info Pop-up", (char*)"Changes display setting for information pop-up boxes.", (char*)"xmb_popup"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Enable", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=xmb_popup; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Parental Control PIN Code", (char*)"Sets the parental control level PIN code.", (char*)"parental_pass"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 1, (char*)"****", (char*)parental_pass); xmb[2].member[xmb[2].size-1].option_selected=0; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Parental Control Level", (char*)"Sets the parental control level for rated titles.", (char*)"parental_level"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Level 1", (char*)"1"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Level 2", (char*)"2"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Level 3", (char*)"3"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Level 4", (char*)"4"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Level 5", (char*)"5"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Level 6", (char*)"6"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Level 7", (char*)"7"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Level 8", (char*)"8"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Level 9", (char*)"9"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Level 10", (char*)"10"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Level 11", (char*)"11"); xmb[2].member[xmb[2].size-1].option_selected=parental_level; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Function Control", (char*)"Adjusts which functions will be enabled or disabled.", (char*)"disable_options"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Enable Copy and Delete", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable Delete", (char*)"1"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable Copy", (char*)"2"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable Copy and Delete", (char*)"3"); xmb[2].member[xmb[2].size-1].option_selected=disable_options; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"File Manager Access", (char*)"Sets whether to restrict access to File Manager.", (char*)"lock_fileman"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Allow", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Deny", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=lock_fileman; xmb[2].member[xmb[2].size-1].icon=xmb_icon_desk; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Verify USB Games", (char*)"Sets whether to check titles on USB for compatibility.", (char*)"verify_data"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"No", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Auto", (char*)"1"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Always", (char*)"2"); xmb[2].member[xmb[2].size-1].option_selected=verify_data; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Scan for Homebrew Applications", (char*)"Sets whether to scan for applications with RELOAD.SELF boot file.", (char*)"scan_for_apps"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"No", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Yes", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=scan_for_apps; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Scan for AVCHD\xE2\x84\xA2 and Blu-ray\xE2\x84\xA2", (char*)"Sets whether to scan USB devices for AVCHD\xE2\x84\xA2 and Blu-ray\xE2\x84\xA2 content.", (char*)"scan_avchd"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"No", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Yes", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=scan_avchd; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Expand Contents of AVCHD\xE2\x84\xA2", (char*)"Sets whether to show one entry per title or all AVCHD\xE2\x84\xA2 playlists.", (char*)"expand_avchd"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Do not expand", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Expand", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=expand_avchd; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Hide BD-ROM Disc from Game List", (char*)"Sets appearance of BD-ROM disc entry in the game list.", (char*)"hide_bd"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"No", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Yes", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=hide_bd; xmb[2].member[xmb[2].size-1].icon=xmb_icon_blu; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Content Filter", (char*)"Changes default content filter (key shortcut SELECT+R1).", (char*)"display_mode"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"No filtering", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"PS3\xE2\x84\xA2 titles only", (char*)"1"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"AVCHD\xE2\x84\xA2 titles only", (char*)"2"); xmb[2].member[xmb[2].size-1].option_selected=display_mode; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Clean Activity Logs", (char*)"Adjusts whether to remove push list and boot history.", (char*)"clear_activity_logs"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"No", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Yes", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=clear_activity_logs; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Date Format", (char*)"Sets the order of display for year, month and day.", (char*)"date_format"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"DD/MM/YYYY", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"MM/DD/YYYY", (char*)"1"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"YYYY/MM/DD", (char*)"2"); xmb[2].member[xmb[2].size-1].option_selected=date_format; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Time Format", (char*)"Sets the time display to either a 12-hour or 24-hour clock.", (char*)"time_format"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"12-Hour Clock", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"24-Hour Clock", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=time_format; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Button Assignment", (char*)"Sets which buttons are used for Accept/Enter and Cancel/Back.", (char*)"confirm_with_x"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Circle is [Accept]", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Cross is [Accept]", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=confirm_with_x; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Default Display Mode", (char*)"Sets default startup display mode. Switch modes with L1/R1.", (char*)"full_png"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Game list (plain)", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"4x2 game list", (char*)"1"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Game list (poster)", (char*)"2"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Game list (user background)", (char*)"3"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Slide cover flow", (char*)"4"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"File Manager mode", (char*)"5"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Box-art", (char*)"6"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"8x4 game list", (char*)"7"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"XMMB (XMB\xE2\x84\xA2 clone)", (char*)"8"); xmb[2].member[xmb[2].size-1].option_selected=initial_cover_mode; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Display Mode Lock", (char*)"Locks multiMAN to pre-selected display mode.", (char*)"lock_display_mode"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable", (char*)"-1"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Game list (plain)", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"4x2 game list", (char*)"1"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Game list (poster)", (char*)"2"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Game list (user background)", (char*)"3"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Slide cover flow", (char*)"4"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"File Manager mode", (char*)"5"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Box-art", (char*)"6"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"8x4 game list", (char*)"7"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"XMMB (XMB\xE2\x84\xA2 clone)", (char*)"8"); xmb[2].member[xmb[2].size-1].option_selected=lock_display_mode+1; if(user_font<10) { add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Font Preference", (char*)"Sets default font (key shortcut R3).", (char*)"user_font"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Default", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Pop" , (char*)"1"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"New Rodin", (char*)"2"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Matisse", (char*)"3"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Rounded", (char*)"4"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"User #1 (font0)", (char*)"5"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"User #2 (font1)", (char*)"6"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"User #3 (font2)", (char*)"7"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"User #4 (font3)", (char*)"8"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"User #5 (font4)", (char*)"9"); xmb[2].member[xmb[2].size-1].option_selected=user_font; } add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Theme Audio", (char*)"Sets whether to play theme music in the background.", (char*)"theme_sound"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Enable", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=theme_sound; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"TV Overscan", (char*)"Sets TV overscan zone in percents (key shortcut SELECT+L2/R2).", (char*)"overscan"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"1%", (char*)"1"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"2%", (char*)"2"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"3%", (char*)"3"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"4%", (char*)"4"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"5%", (char*)"5"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"6%", (char*)"6"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"7%", (char*)"7"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"8%", (char*)"8"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"9%", (char*)"9"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"10%", (char*)"10"); if(overscan<0.00f) overscan=0.00f; if(overscan>0.10f) overscan=0.10f; xmb[2].member[xmb[2].size-1].option_selected=(u8) ((float)overscan * 100.f); xmb[2].member[xmb[2].size-1].icon=xmb_icon_ss; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Title Name Appearance", (char*)"Changes size and appearance of title names and paths.", (char*)"showdir"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Large size title", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Title and path", (char*)"1"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Medium size title", (char*)"2"); xmb[2].member[xmb[2].size-1].option_selected=dir_mode; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Title Details", (char*)"Adjusts level of displayed details for selected display modes.", (char*)"game_details"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Title Only", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Title and ID", (char*)"1"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Full", (char*)"2"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"None", (char*)"3"); xmb[2].member[xmb[2].size-1].option_selected=game_details; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Animation", (char*)"Adjusts animation options for some display modes.", (char*)"animation"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable all animations", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable background slide", (char*)"1"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable icon animation", (char*)"2"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"All animations On", (char*)"3"); xmb[2].member[xmb[2].size-1].option_selected=animation; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Poster Overlay", (char*)"Sets whether to show poster in [Game list (poster)] display mode.", (char*)"game_bg_overlay"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"No", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Yes", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=game_bg_overlay; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Poster and Cover Alteration", (char*)"Sets whether to grayscale game poster and cover when required.", (char*)"gray_poster"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Never", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Auto", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=gray_poster; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Progress Bar", (char*)"Sets whether to show progress bar during copy operations.", (char*)"progress_bar"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"No", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Yes", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=progress_bar; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Inactivity Timeout", (char*)"Dim and hide title names after specified amount of time.", (char*)"dim_titles"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"1 sec", (char*)"1"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"2 sec", (char*)"2"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"3 sec", (char*)"3"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"4 sec", (char*)"4"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"5 sec", (char*)"5"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"6 sec", (char*)"6"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"7 sec", (char*)"7"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"8 sec", (char*)"8"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"9 sec", (char*)"9"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"10 sec", (char*)"10"); if(dim_setting<0) dim_setting=0; if(dim_setting>10) dim_setting=10; xmb[2].member[xmb[2].size-1].option_selected=dim_setting; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Screensaver", (char*)"Turn on screensaver after specified amount of time.", (char*)"ss_timeout"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"1 min", (char*)"1"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"2 min", (char*)"2"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"3 min", (char*)"3"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"4 min", (char*)"4"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"5 min", (char*)"5"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"6 min", (char*)"6"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"7 min", (char*)"7"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"8 min", (char*)"8"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"9 min", (char*)"9"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"10 min", (char*)"10"); xmb[2].member[xmb[2].size-1].option_selected=ss_timeout; xmb[2].member[xmb[2].size-1].icon=xmb_icon_ss; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Motion Sensor", (char*)"Sets whether to use sensor information from SIXAXIS\xE2\x84\xA2 controller.", (char*)"use_pad_sensor"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disabled", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Enabled", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=use_pad_sensor; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Mouse Sensitivity (X)", (char*)"Sets analogue sticks horizontal sensitivity (dead zone).", (char*)"deadzone_x"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"10%", (char*)"10"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"20%", (char*)"20"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"30%", (char*)"30"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"40%", (char*)"40"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"50%", (char*)"50"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"60%", (char*)"60"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"70%", (char*)"70"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"80%", (char*)"80"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"90%", (char*)"90"); if(xDZ>90) xDZ=90; xmb[2].member[xmb[2].size-1].option_selected=(int) (xDZ/10); add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Mouse Sensitivity (Y)", (char*)"Sets analogue sticks vertical sensitivity (dead zone).", (char*)"deadzone_y"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"10%", (char*)"10"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"20%", (char*)"20"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"30%", (char*)"30"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"40%", (char*)"40"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"50%", (char*)"50"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"60%", (char*)"60"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"70%", (char*)"70"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"80%", (char*)"80"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"90%", (char*)"90"); if(yDZ>90) yDZ=90; xmb[2].member[xmb[2].size-1].option_selected=(int) (yDZ/10); add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Key Repeat Delay", (char*)"Sets initial delay before key repeat.", (char*)"repeat_init_delay"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Very Short", (char*)"20"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Short", (char*)"40"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Normal", (char*)"60"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Long", (char*)"80"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Very Long", (char*)"100"); xmb[2].member[xmb[2].size-1].option_selected=(int) ((repeat_init_delay/20)-1); add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Key Repeat Speed", (char*)"Sets key repeat speed.", (char*)"repeat_key_delay"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Very Fast", (char*)"2"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Fast", (char*)"4"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Normal", (char*)"6"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Slow", (char*)"8"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Slower", (char*)"10"); xmb[2].member[xmb[2].size-1].option_selected=(int) ((repeat_key_delay/2)-1); add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"Cache Partition", (char*)"Enable or disable 2GB temporary partition (/dev_hdd1).", (char*)"mount_hdd1"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Disable", (char*)"0"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Enable", (char*)"1"); xmb[2].member[xmb[2].size-1].option_selected=mount_hdd1; add_xmb_option(xmb[2].member, &xmb[2].size, (char*)"BD-ROM Emulator", (char*)"Changes emulator type. System restart required to apply changes. ", (char*)"bd_emulator"); add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"None", (char*)"0"); if(bdemu2_present) add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Hermes", (char*)"1"); else add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"(Unavailable)", (char*)"1"); if(c_firmware==3.55f) add_xmb_suboption(xmb[2].member[xmb[2].size-1].option, &xmb[2].member[xmb[2].size-1].option_size, 0, (char*)"Standard", (char*)"2"); if(c_firmware==3.41f && bd_emulator>1) bd_emulator=1; xmb[2].member[xmb[2].size-1].option_selected=bd_emulator; xmb[2].first=xmb_settings_sel; } void add_home_column() { sprintf(xmb[1].name, "%s", xmb_columns[1]); xmb[1].first=1; xmb[1].size=0; add_xmb_member(xmb[1].member, &xmb[1].size, (char*)STR_XC1_UPDATE, (char*)STR_XC1_UPDATE1, /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_update, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); if(lock_fileman) add_xmb_member(xmb[1].member, &xmb[1].size, (char*)STR_XC1_FILEMAN0, (char*)STR_XC1_FILEMAN1, /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_desk, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); else add_xmb_member(xmb[1].member, &xmb[1].size, (char*)STR_XC1_FILEMAN, (char*)STR_XC1_FILEMAN1, /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_desk, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); add_xmb_member(xmb[1].member, &xmb[1].size, (char*)STR_XC1_REFRESH, (char*)STR_XC1_REFRESH1, /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb[0].data, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); add_xmb_member(xmb[1].member, &xmb[1].size, (char*)STR_XC1_PFS, (char*)STR_XC1_PFS1, /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_hdd, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); add_xmb_member(xmb[1].member, &xmb[1].size, (char*)STR_XC1_SS, (char*)STR_XC1_SS1, /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_ss, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); add_xmb_member(xmb[1].member, &xmb[1].size, (char*)STR_XC1_THEMES, (char*)STR_XC1_THEMES1, /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_theme, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); add_xmb_member(xmb[1].member, &xmb[1].size, (char*)STR_XC1_HELP, (char*)STR_XC1_HELP1, /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_help, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); add_xmb_member(xmb[1].member, &xmb[1].size, (char*)STR_XC1_RESTART, (char*)STR_XC1_RESTART1, /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb[1].data, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); add_xmb_member(xmb[1].member, &xmb[1].size, (char*)STR_XC1_QUIT, (char*)STR_XC1_QUIT1, /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_quit, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); } void add_game_column(t_menu_list *list, int max, int sel, bool force_covers) { int toff=0; int first_sort=0; char icon_path[512]; u8 g_status; char t_ip[512]; u8 *g_icon=xmb[0].data; if(!xmb[5].init || !xmb[5].size) { xmb[5].first=0; xmb[5].size=0; add_xmb_member(xmb[5].member, &xmb[5].size, (char*)STR_XC5_LINK, (char*)STR_XC5_LINK1, /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_showtime, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); add_xmb_member(xmb[5].member, &xmb[5].size, (char*)STR_XC5_ST, (char*)STR_XC5_ST1, /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_showtime, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); } for(int m=0; m<xmb[5].size; m++) if(xmb[5].member[m].type==2) delete_xmb_member(xmb[5].member, &xmb[5].size, m); if(!xmb[6].init) { xmb[6].first=0; xmb[6].size=0; add_xmb_member(xmb[6].member, &xmb[6].size, (char*)STR_XC1_REFRESH, (char*)STR_XC1_REFRESH2, /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb[0].data, 128, 128, /*f_path*/(char*)"/", /*i_path*/(char*)"/", 0, 0); xmb[7].first=0; xmb[7].size=0; } if(!xmb[6].init || !xmb[7].init) //!xmb[5].init || { for(int m=0; m<max; m++) { if(!strcmp(list[m].content, "PS3")) { if(!xmb[6].init) { if(xmb[6].group) { if( (int)((list[m].user>>16)&0x0f) != (xmb[6].group&0x0f) && (xmb[6].group&0x0f) ) continue; if(xmb[6].group>>4) { u8 m_grp= ((xmb[6].group>>4)-1)*2; if( (xmb[6].group>>4)!=15 && (m_grp+0x41) != list[m].title[0] && (m_grp+0x42) != list[m].title[0] && (m_grp+0x61) != list[m].title[0] && (m_grp+0x62) != list[m].title[0] ) continue; else if( (xmb[6].group>>4)==15 && ( ( list[m].title[0]>=0x41 && list[m].title[0]<=0x5a) || (list[m].title[0]>=0x61 && list[m].title[0]<=0x7a) ) ) continue; } } if(m==sel) xmb[6].first=xmb[6].size; toff=0; if(list[m].title[0]=='_') toff=1; if(strstr(list[m].path, "/dev_bdvd")==NULL) g_icon=xmb[0].data; else {g_icon=xmb_icon_blu; first_sort=1;} u16 g_iconw=320; u16 g_iconh=176; g_status=0; if(xmb_cover_column || force_covers) { sprintf(icon_path, "%s/%s.JPG", covers_dir, list[m].title_id); if(exist(icon_path)) {g_iconw=260; g_iconh=300; goto add_mem;} sprintf(icon_path, "%s/%s.PNG", covers_dir, list[m].title_id); if(exist(icon_path)) {g_iconw=260; g_iconh=300; goto add_mem;} if(list[xmb[xmb_icon].member[xmb[6].size].game_id].cover!=-1 && list[xmb[xmb_icon].member[xmb[6].size].game_id].cover!=1) { sprintf(icon_path, "%s/%s.JPG", covers_dir, list[m].title_id); download_cover(list[xmb[xmb_icon].member[xmb[6].size].game_id].title_id, icon_path); list[xmb[xmb_icon].member[xmb[6].size].game_id].cover=1; } } // if(strstr(list[m].path, "/pvd_usb")!=NULL) sprintf(icon_path, "%s/%s_320.PNG", cache_dir, list[m].title_id); // else // sprintf(icon_path, "%s/PS3_GAME/ICON0.PNG", list[m].path); if(exist(icon_path)) {g_iconw=320; g_iconh=176; goto add_mem;} sprintf(icon_path, "%s/ICON0.PNG", list[m].path); if(exist(icon_path)) {g_iconw=320; g_iconh=176; goto add_mem;} else {g_status=2; g_iconw=128; g_iconh=128;} add_mem: if(list[m].title[0]=='_') list[m].split=1; add_xmb_member(xmb[6].member, &xmb[6].size, list[m].title+toff, list[m].path, /*type*/1, /*status*/g_status, /*game_id*/m, /*icon*/g_icon, g_iconw, g_iconh, /*f_path*/list[m].path, /*i_path*/(char*)icon_path, list[m].user, list[m].split); if(list[m].user & IS_FAV) { if(m==sel) xmb[7].first=xmb[7].size; add_xmb_member(xmb[7].member, &xmb[7].size, list[m].title+toff, list[m].path, /*type*/1, /*status*/g_status, /*game_id*/m, /*icon*/g_icon, g_iconw, g_iconh, /*f_path*/list[m].path, /*i_path*/(char*)icon_path, list[m].user, list[m].split); } sort_xmb_col(xmb[6].member, xmb[6].size, first_sort+1); } } else if(!strcmp(list[m].content, "AVCHD") || !strcmp(list[m].content, "BDMV") || !strcmp(list[m].content, "DVD")) { if(cover_mode==8) //!xmb[5].init && { if(m==sel) xmb[5].first=xmb[5].size; toff=0; if(list[m].title[0]=='_') toff=1; else if(strstr(list[m].title, "[Video] ")!=NULL) toff=8; else if(strstr(list[m].title, "[HDD Video] ")!=NULL || strstr(list[m].title, "[DVD Video] ")!=NULL) toff=12; sprintf(t_ip, "%s/HDAVCTN/BDMT_O1.jpg", list[m].path); if(!exist(t_ip)) sprintf(t_ip, "%s/BDMV/META/DL/HDAVCTN_O1.jpg", list[m].path); if(!exist(t_ip)) sprintf(t_ip, "%s/POSTER.JPG", list[m].path); if(!exist(t_ip)) sprintf(t_ip, "%s/COVER.JPG", list[m].path); if(exist(t_ip)) add_xmb_member(xmb[5].member, &xmb[5].size, list[m].title+toff, list[m].content, /*type*/2, /*status*/0, /*game_id*/m, /*icon*/xmb_icon_film, 128, 128, /*f_path*/list[m].path, /*i_path*/(char*) t_ip, 0, 0); else add_xmb_member(xmb[5].member, &xmb[5].size, list[m].title+toff, list[m].content, /*type*/2, /*status*/2, /*game_id*/m, /*icon*/xmb_icon_film, 128, 128, /*f_path*/list[m].path, /*i_path*/(char*)"/", 0, 0); } else { if(cover_mode!=8) { if(list[m].title[0]=='_') toff=1; else if(strstr(list[m].title, "[Video] ")!=NULL) toff=8; else if(strstr(list[m].title, "[HDD Video] ")!=NULL || strstr(list[m].title, "[DVD Video] ")!=NULL) toff=12; sprintf(t_ip, "%s/HDAVCTN/BDMT_O1.jpg", list[m].path); if(!exist(t_ip)) sprintf(t_ip, "%s/BDMV/META/DL/HDAVCTN_O1.jpg", list[m].path); if(!exist(t_ip)) sprintf(t_ip, "%s/POSTER.JPG", list[m].path); if(!exist(t_ip)) sprintf(t_ip, "%s/COVER.JPG", list[m].path); if(!exist(t_ip)) sprintf(t_ip, "%s/NOID.JPG", app_usrdir); if(exist(t_ip)) add_xmb_member(xmb[6].member, &xmb[6].size, list[m].title+toff, list[m].content, /*type*/2, /*status*/0, /*game_id*/m, /*icon*/xmb_icon_film, 128, 128, /*f_path*/list[m].path, /*i_path*/(char*) t_ip, 0, 0); else add_xmb_member(xmb[6].member, &xmb[6].size, list[m].title+toff, list[m].content, /*type*/2, /*status*/2, /*game_id*/m, /*icon*/xmb_icon_film, 128, 128, /*f_path*/list[m].path, /*i_path*/(char*)"/", 0, 0); sort_xmb_col(xmb[6].member, xmb[6].size, first_sort+1); } } } } //sort_xmb_col(xmb[6].member, xmb[6].size, first_sort+1); sort_xmb_col(xmb[7].member, xmb[7].size, 0); sort_xmb_col(xmb[5].member, xmb[5].size, 2); } for(int m=0; m<max; m++) { if(!strcmp(list[m].content, "PS3")) { if(m==sel) for(int m2=0; m2<xmb[6].size; m2++) if(xmb[6].member[m2].game_id==sel) xmb[6].first=m2; } else if(!strcmp(list[m].content, "AVCHD") || !strcmp(list[m].content, "BDMV") || !strcmp(list[m].content, "DVD")) { if(m==sel) for(int m2=0; m2<xmb[5].size; m2++) if(xmb[5].member[m2].game_id==sel) xmb[5].first=m2; } } if(xmb[6].size>1 && xmb[6].first==0) xmb[6].first=1; xmb[6].init=1; xmb[7].init=1; u8 main_group=xmb[6].group & 0x0f; u8 alpha_group=xmb[6].group>>4 & 0x0f; if(main_group) { if(alpha_group) sprintf(xmb[6].name, "%s (%s)", genre[main_group], alpha_groups[alpha_group]); else sprintf(xmb[6].name, "%s", genre[main_group]); } else { if(alpha_group) sprintf(xmb[6].name, "%s (%s)", xmb_columns[6], alpha_groups[alpha_group]); else sprintf(xmb[6].name, "%s", xmb_columns[6]); } if(xmb_icon==6) draw_xmb_icon_text(xmb_icon); } void add_web_column() { sprintf(xmb[9].name, "%s", xmb_columns[9]); xmb[9].first=0; xmb[9].size=0; add_xmb_member(xmb[9].member, &xmb[9].size, (char*)"Download PS3\xE2\x84\xA2 Demos and Utilities", (char*)"Browse PSX Store Website for rich content for your Playstation\xC2\xAE\x33 system", /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_globe, 128, 128, /*f_path*/(char*)"http://www.psxstore.com/", /*i_path*/(char*)"/", 0, 0); add_xmb_member(xmb[9].member, &xmb[9].size, (char*)"Download Themes", (char*)"Check for new downloadable themes", /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_theme, 128, 128, /*f_path*/(char*)"http://ps3.spiffy360.com/themes.php?category=3", /*i_path*/(char*)"/", 0, 0); add_xmb_member(xmb[9].member, &xmb[9].size, (char*)"Visit multiMAN Forum", (char*)"Browse psx-scene thread for multiMAN discussions", /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb[1].data, 128, 128, /*f_path*/(char*)"http://psx-scene.com/forums/f187/multiman-multifunctional-tool-your-ps3-game-manager-file-manager-ftp-avchd-bdmv-72826/", /*i_path*/(char*)"/", 0, 0); add_xmb_member(xmb[9].member, &xmb[9].size, (char*)"View Online User Guide", (char*)"Browse to GBATemp website for beginner's guide to multiMAN", /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb[9].data, 128, 128, /*f_path*/(char*)"http://gbatemp.net/t291170-multiman-beginner-s-guide", /*i_path*/(char*)"/", 0, 0); add_xmb_member(xmb[9].member, &xmb[9].size, (char*)"Support multiMAN Development", (char*)"Find how to contribute to multiMAN development", /*type*/6, /*status*/2, /*game_id*/-1, /*icon*/xmb_icon_help, 128, 128, /*f_path*/(char*)"http://www.google.com/search?q=donate+for+multiMAN", /*i_path*/(char*)"/", 0, 0); } void init_xmb_icons(t_menu_list *list, int max, int sel) { seconds_clock=0; xmb_legend_drawn=0; xmb_info_drawn=0; parental_pin_entered=0; xmb_sublevel=0; xmb_bg_show=0; xmb_bg_counter=200; load_texture(text_FMS, xmbicons, 128); load_texture(xmb_icon_dev, xmbdevs, 64); //load_texture(text_FMS+(33*65536), blankBG, 320); //mip_texture( text_FMS+(33*65536), text_FMS+(33*65536), 320, 178, -2); // -> 216x183 mip_texture( xmb_icon_star_small, xmb_icon_star, 128, 128, -4); load_texture(xmb_icon_retro, xmbicons2, 128); sprintf(auraBG, "%s/DROPS.PNG", app_usrdir); if(exist(auraBG)) load_texture(text_DROPS, auraBG, 256); else use_drops=false; if(cover_mode==8) { memset(text_bmp, 0, 8294400); load_texture(text_bmp, xmbbg, 1920); } reset_xmb(0); free_text_buffers(); for(int n=0; n<MAX_XMB_THUMBS; n++) { xmb_icon_buf[n].used=-1; xmb_icon_buf[n].column=0; xmb_icon_buf[n].data=text_bmpUBG+(n*XMB_THUMB_WIDTH*XMB_THUMB_HEIGHT*4); } xmb_icon_buf_max=0; free_all_buffers(); if(cover_mode==8) { add_home_column(); add_settings_column(); add_web_column(); sprintf(xmb[4].name, "%s", xmb_columns[4]); if(xmb[4].group) sprintf(xmb[4].name, "%s (%s)", xmb_columns[4], alpha_groups[xmb[4].group>>4]); else sprintf(xmb[4].name, "%s", xmb_columns[4]); sprintf(xmb[3].name, "%s", xmb_columns[3]); //video column sprintf(xmb[5].name, "%s", xmb_columns[5]); //game column sprintf(xmb[6].name, "%s", xmb_columns[6]); //game favorites sprintf(xmb[7].name, "%s", xmb_columns[7]); if(!xmb[7].init) { xmb[7].first=0; xmb[7].size=0; } draw_xmb_icon_text(xmb_icon); } add_game_column(list, max, sel, (cover_mode!=8)); if(cover_mode==4) { if(!xmb[6].first && xmb[6].size) xmb[6].first=1; load_coverflow_legend(); load_texture(text_legend, legend, 1665); } is_game_loading=0; // Retro columm if(!xmb[8].init) { xmb[8].first=0; xmb[8].size=0; } /*if(xmb_icon==5) add_video_column(); if(xmb_icon==4) add_music_column(); if(xmb_icon==3) add_photo_column(); if(xmb_icon==8) add_emulator_column();*/ if(cover_mode==8) { add_video_column(); add_music_column(); add_photo_column(); add_emulator_column(); } } void draw_xmb_clock(u8 *buffer, const int _xmb_icon) { if(_xmb_icon) seconds_clock=0; if( (time(NULL)-seconds_clock)<30) goto clock_text; if(_xmb_icon) seconds_clock=0; else seconds_clock=time(NULL); char xmb_date[32]; time ( &rawtime ); timeinfo = localtime ( &rawtime ); // if(_xmb_icon==0) { if(date_format==0) sprintf(xmb_date, "%d/%d %s:%02d", timeinfo->tm_mday, timeinfo->tm_mon+1, tmhour(timeinfo->tm_hour), timeinfo->tm_min); //, timeinfo->tm_sec else sprintf(xmb_date,"%d/%d %s:%02d", timeinfo->tm_mon+1, timeinfo->tm_mday, tmhour(timeinfo->tm_hour), timeinfo->tm_min); // print_label_ex( 0.501f, 0.02f, 0.9f, 0xc0202020, xmb_date, 1.04f, 0.0f, 2, 6.40f, 36.0f, 1); print_label_ex( 0.5f, 0.0f, 0.9f, COL_XMB_CLOCK, xmb_date, 1.04f, 0.0f, 2, 6.40f, 36.0f, 1); } // else { if(_xmb_icon==-1) { if(time(NULL)&1) { set_texture(xmb[0].data, 128, 128); display_img(1770, 74, 64, 64, 128, 128, 0.6f, 128, 128); } } if(_xmb_icon>0 && _xmb_icon<MAX_XMB_ICONS) { set_texture(xmb[_xmb_icon].data, 128, 128); display_img(1834, 74, 64, 64, 128, 128, 0.6f, 128, 128); } } memset(buffer, 0, 36000); flush_ttf(buffer, 300, 30); clock_text: set_texture(buffer, 300, 30); display_img(1520, 90, 300, 30, 300, 30, 0.7f, 300, 30); } void draw_xmb_legend(const int _xmb_icon) { if(xmb_bg_counter>30 || _xmb_icon==1 || _xmb_icon==9 || c_opacity2<=0x40 || xmb_slide_step!=0 || xmb_slide_step_y!=0 || xmb_popup==0 || key_repeat) return; if(!xmb_legend_drawn) { u8 _menu_font=2; if(mm_locale) _menu_font=mui_font; xmb_legend_drawn=1; char xmb_text[32]; xmb_text[0]=0; for(int fsr=0; fsr<84000; fsr+=4) *(uint32_t*) ((uint8_t*)(text_MSG)+fsr)=0x22222280; if( (_xmb_icon==6 && xmb[_xmb_icon].first) || _xmb_icon==7) { sprintf(xmb_text, "%s", (char*) STR_POP_GS); put_texture_with_alpha_gen( text_MSG, text_DOX+(dox_triangle_x*4 + dox_triangle_y * dox_width*4), dox_triangle_w, dox_triangle_h, dox_width, 300, 8, 5); } if((_xmb_icon>1 &&_xmb_icon<6) || (_xmb_icon==6 && xmb[_xmb_icon].first==0) || _xmb_icon==8) { if(_xmb_icon==2 && xmb[_xmb_icon].first>1) sprintf(xmb_text, "%s", (char*) STR_POP_CHANGE_S); else if(_xmb_icon==2 && xmb[_xmb_icon].first==0) sprintf(xmb_text, "%s", (char*) STR_POP_VIEW_SYSINF); else if(_xmb_icon==2 && xmb[_xmb_icon].first==1) sprintf(xmb_text, "%s", (char*) STR_POP_LANGUAGE); else if(_xmb_icon==2 && xmb[_xmb_icon].first==2) sprintf(xmb_text, "%s", (char*) STR_POP_CACHE); else if(_xmb_icon==3) sprintf(xmb_text, "%s", (char*) STR_POP_PHOTO); else if(_xmb_icon==4) sprintf(xmb_text, "%s", (char*) STR_POP_MUSIC); else if(_xmb_icon==5 && xmb[_xmb_icon].first<2) sprintf(xmb_text, "%s", (char*) STR_POP_ST); else if(_xmb_icon==5 && xmb[_xmb_icon].first>1) sprintf(xmb_text, "%s", (char*) STR_POP_VIDEO); else if(_xmb_icon==6 && xmb[_xmb_icon].first==0) sprintf(xmb_text, "%s", (char*) STR_POP_REF_GAMES); else if(_xmb_icon==8 && xmb[_xmb_icon].first==0) sprintf(xmb_text, "%s", (char*) STR_POP_REF_ROMS); else if(_xmb_icon==8 && xmb[_xmb_icon].first) sprintf(xmb_text, "%s", (char*) STR_POP_ROM); put_texture_with_alpha_gen( text_MSG, text_DOX+(dox_cross_x *4 + dox_cross_y * dox_width*4), dox_cross_w, dox_cross_h, dox_width, 300, 8, 5); } if(_xmb_icon==4 || _xmb_icon==6 || _xmb_icon==8) { if(_xmb_icon==6) print_label_ex( 0.17f, 0.55f, 0.6f, 0xffd0d0d0, (char*)STR_POP_GRP_GENRE, 1.00f, 0.0f, _menu_font, 6.40f, 18.0f, 0); else if(_xmb_icon==8) print_label_ex( 0.17f, 0.55f, 0.6f, 0xffd0d0d0, (char*)STR_POP_GRP_EMU, 1.00f, 0.0f, _menu_font, 6.40f, 18.0f, 0); else if(_xmb_icon==4) print_label_ex( 0.17f, 0.55f, 0.6f, 0xffd0d0d0, (char*)STR_POP_GRP_NAME, 1.00f, 0.0f, _menu_font, 6.40f, 18.0f, 0); put_texture_with_alpha_gen( text_MSG, text_DOX+(dox_square_x *4 + dox_square_y * dox_width*4), dox_square_w, dox_square_h, dox_width, 300, 8, 36); } else { put_texture_with_alpha_gen( text_MSG, text_DOX+(dox_l1_x*4 + dox_l1_y * dox_width*4), dox_l1_w, dox_l1_h, dox_width, 300, 8, 42); put_texture_with_alpha_gen( text_MSG, text_DOX+(dox_r1_x*4 + dox_r1_y * dox_width*4), dox_r1_w, dox_r1_h, dox_width, 300, 8+dox_l1_w+5, 42); print_label_ex( 0.475f, 0.55f, 0.6f, 0xffd0d0d0, (char*) STR_POP_SWITCH, 1.00f, 0.0f, _menu_font, 6.40f, 18.0f, 0); } print_label_ex( 0.17f, 0.10f, 0.6f, 0xffd0d0d0, xmb_text, 1.00f, 0.0f, _menu_font, 6.40f, 18.0f, 0); flush_ttf(text_MSG, 300, 70); } if(c_opacity2<=0x80) change_opacity(text_MSG, -95, 84000); set_texture(text_MSG, 300, 70); display_img(1520, 930, 300, 70, 300, 70, -0.1f, 300, 70); } void draw_xmb_info() { if( c_opacity2<=0x10 || (cover_mode!=5 && (xmb_bg_counter>30 || xmb_slide_step!=0 || xmb_slide_step_y!=0 || xmb_popup==0)) || !mm_is_playing || is_theme_playing || !(multiStreamStarted==1 && current_mp3!=0 && max_mp3>1)) return; if(!xmb_info_drawn) { u8 _menu_font=2; if(mm_locale) _menu_font=mui_font; xmb_info_drawn=1; char xmb_text[512]; xmb_text[0]=0; char mp3_tmp[512]; char *pch=mp3_playlist[current_mp3].path; char *pathpos=strrchr(pch,'/'); sprintf(mp3_tmp, "%s", pathpos+1); mp3_tmp[strlen(mp3_tmp)-4]=0; for(int fsr=0; fsr<106400; fsr+=4) *(uint32_t*) ((uint8_t*)(text_INFO)+fsr)=0x22222260; sprintf(xmb_text, "%s", mp3_tmp); xmb_text[46]='.'; xmb_text[47]='.'; xmb_text[48]='.'; xmb_text[49]=0; print_label_ex( 0.04f, 0.10f, 0.6f, 0xffb0b0b0, xmb_text, 1.00f, 0.0f, _menu_font, 5.05f, 18.0f, 0); sprintf(xmb_text, (const char*)STR_POP_1OF1, (update_ms? ((char*)STR_POP_PLAYING) : ((char*)STR_POP_PAUSED) ), current_mp3, max_mp3); print_label_ex( 0.04f, 0.55f, 0.6f, 0xffb0b0b0, xmb_text, 1.00f, 0.0f, _menu_font, 5.05f, 18.0f, 0); sprintf(xmb_text, (const char*)STR_POP_VOL,(int) (mp3_volume*100)); print_label_ex( 0.96f, 0.55f, 0.6f, 0xffb0b0b0, xmb_text, 1.00f, 0.0f, _menu_font, 5.05f, 18.0f, 2); flush_ttf(text_INFO, 380, 70); } if(c_opacity2<=0x80 && c_opacity2) change_opacity(text_INFO, -95, 106400); set_texture(text_INFO, 380, 70); display_img( (cover_mode==5 ? 1540 : 100), (cover_mode==5 ? 880 : 930), 380, 70, 380, 70, -0.1f, 380, 70); } void redraw_column_texts(int _xmb_icon) { for(int n=0; n<xmb[_xmb_icon].size; n++) xmb[_xmb_icon].member[n].data=-1; if(_xmb_icon==2) //settings { u8 first=xmb[2].first; xmb[2].first=0; xmb[2].size=0; add_settings_column(); xmb[2].first=first; } } void draw_xmb_icon_text(int _xmb_icon) { xmb_legend_drawn=0; xmb_info_drawn=0; //draw column name max_ttf_label=0; // print_label_ex( 0.504f, 0.04f, 1.0f, 0x101010ff, xmb[_xmb_icon].name, 1.04f, 0.0f, 8, 4.48f, 24.0f, 1); print_label_ex( 0.5f, 0.0f, 1.0f, COL_XMB_COLUMN, xmb[_xmb_icon].name, 1.04f, 0.0f, mui_font, 4.48f, 24.0f, 1); memset(xmb_col, 0, 36000); flush_ttf(xmb_col, 300, 30); for(int n=0; n<xmb[_xmb_icon].size; n++) xmb[_xmb_icon].member[n].data=-1; } void draw_stars() { if(use_drops) set_texture(text_DROPS, 256, 256); for(int n=0; n<(use_drops?64:MAX_STARS); n++) { int move_star= rndv(10); if(use_drops) { display_img(stars[n].x*64, stars[n].y, 256, 256, 256, 256, 0.85f, 256, 256); if(move_star>4) {stars[n].y+=24; } else {stars[n].y+=16; } if(stars[n].x>1919 || stars[n].y>1016) { stars[n].x=rndv(28); stars[n].y=rndv(256); stars[n].bri=rndv(200); stars[n].size=rndv(XMB_SPARK_SIZE)+1; } } else { draw_square(((float)stars[n].x/1920.0f-0.5f)*2.0f, (0.5f-(float)stars[n].y/1080.0f)*2.0f, (stars[n].size/1920.f), (stars[n].size/1080.f), 0.0f, ( (XMB_SPARK_COLOR&0xffffff00) | stars[n].bri)); if(move_star==4) {stars[n].x++; } else if(move_star==5) {stars[n].x--; } if(move_star>3) {stars[n].y++; } if(move_star==2) {stars[n].y+=2; } if(move_star>6) stars[n].bri-=4; if(stars[n].x>1919 || stars[n].y>1079 || stars[n].x<1 || stars[n].y<1 || stars[n].bri<4) { stars[n].x=rndv(1920); if(cover_mode==8) stars[n].y=rndv(360)+360; else stars[n].y=rndv(1080); stars[n].bri=rndv(222); stars[n].size=rndv(XMB_SPARK_SIZE)+1; } } } } void launch_web_browser(char *start_page) { int mc_size; int ret = sys_memory_container_create( &memory_container_web, MEMORY_CONTAINER_SIZE_WEB); if(ret!=CELL_OK) { goto err_web; } cellWebBrowserConfig2(&config_full, CELL_WEBBROWSER_MK_VER(2, 0)); cellWebBrowserConfigSetFunction2(&config_full, CELL_WEBBROWSER_FUNCTION2_MOUSE | CELL_WEBBROWSER_FUNCTION2_URL_INPUT | CELL_WEBBROWSER_FUNCTION2_SETTING | CELL_WEBBROWSER_FUNCTION2_BOOKMARK); cellWebBrowserConfigSetTabCount2(&config_full, 2); cellWebBrowserConfigSetHeapSize2(&config_full, MB(36)); //2tabs 34mb and 62 container works cellWebBrowserConfigSetViewCondition2(&config_full, CELL_WEBBROWSER_VIEWCOND2_OVERFLOW_AUTO | CELL_WEBBROWSER_VIEWCOND2_TRANSPARENT | CELL_WEBBROWSER_VIEWCOND2_NO_FULL_SCREEN); cellWebBrowserConfigSetUnknownMIMETypeHook2(&config_full, unknown_mimetype_callback, NULL); cellWebBrowserEstimate2(&config_full, &mc_size); if((uint32_t)mc_size <= MEMORY_CONTAINER_SIZE_WEB) { dimc=0; dim=1;c_opacity_delta=-2; c_opacity=0x98; c_opacity2=0x98; www_running = 1; sprintf(status_info, "%s", "Web browser mode"); cellWebBrowserInitialize(system_callback, memory_container_web); cellWebBrowserCreate2(&config_full, start_page); } else { err_web: www_running = 0; status_info[0]=0; // sprintf(string1, "Browser disabled during Remote Play!\n\nNot enough memory to launch web browser!\n\nRequired memory: %.2f MB (allocated %.2f MB)", (double) mc_size/1024/1024, (double) MEMORY_CONTAINER_SIZE_ACTIVE/1024/1024);dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, string1, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_ERR_NOMEM_WEB, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } } /****************************************************/ /* MAIN */ /****************************************************/ char bluray_game[64], bluray_id[10]; int bluray_pl=0; u8 read_pad_info() { u8 to_return=0; int skip_t=14; if ( ( ( (new_pad & BUTTON_UP) || ( (new_pad & BUTTON_L2) && (cover_mode==1 || cover_mode==7))) && (cover_mode!=4 && cover_mode!=6)) || ((new_pad & BUTTON_LEFT) && (cover_mode==4 || cover_mode==6)) ) { c_opacity_delta=16; dimc=0; dim=1; // old_pad=0; new_pad=0; counter_png=30; if(cover_mode==1) skip_t=4; else if(cover_mode==7) skip_t=8; else skip_t=1; if(cover_mode==1 && (new_pad & BUTTON_L2)) skip_t=8; if(cover_mode==7 && (new_pad & BUTTON_L2)) skip_t=32; if(cover_mode!=8 && cover_mode!=4) { game_sel_last=game_sel; game_sel-=skip_t; } new_pad=0; if((cover_mode==8 || cover_mode==4) && xmb[xmb_icon].size>1) { xmb_legend_drawn=0; xmb_info_drawn=0; xmb_bg_show=0; xmb_bg_counter=200; if(xmb[xmb_icon].first==0) {xmb[xmb_icon].first=xmb[xmb_icon].size-1; xmb_slide_y=0; xmb_slide_step_y=0; if(cover_mode==4) load_coverflow_legend();} else { if(xmb_slide_step_y!=0) { if(xmb_slide_y >0) { if(xmb[xmb_icon].first>0) xmb[xmb_icon].first-=repeat_counter3; xmb_slide_y=0;} if(xmb_slide_y <0) { if(xmb[xmb_icon].first<xmb[xmb_icon].size-1) xmb[xmb_icon].first+=repeat_counter3; xmb_slide_y=0;} if(xmb[xmb_icon].first==1 || xmb[xmb_icon].first>=xmb[xmb_icon].size) {repeat_counter1=120; repeat_counter2=repeat_key_delay;repeat_counter3=1;repeat_counter3_inc=0.f;} if(xmb[xmb_icon].first>=xmb[xmb_icon].size) xmb[xmb_icon].first=xmb[xmb_icon].size-1; load_coverflow_legend(); } //else xmb_slide_step_y=10; } } //if(cover_mode==8) goto leave_for8; if(game_sel<0) { game_sel=max_menu_list-1; game_sel_last=game_sel; //if(cover_mode==8 && xmb_icon==6) xmb[xmb_icon].first=game_sel; //xmb_slide_step_y=0; counter_png=0; new_pad=0; if(cover_mode!=8 && cover_mode!=4) {to_return=1; goto leave_for8;}} if(cover_mode==0 || cover_mode==2) { draw_list_text( text_bmp, 1920, 1080, menu_list, max_menu_list, game_sel | (0x10000 * ((menu_list[0].flags & 2048)!=0)), dir_mode, display_mode, cover_mode, c_opacity, 0); if( (int) (game_sel/14) != (int) (game_sel_last/14)) {counter_png=0;new_pad=0;{to_return=1; goto leave_for8;}} } if(cover_mode==1 && game_last_page!=int(game_sel/8)){game_last_page=-1;new_pad=0;{to_return=1; goto leave_for8;}} if(cover_mode==7 && game_last_page!=int(game_sel/32)){game_last_page=-1;new_pad=0;{to_return=1; goto leave_for8;}} } if ( (((new_pad & BUTTON_DOWN) || ( (new_pad & BUTTON_R2) && (cover_mode==1 || cover_mode==7))) && (cover_mode!=4 && cover_mode!=6)) || ((new_pad & BUTTON_RIGHT) && (cover_mode==4 || cover_mode==6)) ) { // old_pad=0; new_pad=0; c_opacity_delta=16; dimc=0; dim=1; counter_png=30; if(cover_mode==1) skip_t=4; else if(cover_mode==7) skip_t=8; else skip_t=1; if(cover_mode==1 && (new_pad & BUTTON_R2)) skip_t=8; if(cover_mode==7 && (new_pad & BUTTON_R2)) skip_t=32; if(cover_mode!=8 && cover_mode!=4) { game_sel_last=game_sel; game_sel+=skip_t; if(skip_t>1 && game_sel>=max_menu_list) game_sel=max_menu_list-1; } new_pad=0; if((cover_mode==8 || cover_mode==4) && xmb[xmb_icon].size>1) { xmb_legend_drawn=0; xmb_info_drawn=0; xmb_bg_show=0; xmb_bg_counter=200; if(xmb[xmb_icon].first==xmb[xmb_icon].size-1) {xmb[xmb_icon].first=0; xmb_slide_y=0; xmb_slide_step_y=0;if(cover_mode==4) load_coverflow_legend();} else { if(xmb_slide_step_y!=0) { if(xmb_slide_y >0) { if(xmb[xmb_icon].first>0) xmb[xmb_icon].first-=repeat_counter3; xmb_slide_y=0;} if(xmb_slide_y <0) { if(xmb[xmb_icon].first<xmb[xmb_icon].size-1) xmb[xmb_icon].first+=repeat_counter3; xmb_slide_y=0;} if(xmb[xmb_icon].first>=xmb[xmb_icon].size-2) {repeat_counter1=120; repeat_counter2=repeat_key_delay;repeat_counter3=1;repeat_counter3_inc=0.f;} load_coverflow_legend(); } //else xmb_slide_step_y=-10; if(xmb[xmb_icon].first>=xmb[xmb_icon].size) xmb[xmb_icon].first=xmb[xmb_icon].size-1; } } // if(cover_mode==8) goto leave_for8; if(game_sel>=max_menu_list) { //if(cover_mode==8 && xmb_icon==6) xmb[xmb_icon].first=0; //xmb_slide_step_y=0; game_sel=0; game_sel_last=0; counter_png=0; new_pad=0; if(cover_mode!=8 && cover_mode!=4) {to_return=1; goto leave_for8;} } if(cover_mode==0 || cover_mode==2) { if( (int) (game_sel/14) != (int) (game_sel_last/14)) {counter_png=0; new_pad=0; {to_return=1; goto leave_for8;}} else draw_list_text( text_bmp, 1920, 1080, menu_list, max_menu_list, game_sel | (0x10000 * ((menu_list[0].flags & 2048)!=0)), dir_mode, display_mode, cover_mode, c_opacity, 0); } if(cover_mode==1 && game_last_page!=int(game_sel/8)){game_last_page=-1;new_pad=0;{to_return=1; goto leave_for8;}} if(cover_mode==7 && game_last_page!=int(game_sel/32)){game_last_page=-1;new_pad=0;{to_return=1; goto leave_for8;}} } if ( ((new_pad & BUTTON_LEFT) && (cover_mode!=4 && cover_mode!=6)) || ((new_pad & BUTTON_UP) && (cover_mode==4 || cover_mode==6)) ) { // old_pad=0; new_pad=0; xmb_legend_drawn=0; xmb_info_drawn=0; if(cover_mode==8 && xmb_icon>1) { if(xmb_slide_step!=0) { if(xmb_slide >0) {if(xmb_icon>2) xmb_icon--; if(xmb_icon==2) free_all_buffers(); xmb_slide=0;draw_xmb_icon_text(xmb_icon);} if(xmb_slide <0) {if(xmb_icon<MAX_XMB_ICONS-2) xmb_icon++; if(xmb_icon==4) free_all_buffers(); xmb_slide=0; draw_xmb_icon_text(xmb_icon);} if(xmb_icon!=1) xmb_slide_step=15; if(xmb_icon==2) {repeat_counter1=120; repeat_counter2=repeat_key_delay;repeat_counter3=1;repeat_counter3_inc=0.f;} } else xmb_slide_step=15; } if(cover_mode==8) goto leave_for8; if(cover_mode==1 || cover_mode==7) skip_t=1; else if(cover_mode==6) skip_t=3; else skip_t=14; c_opacity_delta=16; dimc=0; dim=1; if(game_sel == 0) { game_sel=max_menu_list-1; game_sel_last=game_sel; counter_png=0; new_pad=0; {to_return=1; goto leave_for8;}} else { // old_pad=0; new_pad=0; game_sel = game_sel-skip_t; game_sel_last=game_sel; if(game_sel<0) {game_sel = 0; game_sel_last=0; counter_png=0; new_pad=0;{to_return=1; goto leave_for8;}} } if(cover_mode==1 && game_last_page!=int(game_sel/8)){game_last_page=-1;new_pad=0;{to_return=1; goto leave_for8;}} if(cover_mode==7 && game_last_page!=int(game_sel/32)){game_last_page=-1;new_pad=0;{to_return=1; goto leave_for8;}} } if ( ((new_pad & BUTTON_RIGHT) && (cover_mode!=4 && cover_mode!=6)) || ((new_pad & BUTTON_DOWN) && (cover_mode==4 || cover_mode==6)) ) { // old_pad=0; new_pad=0; xmb_legend_drawn=0; xmb_info_drawn=0; if(cover_mode==8 && xmb_icon<MAX_XMB_ICONS-1) { if(xmb_slide_step!=0) { if(xmb_slide >0) {if(xmb_icon>2) xmb_icon--; if(xmb_icon==2) free_all_buffers(); xmb_slide=0; draw_xmb_icon_text(xmb_icon);} if(xmb_slide <0) {if(xmb_icon<MAX_XMB_ICONS-2) xmb_icon++; if(xmb_icon==4) free_all_buffers(); xmb_slide=0;draw_xmb_icon_text(xmb_icon);} xmb_slide_step=-15; if(xmb_icon!=MAX_XMB_ICONS-1) xmb_slide_step=-15; if(xmb_icon==MAX_XMB_ICONS-2) {repeat_counter1=120; repeat_counter2=repeat_key_delay;repeat_counter3=1;repeat_counter3_inc=0.f;} } else xmb_slide_step=-15; } if(cover_mode==8) goto leave_for8; if(cover_mode==1 || cover_mode==7) skip_t=1; else if(cover_mode==6) skip_t=3; else skip_t=14; c_opacity_delta=16; dimc=0; dim=1; if(game_sel == max_menu_list-1) { game_sel = 0; game_sel_last=game_sel; } else { // old_pad=0; new_pad=0; game_sel = game_sel + skip_t; game_sel_last=game_sel; if(game_sel>=max_menu_list) {game_sel=max_menu_list-1; new_pad=0; game_sel_last=game_sel; counter_png=0; {to_return=1; goto leave_for8;}} } if(cover_mode==1 && game_last_page!=int(game_sel/8)){game_last_page=-1;new_pad=0; {to_return=1; goto leave_for8;}} if(cover_mode==7 && game_last_page!=int(game_sel/32)){game_last_page=-1;new_pad=0; {to_return=1; goto leave_for8;}} } if((old_pad & BUTTON_SELECT) && (new_pad & BUTTON_R2)) { c_opacity_delta=16; dimc=0; dim=1; new_pad=0; //state_draw=1; overscan+=0.01f; if(overscan>0.10f) overscan=0.10f; if(cover_mode==8 && xmb_icon==2) redraw_column_texts(xmb_icon); {to_return=1; goto leave_for8;} } if((old_pad & BUTTON_SELECT) && (new_pad & BUTTON_L2)) { c_opacity_delta=16; dimc=0; dim=1; new_pad=0; //old_pad=0; state_draw=1; overscan-=0.01f;if(overscan<0.0f) overscan=0.00f; if(cover_mode==8 && xmb_icon==2) redraw_column_texts(xmb_icon); {to_return=1; goto leave_for8;} } leave_for8: return to_return; } void draw_whole_xmb(u8 mode) { char filename[1024]; drawing_xmb=1; if(mode) { pad_read(); read_pad_info(); ClearSurface(); } if((xmb_icon>1 && xmb_icon<6) || xmb_icon==8) xmb_bg_counter--; if(xmb_icon==5 && xmb[5].init==0) add_video_column();// && xmb_bg_counter<100 else if(xmb_icon==4 && xmb[4].init==0) add_music_column(); else if(xmb_icon==3 && xmb[3].init==0) add_photo_column(); else if(xmb_icon==8 && xmb[8].init==0) add_emulator_column(); if(xmb_slide_step!=0 || xmb_slide_step_y!=0 || (xmb_game_bg==0 && xmb_cover==0)) xmb_bg_show=0; if(!use_drops) if(xmb_sparks==1 || (xmb_sparks==2 && xmb_bg_show==0)) draw_stars(); if(!xmb_bg_show) set_texture( text_bmp, 1920, 1080); else set_texture( text_FONT, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.9f, 1920, 1080); if(use_drops) if(xmb_sparks==1 || (xmb_sparks==2 && xmb_bg_show==0)) draw_stars(); draw_xmb_clock(xmb_clock, 0); draw_xmb_legend(xmb_icon); draw_xmb_info(); if(xmb_slide_step!=0) //xmmb sliding horizontally { xmb_slide+=xmb_slide_step; /*if(xmb_slide == 165) xmb_slide_step=3; //slow it down before settling else if(xmb_slide ==-165) xmb_slide_step=-3; else */ if(xmb_slide == 180) xmb_slide_step= 2; else if(xmb_slide ==-180) xmb_slide_step=-2; else if(xmb_slide >= 200) {xmb_slide_step= 0; if(xmb_icon==3) free_all_buffers(); xmb_icon--; xmb_slide=0; draw_xmb_icon_text(xmb_icon); parental_pin_entered=0;} else if(xmb_slide <=-200) {xmb_slide_step= 0; if(xmb_icon==3) free_all_buffers(); xmb_icon++; xmb_slide=0; draw_xmb_icon_text(xmb_icon); parental_pin_entered=0;} if(xmb_icon>MAX_XMB_ICONS-1) xmb_icon=MAX_XMB_ICONS-1; else if(xmb_icon<1) xmb_icon=1; if(xmb_slide_step==0) xmb_bg_counter=200; } if(xmb_slide_step_y!=0) //xmmb sliding vertically { xmb_slide_y+=xmb_slide_step_y; if(xmb_slide_y == 40) xmb_slide_step_y = 5; else if(xmb_slide_y ==-40) xmb_slide_step_y =-5; else if(xmb_slide_y == 80) xmb_slide_step_y = 2; else if(xmb_slide_y ==-80) xmb_slide_step_y =-2; else if(xmb_slide_y >= 90) {xmb_slide_step_y= 0; xmb_legend_drawn=0; if(xmb[xmb_icon].first>0) xmb[xmb_icon].first--; xmb_slide_y=0;} else if(xmb_slide_y <=-90) {xmb_slide_step_y= 0; xmb_legend_drawn=0; if(xmb[xmb_icon].first<xmb[xmb_icon].size-1) xmb[xmb_icon].first++; xmb_slide_y=0;} if(xmb_slide_step_y==0) xmb_bg_counter=200; } if( (xmb_icon==6 || xmb_icon==7) && xmb[xmb_icon].size) // && max_menu_list>0 { if(xmb_bg_counter>0 && !xmb_bg_show) xmb_bg_counter--; if(xmb_bg_counter==0 && !xmb_bg_show && xmb_slide_step==0 && xmb_slide_step_y==0 && (xmb_game_bg==1 || xmb_cover==1) && (xmb_icon!=6 || (xmb_icon==6 && xmb[xmb_icon].first)) && !is_game_loading) { sprintf(filename, "%s/%s_1920.PNG", cache_dir, menu_list[xmb[xmb_icon].member[xmb[xmb_icon].first].game_id].title_id); if(exist(filename) && xmb_game_bg==1) { //load_png_partial(text_FONT, filename, 1920, 90, 0); //load_png_texture(text_FONT, filename, 1920); //sprintf(filename, "%s/PS3_GAME/PIC0.PNG", menu_list[xmb[xmb_icon].member[xmb[xmb_icon].first].game_id].path); //if(exist(filename)) load_png_texture(text_FONT+1998640, filename, 1920); load_png_texture(text_FONT, filename, 1920); //change_opacity(text_FONT, -75, 8294400); if(menu_list[xmb[xmb_icon].member[xmb[xmb_icon].first].game_id].split==1 || menu_list[xmb[xmb_icon].member[xmb[xmb_icon].first].game_id].title[0]=='_') gray_texture(text_FONT, 1920, 1080, 0); //blur_texture(text_FONT, 1920, 1080, 0, 0, 1920, 1080, 70, ((menu_list[xmb[xmb_icon].member[xmb[xmb_icon].first].game_id].split==1 || menu_list[xmb[xmb_icon].member[xmb[xmb_icon].first].game_id].title[0]=='_') ? 1 : 0), 1, 1); } else memcpy(text_FONT, text_bmp, 8294400); if(xmb_cover==1)// && xmb_icon==6) { if(xmb_cover_column) { sprintf(filename, "%s/%s_320.PNG", cache_dir, menu_list[xmb[xmb_icon].member[xmb[xmb_icon].first].game_id].title_id); if(exist(filename)) load_png_texture(text_FONT+4419016, filename, 1920);//(575*1920+814)*4 } else { sprintf(filename, "%s/%s.JPG", covers_dir, menu_list[xmb[xmb_icon].member[xmb[xmb_icon].first].game_id].title_id); char cvstr [128]; if(exist(filename)) { sprintf(cvstr, "%s/CBOX3.PNG", app_usrdir); if(exist(cvstr)){ load_texture(text_TEMP, cvstr, 349); put_texture_with_alpha( text_FONT, text_TEMP, 349, 356, 349, 785, 550, 0, 0); } load_jpg_texture(text_FONT+4419256, filename, 1920);//(575*1920+814)*4 sprintf(filename, "%s/GLC.PNG", app_usrdir); if(exist(filename)) { load_texture(text_TEMP, filename, 260); put_texture_with_alpha( text_FONT, text_TEMP, 260, 300, 260, 814, 575, 0, 0); } } else { if(menu_list[xmb[xmb_icon].member[xmb[xmb_icon].first].game_id].cover!=-1 && menu_list[xmb[xmb_icon].member[xmb[xmb_icon].first].game_id].cover!=1) { download_cover(menu_list[xmb[xmb_icon].member[xmb[xmb_icon].first].game_id].title_id, filename); menu_list[xmb[xmb_icon].member[xmb[xmb_icon].first].game_id].cover=1; } sprintf(filename, "%s/%s.PNG", covers_dir, menu_list[xmb[xmb_icon].member[xmb[xmb_icon].first].game_id].title_id); if(exist(filename)) { sprintf(cvstr, "%s/CBOX3.PNG", app_usrdir); if(exist(cvstr)){ load_png_texture(text_TEMP, cvstr, 349); put_texture_with_alpha( text_FONT, text_TEMP, 349, 356, 349, 785, 550, 0, 0); } load_texture(text_FONT+(575*1920+814)*4, filename, 1920); sprintf(filename, "%s/GLC.PNG", app_usrdir); if(exist(filename)) { load_texture(text_TEMP, filename, 260); put_texture_with_alpha( text_FONT, text_TEMP, 260, 300, 260, 814, 575, 0, 0); } }// else xmb_bg_counter=-1; } } } // sprintf(icon_path, "%s/%s.PNG", covers_dir, list[m].title_id); // if(stat(icon_path, &s3)>=0) {g_iconw=260; g_iconh=300; goto add_mem;} xmb_bg_show=1; } } draw_xmb_icons(xmb, xmb_icon, xmb_slide, xmb_slide_y, 0, xmb_sublevel); if((xmb_icon==6 || xmb_icon==7 || xmb_icon==5) && xmb[xmb_icon].member[xmb[xmb_icon].first].game_id!=-1) game_sel=xmb[xmb_icon].member[xmb[xmb_icon].first].game_id; if(xmb_icon==2) xmb_settings_sel=xmb[2].first; if(mode) flip(); drawing_xmb=0; } void show_sysinfo() { char sys_info[512]; get_free_memory(); char line1[128]; char line2[128]; char line3[128]; char line4[128]; char line5[64]; cellFsGetFreeSize((char*)"/dev_hdd0", &blockSize, &freeSize); freeSpace = ( ((uint64_t)blockSize * freeSize)); sprintf(line5, "Free HDD space: %.2f GB", (double) (freeSpace / 1073741824.00f)); strncpy(line4, current_version, 8); line4[8]=0; sprintf(line1, "Free Memory: %.0f KB", (double) (meminfo.avail/1024.0f));//, (double) ((meminfo.avail+meminfo.total)/1024.0f) if(payload==-1) sprintf(line2, "PS3\xE2\x84\xA2 System: Firmware %.2f", c_firmware); if(payload== 0 && payloadT[0]!=0x44) sprintf(line2, "PS3\xE2\x84\xA2 System: Firmware %.2f [SC-36 | PSGroove]", c_firmware); if(payload== 0 && payloadT[0]==0x44) sprintf(line2, "PS3\xE2\x84\xA2 System: Firmware %.2f [SC-36 | Standard]", c_firmware); if(payload== 1) sprintf(line2, "PS3\xE2\x84\xA2 System: Firmware %.2f [SC-8 | Hermes]", c_firmware); if(payload== 2) sprintf(line2, "PS3\xE2\x84\xA2 System: Firmware %.2f [SC-35 | PL3]", c_firmware); net_avail=cellNetCtlGetInfo(16, &net_info); if(net_avail<0) { sprintf(line3, "%s", "IP Address: [Not Available]"); } else sprintf(line3, "IP Address: %s", net_info.ip_address); sprintf(sys_info, "multiMAN Version: %s\n\n%s\n%s\n%s\n%s", line4, line2, line3, line1, line5); dialog_ret=0; cellMsgDialogOpen2( type_dialog_back, sys_info, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } int main(int argc, char **argv) { cellSysutilRegisterCallback( 0, sysutil_callback, NULL ); payloadT[0]='M'; payloadT[1]=0; (void)argc; // (void)argv; int ret; int one_time=1; ret = cellSysmoduleLoadModule( CELL_SYSMODULE_GCM_SYS ); if (ret != CELL_OK) sys_process_exit(1); else unload_mod|=8; host_addr = memalign(MB(1), MB(1)); //cellGcmInitSystemMode(CELL_GCM_SYSTEM_MODE_IOMAP_512MB); if(cellGcmInit(KB(128), MB(1), host_addr) != CELL_OK) sys_process_exit(1); if(initDisplay()!=0) sys_process_exit(1); initShader(); setDrawEnv(); if(setRenderObject()) sys_process_exit(1); ret = cellPadInit(8); setRenderTarget(); initFont(); app_path[0]='B'; app_path[1]='L'; app_path[2]='E'; app_path[3]='S'; app_path[4]='8'; app_path[5]='0'; app_path[6]='6'; app_path[7]='0'; app_path[8]='8'; app_path[9]=0; if(!strncmp( argv[0], "/dev_hdd0/game/", 15)) { char *s; int n=0; s= ((char *) argv[0])+15; while(*s!=0 && *s!='/' && n<32) {app_path[n]=*s++; n++;} app_path[n]=0; } is_reloaded=0; sprintf(app_homedir, "/dev_hdd0/game/%s",app_path); if(strstr(argv[0],"/dev_hdd0/game/")==NULL) { mkdir(app_homedir, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sprintf(app_usrdir, "/dev_hdd0/game/%s/USRDIR",app_path); mkdir(app_usrdir, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); } else sprintf(app_usrdir, "/dev_hdd0/game/%s/USRDIR",app_path); char string1x[512], string2x[512], string3x[512], string1[1024], filename[1024]; MM_LocaleSet (0); sprintf(disclaimer, "%s/DISCLM.BIN", app_usrdir); sprintf(string1 , "%s/DISACC.BIN", app_usrdir); cellMsgDialogAbort(); if(!exist(disclaimer) || exist(string1)) { sprintf(string1x, "multiMAN (referred hereafter as \"software\"), its author, partners, and associates do not condone piracy. multiMAN is a hobby project, distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\nDo you accept this binding agreement (1/3)?"); dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_no, string1x, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret!=1) sys_process_exit(1); sprintf(string2x, "The software is intended solely for educational and testing purposes, and while it may allow the user to create copies of legitimately acquired and/or owned content, it is required that such user actions must comply with local, federal and country legislation.\n\nFurthermore, the author of this software, its partners and associates shall assume NO responsibility, legal or otherwise implied, for any misuse of, or for any loss that may occur while using multiMAN.\n\nDo you accept this binding agreement (2/3)?"); dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_no, string2x, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret!=1) sys_process_exit(1); sprintf(string3x, "You are solely responsible for complying with the applicable laws in your country and you must cease using this software should your actions during multiMAN operation lead to or may lead to infringement or violation of the rights of the respective content copyright holders.\n\nmultiMAN is not licensed, approved or endorsed by \"Sony Computer Entertainment, Inc.\" (SCEI) or any other party.\n\nDo you understand and accept this binding agreement?"); dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_no, string3x, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret!=1) sys_process_exit(1); FILE *fpA; fpA = fopen ( disclaimer, "w" ); if(fpA!=NULL) { fputs ( "USER AGREED TO DISCLAIMER: ", fpA );fputs ( string1x, fpA );fputs ( string2x, fpA ); fputs ( string3x, fpA ); fclose( fpA); } remove(string1); } sprintf(string1x, "%s/RELOADED.BIN", app_usrdir); if(exist(string1x)) is_reloaded=1; else { FILE *fpA; fpA = fopen ( string1x, "w" ); fputs ( "multiMAN was reloaded", fpA );fputs ( string1x, fpA ); fclose( fpA); sprintf(string1, "%s/PARAM.SFO", app_homedir); change_param_sfo_version(string1); //change_param_sfo_field( string1, (char*)"TITLE", (char*) "multiMAN"); } sprintf(current_version_NULL, "%s", current_version); sys_spu_initialize(6, 0); ret = load_modules(); if(ret!=CELL_OK && ret!=0) sys_process_exit(1); cellSysutilEnableBgmPlayback(); // allocate buffers for images (one big buffer = 76MB) // XMMB mode uses 7 frame buffers (56MB) u32 buf_align= FB(1); u32 frame_buf_size = (buf_align * 8)+5324800;// for text_bmpS 320x320x13 -> 1920*648 * 4 frame_buf_size = ( frame_buf_size + 0xfffff ) & ( ~0xfffff ); text_bmp = (u8 *) memalign(0x100000, frame_buf_size); if(map_rsx_memory( text_bmp, frame_buf_size)) sys_process_exit(1); text_bmpUBG = text_bmp + buf_align * 1; //3 x 1920x1080 text_bmpUPSR= text_bmp + buf_align * 4; //2 x 1920x1080 text_FONT = text_bmp + buf_align * 6; text_FMS = text_bmp + buf_align * 7; text_bmpS = text_bmp + buf_align * 8; text_legend = text_bmpUPSR + buf_align; text_BOOT = text_bmpUBG + buf_align; //pData = (long)text_bmp + buf_align * 8;//(long)memalign(128, _mp3_buffer*1024*1024); //==================================================================== xmb_icon_globe = text_FMS+( 9*65536); xmb_icon_help = text_FMS+(10*65536); xmb_icon_quit = text_FMS+(11*65536); xmb_icon_star = text_FMS+(12*65536); xmb_icon_desk = text_FMS+(13*65536); xmb_icon_hdd = text_FMS+(14*65536); xmb_icon_blu = text_FMS+(15*65536); xmb_icon_tool = text_FMS+(16*65536); xmb_icon_note = text_FMS+(17*65536); xmb_icon_film = text_FMS+(18*65536); xmb_icon_photo = text_FMS+(19*65536); xmb_icon_update = text_FMS+(20*65536); xmb_icon_ss = text_FMS+(21*65536); xmb_icon_showtime= text_FMS+(22*65536); xmb_icon_theme = text_FMS+(23*65536); //XMB.PNG end (24 icons 128x128 = 128x3072) //==================================================================== xmb_icon_retro = text_FMS+(24*65536); //XMB2.PNG start xmb_icon_ftp = text_FMS+(25*65536); xmb_icon_folder = text_FMS+(26*65536); // text_??? = text_FMS+(25*65536); // // text_???LAST = text_FMS+(47*65536); //XMB2.PNG end (24 icons 128x128 = 128x3072) //==================================================================== xmb_icon_star_small = text_FMS+(48*65536);//+(16384*0)//64*64*4 // xmb_icon_????_small = text_FMS+(48*65536)+(16384*1); xmb_col = text_FMS+(49*65536); // Current XMMB Column name (300x30) xmb_clock = text_FMS+(50*65536); // Clock (300x30) //==================================================================== xmb_icon_dev = text_FMS+(51*65536); // XMB64.PNG start (32 icons 64x64 = 64x2048) (51->58) //==================================================================== text_DOX = text_FMS+(59*65536); // DOX.PNG (256x256) (59->62) //==================================================================== text_MSG = text_FMS+(63*65536); // Legend pop-up in XMMB mode (300x70) (63->64) text_INFO = text_FMS+(65*65536); // Info pop-up in XMMB mode (300x70) (65->66) // text_??? = text_FMS+(67*65536); // // text_???LAST = text_FMS+(125*65536);// end of text_FMS frame buffer //==================================================================== u32 buf_align2= (320 * 320 * 4); text_HDD = text_bmpS + buf_align2 * 1; text_USB = text_bmpS + buf_align2 * 2; text_BLU_1 = text_bmpS + buf_align2 * 3; text_OFF_2 = text_bmpS + buf_align2 * 4; text_CFC_3 = text_bmpS + buf_align2 * 5; text_SDC_4 = text_bmpS + buf_align2 * 6; text_MSC_5 = text_bmpS + buf_align2 * 7; text_NET_6 = text_bmpS + buf_align2 * 8; text_bmpIC = text_bmpS + buf_align2 * 9; text_TEMP = text_bmpS + buf_align2 * 10; //+11 text_DROPS = text_bmpS + buf_align2 * 12; sprintf(avchdBG, "%s/BOOT.PNG",app_usrdir); load_texture(text_BOOT, avchdBG, 1920); sprintf(string1, "%s/GLO.PNG", app_usrdir); if(exist(string1)) { load_texture(text_bmpUPSR, string1, 1920); put_texture_with_alpha( text_BOOT, text_bmpUPSR, 1920, 1080, 1920, 0, 0, 0, 0); } ClearSurface(); set_texture( text_BOOT, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); flip(); MEMORY_CONTAINER_SIZE_ACTIVE = MEMORY_CONTAINER_SIZE; ret = sys_memory_container_create( &memory_container, MEMORY_CONTAINER_SIZE_ACTIVE); if(ret!=CELL_OK) { MEMORY_CONTAINER_SIZE_ACTIVE = MEMORY_CONTAINER_SIZE - (2 * 1024 * 1024); ret = sys_memory_container_create( &memory_container, MEMORY_CONTAINER_SIZE_ACTIVE); } if(ret!=CELL_OK) sys_process_exit(1); //cellFsChmod(argv[0], 0666); url_base[ 0]=0x68; url_base[ 1]=0x74; url_base[ 2]=0x74; url_base[ 3]=0x70; url_base[ 4]=0x3a; url_base[ 5]=0x2f; url_base[ 6]=0x2f; url_base[ 7]=0x73; url_base[ 8]=0x68; url_base[ 9]=0x61; url_base[10]=0x6a; url_base[11]=0x2e; url_base[12]=0x6d; url_base[13]=0x65; url_base[14]=0x2f; url_base[15]=0x64; url_base[16]=0x65; url_base[17]=0x61; url_base[18]=0x6e; url_base[19]=0x2f; url_base[20]=0x6d; url_base[21]=0x75; url_base[22]=0x6c; url_base[23]=0x74; url_base[24]=0x69; url_base[25]=0x6d; url_base[26]=0x61; url_base[27]=0x6e; url_base[28]=0x00; // use 32MB virtual memory pool (with vm_real_size) real memory //sys_vm_memory_map(MB(32), MB(vm_real_size), SYS_MEMORY_CONTAINER_ID_INVALID, SYS_MEMORY_PAGE_SIZE_64K, SYS_VM_POLICY_AUTO_RECOMMENDED, &vm); //sys_vm_touch(vm, MB(vm_real_size)); pData = (char*) memalign(16, _mp3_buffer); //allocate 2 buffers for mp3 playback pDataB = pData; multiStreamStarted = StartMultiStream(); max_menu_list=0; c_firmware = (float) get_system_version(); if(c_firmware>3.40f && c_firmware<3.55f) c_firmware=3.41f; if(c_firmware>3.55f) c_firmware=3.55f; mod_mount_table((char*)"nothing", 0); //restore for(int n2=0;n2<99;n2++) { sprintf(string1, "/dev_usb%03i/PS3_GAME", n2); if(exist(string1)) check_usb_ps3game(string1); } sprintf(list_file, "%s/LLIST.BIN", app_usrdir); sprintf(list_file_state, "%s/LSTAT.BIN", app_usrdir); sprintf(snes_self, "%s", "/dev_hdd0/game/SNES90000/USRDIR/RELOAD.SELF"); sprintf(snes_roms, "%s", "/dev_hdd0/game/SNES90000/USRDIR/roms"); sprintf(genp_self, "%s", "/dev_hdd0/game/GENP00001/USRDIR/RELOAD.SELF"); sprintf(genp_roms, "%s", "/dev_hdd0/game/GENP00001/USRDIR/roms"); sprintf(fceu_self, "%s", "/dev_hdd0/game/FCEU90000/USRDIR/RELOAD.SELF"); sprintf(fceu_roms, "%s", "/dev_hdd0/game/FCEU90000/USRDIR/roms"); sprintf(vba_self, "%s", "/dev_hdd0/game/VBAM90000/USRDIR/RELOAD.SELF"); sprintf(vba_roms, "%s", "/dev_hdd0/game/VBAM90000/USRDIR/roms"); sprintf(fba_self, "%s", "/dev_hdd0/game/FBAN00000/USRDIR/RELOAD.SELF"); sprintf(fba_roms, "%s", "/dev_hdd0/game/FBAN00000/USRDIR/roms"); u32 reload_fdevices=0; if(is_reloaded || exist(list_file)) { // ClearSurface(); draw_square(-1.0f, 1.0f, 2.0f, 2.0f, 0.0f, 0x10101080); // cellDbgFontPrintf( 0.28f, 0.85f, 1.0f, 0x90909090, "multiMAN is parsing last state data..."); // cellDbgFontDrawGcm(); setRenderColor(); flip(); //is_reloaded=0; FILE *flist; flist = fopen(list_file, "rb"); if ( flist != NULL ) { fread((char*) &string1, 8, 1, flist); if(strstr(string1, GAME_LIST_VER)!=NULL) { fseek(flist, 0, SEEK_END); int llist_size=ftell(flist)-8; fseek(flist, 8, SEEK_SET); fread((char*) &menu_list, llist_size, 1, flist); fclose(flist); max_menu_list=(int)(llist_size / sizeof(t_menu_list))-1;//sizeof(t_menu_list)); if(!is_reloaded) {delete_entries(menu_list, &max_menu_list, 1); is_reloaded=1;} else is_reloaded=2; sort_entries(menu_list, &max_menu_list ); int i; for(i=0;i<max_menu_list;i++) { if(menu_list[i].cover==1) menu_list[i].cover=0; if(!exist(menu_list[i].path)) {max_menu_list=0; is_reloaded=0; break;} //else {is_reloaded=1; }//forcedevices=0x0001; } } else {fclose(flist);remove(list_file);is_reloaded=0;} } else is_reloaded=0; } if(exist(list_file_state)) { FILE *flist; flist = fopen(list_file_state, "rb"); if ( flist != NULL ) { fread((char*) &string1, 8, 1, flist); if(strstr(string1, GAME_STATE_VER)!=NULL) { fread((char*) &reload_fdevices, sizeof(reload_fdevices), 1, flist); fread((char*) &mouseX, sizeof(mouseX), 1, flist); fread((char*) &mouseY, sizeof(mouseY), 1, flist); fread((char*) &mp3_volume, sizeof(mp3_volume), 1, flist); if(mp3_volume<0.0f) mp3_volume=0.0f; fread((char*) &current_left_pane, sizeof(current_left_pane), 1, flist); fread((char*) &current_right_pane, sizeof(current_right_pane), 1, flist); fread((char*) &xmb_icon_last, sizeof(xmb_icon), 1, flist); fread((char*) &xmb_icon_last_first, sizeof(xmb[xmb_icon].first), 1, flist); fread((char*) &xmb[6].group, sizeof(xmb[6].group), 1, flist); fread((char*) &xmb[8].group, sizeof(xmb[8].group), 1, flist); fread((char*) &xmb[4].group, sizeof(xmb[4].group), 1, flist); if(is_reloaded==1)forcedevices=0x0001; } fclose(flist); } } if(true) { for(int c=3;c<9;c++) { if(c>5) c=8; u8 main_group=xmb[c].group & 0x0f; u8 alpha_group=xmb[c].group>>4 & 0x0f; if(alpha_group>14) alpha_group=0; main_group&=0x0f; if(c==8 && xmb[8].group) { if(main_group>5) main_group=0; if(main_group) { read_xmb_column_type(8, main_group+7, alpha_group); if(alpha_group) sprintf(xmb[8].name, "%s (%s)", retro_groups[main_group], alpha_groups[alpha_group]); else sprintf(xmb[8].name, "%s", retro_groups[main_group]); } else { read_xmb_column(8, alpha_group); if(alpha_group) sprintf(xmb[8].name, "%s (%s)", xmb_columns[8], alpha_groups[alpha_group]); else sprintf(xmb[8].name, "%s", xmb_columns[8]); } } else { if(c==4) { read_xmb_column(c, alpha_group); if(alpha_group) sprintf(xmb[4].name, "%s (%s)", xmb_columns[4], alpha_groups[alpha_group]); else sprintf(xmb[4].name, "%s", xmb_columns[4]); } else read_xmb_column(c, 0); } } free_all_buffers(); free_text_buffers(); //xmb[5].init=0; xmb[6].init=0; xmb[7].init=0; } // int reloaded_menu_list=max_menu_list; sprintf(string1, "%s/COLOR.INI", app_usrdir); if(exist(string1)) sprintf(color_ini, "%s/COLOR.INI", app_usrdir); else sprintf(color_ini, "%s/COLOR.BIN", app_usrdir); sprintf(options_bin, "%s/options.bin", app_usrdir); sprintf(parental_pass, "0000"); parental_pass[4]=0; if(!exist(options_bin)) {ftp_on(); ftp_service=1; save_options();} int usb_loop; for(usb_loop=0;usb_loop<8;usb_loop++) { sprintf(options_ini, "/dev_usb00%i/options.ini", usb_loop); if(!exist(options_ini)) sprintf(options_ini, "/dev_usb00%i/options_default.ini", usb_loop); if(exist(options_ini)) break; } if(exist(options_ini)) { sprintf(string1, "%s/options.ini", app_usrdir); file_copy((char *) options_ini, (char *) string1, 0); sprintf(options_ini, "%s/options.ini", app_usrdir); } if(!exist(options_ini)) { sprintf(options_ini, "%s/options.ini",app_usrdir); if(!exist(options_ini)) sprintf(options_ini, "%s/options_default.ini",app_usrdir); } sprintf(covers_dir, "%s/covers",app_usrdir); mkdir(covers_dir, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sprintf(covers_retro, "%s/covers_retro",app_usrdir); mkdir(covers_retro, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sprintf(themes_dir, "%s/themes",app_usrdir); mkdir(themes_dir, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sprintf(themes_web_dir, "%s/themes_web",app_usrdir); mkdir(themes_web_dir, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sprintf(string1, "%s/lang", app_usrdir); mkdir(string1, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sprintf(string1, "%s/LICDIR/LIC.DAT", app_homedir); remove(string1); sprintf(string1, "%s/LICDIR", app_homedir); rmdir(string1); sprintf(string1, "%s/TROPDIR", app_homedir); my_game_delete(string1); rmdir(string1); pad_read();pad_read(); debug_mode = ( (new_pad | old_pad) & (BUTTON_R2 | BUTTON_L2) ); new_pad=0; old_pad=0; if(debug_mode) // Save default English GUI labels // New line characters are marked with "|" symbol, do not remove! { sprintf(string1, "%s/lang/LANG_DEFAULT.TXT", app_usrdir); remove(string1); FILE *fpA; fpA = fopen ( string1, "wb" ); if(fpA!=NULL) { char lab[512]; fputs ( "\xEF\xBB\xBF", fpA ); // set text file header to UTF-8 for(int n=0; n<STR_LAST_ID; n++) { sprintf(lab, "%s", (const char*)g_MMString[n].m_pStr); for(u16 m=0; m<strlen(lab); m++) if(lab[m]=='\n') lab[m]='|'; fwrite ( lab, strlen(lab), 1, fpA ); //g_MMString[n].m_pStr fputs ( (char*)"\r", fpA ); } fclose( fpA); } } parse_ini(options_ini,0); load_localization(mm_locale); for(usb_loop=0;usb_loop<8;usb_loop++) { sprintf(filename, "/dev_usb00%i/COLOR.INI", usb_loop); if(exist(filename)) { sprintf(string1, "%s/COLOR.INI", app_usrdir); file_copy(filename, string1, 0); break; } } sprintf(app_temp, "%s/TEMP",app_usrdir); del_temp(app_temp); rnd=time(NULL)&0x03; sprintf(auraBG, "%s/AUR%i.JPG",app_usrdir, rnd); sprintf(userBG, "%s/PICBG.JPG",app_usrdir); sprintf(xmbicons, "%s/XMB.PNG", app_usrdir); sprintf(xmbicons2, "%s/XMB2.PNG", app_usrdir); sprintf(xmbdevs, "%s/XMB64.PNG", app_usrdir); sprintf(xmbbg, "%s/XMBBG.PNG", app_usrdir); sprintf(filename, "%s/XMBR.PNG", app_usrdir); remove(filename); sprintf(filename, "%s/DOX.PNG", app_usrdir); load_texture(text_DOX, filename, dox_width); sprintf(playBGR, "%s/PICPA.PNG",app_usrdir); /* sprintf(blankBG, "/dev_hdd0/game/%s/PIC0.PNG",app_path); sprintf(filename, "%s/XMB0.PNG",app_usrdir); if(exist(filename) && stat(blankBG, &s2)<0 ) file_copy(filename, blankBG, 0); sprintf(blankBG, "/dev_hdd0/game/%s/PIC1.PNG",app_path); sprintf(filename, "%s/XMB1.PNG",app_usrdir); if(exist(filename) && stat(blankBG, &s2)<0 ) file_copy(filename, blankBG, 0); */ sprintf(blankBG, "%s/ICON0.PNG", app_homedir); sprintf(filename, "%s/ICON0.PNG", app_usrdir); if(exist(filename)) file_copy(filename, blankBG, 0); if(V_WIDTH>1280) sprintf(filename, "%s/MP_HR.PNG",app_usrdir); else { sprintf(filename, "%s/MP_LR.PNG",app_usrdir); mp_WIDTH=15, mp_HEIGHT=21; //mouse icon LR } if(exist(filename)) {load_texture((unsigned char *) mouse, filename, mp_WIDTH);}// gray_texture(mouse, 32, 32);} sprintf(helpNAV, "%s/NAV.JPG",app_usrdir); sprintf(helpMME, "%s/help.MME",app_usrdir); sprintf(ps2png, "%s/PS2.JPG",app_usrdir); sprintf(dvdpng, "%s/DVD.JPG",app_usrdir); sprintf(avchdIN, "%s/AVCIN.DAT",app_usrdir); sprintf(avchdMV, "%s/AVCMV.DAT",app_usrdir); sprintf(iconHDD, "%s/HDD.JPG",app_usrdir); sprintf(iconUSB, "%s/USB.JPG",app_usrdir); sprintf(iconBLU, "%s/BLU.JPG",app_usrdir); sprintf(iconNET, "%s/NET.JPG",app_usrdir); sprintf(iconOFF, "%s/OFF.JPG",app_usrdir); sprintf(iconCFC, "%s/CFC.JPG",app_usrdir); sprintf(iconSDC, "%s/SDC.JPG",app_usrdir); sprintf(iconMSC, "%s/MSC.JPG",app_usrdir); sprintf(playBG, "%s/FMS.PNG",app_usrdir); sprintf(legend, "%s/LEGEND2.PNG", app_usrdir); sprintf(versionUP, "%s/VERSION.DAT",app_usrdir); sprintf(filename, "%s/DROPS.PNG",app_usrdir); if(!exist(filename) || !exist(xmbdevs)) { dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_INCOMPLETE, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } ClearSurface(); set_texture( text_BOOT, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); flip(); load_texture(text_bmpUPSR, playBGR, 1920); load_texture(text_bmpIC, blankBG, 320); load_texture(text_HDD, iconHDD, 320); load_texture(text_USB, iconUSB, 320); load_texture(text_BLU_1, iconBLU, 320); load_texture(text_NET_6, iconNET, 320); load_texture(text_OFF_2, iconOFF, 320); load_texture(text_CFC_3, iconCFC, 320); load_texture(text_SDC_4, iconSDC, 320); load_texture(text_MSC_5, iconMSC, 320); sprintf(filename, "%s/XMB Video", app_usrdir); if(!exist(filename)) mkdir(filename, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sprintf(cache_dir, "%s/cache", app_usrdir); if(!exist(filename)) { is_reloaded=0; mkdir(cache_dir, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); } sprintf(filename, "%s/.mmcache002", cache_dir); if(!exist(filename)) {is_reloaded=0; file_copy(disclaimer, filename, 0); max_menu_list=0; forcedevices=0xffff;} //fix_perm_recursive(cache_dir); sprintf(filename, "%s/TEMP",app_usrdir); mkdir(filename, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sprintf(game_cache_dir, "%s/game_cache",app_usrdir); mkdir(game_cache_dir, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sc36_path_patch=0; payload = -1; // 0->psgroove 1->hermesV3/V4 2->PL3 payloadT[0]=0x20; if(sys8_enable(0) > 0) { payload=1; payloadT[0]=0x48; //H ret = sys8_enable(0); ret = sys8_path_table(0ULL); } else { payload=0; if (syscall35("/dev_hdd0", "/dev_hdd0") == 0) { payload=2; payloadT[0]=0x50; //P } else { payload=0; if(peekq(0x8000000000346690ULL) == 0x80000000002BE570ULL && peekq(0x80000000002D8538ULL) == 0x7FA3EB784BFDAD60ULL) { pokeq(0x80000000002D8498ULL, 0x38A000064BD7623DULL ); // 09 symbols search pokeq(0x80000000002D8504ULL, 0x38A000024BD761D1ULL ); // 0x002D7800 (/app_home) 2 search // enable_sc36(); }//D payload=-1; system_call_1(36, (uint32_t) app_usrdir); sprintf(filename, "%s", "/dev_bdvd/EBOOT.BIN"); if(exist(filename)) { payload=0; payloadT[0]=0x47; //G if(peekq(0x8000000000346690ULL) == 0x80000000002BE570ULL && peekq(0x80000000002D8538ULL) == 0x7FA3EB784BFDAD60ULL) {payloadT[0]=0x44; sc36_path_patch=1; }//D } } } sprintf(filename, "%s/BDEMU.BIN", app_usrdir); if(exist(filename)) { fpV = fopen ( filename, "rb" ); fseek(fpV, 0, SEEK_END); u32 len=ftell(fpV); fclose(fpV); if(len==488) {bdemu2_present=0; if(bd_emulator) bd_emulator=2;} if(len==4992) {bdemu2_present=1;} } sprintf(filename, "%s/BDEMU.BIN", app_usrdir); if(c_firmware == 3.55f && payload==-1 && exist(filename) && bd_emulator==2) { fpV = fopen ( filename, "rb" ); fseek(fpV, 0, SEEK_SET); fread((void *) bdemu, 488, 1, fpV); fclose(fpV); payload=0; psgroove_main(0); if(peekq(0x8000000000346690ULL) == 0x80000000002BE570ULL){ payload=0; if(peekq(0x80000000002D8538ULL) == 0x7FA3EB784BFDAD60ULL ) { payloadT[0]=0x44; //D sc36_path_patch=1; } else { payloadT[0]=0x47; //G sc36_path_patch=0; } } else { payload=-1; payloadT[0]=0x20; //NONE } } sprintf(filename, "%s/BDEMU.BIN", app_usrdir); if(c_firmware == 3.55f && payload==-1 && exist(filename) && bd_emulator==1) { fpV = fopen ( filename, "rb" ); fseek(fpV, 0, SEEK_END); u32 len=ftell(fpV); if(len>=4992) { fseek(fpV, 488, SEEK_SET); fread((void *) bdemu, 1024, 1, fpV); fclose(fpV); payload=0; hermes_payload_355(0); if(sys8_enable(0) > 0) { payload=1; payloadT[0]=0x48; //H ret = sys8_enable(0); ret = sys8_path_table(0ULL); //ret = sys8_perm_mode(1); bdemu2_present=1; } else { payload=-1; payloadT[0]=0x20; //NONE } } else { payload=-1; payloadT[0]=0x20; //NONE fclose(fpV); dialog_ret=0;cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_ERR_BDEMU1, dialog_fun2, (void*)0x0000aaab, NULL );wait_dialog(); } } sprintf(filename, "%s/BDEMU.BIN", app_usrdir); if(c_firmware == 3.41f && payload==-1 && exist(filename) && bd_emulator==1) { fpV = fopen ( filename, "rb" ); fseek(fpV, 0, SEEK_END); u32 len=ftell(fpV); if(len>=4992) { fseek(fpV, 1512, SEEK_SET); fread((void *) bdemu, 3480, 1, fpV); fclose(fpV); payload=0; hermes_payload_341(); sys_timer_usleep(250000); if(sys8_enable(0) > 0) { payload=1; payloadT[0]=0x48; //H ret = sys8_enable(0); ret = sys8_path_table(0ULL); bdemu2_present=1; } else { payload=-1; payloadT[0]=0x20; //NONE } } else { payload=-1; payloadT[0]=0x20; //NONE fclose(fpV); dialog_ret=0;cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_ERR_BDEMU1, dialog_fun2, (void*)0x0000aaab, NULL );wait_dialog(); } } parse_color_ini(); parse_last_state(); clean_up(); if(payload==-1) { if(bd_emulator) { dialog_ret=0; sprintf(filename, "%s/BDEMU.BIN", app_usrdir); if(!exist(filename)) cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_ERR_BDEMU2, dialog_fun2, (void*)0x0000aaab, NULL ); else cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_ERR_BDEMU3, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } if(c_firmware == 3.55f) psgroove_main(1); } else reset_mount_points(); disable_sc36(); if(cover_mode==3) load_texture(text_FONT, userBG, 1920); if(cover_mode<3 || cover_mode>5) draw_legend=1; else draw_legend=0; if(c_firmware==3.41f && peekq(0x80000000000505d0ULL) == memvalnew) patchmode = 1; else patchmode = 0; if(mount_hdd1==1) { memset(&cache_param, 0x00 , sizeof(CellSysCacheParam)) ; strncpy(cache_param.cacheId, app_path, sizeof(cache_param.cacheId)) ; cellSysCacheMount( &cache_param ) ; remove( (char*) "/dev_hdd1/multiMAN" ); remove( (char*) "/dev_hdd1/multiMAN.srt" ); remove( (char*) "/dev_hdd1/multiMAN.ssa" ); remove( (char*) "/dev_hdd1/multiMAN.ass" ); } for(int n=0;n<max_hosts;n++) if(host_list[n].port>0) remove(host_list[n].name); for(int n=0; n<MAX_STARS;n++) { stars[n].x=rndv(1920); stars[n].y=rndv(1080); stars[n].bri=rndv(128); stars[n].size=rndv(XMB_SPARK_SIZE)+1; } mkdir(covers_dir, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); DIR *dir;dir=opendir (ini_hdd_dir); if(!dir) mkdir(ini_hdd_dir, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); else closedir(dir); strncpy(hdd_folder, ini_hdd_dir, 64); dir=opendir (ini_hdd_dir); if(!dir){ dialog_ret=0; force_disable_copy=1; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_CRITICAL, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } else closedir(dir); if(theme_sound && multiStreamStarted) { sprintf(bootmusic, "%s/SOUND.BIN", app_usrdir); if(exist(bootmusic)) { main_mp3((char*)bootmusic); main_mp3_th(bootmusic, 0); force_mp3=false; } } int find_device=0; game_last_page=-1; last_selected=-1; //use_depth=(cover_mode!=8); uint64_t nread; int dir_fd; CellFsDirent entryF; net_avail=cellNetCtlGetInfo(16, &net_info); init_finished=1; sys_ppu_thread_create( &download_thr_id, download_thread_entry, NULL, 3000, app_stack_size, 0, "multiMAN_downqueue" ); sys_ppu_thread_create( &misc_thr_id, misc_thread_entry, NULL, misc_thr_prio, app_stack_size, 0, "multiMAN_misc" );//SYS_PPU_THREAD_CREATE_JOINABLE ss_timer=0; ss_timer_last=time(NULL); get_free_memory(); if (meminfo.avail<16777216) // Quit if less than 16MB RAM available (at least 12 required for copy operations + 4 to be on the safe side) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_ERR_NOMEM, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); unload_modules(); sys_process_exit(1); } if(debug_mode) { dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_DEBUG_MODE, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog_simple(); current_version[6]=0x44; current_version[7]=0x44; current_version_NULL[6]=0x44; current_version_NULL[7]=0x44; } /* main loop */ while( pad_read() != 0) { start_of_loop: if(dim_setting>0) { dimc++; if( (dimc>(dim_setting*80) && cover_mode!=5) || ( (cover_mode==5 || cover_mode==8) && dimc>(dim_setting*80*7)) ) {dimc=0; dim=1;c_opacity_delta=-1;} } else { dimc=0; dim=0; c_opacity_delta=0;} int count_devices=0; int dev_changed=0; int dev_removed=0; int to_restore=1; if(one_time) {one_time=0;goto skip_find_device;} CellFsStat status; if( (time(NULL)-last_refresh)>3 || first_launch || forcedevices!=0 ) { u32 fdevices0=0; cellFsOpendir((char*) "/", &dir_fd); while(1) { last_refresh=time(NULL); cellFsReaddir(dir_fd, &entryF, &nread); if(nread==0) break; sprintf(filename, "%s", entryF.d_name); if(strstr(filename,"app_home")!=NULL || strstr(filename,"dev_hdd1")!=NULL) continue; find_device=-1; if(strstr(filename,"dev_hdd0")!=NULL) find_device=0; else if(strstr(filename,"dev_usb00")!=NULL) find_device=(filename[9])-0x2f; else if(strstr(filename,"dev_bdvd")!=NULL && hide_bd==0) find_device=11; else if(strstr(filename,"host_root")!=NULL && pfs_enabled) find_device=13; else if(strstr(filename,"dev_sd")!=NULL) find_device=14; else if(strstr(filename,"dev_ms")!=NULL) find_device=15; if(find_device!=-1) fdevices0|=(1<<find_device); } cellFsClosedir(dir_fd); #if (CELL_SDK_VERSION>0x210001) if ( ( (fdevices0>>13) & 1 ) && pfs_enabled) { sprintf(filename, "/pvd_usb000"); if (PfsmVolStat(0) == 0) fdevices0 |= 1 << 13; else fdevices0 &= ~(1 << 13); } else #endif fdevices0 &= ~(1 << 13); for(find_device=0;find_device<16;find_device++) { { if( (( (fdevices0>>find_device) & 1 ) ))// && ((forcedevices>>find_device) & 1)==0))// || find_device==0 { fdevices|= 1<<find_device; } else fdevices&= ~ (1<<find_device); } if(((fdevices>>find_device) & 1) && find_device!=11) { count_devices++; if(count_devices>14) fdevices&= ~ (1<<find_device); } // bdvd if(find_device==11) { if(((forcedevices>>find_device) & 1) || ((fdevices>>find_device) & 1)!=((fdevices_old>>find_device) & 1)) //fdevices!=fdevices_old || { c_opacity_delta=16; dimc=0; dim=1; dev_changed=1; if( ((fdevices>>11) & 1) && hide_bd==0) { sprintf(filename, "/dev_bdvd/PS3_GAME/PARAM.SFO"); bluray_game[0]=0; parse_param_sfo(filename, bluray_game, bluray_id, &bluray_pl); bluray_game[63]=0; sprintf(filename, "%s/%s_240.RAW", cache_dir, bluray_id); if(!exist(filename)) { sprintf(filename, "%s", "/dev_bdvd/PS3_GAME/PIC1.PNG"); cache_png(filename, bluray_id); } if(max_menu_list>=MAX_LIST) max_menu_list= MAX_LIST-1; sprintf(menu_list[max_menu_list].path, "/dev_bdvd"); memcpy(menu_list[max_menu_list].title, bluray_game, 63); sprintf(menu_list[max_menu_list].title_id, "%s", bluray_id); menu_list[max_menu_list].title[63]=0; menu_list[max_menu_list].flags=(1<<11); sprintf(menu_list[max_menu_list ].content, "%s", "PS3"); menu_list[max_menu_list].plevel=bluray_pl; menu_list[max_menu_list].user=0; menu_list[max_menu_list].split=0; if(!exist((char*) "/dev_bdvd/PS3_GAME/PARAM.SFO")) { menu_list[max_menu_list ].flags=(1<<11); sprintf(filename, "[Disc] Data Disc"); strncpy(menu_list[max_menu_list ].title, filename, 63); menu_list[max_menu_list ].title[63]=0; menu_list[max_menu_list ].cover=-1; sprintf(menu_list[max_menu_list ].path, "/dev_bdvd"); sprintf(menu_list[max_menu_list ].entry, "Data Disc"); sprintf(menu_list[max_menu_list ].content, "%s", "DATA"); sprintf(menu_list[max_menu_list ].title_id, "%s", "NO_ID"); } //check for PS2/DVD sprintf(filename, "/dev_bdvd/BDMV/index.bdmv"); if(exist(filename)) { menu_list[max_menu_list ].flags=(1<<11); sprintf(filename, "[BDMV] Blu-ray\xE2\x84\xA2 Video Disc"); strncpy(menu_list[max_menu_list ].title, filename, 63); menu_list[max_menu_list ].title[63]=0; menu_list[max_menu_list ].cover=-1; sprintf(menu_list[max_menu_list ].path, "/dev_bdvd"); sprintf(menu_list[max_menu_list ].entry, "[BDMV]"); sprintf(menu_list[max_menu_list ].content, "%s", "BDMV"); sprintf(menu_list[max_menu_list ].title_id, "%s", "NO_ID"); } sprintf(filename, "/dev_bdvd/SYSTEM.CNF"); if(!exist(filename)) sprintf(filename, "/dev_bdvd/system.cnf"); if(exist(filename)) { menu_list[max_menu_list ].flags=(1<<11); sprintf(filename, "[PS2] Disc"); strncpy(menu_list[max_menu_list ].title, filename, 63); menu_list[max_menu_list ].title[63]=0; menu_list[max_menu_list ].cover=-1; sprintf(menu_list[max_menu_list ].path, "/dev_bdvd"); sprintf(menu_list[max_menu_list ].entry, "PS2 Game"); sprintf(menu_list[max_menu_list ].content, "%s", "PS2"); sprintf(menu_list[max_menu_list ].title_id, "%s", "NO_ID"); } else { sprintf(filename, "/dev_bdvd/VIDEO_TS/VIDEO_TS.IFO"); if(exist(filename)) { menu_list[max_menu_list ].flags=(1<<11); sprintf(filename, "[DVD Video] Video Disc"); strncpy(menu_list[max_menu_list ].title, filename, 63); menu_list[max_menu_list ].title[63]=0; menu_list[max_menu_list ].cover=-1; sprintf(menu_list[max_menu_list ].path, "/dev_bdvd/VIDEO_TS"); sprintf(menu_list[max_menu_list ].entry, "DVD Video Disc"); sprintf(menu_list[max_menu_list ].content, "%s", "DVD"); sprintf(menu_list[max_menu_list ].title_id, "%s", "NO_ID"); } } max_menu_list++; } else { delete_entries(menu_list, &max_menu_list, (1<<11)); dev_removed=1; } sort_entries(menu_list, &max_menu_list ); old_fi=-1; game_last_page=-1; forcedevices &= ~ (1<<find_device); fdevices_old&= ~ (1<<find_device); fdevices_old|= fdevices & (1<<find_device); if(game_sel>max_menu_list-1) game_sel=max_menu_list-1; } } //end of bdrom disc else { //other devices if(((forcedevices>>find_device) & 1) || ((fdevices>>find_device) & 1)!=((fdevices_old>>find_device) & 1)) //fdevices!=fdevices_old || { if(to_restore) {if(cover_mode!=8) set_fm_stripes(); to_restore=0;} dev_changed=1; // game_sel=0; old_fi=-1; game_last_page=-1; state_read=1; first_left=0; first_right=0; state_draw=1; if(find_device==0) sprintf(filename, "%s", hdd_home); else { if(strstr (usb_home,"/")!=NULL) sprintf(filename, "/dev_usb00%c%s", 47+find_device, usb_home); else sprintf(filename, "/dev_usb00%c/%s", 47+find_device, usb_home); if(find_device==13 && !pfs_enabled) sprintf(filename, "/dev_none"); if(find_device==13 && pfs_enabled) sprintf(filename, "/pvd_usb000%s", usb_home); if(find_device==14) sprintf(filename, "/dev_sd%s", usb_home); if(find_device==15) sprintf(filename, "/dev_ms%s", usb_home); } if((fdevices>>find_device) & 1) { if(strstr (filename,"/dev_hdd")!=NULL){ if(is_reloaded && (strstr(hdd_home_2,"/dev_usb")!=NULL || strstr(hdd_home_3,"/dev_usb")!=NULL || strstr(hdd_home_4,"/dev_usb")!=NULL || strstr(hdd_home_5,"/dev_usb")!=NULL) ) {max_menu_list=0; is_reloaded=0;} fill_entries_from_device(filename, menu_list, &max_menu_list, (1<<find_device), 0); if(strstr (hdd_home_2,"/dev_")!=NULL) fill_entries_from_device(hdd_home_2, menu_list, &max_menu_list, (1<<find_device), 2); if(strstr (hdd_home_3,"/dev_")!=NULL) fill_entries_from_device(hdd_home_3, menu_list, &max_menu_list, (1<<find_device), 2); if(strstr (hdd_home_4,"/dev_")!=NULL) fill_entries_from_device(hdd_home_4, menu_list, &max_menu_list, (1<<find_device), 2); if(strstr (hdd_home_5,"/dev_")!=NULL) fill_entries_from_device(hdd_home_5, menu_list, &max_menu_list, (1<<find_device), 2); if(scan_for_apps==1) fill_entries_from_device((char*)"/dev_hdd0/game", menu_list, &max_menu_list, (1<<find_device), 2); } if(strstr (filename,"/dev_usb")!=NULL){ fill_entries_from_device(filename, menu_list, &max_menu_list, (1<<find_device), 0); sprintf(filename, "/dev_usb00%c%s", 47+find_device, usb_home_2); if(strstr (usb_home_2,"/")!=NULL && find_device!=0) fill_entries_from_device(filename, menu_list, &max_menu_list, (1<<find_device), 2); sprintf(filename, "/dev_usb00%c%s", 47+find_device, usb_home_3); if(strstr (usb_home_3,"/")!=NULL && find_device!=0) fill_entries_from_device(filename, menu_list, &max_menu_list, (1<<find_device), 2); sprintf(filename, "/dev_usb00%c%s", 47+find_device, usb_home_4); if(strstr (usb_home_4,"/")!=NULL && find_device!=0) fill_entries_from_device(filename, menu_list, &max_menu_list, (1<<find_device), 2); sprintf(filename, "/dev_usb00%c%s", 47+find_device, usb_home_5); if(strstr (usb_home_5,"/")!=NULL && find_device!=0) fill_entries_from_device(filename, menu_list, &max_menu_list, (1<<find_device), 2); } if(strstr (filename,"/dev_sd")!=NULL && exist((char*)"/dev_sd")) { fill_entries_from_device(filename, menu_list, &max_menu_list, (1<<find_device), 0); } if(strstr (filename,"/dev_ms")!=NULL && exist((char*)"/dev_ms")){ fill_entries_from_device(filename, menu_list, &max_menu_list, (1<<find_device), 0); } #if (CELL_SDK_VERSION>0x210001) if(strstr (filename,"/pvd_usb")!=NULL && pfs_enabled){ int fsVol=0; for(fsVol=0;fsVol<(max_usb_volumes);fsVol++) { if (PfsmVolStat(fsVol) == 0) { if(strstr (usb_home,"/")!=NULL) sprintf(filename, "/pvd_usb00%i%s", fsVol, usb_home); else sprintf(filename, "/pvd_usb00%i/%s", fsVol, usb_home); if(fsVol==0) fill_entries_from_device_pfs(filename, menu_list, &max_menu_list, (1<<find_device), 0); else fill_entries_from_device_pfs(filename, menu_list, &max_menu_list, (1<<find_device), 2); } } } #endif } else { delete_entries(menu_list, &max_menu_list, (1<<find_device)); dev_removed=1; } if(cover_mode<3 || cover_mode>5) draw_legend=1; forcedevices &= ~ (1<<find_device); fdevices_old&= ~ (1<<find_device); fdevices_old|= fdevices & (1<<find_device); if(game_sel>max_menu_list-1) game_sel=max_menu_list-1; } } } } is_game_loading=0; if(dev_changed){ if(!first_launch) { xmb_icon_last=xmb_icon; xmb_icon_last_first=xmb[xmb_icon].first; } sort_entries(menu_list, &max_menu_list ); if(cover_mode!=5 && cover_mode!=8 && !first_launch) load_texture(text_legend, legend, 1665); if(!first_launch) { if(dev_removed) { reset_xmb_checked(); xmb[6].init=0; xmb[7].init=0; if(cover_mode==8 || cover_mode==4) {init_xmb_icons(menu_list, max_menu_list, game_sel );} } else { reset_xmb(1); if(cover_mode==8 || cover_mode==4) {init_xmb_icons(menu_list, max_menu_list, game_sel );} } } dev_changed=0; dev_removed=0; c_opacity_delta=16; dimc=0; dim=1; b_box_opaq= 0xfe; b_box_step= -4; } if(first_launch) { sort_entries(menu_list, &max_menu_list ); sprintf(avchdBG, "%s/AVCHD.JPG",app_usrdir); load_texture(text_bmpUBG, avchdBG, 1920); if(cover_mode==3) load_texture(text_FONT, userBG, 1920); first_launch=0; if(cover_mode!=5) load_texture(text_legend, legend, 1665); else set_fm_stripes(); parse_last_state(); if(cover_mode==8 || cover_mode==4) { if(cover_mode==4) xmb[6].init=0; init_xmb_icons(menu_list, max_menu_list, game_sel ); if(xmb_icon_last!=6) { xmb_icon=xmb_icon_last; draw_xmb_icon_text(xmb_icon); if(xmb_icon==5 && xmb[5].init==0) add_video_column(); else if(xmb_icon==4 && xmb[4].init==0) add_music_column(); else if(xmb_icon==3 && xmb[3].init==0) add_photo_column(); else if(xmb_icon==8 && xmb[8].init==0) add_emulator_column(); else if(xmb_icon_last_first<xmb[xmb_icon].size) { xmb[xmb_icon].first=xmb_icon_last_first; xmb_icon_last_first=0;} } else if(xmb_icon_last_first<xmb[xmb_icon].size) { xmb[xmb_icon].first=xmb_icon_last_first; xmb_icon_last_first=0; xmb_icon_last=0; } if(cover_mode==4) load_coverflow_legend(); } } if(game_sel<0) game_sel=0; if(is_reloaded) {is_reloaded=0; //max_menu_list=reloaded_menu_list; //reload_fdevices=reload_fdevices&0xefff; //ignore bd disc 0000 0000 0000 //sprintf(string1, "fdevices=%8X fdevices_old=%8X reload_fdevices=%8X", fdevices, fdevices_old, reload_fdevices); dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, string1, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); fdevices_old=reload_fdevices; reload_fdevices=0; } force_reload: is_game_loading=0; //use_depth=(cover_mode!=8); if( (old_fi!=game_sel && game_sel>=0 && game_sel<max_menu_list && max_menu_list>0 && counter_png==0) || (cover_mode==1 && game_last_page!=int(game_sel/8)) || (cover_mode==7 && game_last_page!=int(game_sel/32)) ) { old_fi=game_sel; counter_png=10; if( (cover_mode!=1 && cover_mode!=7) || (cover_mode==1 && game_last_page!=int(game_sel/8)) || ( cover_mode==7 && game_last_page!=int(game_sel/32)) ) draw_legend=1; // if( ( (cover_mode!=1) || (cover_mode==1 && game_last_page!=int(game_sel/8))) || ( (cover_mode!=7) || (cover_mode==7 && game_last_page!=int(game_sel/32))) ) draw_legend=1; if(mode_list==0) { if(cover_mode==0 ) { if(strstr(menu_list[game_sel].path,"/pvd_usb")!=NULL && strstr(menu_list[game_sel].title_id, "NO_ID")==NULL) sprintf(filename, "%s/%s_320.PNG", cache_dir, menu_list[game_sel].title_id); else { sprintf(filename, "%s/PS3_GAME/ICON0.PNG", menu_list[game_sel].path); if(!exist(filename)) sprintf(filename, "%s/ICON0.PNG", menu_list[game_sel].path); } if(strstr(menu_list[game_sel].content,"PS2")!=NULL) sprintf(filename, "%s", ps2png); if(strstr(menu_list[game_sel].content,"DVD")!=NULL) sprintf(filename, "%s", dvdpng); if(!exist(filename)) sprintf(filename, "%s/HDAVCTN/BDMT_O1.jpg", menu_list[game_sel].path); if(!exist(filename)) sprintf(filename, "%s/BDMV/META/DL/HDAVCTN_O1.jpg", menu_list[game_sel].path); if(!exist(filename)) sprintf(filename, "%s", blankBG); offX=0; offY=0; draw_list_text( text_bmp, 1920, 1080, menu_list, max_menu_list, game_sel | (0x10000 * ((menu_list[0].flags & 2048)!=0)), dir_mode, display_mode, cover_mode, c_opacity, 1); sprintf(string1, "%s/%s_320.RAW", cache_dir, menu_list[game_sel].title_id); if(exist(string1)) { load_texture(text_bmpS, string1, 320); put_texture( text_bmp, text_bmpS, 320, 176, 320, 1440, 648, 2, 0xc0c0c080); } cover_available=0; if(strstr(menu_list[game_sel].content,"PS3")!=NULL) { sprintf(string1, "%s/%s.JPG", covers_dir, menu_list[game_sel].title_id); if(exist(string1)) { cover_available=1; goto fixed_cover_dm0; } else sprintf(string1, "%s/%s.PNG", covers_dir, menu_list[game_sel].title_id); if(exist(string1)) { cover_available=1; goto fixed_cover_dm0; } else { if((menu_list[game_sel].cover!=-1 && menu_list[game_sel].cover!=1)) { sprintf(string1, "%s/%s.JPG", covers_dir, menu_list[game_sel].title_id); download_cover(menu_list[game_sel].title_id, string1); } } if(exist(string1)) { cover_available=1; } else { sprintf(string1, "%s/NOID.JPG", app_usrdir); cover_available=1; } fixed_cover_dm0: if(cover_available) { load_texture(text_bmpS, string1, 320); put_texture( text_bmp, text_bmpS, 260, 300, 320, 1470, 300, 2, 0xc0c0c080); } } else { sprintf(string1, "%s/NOID.JPG", app_usrdir); load_texture(text_bmpS, string1, 320); put_texture( text_bmp, text_bmpS, 260, 300, 320, 1470, 300, 2, 0xc0c0c080); } load_texture(text_bmpS, filename, 320); if(menu_list[game_sel].title[0]=='_' || menu_list[game_sel].split) gray_texture(text_bmpS, 320, 320, 0); counter_png=10; } if(cover_mode==1 && int(game_sel/8)!=game_last_page) { legend_y=760; rnd=time(NULL)&0x03; sprintf(auraBG, "%s/AUR%i.JPG", app_usrdir, rnd); load_texture(text_bmp, auraBG, 1920); memcpy(text_FONT, text_bmp + (1920*4*legend_y), (1920*4*legend_h)); game_last_page=int(game_sel/8); last_selected=-1; int game_rel=0, c_x=0, c_y=0, c_game=0, game_rel2, alpha_cbox=1; int glo_box=0; game_rel2=int(game_sel/8)*8; sprintf(filename, "%s/CBOX4.PNG", app_usrdir); if(exist(filename)) {alpha_cbox=2; load_texture(text_FONT+1024*1024*1, filename, 349);} else { sprintf(filename, "%s/CBOX2.PNG", app_usrdir); if(!exist(filename)) {sprintf(filename, "%s/CBOX.PNG", app_usrdir); alpha_cbox=0;} load_texture(text_FONT+1024*1024*1, filename, 459); } sprintf(filename, "%s/GLC2.PNG", app_usrdir); if(exist(filename)) { load_texture(text_FONT+1024*1024*2, filename, 260); glo_box=1; } for (game_rel=game_rel2; (((game_rel-game_rel2)<8) && game_rel<max_menu_list); game_rel++) { cover_available=0; if(strstr(menu_list[game_rel].content,"PS3")!=NULL) { sprintf(filename, "%s/%s.JPG", covers_dir, menu_list[game_rel].title_id); if(exist(filename)) { cover_available=1; goto fixed_cover; } else sprintf(filename, "%s/%s.PNG", covers_dir, menu_list[game_rel].title_id); if(exist(filename)) { cover_available=1; goto fixed_cover; } else { if((menu_list[game_rel].cover!=-1 && menu_list[game_rel].cover!=1)) { sprintf(filename, "%s/%s.JPG", covers_dir, menu_list[game_rel].title_id); download_cover(menu_list[game_rel].title_id, filename); } } if(exist(filename)) { cover_available=1; goto fixed_cover; } else { //menu_list[game_rel].cover=-1; // if(strstr(menu_list[game_rel].path, "/pvd_usb")!=NULL) sprintf(filename, "%s/%s_320.PNG", cache_dir, menu_list[game_rel].title_id); //sprintf(filename, "%s", blankBG); // else // { // sprintf(filename, "%s/PS3_GAME/ICON0.PNG", menu_list[game_rel].path); if(!exist(filename)) sprintf(filename, "%s/ICON0.PNG", menu_list[game_rel].path); // } cover_available=0; } goto fixed_cover; } else //not a ps3 game { sprintf(filename, "%s/COVER.JPG", menu_list[game_rel].path); if(!exist(filename)) sprintf(filename, "%s/COVER.PNG", menu_list[game_rel].path); if(exist(filename)) { cover_available=1; goto fixed_cover; } if(strstr(menu_list[game_rel].content,"PS2")!=NULL) {sprintf(filename, "%s", ps2png); goto fixed_cover;} if(strstr(menu_list[game_rel].content,"DVD")!=NULL) {sprintf(filename, "%s", dvdpng); goto fixed_cover;} sprintf(filename, "%s/HDAVCTN/BDMT_O1.jpg", menu_list[game_rel].path); // if(!exist(filename)) sprintf(filename, "%s/BDMV/META/DL/HDAVCTN_O1.jpg", menu_list[game_rel].path); if(!exist(filename)) sprintf(filename, "%s", blankBG); fixed_cover: offX=0; offY=0; load_texture(text_bmpS, filename, 320); } c_game=game_rel-game_rel2; if(c_game<4) { c_y=64; c_x= 150 + (433*c_game); } else { c_y=430; c_x= 150 + (433*(c_game-4)); } if(menu_list[game_rel].title[0]=='_' || menu_list[game_rel].split) gray_texture(text_bmpS, 320, 320, 0); if(cover_available==0) put_texture( text_bmp, text_bmpS, 320, 176, 320, c_x, c_y+124, 3, 0x0080ff80); else { menu_list[game_rel].cover=1; if(alpha_cbox!=0) { if(alpha_cbox==1) put_texture_with_alpha( text_bmp, text_FONT+1024*1024*1+9420, 335, 351, 459, c_x+8, c_y-19, 0, 0); else put_texture_with_alpha( text_bmp, text_FONT+1024*1024, 349, 356, 349, c_x+1, c_y-26, 0, 0); } else put_texture_Galpha( text_bmp, 1920, 1080, text_FONT+1024*1024*1+9420, 335, 351, 459, c_x+8, c_y-19, 0, 0); put_texture( text_bmp, text_bmpS, 260, 300, 320, c_x+30, c_y, 0, 0x0080ff60); if(glo_box==1) put_texture_with_alpha( text_bmp, text_FONT+1024*1024*2, 260, 300, 260, c_x+30, c_y, 0, 0); } } counter_png=40; } if(cover_mode==3) { if(strstr(menu_list[game_sel].title_id, "NO_ID")==NULL) sprintf(filename, "%s/%s_1920.PNG", cache_dir, menu_list[game_sel].title_id); else sprintf(filename, "%s/PS3_GAME/PIC1.PNG", menu_list[game_sel].path); if(!exist(filename)) { sprintf(filename, "%s/PS3_GAME/PIC1.PNG", menu_list[game_sel].path); if(!exist(filename)) sprintf(filename, "%s/POSTER.JPG", menu_list[game_sel].path); if(!exist(filename)) sprintf(filename, "%s/POSTER.PNG", menu_list[game_sel].path); if(!exist(filename)) sprintf(filename, "%s", avchdBG); else if(strstr(filename, "POSTER")==NULL) //strstr (filename,"/dev_hdd0/")==NULL && { sprintf(string1, "%s", filename); sprintf(filename, "%s/%s_1920.PNG", cache_dir, menu_list[game_sel].title_id); if(!exist(filename)) {cache_png(string1, menu_list[game_sel].title_id); load_texture(text_FONT, userBG, 1920);} } } offX=-1543; offY=0; if(!exist(filename)) { sprintf(filename, "%s", avchdBG); offX=0; } if(strstr (filename,"AVCHD.JPG")!=NULL) offX=0; if(game_bg_overlay==1) { load_texture(text_bmp, filename, 1920); if(menu_list[game_sel].title[0]=='_' || menu_list[game_sel].split) gray_texture(text_bmp, 1920, 1080, 0); } cover_available=0; sprintf(filename, "%s/%s.PNG", covers_dir, menu_list[game_sel].title_id); if(!exist(filename)) sprintf(filename, "%s/%s.JPG", covers_dir, menu_list[game_sel].title_id); if(!exist(filename) && menu_list[game_sel].cover!=-1 && menu_list[game_sel].cover!=1) {download_cover(menu_list[game_sel].title_id, filename);} if(exist(filename)) { cover_available=1; load_texture(text_bmpS, filename, 320); if(menu_list[game_sel].title[0]=='_' || menu_list[game_sel].split) gray_texture(text_bmpS, 320, 320, 0); } if(cover_available==0){ sprintf(filename, "%s/COVER.JPG", menu_list[game_sel].path); if(!exist(filename)) sprintf(filename, "%s/COVER.PNG", menu_list[game_sel].path); if(!exist(filename)) sprintf(filename, "%s/NOID.JPG", app_usrdir); if(exist(filename)) { cover_available=1; load_texture(text_bmpS, filename, 320); if(menu_list[game_sel].title[0]=='_' || menu_list[game_sel].split) gray_texture(text_bmpS, 320, 320, 0); } load_texture(text_FONT, userBG, 1920); } counter_png=40; } if(cover_mode==2) { cover_available=0; if(strstr(menu_list[game_sel].content,"PS2")!=NULL || strstr(menu_list[game_sel].content,"DVD")!=NULL) { sprintf(filename, "%s", avchdBG); goto DM2_load_textB; } if(strstr(menu_list[game_sel].content,"PS3")!=NULL) sprintf(filename, "%s/PS3_GAME/PIC1.PNG", menu_list[game_sel].path); else sprintf(filename, "%s/POSTER.JPG", menu_list[game_sel].path); if(strstr(menu_list[game_sel].content,"PS3")==NULL) { if(!exist(filename) && strstr(menu_list[game_sel].path,"/pvd_usb")==NULL) sprintf(filename, "%s", avchdBG); } else { sprintf(string1, "%s/PS3_GAME/PIC1.PNG", menu_list[game_sel].path); if(strstr(filename, "POSTER")==NULL) { //strstr (filename,"/dev_hdd0/")==NULL && sprintf(filename, "%s/%s_1920.PNG", cache_dir, menu_list[game_sel].title_id); if(!exist(filename)) cache_png(string1, menu_list[game_sel].title_id); if(!exist(filename)) {sprintf(filename, "%s", avchdBG);} } } DM2_load_textB: load_texture(text_bmp, filename, 1920); draw_list_text( text_bmp, 1920, 1080, menu_list, max_menu_list, game_sel | (0x10000 * ((menu_list[0].flags & 2048)!=0)), dir_mode, display_mode, cover_mode, c_opacity, 1); if(strstr(menu_list[game_sel].content,"PS2")!=NULL) {sprintf(filename, "%s", ps2png); goto DM2_load_text;} if(strstr(menu_list[game_sel].content,"DVD")!=NULL) { cover_available=1; sprintf(filename, "%s/COVER.JPG", menu_list[game_sel].path); if(!exist(filename)) sprintf(filename, "%s/COVER.PNG", menu_list[game_sel].path); if(!exist(filename)) {sprintf(filename, "%s", dvdpng); cover_available=0; } goto DM2_load_text; } if(strstr(menu_list[game_sel].content,"PS3")!=NULL) { sprintf(filename, "%s/%s.JPG", covers_dir, menu_list[game_sel].title_id); if(!exist(filename)) sprintf(filename, "%s/%s.PNG", covers_dir, menu_list[game_sel].title_id); else { cover_available=1; goto DM2_load_text; } if(!exist(filename)) { if(menu_list[game_sel].cover!=-1 && menu_list[game_sel].cover!=1) { sprintf(filename, "%s/%s.JPG", covers_dir, menu_list[game_sel].title_id); download_cover(menu_list[game_sel].title_id, filename); if(exist(filename)) cover_available=1; else { sprintf(filename, "%s/%s_320.PNG", cache_dir, menu_list[game_sel].title_id); if(!exist(filename)) sprintf(filename, "%s/ICON0.PNG", menu_list[game_sel].path); } } else { sprintf(filename, "%s/%s_320.PNG", cache_dir, menu_list[game_sel].title_id); if(!exist(filename)) sprintf(filename, "%s/ICON0.PNG", menu_list[game_sel].path); } } else cover_available=1; goto DM2_load_text; } sprintf(filename, "%s/HDAVCTN/BDMT_O1.jpg", menu_list[game_sel].path); if(!exist(filename)) sprintf(filename, "%s/BDMV/META/DL/HDAVCTN_O1.jpg", menu_list[game_sel].path); sprintf(string1, "%s/COVER.JPG", menu_list[game_sel].path); if(!exist(string1)) sprintf(string1, "%s/COVER.PNG", menu_list[game_sel].path); if(exist(string1)) { cover_available=1; sprintf(filename,"%s",string1); } else { //menu_list[game_sel].cover=-1; cover_available=1; sprintf(filename, "%s/NOID.JPG", app_usrdir); } if(!exist(filename)) sprintf(filename, "%s", blankBG); DM2_load_text: load_texture(text_bmpS, filename, 320); if(menu_list[game_sel].title[0]=='_' || menu_list[game_sel].split) gray_texture(text_bmpS, 320, 320, 0); counter_png=40; } if(cover_mode==6) { int a_offset=40, alpha_cbox=1, alpha_gbox=1; legend_y=170; sprintf(auraBG, "%s/AUR%i.JPG", app_usrdir, 4); load_texture(text_bmp, auraBG, 1920); if(game_last_page==-1) memcpy(text_FONT, text_bmp + (1920*4*legend_y), (1920*4*legend_h)); last_selected=-1; int game_rel=0, game_rel2;//, c_x=0, c_y=0, c_game=0; game_rel2=int(game_sel/8)*8; game_rel=game_sel; sprintf(filename, "%s/CBOX2.PNG", app_usrdir); if(!exist(filename)) {sprintf(filename, "%s/CBOX.PNG", app_usrdir); alpha_cbox=0;} load_texture(text_FONT+1024*1024*1, filename, 459); sprintf(filename, "%s/GBOX2.PNG", app_usrdir); if(!exist(filename)) {sprintf(filename, "%s/GBOX.PNG", app_usrdir); alpha_gbox=0;} load_texture(text_FONT+1024*1024*2, filename, 717); game_last_page=int(game_sel/8); if(alpha_cbox) put_texture_with_alpha( text_bmp, text_FONT+1024*1024*1, 459, 356, 459, 353, 360-a_offset, 0, 0); else put_texture_Galpha( text_bmp, 1920, 1080, text_FONT+1024*1024*1, 459, 356, 459, 353, 360-a_offset, 0, 0); if(alpha_gbox) put_texture_with_alpha( text_bmp, text_FONT+1024*1024*2, 717, 473, 717, 1112, 302-a_offset, 0, 0); else put_texture_Galpha( text_bmp, 1920, 1080, text_FONT+1024*1024*2, 717, 473, 717, 1112, 302-a_offset, 0, 0); sprintf(filename, "%s/%s_640.RAW", cache_dir, menu_list[game_sel].title_id); load_texture(text_FONT+3453716, filename, 640); put_texture( text_bmp, text_FONT+3453716, 640, 360, 640, 1148, 372-a_offset, 0, 0x0080ff80); put_reflection( text_bmp, 1920, 1080, 654, 437, 1142, 322-a_offset, 1142, 756-a_offset, 3); if(game_sel>0) { sprintf(filename, "%s/%s_240.RAW", cache_dir, menu_list[game_sel-1].title_id); load_texture(text_FONT+3453716, filename, 240); put_texture( text_bmp, text_FONT+3453716, 240, 135, 240, 110, 473-a_offset, 2, 0x0080ff80); } if(game_sel>1) { sprintf(filename, "%s/%s_160.RAW", cache_dir, menu_list[game_sel-2].title_id); load_texture(text_FONT+3453716, filename, 160); put_texture( text_bmp, text_FONT+3453716, 160, 90, 160, 110, 630-a_offset, 1, 0x0080ff80); } if(game_sel>2) { sprintf(filename, "%s/%s_80.RAW", cache_dir, menu_list[game_sel-3].title_id); load_texture(text_FONT+3453716, filename, 80); put_texture( text_bmp, text_FONT+3453716, 80, 45, 80, 110, 742-a_offset, 1, 0x0080ff80); } if(game_sel<max_menu_list-1) { sprintf(filename, "%s/%s_240.RAW", cache_dir, menu_list[game_sel+1].title_id); load_texture(text_FONT+3453716, filename, 240); put_texture( text_bmp, text_FONT+3453716, 240, 135, 240, 810, 473-a_offset, 2, 0x0080ff80); } if(game_sel<max_menu_list-2) { sprintf(filename, "%s/%s_160.RAW", cache_dir, menu_list[game_sel+2].title_id); load_texture(text_FONT+3453716, filename, 160); put_texture( text_bmp, text_FONT+3453716, 160, 90, 160, 890, 630-a_offset, 1, 0x0080ff80); } if(game_sel<max_menu_list-3) { sprintf(filename, "%s/%s_80.RAW", cache_dir, menu_list[game_sel+3].title_id); load_texture(text_FONT+3453716, filename, 80); put_texture( text_bmp, text_FONT+3453716, 80, 45, 80, 970, 742-a_offset, 1, 0x0080ff80); } { cover_available=0; if(strstr(menu_list[game_rel].content,"PS3")!=NULL) { sprintf(filename, "%s/%s.JPG", covers_dir, menu_list[game_rel].title_id); if(exist(filename)) { cover_available=1; goto fixed_cover6; } else sprintf(filename, "%s/%s.PNG", covers_dir, menu_list[game_rel].title_id); if(exist(filename)) { cover_available=1; goto fixed_cover6; } else { if((menu_list[game_rel].cover!=-1 && menu_list[game_rel].cover!=1)) { sprintf(filename, "%s/%s.JPG", covers_dir, menu_list[game_rel].title_id); download_cover(menu_list[game_rel].title_id, filename); } } if(exist(filename)) { cover_available=1; goto fixed_cover6; } else { //menu_list[game_rel].cover=-1; // if(strstr(menu_list[game_rel].path, "/pvd_usb")!=NULL) sprintf(filename, "%s/%s_320.PNG", cache_dir, menu_list[game_rel].title_id); //sprintf(filename, "%s", blankBG); // else // { // sprintf(filename, "%s/PS3_GAME/ICON0.PNG", menu_list[game_rel].path); if(!exist(filename)) sprintf(filename, "%s/ICON0.PNG", menu_list[game_rel].path); // } cover_available=0; } goto fixed_cover6; } else //not a ps3 game { if(strstr(menu_list[game_rel].content,"PS2")!=NULL) {sprintf(filename, "%s", ps2png); goto fixed_cover6;} if(strstr(menu_list[game_rel].content,"DVD")!=NULL) { sprintf(filename, "%s/COVER.JPG", menu_list[game_rel].path); if(!exist(filename) ) sprintf(filename, "%s/COVER.PNG", menu_list[game_rel].path); if(exist(filename)) { cover_available=1; goto fixed_cover6; } cover_available=0; sprintf(filename, "%s", dvdpng); goto fixed_cover6; } sprintf(filename, "%s/COVER.JPG", menu_list[game_rel].path); if(!exist(filename) ) sprintf(filename, "%s/COVER.PNG", menu_list[game_rel].path); if(exist(filename)) { cover_available=1; goto fixed_cover6; } sprintf(filename, "%s/HDAVCTN/BDMT_O1.jpg", menu_list[game_rel].path); // if(!exist(filename)) sprintf(filename, "%s/BDMV/META/DL/HDAVCTN_O1.jpg", menu_list[game_rel].path); if(!exist(filename)) sprintf(filename, "%s", blankBG); fixed_cover6: offX=0; offY=0; if(cover_available==0) { memset(text_bmpS, 0x00, 409600); load_texture(text_bmpS+79360, filename, 320); } else load_texture(text_bmpS, filename, 320); } if(menu_list[game_rel].title[0]=='_' || menu_list[game_rel].split) gray_texture(text_bmpS, 320, 320, 0); if(cover_available==0) // put_texture( text_bmp, text_bmpS+120, 260, 176, 320, 435, 446-a_offset, 0, 0x0080ff60); put_texture( text_bmp, text_bmpS+120, 260, 300, 320, 435, 384-a_offset, 0, 0x0080ff60); else { menu_list[game_rel].cover=1; put_texture( text_bmp, text_bmpS, 260, 300, 320, 435, 384-a_offset, 0, 0x0080ff60); } put_reflection( text_bmp, 1920, 1080, 302, 332, 429, 378-a_offset, 429, 707-a_offset, 2); } counter_png=20; } if(cover_mode==7 && int(game_sel/32)!=game_last_page) { legend_y=760; //rnd=time(NULL)&0x03; sprintf(auraBG, "%s/AUR5.JPG", app_usrdir); load_texture(text_bmp, auraBG, 1920); ClearSurface(); set_texture( text_bmp, 1920, 1080); //PIC1.PNG display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); flip(); // gray_texture(text_bmp, 1920, 1080); // if(game_last_page==-1) memcpy(text_FONT, text_bmp + (1920*4*legend_y), (1920*4*legend_h)); game_last_page=int(game_sel/32); last_selected=-1; int game_rel=0, c_x=0, c_y=0, c_game=0, game_rel2; game_rel2=int(game_sel/32)*32; int glo_box=0; sprintf(filename, "%s/SBOX.PNG", app_usrdir); load_texture(text_FONT+1024*1024*7, filename, 432); mip_texture( text_FONT+1024*1024*1, text_FONT+1024*1024*7, 432, 366, -2); // -> 216x183 sprintf(filename, "%s/GLC3.PNG", app_usrdir); if(exist(filename)) { load_texture(text_FONT+1024*1024*7, filename, 130); glo_box=1; } for (game_rel=game_rel2; (((game_rel-game_rel2)<32) && game_rel<max_menu_list); game_rel++) { cover_available=0; if(strstr(menu_list[game_rel].content,"PS3")!=NULL) { sprintf(filename, "%s/%s.JPG", covers_dir, menu_list[game_rel].title_id); if(exist(filename)) { cover_available=1; goto fixed_cover_7; } else sprintf(filename, "%s/%s.PNG", covers_dir, menu_list[game_rel].title_id); if(exist(filename)) { cover_available=1; goto fixed_cover_7; } else { if((menu_list[game_rel].cover!=-1 && menu_list[game_rel].cover!=1)) { sprintf(filename, "%s/%s.JPG", covers_dir, menu_list[game_rel].title_id); download_cover(menu_list[game_rel].title_id, filename); } } if(exist(filename)) { cover_available=1; goto fixed_cover_7; } else { //menu_list[game_rel].cover=-1; if(strstr(menu_list[game_rel].path, "/pvd_usb")!=NULL) sprintf(filename, "%s/%s_320.PNG", cache_dir, menu_list[game_rel].title_id); //sprintf(filename, "%s", blankBG); else { // sprintf(filename, "%s/PS3_GAME/ICON0.PNG", menu_list[game_rel].path); sprintf(filename, "%s/NOID.JPG", app_usrdir); cover_available=1; goto fixed_cover_7; // if(!exist(filename)) sprintf(filename, "%s/ICON0.PNG", menu_list[game_rel].path); } cover_available=0; } goto fixed_cover_7; } else //not a ps3 game { if(strstr(menu_list[game_rel].content,"PS2")!=NULL) {sprintf(filename, "%s", ps2png); goto fixed_cover_7;} if(strstr(menu_list[game_rel].content,"DVD")!=NULL) { sprintf(filename, "%s/COVER.JPG", menu_list[game_rel].path); if(!exist(filename)) sprintf(filename, "%s/COVER.PNG", menu_list[game_rel].path); if(exist(filename)) { cover_available=1; goto fixed_cover_7; } cover_available=0; sprintf(filename, "%s", dvdpng); goto fixed_cover_7; } sprintf(filename, "%s/COVER.JPG", menu_list[game_rel].path); if(!exist(filename) ) sprintf(filename, "%s/COVER.PNG", menu_list[game_rel].path); if(exist(filename)) { cover_available=1; goto fixed_cover_7; } sprintf(filename, "%s/HDAVCTN/BDMT_O1.jpg", menu_list[game_rel].path); // if(!exist(filename)) sprintf(filename, "%s/BDMV/META/DL/HDAVCTN_O1.jpg", menu_list[game_rel].path); if(!exist(filename)) sprintf(filename, "%s", blankBG); fixed_cover_7: offX=0; offY=0; load_texture(text_FONT+1024*1024*6, filename, 320); mip_texture( text_FONT+1024*1024*5, text_FONT+1024*1024*6, 320, 300, -2); } c_game=game_rel-game_rel2; if(c_game<8) { c_y=62; c_x= 118 + (int)(216.5f*c_game); } if(c_game>7 && c_game<16) { c_y=240; c_x= 118 + (int)(216.5f*(c_game-8)); } if(c_game>15 && c_game<24) { c_y=418; c_x= 118 + (int)(216.5f*(c_game-16)); } if(c_game>23 && c_game<32) { c_y=596; c_x= 118 + (int)(216.5f*(c_game-24)); } if(menu_list[game_rel].title[0]=='_' || menu_list[game_rel].split) gray_texture(text_FONT+1024*1024*5, 160, 160, 0); if(cover_available==0) put_texture( text_bmp, text_FONT+1024*1024*5, 160, 88, 160, c_x+7, c_y+62, 2, 0x0080ff80); else { menu_list[game_rel].cover=1; // put_texture_Galpha( text_bmp, 1920, 1080, text_FONT+1024*1024*1, 168, 174, 230, c_x+4, c_y-10, 0, 0); put_texture_with_alpha( text_bmp, text_FONT+1024*1024*1, 216, 183, 216, c_x-28, c_y-16, 0, 0); put_texture( text_bmp, text_FONT+1024*1024*5, 130, 150, 160, c_x+15, c_y, 0, 0x0080ff60); if(glo_box==1) put_texture_with_alpha( text_bmp, text_FONT+1024*1024*7, 130, 150, 130, c_x+15, c_y, 0, 0); } } counter_png=40; } //mode7 } } if(counter_png) counter_png--; if ((old_pad & BUTTON_START) && (new_pad & BUTTON_TRIANGLE)){ switch_ntfs: new_pad=0; if(!pfs_enabled) { dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_yes_no, (const char*) STR_ATT_USB2, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) { pfs_mode(1); dialog_ret=0; cellMsgDialogOpen2( type_dialog_no, (const char*) STR_PLEASE_WAIT, dialog_fun2, (void*)0x0000aaab, NULL ); flipc(60); sys_timer_usleep(6000*1000); cellMsgDialogAbort(); forcedevices=0xFFFE; goto start_of_loop; } } else { pfs_mode(0); dialog_ret=0; cellMsgDialogOpen2( type_dialog_no, (const char*) STR_PLEASE_WAIT, dialog_fun2, (void*)0x0000aaab, NULL ); flipc(60); sys_timer_usleep(6000*1000); cellMsgDialogAbort(); forcedevices=0xFFFE; goto start_of_loop; } } if ( ((old_pad & BUTTON_START) && (new_pad & BUTTON_R2))) { new_pad=0; time ( &rawtime ); timeinfo = localtime ( &rawtime ); char video_mem[64]; sprintf(video_mem, "/dev_hdd0/%04d%02d%02d-%02d%02d%02d-SCREENSHOT.RAW", timeinfo->tm_year+1900, timeinfo->tm_mon+1, timeinfo->tm_mday, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); FILE *fpA; remove(video_mem); fpA = fopen ( video_mem, "wb" ); uint64_t c_pos=0; for(c_pos=0;c_pos<video_buffer;c_pos+=4){ fwrite((uint8_t*)(color_base_addr)+c_pos+1, 3, 1, fpA); } fclose(fpA); if(exist((char*)"/dev_usb000")){ sprintf(string1, "/dev_usb000/%s", video_mem+10); file_copy(video_mem, string1, 0); remove(video_mem); sprintf(video_mem, "%s", string1); } else if(exist((char*)"/dev_usb001")){ sprintf(string1, "/dev_usb001/%s", video_mem+10); file_copy(video_mem, string1, 0); remove(video_mem); sprintf(video_mem, "%s", string1); } sprintf(string1, "Screenshot successfully saved as:\n\n[%s]", video_mem); dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, string1, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } if ((old_pad & BUTTON_START) && (new_pad & BUTTON_SQUARE)){ new_pad=0; stop_mp3(5); } if ((old_pad & BUTTON_START) && (new_pad & BUTTON_RIGHT)){ //next song new_pad=0; next_mp3(); } if ((old_pad & BUTTON_START) && (new_pad & BUTTON_LEFT)){ //prev song new_pad=0; prev_mp3(); } if ((new_pad & BUTTON_PAUSE)) { update_ms=!update_ms; xmb_info_drawn=0; } if ((old_pad & BUTTON_START) && ( (new_pad & BUTTON_DOWN) || (new_pad & BUTTON_UP)) && multiStreamStarted==1) { //mp3 volume if((new_pad & BUTTON_UP)) mp3_volume+=0.05f; else mp3_volume-=0.05f; if(mp3_volume<0.0f) mp3_volume=0.0f; new_pad=0; set_channel_vol(nChannel, mp3_volume, 0.1f); xmb_info_drawn=0; } /*if ((old_pad & BUTTON_START) && ( (new_pad & BUTTON_L1) || (new_pad & BUTTON_R1))) { if((new_pad & BUTTON_L1)) mp3_skip-=1.0f; if(mp3_skip<0) mp3_skip=0.f; else mp3_skip+=1.f; main_mp3_th(force_mp3_file, mp3_skip); new_pad=0; }*/ if (((old_pad & BUTTON_SELECT) && (new_pad & BUTTON_CIRCLE)) && cover_mode!=5 && (cover_mode!=8 || (cover_mode==8 && (xmb_icon==6 || xmb_icon==7))) ) { rename_title: new_pad=0; xmb_bg_show=0; xmb_bg_counter=200; if((strstr(menu_list[game_sel].path, "/dev_hdd0")!=NULL || strstr(menu_list[game_sel].path, "/dev_usb")!=NULL) && strstr(menu_list[game_sel].content, "PS3")!=NULL) { c_opacity_delta=16; dimc=0; dim=1; OutputInfo.result = CELL_OSKDIALOG_INPUT_FIELD_RESULT_OK; OutputInfo.numCharsResultString = 64; OutputInfo.pResultString = Result_Text_Buffer; open_osk(4, (menu_list[game_sel].title[0]=='_' ? menu_list[game_sel].title+1 : menu_list[game_sel].title) ); if(cover_mode!=8) { sprintf(filename, "%s/%s_1920.PNG", cache_dir, menu_list[game_sel].title_id); if(!exist(filename)) sprintf(filename, "%s", avchdBG); load_texture( text_FONT, filename, 1920);// gray_texture(text_FONT, 1920, 1080); max_ttf_label=0; sprintf(string1, "::: %s :::", (menu_list[game_sel].title[0]=='_' ? menu_list[game_sel].title+1 : menu_list[game_sel].title)); print_label_ex( 0.5f, 0.10f, 1.0f, 0xffffffff, string1, 1.04f, 0.0f, 1, 1.0f, 1.0f, 1); flush_ttf(text_FONT, 1920, 1080); max_ttf_label=0; sprintf(string1, "%s", "Enter new game title:"); print_label_ex( 0.5f, 0.20f, 1.2f, 0xffffffff, string1, 1.00f, 0.0f, 2, 1.0f, 1.0f, 1); flush_ttf(text_FONT, 1920, 1080); } while(1){ { ClearSurface(); if(cover_mode!=8) {set_texture( text_FONT, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); } else draw_whole_xmb(0); setRenderColor(); flip(); } if(osk_dialog==1 || osk_dialog==-1) break; } osk_open=0; if(osk_dialog!=0) { char pin_result[128]; wchar_t *pin_result2; pin_result2 = (wchar_t*)OutputInfo.pResultString; wcstombs(pin_result, pin_result2, 64); if(strlen(pin_result)>1) { u8 n; for(n=0; n<(strlen(pin_result)-3); n++) { // (TM) = E2 84 A2 | 28 54 4D 29 if(pin_result[n]==0x28 && (pin_result[n+1]==0x54 || pin_result[n+1]==0x74) && (pin_result[n+2]==0x4D || pin_result[n+2]==0x6D) && pin_result[n+3]==0x29) { pin_result[n] =0xE2; pin_result[n+1]=0x84; pin_result[n+2]=0xA2; // pin_result[n+3]=0x20; strncpy(pin_result+n+3, pin_result+n+4, strlen(pin_result)-n-4); pin_result[strlen(pin_result)-1]=0; } } for(n=0; n<(strlen(pin_result)-2); n++) { // (R) = C2 AE | 28 52 29 if(pin_result[n]==0x28 && (pin_result[n+1]==0x52 || pin_result[n+1]==0x72) && pin_result[n+2]==0x29) { pin_result[n] =0xC2; pin_result[n+1]=0xAE; strncpy(pin_result+n+2, pin_result+n+3, strlen(pin_result)-n-3); pin_result[strlen(pin_result)-1]=0; } } for(n=0; n<(strlen(pin_result)-2); n++) { // (C) = C2 A9 | 28 63 29 if(pin_result[n]==0x28 && (pin_result[n+1]==0x43 || pin_result[n+1]==0x63) && pin_result[n+2]==0x29) { pin_result[n] =0xC2; pin_result[n+1]=0xA9; strncpy(pin_result+n+2, pin_result+n+3, strlen(pin_result)-n-3); pin_result[strlen(pin_result)-1]=0; } } sprintf(filename, "%s/PS3_GAME/PARAM.SFO", menu_list[game_sel].path); if(!exist(filename)) sprintf(filename, "%s/PARAM.SFO", menu_list[game_sel].path); change_param_sfo_field( filename, (char*)"TITLE", pin_result); sprintf(menu_list[game_sel].title, "%s", pin_result); } } if(cover_mode==3) load_texture(text_FONT, userBG, 1920); if(cover_mode==8) {xmb[6].init=0; xmb[7].init=0; init_xmb_icons(menu_list, max_menu_list, game_sel );} game_last_page=-1; old_fi=-1; goto force_reload; } } if ((old_pad & BUTTON_SELECT) && (new_pad & BUTTON_R1)){ new_pad=0; c_opacity_delta=16; dimc=0; dim=1; display_mode++; if(display_mode>2) display_mode=0; if(cover_mode==8) redraw_column_texts(xmb_icon); old_fi=-1; counter_png=0; forcedevices=0xFFFF; max_menu_list=0; game_last_page=-1; goto start_of_loop; } if ( (new_pad & BUTTON_R1) && (lock_display_mode==-1) ) {// && cover_mode!=5 next_for_FM: c_opacity_delta=16; dimc=0; dim=1; if(cover_mode==3) {slide_screen_left(text_FONT); load_texture(text_bmpUPSR, playBGR, 1920);} else if(cover_mode==4 || cover_mode==5) slide_screen_left(text_bmpUPSR); else slide_screen_left(text_bmp); last_cover_mode=cover_mode; if(cover_mode==5) { load_texture(text_bmpUPSR, playBGR, 1920); if(lock_display_mode!=-1) cover_mode=lock_display_mode-1; } cover_mode++; if(cover_mode==5) cover_mode++; c_opacity=0xff; c_opacity2=0xff; game_last_page=-1; game_sel_last=game_sel; new_pad=0; state_read=1; state_draw=1; if(cover_mode>8) {cover_mode=0;} if(cover_mode==3) load_texture(text_FONT, userBG, 1920); if(cover_mode==5) set_fm_stripes(); if(cover_mode<3 || cover_mode>5) load_texture(text_legend, legend, 1665);//&& last_cover_mode>2) if(cover_mode==8 || cover_mode==4) {xmb[6].init=0; xmb[7].init=0; init_xmb_icons(menu_list, max_menu_list, game_sel );} old_fi=-1; counter_png=0; goto force_reload; } if ( (old_pad & BUTTON_SELECT) && (new_pad & BUTTON_START)) { if(cover_mode==5) { new_pad=0; goto from_fm; } open_file_manager: state_draw=1; c_opacity=0xff; c_opacity2=0xff; if(!lock_fileman) { if(cover_mode!=5) last_cover_mode=cover_mode; cover_mode=5; counter_png=0; state_read=1; state_draw=1; memset(text_bmpUPSR, 0, 8294400); set_fm_stripes(); old_fi=-1; goto skip_to_FM; } } if ( ((new_pad & BUTTON_L1) || ((old_pad & BUTTON_SELECT) && ( (new_pad & BUTTON_L1) || (new_pad & BUTTON_START) )) ) && (lock_display_mode==-1 || cover_mode==5) ) { c_opacity_delta=16; dimc=0; dim=1; if(cover_mode==3) slide_screen_right(text_FONT); else if(cover_mode==4 || cover_mode==5) slide_screen_right(text_bmpUPSR); else slide_screen_right(text_bmp); from_fm: if(cover_mode==5 || cover_mode==6) { load_texture(text_bmpUPSR, playBGR, 1920); load_texture(text_legend, legend, 1665); sprintf(auraBG, "%s/AUR5.JPG", app_usrdir); load_texture(text_bmp, auraBG, 1920); game_last_page=-1; if((old_pad & BUTTON_SELECT)) { if(last_cover_mode==5) cover_mode--; else cover_mode=last_cover_mode; } else { last_cover_mode=cover_mode; cover_mode--; } } else { last_cover_mode=cover_mode; cover_mode--; game_last_page=-1; } if(cover_mode==5) cover_mode--; if(lock_display_mode!=-1) cover_mode=lock_display_mode; game_sel_last=game_sel; state_read=1; state_draw=1; new_pad=0; c_opacity=0xff; c_opacity2=0xff; if(cover_mode<0) {cover_mode=8;} if(cover_mode==3) load_texture(text_FONT, userBG, 1920); if(cover_mode==5) set_fm_stripes(); if((cover_mode<3 || cover_mode>5) && last_cover_mode>2) load_texture(text_legend, legend, 1665); if(cover_mode==8 || cover_mode==4) {xmb[6].init=0; xmb[7].init=0; init_xmb_icons(menu_list, max_menu_list, game_sel );} old_fi=-1; counter_png=0; goto force_reload; } if ( (old_pad & BUTTON_START) && (new_pad & BUTTON_SELECT)) { char reload_self[128]; //new_pad=0; old_pad=0; sprintf(reload_self, "%s/RELOAD.SELF", app_usrdir); if(exist(reload_self) && net_used_ignore()) { cellMsgDialogAbort(); dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_no, (const char*) STR_RESTART, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1){ unload_modules(); sys_game_process_exitspawn2((char*) reload_self, NULL, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } } } if (( (old_pad & BUTTON_L2) && (old_pad & BUTTON_R2)) || (ss_timer>=(ss_timeout*60) && ss_timeout) || www_running) screen_saver(); if(force_update_check==1) {check_for_update(); force_update_check=0;} if(cover_mode==5) {goto skip_to_FM;} skip_find_device: is_game_loading=0; if(read_pad_info()) goto force_reload; if ((old_pad & BUTTON_SELECT) && (new_pad & BUTTON_L3)){ reset_xmb(1); refresh_list: new_pad=0; is_reloaded=0; //sys_timer_usleep(1*1000*1000); c_opacity_delta=16; dimc=0; dim=1; old_fi=-1; counter_png=0; forcedevices=0xFFFF; max_menu_list=0; //if(cover_mode==8) reset_xmb(1); goto start_of_loop; } if ( new_pad & BUTTON_L3){ dir_mode++; new_pad=0; if(dir_mode>2) dir_mode=0; if(cover_mode==8) redraw_column_texts(xmb_icon); old_fi=-1; counter_png=0; c_opacity_delta=16; dimc=0; dim=1; goto force_reload; } if ( (new_pad & BUTTON_R3)) { new_pad=0;//new_pad=0; user_font++; if (user_font>9) user_font=0; if(cover_mode==8) redraw_column_texts(xmb_icon); old_fi=-1; counter_png=0; game_last_page=-1; goto force_reload; } if ( (old_pad & BUTTON_START) && (new_pad & BUTTON_R3)){ new_pad=0; update_title: if(strstr(menu_list[game_sel].content, "PS3")!=NULL) check_for_game_update(menu_list[game_sel].title_id, menu_list[game_sel].title); } if ( (new_pad & BUTTON_TRIANGLE) && cover_mode!=8) { if(cover_mode==4) { sprintf(auraBG, "%s/AUR5.JPG", app_usrdir); load_texture(text_bmp, auraBG, 1920);} int ret_f=open_mm_submenu(text_bmp);//, &game_sel); if(ret_f) {slide_screen_left(text_FONT);memset(text_bmp, 0, FB(1));} if(cover_mode==8 || ret_f==11) { load_texture(text_FMS, xmbicons, 128); load_texture(xmb_icon_retro, xmbicons2, 128); memset(text_bmp, 0, 8294400); load_texture(text_bmp, xmbbg, 1920); if(ret_f==11) {cover_mode=8; xmb_icon=2; init_xmb_icons(menu_list, max_menu_list, game_sel ); } } if(cover_mode==4) {load_texture(text_legend, legend, 1665);init_xmb_icons(menu_list, max_menu_list, game_sel );} if(cover_mode==3) load_texture(text_FONT, userBG, 1920); old_fi=-1; if(ret_f==1) force_update_check=1; if(ret_f==2) { if(!lock_fileman) {last_cover_mode=cover_mode; cover_mode=5; new_pad=0; goto open_file_manager;}} if(ret_f==3) goto switch_ntfs; // if(ret_f==4) {screenshot} if(ret_f==5 && net_used_ignore()) { char reload_self[128]; sprintf(reload_self, "%s/RELOAD.SELF", app_usrdir); if(exist(reload_self)) { unload_modules(); sys_game_process_exitspawn2((char*) reload_self, NULL, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } } if(ret_f==6 && net_used_ignore()) {unload_modules(); sys_process_exit(1);} if(ret_f==7) goto refresh_list; if( (ret_f==8 || ret_f==9) && net_used_ignore() ) { sprintf(my_mp3_file, "%s/XMB Video", app_usrdir); if(!exist(my_mp3_file) || ret_f==9) { if(!exist(my_mp3_file)) mkdir(my_mp3_file, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); else del_temp(my_mp3_file); max_dir_l=0; ps3_home_scan_bare2((char*)"/dev_hdd0/video", pane_l, &max_dir_l); char linkfile[512]; for(ret_f=0; ret_f<max_dir_l; ret_f++) { sprintf(filename, "%s/XMB Video/%s", app_usrdir, pane_l[ret_f].name); sprintf(linkfile, "%s/%s", pane_l[ret_f].path, pane_l[ret_f].name); link(linkfile, filename); } } retry_showtime_mm: sprintf(filename, "%s/SHOWTIME.SELF", app_usrdir); if(exist(filename)) { unload_modules(); sprintf(filename, "%s/SHOWTIME.SELF", app_usrdir); sys_game_process_exitspawn2(filename, NULL, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } else { cellMsgDialogAbort(); dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_no, (const char*) STR_DL_ST, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) { sprintf(filename, "%s/SHOWTIME.SELF", app_usrdir); sprintf(string1, "%s/SHOWTIME.SELF", url_base); download_file(string1, filename, 1); goto retry_showtime_mm; } } } if(ret_f==10) screen_saver(); // if(ret_f==11) goto open_setup; if(ret_f==12 && exist(helpMME) && net_used_ignore()) { unload_modules(); sys_game_process_exitspawn2((char*) helpMME, NULL, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } goto force_reload; } if ((old_pad & BUTTON_R1) && c_firmware!=3.41f && 0) { setperm_title: dialog_ret=0; cellMsgDialogOpen2( type_dialog_back, (const char*) STR_SET_ACCESS, dialog_fun2, (void*)0x0000aaab, NULL ); flipc(62); sprintf(filename, "%s", menu_list[game_sel].path); abort_rec=0; fix_perm_recursive(filename); new_pad=0; cellMsgDialogAbort(); flip(); } if ((new_pad & BUTTON_R2) && game_sel>=0 && max_menu_list>0 && mode_list==0 && 0) { test_title: time_start= time(NULL); abort_copy=0; initConsole(); file_counter=0; new_pad=0; global_device_bytes=0; num_directories= file_counter= num_files_big= num_files_split= 0; sprintf(string1,"Checking, please wait...\n\n%s",menu_list[game_sel].path); ClearSurface(); draw_square(-1.0f, 1.0f, 2.0f, 2.0f, 0.0f, 0x10101080); cellDbgFontPrintf( 0.07f, 0.07f, 1.2f, 0xc0c0c0c0, string1); cellDbgFontPrintf( 0.5f-0.15f, 1.0f-0.07*2.0f, 1.2f, 0xc0c0c0c0, "Hold /\\ to Abort"); cellDbgFontDrawGcm(); flip(); my_game_test( menu_list[game_sel].path, 0); DPrintf("Directories: %i Files: %i\nBig files: %i Split files: %i\n\n", num_directories, file_counter, num_files_big, num_files_split); int seconds= (int) (time(NULL)-time_start); int vflip=0; while(1){ if(abort_copy==2) sprintf(string1,"Aborted! Time: %2.2i:%2.2i:%2.2i\n", seconds/3600, (seconds/60) % 60, seconds % 60); else if(abort_copy==1) sprintf(string1,"Folder contains over %i files. Time: %2.2i:%2.2i:%2.2i Vol: %1.2f GB+\n", file_counter, seconds/3600, (seconds/60) % 60, seconds % 60, ((double) global_device_bytes)/(1024.0*1024.*1024.0)); else sprintf(string1,"Files tested: %i Time: %2.2i:%2.2i:%2.2i Size: %1.2f GB\nActual size : %.f bytes", file_counter, seconds/3600, (seconds/60) % 60, seconds % 60, ((double) global_device_bytes)/(1024.0*1024.*1024.0),(double) global_device_bytes); ClearSurface(); draw_square(-1.0f, 1.0f, 2.0f, 2.0f, 0.0f, 0x10101080); cellDbgFontPrintf( 0.07f, 0.07f, 1.2f,0xc0c0c0c0,string1); if(vflip & 32) cellDbgFontPrintf( 0.5f-0.15f, 1.0f-0.07*2.0f, 1.2f, 0xffffffff, "Press [ ] to continue"); vflip++; cellDbgFontDrawGcm(); flip(); pad_read(); if (new_pad & BUTTON_SQUARE) { new_pad=0; break; } } termConsole(); } if ( (new_pad & BUTTON_SQUARE) && game_sel>=0 && max_menu_list>0 && mode_list==0 && (!(menu_list[game_sel].flags & 2048)) && disable_options!=1 && disable_options!=3 && strstr(menu_list[game_sel].path,"/pvd_usb")==NULL && 0){ delete_title: int n; c_opacity_delta=16; dimc=0; dim=1; for(n=0;n<11;n++){ if((menu_list[game_sel].flags>>n) & 1) break; } if(n==0) sprintf(filename, "%s", (const char*) STR_DEL_TITLE_HDD); else sprintf(filename, (const char*) STR_DEL_TITLE_USB, 47+n); dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1){ sprintf(filename, "%s/%s", game_cache_dir, menu_list[game_sel].title_id); if(exist(filename)) { dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_yes_no, (const char*) STR_DEL_GCACHE, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); } if(dialog_ret==1){ sprintf(filename, "%s/%s", game_cache_dir, menu_list[game_sel].title_id); my_game_delete(filename); } time_start= time(NULL); old_fi=-1; counter_png=0; game_last_page=-1; forcedevices=(1<<n); abort_copy=0; initConsole(); file_counter=0; new_pad=0; DPrintf("Deleting... \n %s\n\n", menu_list[game_sel].path); my_game_delete((char *) menu_list[game_sel].path); rmdir((char *) menu_list[game_sel].path); // delete this folder if(game_sel>max_menu_list-1) game_sel=max_menu_list-1; int seconds= (int) (time(NULL)-time_start); int vflip=0; while(1){ if(abort_copy) sprintf(string1,"Aborted! Time: %2.2i:%2.2i:%2.2i\n", seconds/3600, (seconds/60) % 60, seconds % 60); else {sprintf(string1,"Done! Files Deleted: %i Time: %2.2i:%2.2i:%2.2i\n", file_counter, seconds/3600, (seconds/60) % 60, seconds % 60); break;} ClearSurface(); cellDbgFontPrintf( 0.07f, 0.07f, 1.2f, 0xc0c0c0c0, string1); if(vflip & 32) cellDbgFontPrintf( 0.5f-0.15f, 1.0f-0.07*2.0f, 1.2f, 0xc0c0c0c0, "Press [ ] to continue."); vflip++; cellDbgFontDrawGcm(); flip(); pad_read(); if (new_pad & BUTTON_SQUARE) { new_pad=0; break; } } termConsole(); } xmb[6].init=0; xmb[7].init=0; } if ((new_pad & BUTTON_CIRCLE) && game_sel>=0 && max_menu_list>0 && mode_list==0 && disable_options!=2 && disable_options!=3 && 0)// && !patchmode { copy_title: c_opacity_delta=16; dimc=0; dim=1; if(menu_list[game_sel].flags & 2048) goto copy_from_bluray; int n; int curr_device=0; char name[1024]; int dest=0; dialog_ret=0; if(menu_list[game_sel].flags & 1) // is hdd0 { for(n=1;n<11;n++) { dialog_ret=0; if((fdevices>>n) & 1) { sprintf(filename, (const char*) STR_COPY_HDD2USB, 47+n); ret = cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) {curr_device=n;break;} // exit } } dest=n; if(dialog_ret==1) { char *p=gameID; char *pch=menu_list[game_sel].path; int len = strlen(pch), i; char *pathpos=strrchr(pch,'/'); int lastO=pathpos-pch+1; for(i=lastO;i<len;i++)p[i-lastO]=pch[i];p[i-lastO]=0; // fix_perm_recursive(ini_usb_dir); sprintf(name, "/dev_usb00%c/%s", 47+curr_device, ini_usb_dir); mkdir(name, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sprintf(name, "/dev_usb00%c/%s/%s", 47+curr_device, ini_usb_dir, p); if(exist(name)) { sprintf(string1, (const char*) STR_TITLE_EXISTS, name ); dialog_ret=0;cellMsgDialogOpen2( type_dialog_ok, string1, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); goto overwrite_cancel; } mkdir(name, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); } } else if(fdevices & 1) { for(n=1;n<13;n++) { if((menu_list[game_sel].flags>>n) & 1) break; } if(n==11 || n==12) continue; curr_device=0; dest=0; char *p=gameID; char *pch=menu_list[game_sel].path; int len = strlen(pch), i; char *pathpos=strrchr(pch,'/'); int lastO=pathpos-pch+1; for(i=lastO;i<len;i++)p[i-lastO]=pch[i];p[i-lastO]=0; if(p[0]=='_') p++; // skip special char dialog_ret=0; if(force_disable_copy==0) { if(strstr(menu_list[game_sel].path,"/pvd_usb")==NULL) sprintf(filename, (const char*) STR_COPY_USB2HDD, 47+n, n-1, ini_usb_dir, p, hdd_folder, p); else sprintf(filename, (const char*) STR_COPY_PFS2HDD, menu_list[game_sel].path, hdd_folder, p); ret = cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); } if(dialog_ret==1) { mkdir(hdd_folder, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sprintf(name, "%s/%s", hdd_folder, p); if(exist(name)) { sprintf(string1, (const char*) STR_TITLE_EXISTS, name ); dialog_ret=0;cellMsgDialogOpen2( type_dialog_ok, string1, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); goto overwrite_cancel; } mkdir(name, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); } else //ext to ext (USB2USB) { for(int n3=1;n3<11;n3++) { dialog_ret=0; if( ((fdevices>>n3) & 1) && n3!=n ) { sprintf(filename, (const char*) STR_COPY_USB2USB, 47+n, 47+n3, n-1, ini_usb_dir, p, n3-1, ini_usb_dir, p); ret = cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) { sprintf(string1, "/dev_usb00%c/%s", 47+n3, ini_usb_dir); mkdir(string1, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sprintf(name, "/dev_usb00%c/%s/%s", 47+n3, ini_usb_dir, p); if(exist(name)) { sprintf(string1, (const char*) STR_TITLE_EXISTS, name ); dialog_ret=0;cellMsgDialogOpen2( type_dialog_ok, string1, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); goto overwrite_cancel; } mkdir(name, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); dest=n3; curr_device=n3; break; } } } } } if(dialog_ret==1) { old_fi=-1; counter_png=0; game_last_page=-1; forcedevices=(1<<curr_device); time_start= time(NULL); abort_copy=0; initConsole(); file_counter=0; new_pad=0; DPrintf("Copying... \n %s\n to %s\n\n", menu_list[game_sel].path, name); if(curr_device!=0) copy_mode=1; // break files >= 4GB else copy_mode=0; copy_is_split=0; num_directories= file_counter= num_files_big= num_files_split= 0; my_game_copy((char *) menu_list[game_sel].path, (char *) name); //ret=cellMsgDialogAbort();sys_timer_usleep(100000); ClearSurface(); int seconds= (int) (time(NULL)-time_start); int vflip=0; if(copy_is_split && !abort_copy) { char *p=gameID; char *pch=menu_list[game_sel].path; int len = strlen(pch), i; char *pathpos=strrchr(pch,'/'); int lastO=pathpos-pch+1; for(i=lastO;i<len;i++)p[i-lastO]=pch[i];p[i-lastO]=0; if(p[0]=='_') p++; // skip special char if(dest==0) sprintf(filename, "%s/_%s", hdd_folder, p); else sprintf(filename, "/dev_usb00%c/%s/_%s", 47+dest, ini_usb_dir, p); ret=rename(name, filename); } while(1) { if(abort_copy) sprintf(string1,"Aborted! (%i) Time: %2.2i:%2.2i:%2.2i\n", abort_copy, seconds/3600, (seconds/60) % 60, seconds % 60); else { if(use_symlinks==1) { sprintf(filename, "%s/USRDIR/EBOOT.BIN", menu_list[game_sel].path); sprintf(string1 , "%s/USRDIR/MM_EBOOT.BIN", name); file_copy(filename, string1, 0); } sprintf(string1,"Done! Files Copied: %i Time: %2.2i:%2.2i:%2.2i Vol: %1.2f GB\n", file_counter, seconds/3600, (seconds/60) % 60, seconds % 60, ((double) global_device_bytes)/(1024.0*1024.*1024.0)); } ClearSurface(); // draw_square(-1.0f, 1.0f, 2.0f, 2.0f, 0.0f, 0x200020ff); cellDbgFontPrintf( 0.07f, 0.07f, 1.2f, 0xc0c0c0c0, string1); if(vflip & 32) cellDbgFontPrintf( 0.5f-0.15f, 1.0f-0.07*2.0f, 1.2f, 0xc0c0c0c0, "Press [ ] to continue"); vflip++; cellDbgFontDrawGcm(); flip(); pad_read(); if (new_pad & BUTTON_SQUARE) { new_pad=0; break; } } if(abort_copy ) { if(dest==0) sprintf(filename, (const char*) STR_DEL_PART_HDD, menu_list[game_sel].title); else sprintf(filename, (const char*) STR_DEL_PART_USB, menu_list[game_sel].title, 47+dest); dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) { abort_copy=0; time_start= time(NULL); file_counter=0; my_game_delete((char *) name); rmdir((char *) name); // delete this folder if(game_sel>max_menu_list-1) game_sel=max_menu_list-1; } else { char *p=gameID; char *pch=menu_list[game_sel].path; int len = strlen(pch), i; char *pathpos=strrchr(pch,'/'); int lastO=pathpos-pch+1; for(i=lastO;i<len;i++)p[i-lastO]=pch[i];p[i-lastO]=0; if(p[0]=='_') p++; // skip special char if(dest==0) sprintf(filename, "%s/_%s", hdd_folder, p); else sprintf(filename, "/dev_usb00%c/%s/_%s", 47+dest, ini_usb_dir, p); ret=rename(name, filename); } } if(game_sel>max_menu_list-1) game_sel=max_menu_list-1; termConsole(); } xmb[6].init=0; xmb[7].init=0; } overwrite_cancel: // copy from bluray if ( (new_pad & BUTTON_CIRCLE) & ((fdevices>>11) & 1) && mode_list==0 && disable_options!=2 && disable_options!=3) { copy_from_bluray: c_opacity_delta=16; dimc=0; dim=1; char name[1024]; int curr_device=0; // CellFsStat status; char id2[16], id[16]; int n; for(n=0;n<11;n++) { dialog_ret=0; if((fdevices>>n) & 1) { if(n==0) sprintf(filename, "%s", (const char*) STR_COPY_BD2HDD); else sprintf(filename, (const char*) STR_COPY_BD2USB, 47+n); ret = cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) {curr_device=n;break;} // exit } } if(dialog_ret==1) { if(curr_device==0) sprintf(name, "/dev_hdd0"); else sprintf(name, "/dev_usb00%c", 47+curr_device); if (cellFsStat(name, &status) == CELL_FS_SUCCEEDED && !parse_ps3_disc((char *) "/dev_bdvd/PS3_DISC.SFB", id2)) { old_fi=-1; counter_png=0; forcedevices=(1<<curr_device); int gn, gn2=0; char bluray_game2[128]; bluray_game2[0]=0; for(gn=0; (gn<(int)strlen(bluray_game) && gn<53 && gn2<53); gn++ ) { if( (bluray_game[gn]>0x2f && bluray_game[gn]<0x3a) || (bluray_game[gn]>0x60 && bluray_game[gn]<0x7b) || (bluray_game[gn]>0x40 && bluray_game[gn]<0x5b) || bluray_game[gn]==0x20) { bluray_game2[gn2]=bluray_game[gn]; bluray_game2[gn2+1]=0; gn2++; } } sprintf(id, "%s-[%s]", id2, bluray_game2); id[64]=0; if(curr_device==0) { mkdir(hdd_folder, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sprintf(name, "%s/%s", hdd_folder, id); if(cellFsStat(name, &status)== CELL_FS_SUCCEEDED) { sprintf(string1, (const char*) STR_TITLE_EXISTS, name ); dialog_ret=0;cellMsgDialogOpen2( type_dialog_ok, string1, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); goto overwrite_cancel_bdvd; } mkdir(name, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); } else { sprintf(name, "/dev_usb00%c/%s", 47+curr_device, ini_usb_dir); mkdir(name, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sprintf(name, "/dev_usb00%c/%s/%s", 47+curr_device, ini_usb_dir, id); if(cellFsStat(name, &status)== CELL_FS_SUCCEEDED) { sprintf(string1, (const char*) STR_TITLE_EXISTS, name ); dialog_ret=0;cellMsgDialogOpen2( type_dialog_ok, string1, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); goto overwrite_cancel_bdvd; } mkdir(name, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); } time_start= time(NULL); abort_copy=0; initConsole(); file_counter=0; new_pad=0; if(curr_device!=0) copy_mode=1; // break files >= 4GB else copy_mode=0; copy_is_split=0; my_game_copy((char *) "/dev_bdvd", (char *) name);//ret=cellMsgDialogAbort();sys_timer_usleep(100000); int seconds= (int) (time(NULL)-time_start); int vflip=0; if(copy_is_split && !abort_copy) { if(curr_device==0) sprintf(filename, "%s/%s", hdd_folder, id); else sprintf(filename, "/dev_usb00%c/%s/_%s", 47+curr_device, ini_usb_dir, id); ret=rename(name, filename); } while(1) { if(abort_copy) sprintf(string1,"Aborted! Time: %2.2i:%2.2i:%2.2i\n", seconds/3600, (seconds/60) % 60, seconds % 60); else { sprintf(string1,"Done! Files Copied: %i Time: %2.2i:%2.2i:%2.2i Vol: %1.2f GB\n", file_counter, seconds/3600, (seconds/60) % 60, seconds % 60, ((double) global_device_bytes)/(1024.0*1024.*1024.0)); } ClearSurface(); cellDbgFontPrintf( 0.07f, 0.07f, 1.2f, 0xc0c0c0c0, string1); if(vflip & 32) cellDbgFontPrintf( 0.5f-0.15f, 1.0f-0.07*2.0f, 1.2f, 0xc0c0c0c0, "Press [ ] to continue"); vflip++; cellDbgFontDrawGcm(); flip(); pad_read(); if (new_pad & BUTTON_SQUARE) { new_pad=0; break; } } if(abort_copy) { if(curr_device==0) sprintf(filename, (const char*) STR_DEL_PART_HDD, id); else sprintf(filename, (const char*) STR_DEL_PART_USB, id, 47+curr_device); dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) { time_start= time(NULL); file_counter=0; abort_copy=0; my_game_delete((char *) name); rmdir((char *) name); // delete this folder } else { if(curr_device==0) sprintf(filename, "%s/_%s", hdd_folder, id); else sprintf(filename, "/dev_usb00%c/%s/_%s", 47+curr_device, ini_usb_dir, id); ret=rename(name, filename); } } termConsole(); if(game_sel>max_menu_list-1) game_sel=max_menu_list-1; } } if(game_sel>max_menu_list-1) game_sel=max_menu_list-1; game_last_page=-1; xmb[6].init=0; xmb[7].init=0; } overwrite_cancel_bdvd: join_copy=0; if ( ((new_pad & BUTTON_CROSS) && (cover_mode==8 || cover_mode==4) && (xmb_icon!=6 || (xmb_icon==6 && xmb[xmb_icon].member[xmb[xmb_icon].first].type==6))) || ((new_pad & BUTTON_CIRCLE) && (cover_mode==8 || cover_mode==4) && (xmb_icon==2 && xmb[xmb_icon].member[xmb[xmb_icon].first].type==7)) ) { while(xmb_slide || xmb_slide_y){draw_whole_xmb(xmb_icon);} if(xmb_icon==9) { if(xmb[9].first!=1) launch_web_browser(xmb[xmb_icon].member[xmb[xmb_icon].first].file_path); //web "http://www.psxstore.com/" else { slide_xmb_left(9); get_www_themes(www_theme, &max_theme); if(max_theme) { use_analog=1; float b_mX=mouseX; float b_mY=mouseY; mouseX=480.f/1920.f; mouseY=225.f/1080.f; is_any_xmb_column=xmb_icon; int ret_f=open_theme_menu((char*) STR_BUT_DOWN_THM, 600, www_theme, max_theme, 320, 225, 16, 1); is_any_xmb_column=0; use_analog=0; mouseX=b_mX; mouseY=b_mY; if(ret_f!=-1) { char tdl[512]; sprintf(tdl, "%s/%s.pkg", themes_web_dir, www_theme[ret_f].name); if(download_file(www_theme[ret_f].pkg, tdl, 4)==1 && net_used_ignore()) { syscall_mount(themes_web_dir, mount_bdvd); dialog_ret=0; sprintf(string1, (const char*) STR_INSTALL_THEME, www_theme[ret_f].name); cellMsgDialogOpen2( type_dialog_yes_no, string1, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret!=1) {reset_mount_points(); goto cancel_theme_exit;} unload_modules(); sys_process_exit(1); }; } } cancel_theme_exit: slide_xmb_right(); } } if(xmb_icon==6 && xmb[xmb_icon].member[xmb[xmb_icon].first].type==6) { if(xmb[6].first==0) goto refresh_list; } if(xmb_icon==1) //home { if(xmb[1].first==0) force_update_check=1; if(xmb[1].first==1) { if(!lock_fileman) {last_cover_mode=cover_mode; cover_mode=5; new_pad=0; goto open_file_manager;}} if(xmb[1].first==2) goto refresh_list; if(xmb[1].first==3) goto switch_ntfs; if(xmb[1].first==4) {screen_saver(); goto start_of_loop; } if(xmb[1].first==5) select_theme(); if(xmb[1].first==6 && exist(helpMME) && net_used_ignore()) { unload_modules(); sys_game_process_exitspawn2((char*) helpMME, NULL, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } if(xmb[1].first==7 && net_used_ignore()) { char reload_self[128]; sprintf(reload_self, "%s/RELOAD.SELF", app_usrdir); if(exist(reload_self)) { unload_modules(); sys_game_process_exitspawn2((char*) reload_self, NULL, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } } if(xmb[1].first==8 && net_used_ignore()) {unload_modules(); sys_process_exit(1);} } if(xmb_icon==2 && (xmb[2].member[xmb[2].first].option_size || xmb[2].first<3) ) //settings { if(xmb[2].first==0) // system information { is_any_xmb_column=xmb_icon; parse_ini(options_ini,1); show_sysinfo(); is_any_xmb_column=0; pad_read(); new_pad=0; goto xmb_cancel_option; } if(xmb[2].first==1) // select interface language { is_any_xmb_column=xmb_icon; select_language(); pad_read(); new_pad=0; is_any_xmb_column=0; goto xmb_cancel_option; } if(xmb[2].first==2) // clear game cache { if(delete_game_cache()!=-1) { pad_read(); new_pad=0; dialog_ret=0; cellMsgDialogOpen2( type_dialog_back, (const char*) STR_DEL_CACHE_DONE, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); wait_dialog(); } goto xmb_cancel_option; } if(xmb[2].first>1) xmb[2].member[xmb[2].first].data=-1; if(!strcmp(xmb[2].member[xmb[2].first].optionini, "parental_level") || !strcmp(xmb[2].member[xmb[2].first].optionini, "parental_pass") || !strcmp(xmb[2].member[xmb[2].first].optionini, "disable_options") || !strcmp(xmb[2].member[xmb[2].first].optionini, "lock_fileman")) { if(parental_pin_entered && (!strcmp(xmb[2].member[xmb[2].first].optionini, "disable_options") || !strcmp(xmb[2].member[xmb[2].first].optionini, "parental_level") || !strcmp(xmb[2].member[xmb[2].first].optionini, "lock_fileman") )) goto xmb_pin_ok; { sprintf(string1, "%s", (const char*) STR_PIN_ENTER); OutputInfo.result = CELL_OSKDIALOG_INPUT_FIELD_RESULT_OK; OutputInfo.numCharsResultString = 128; OutputInfo.pResultString = Result_Text_Buffer; open_osk(3, (char*) string1); is_any_xmb_column=xmb_icon; while(1){ draw_whole_xmb(xmb_icon); if(osk_dialog==1 || osk_dialog==-1) break; } ClearSurface(); flip(); ClearSurface(); flipc(30); is_any_xmb_column=0; osk_open=0; if(osk_dialog!=0) { char pin_result[32]; wchar_t *pin_result2; pin_result2 = (wchar_t*)OutputInfo.pResultString; wcstombs(pin_result, pin_result2, 4); if(strlen(pin_result)==4) { if(strcmp(pin_result, parental_pass)==0) { parental_pin_entered=1; goto xmb_pin_ok; } } } dialog_ret=0; parental_pin_entered=0; cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_PIN_ERR, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); goto xmb_cancel_option; } goto xmb_cancel_option; } xmb_pin_ok: if(!strcmp(xmb[2].member[xmb[2].first].optionini, "parental_pass")) { sprintf(string1, "%s", (const char*) STR_PIN_NEW); OutputInfo.result = CELL_OSKDIALOG_INPUT_FIELD_RESULT_OK; OutputInfo.numCharsResultString = 128; OutputInfo.pResultString = Result_Text_Buffer; open_osk(3, (char*) string1); while(1){ draw_xmb_bare(2, 1, 0, 0); if(osk_dialog==1 || osk_dialog==-1) break; } ClearSurface(); flip(); ClearSurface(); flipc(60); osk_open=0; parental_pin_entered=0; if(osk_dialog!=0) { char pin_result[32]; wchar_t *pin_result2; pin_result2 = (wchar_t*)OutputInfo.pResultString; wcstombs(pin_result, pin_result2, 4); if(strlen(pin_result)==4) { sprintf(parental_pass, "%s", pin_result); goto xmb_pin_ok2; } } dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_PIN_ERR2, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); goto xmb_cancel_option; } xmb_pin_ok2: if(new_pad & BUTTON_CIRCLE) { if(xmb[2].member[xmb[2].first].option_selected<1) xmb[2].member[xmb[2].first].option_selected=xmb[2].member[xmb[2].first].option_size; xmb[2].member[xmb[2].first].option_selected--; } else { xmb[2].member[xmb[2].first].option_selected++; if(xmb[2].member[xmb[2].first].option_selected>=xmb[2].member[xmb[2].first].option_size) xmb[2].member[xmb[2].first].option_selected=0; } parse_settings(); if(!strcmp(xmb[2].member[xmb[2].first].optionini, "xmb_cover_column")) {free_all_buffers(); xmb[6].init=0; xmb[7].init=0; init_xmb_icons(menu_list, max_menu_list, game_sel );} if(!strcmp(xmb[2].member[xmb[2].first].optionini, "confirm_with_x")) {set_xo();xmb_legend_drawn=0;} if(!strcmp(xmb[2].member[xmb[2].first].optionini, "display_mode") || !strcmp(xmb[2].member[xmb[2].first].optionini, "hide_bd")) forcedevices=(1<<11);//0x0800; if(!strcmp(xmb[2].member[xmb[2].first].optionini, "bd_emulator") && xmb[2].member[xmb[2].first].option_selected==1 && !bdemu2_present) { if(c_firmware==3.55f) xmb[2].member[xmb[2].first].option_selected=2; else xmb[2].member[xmb[2].first].option_selected=0; dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, "Selected option is not available.\n\nERROR: Incorrect BDEMU version!", dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } if(!strcmp(xmb[2].member[xmb[2].first].optionini, "lock_fileman")) { if(lock_fileman) sprintf(xmb[1].member[1].name, "%s", "File Manager (Disabled)"); else sprintf(xmb[1].member[1].name, "%s", "File Manager"); for(int n=0; n<MAX_XMB_TEXTS; n++) { xmb_txt_buf[n].used=0; } xmb_txt_buf_max=0; for(int n=0; n<xmb[1].size; n++) xmb[1].member[n].data=-1; for(int n=0; n<xmb[2].size; n++) xmb[2].member[n].data=-1; } if(!strcmp(xmb[2].member[xmb[2].first].optionini, "theme_sound")) { if(is_theme_playing && !theme_sound) stop_audio(5); if(is_theme_playing && theme_sound) sprintf(filename, "%s/SOUND.BIN", app_usrdir); if(exist(filename)) main_mp3((char*)filename); } if(!strcmp(xmb[2].member[xmb[2].first].optionini, "user_font")) redraw_column_texts(xmb_icon); xmb_cancel_option: //redraw_column_texts(xmb_icon); dialog_ret=0; } if(xmb_icon==4 && xmb[xmb_icon].member[xmb[xmb_icon].first].type==4) //music { char aufile[512]; sprintf(aufile, "%s", xmb[xmb_icon].member[xmb[xmb_icon].first].file_path); if(exist(aufile) && (strstr(aufile, ".mp3")!=NULL || strstr(aufile, ".MP3")!=NULL)) { int ci2; max_mp3=1; current_mp3=1; sprintf(mp3_playlist[max_mp3].path, "%s", aufile); //add the rest of the files as a playlist for(ci2=xmb[xmb_icon].first+1; ci2<xmb[xmb_icon].size; ci2++) { sprintf(aufile, "%s", xmb[xmb_icon].member[ci2].file_path); if(strstr(aufile, ".mp3")!=NULL || strstr(aufile, ".MP3")!=NULL) { if(max_mp3>=MAX_MP3) break; max_mp3++; sprintf(mp3_playlist[max_mp3].path, "%s", aufile); } } for(ci2=0; ci2<(xmb[xmb_icon].first); ci2++) { sprintf(aufile, "%s", xmb[xmb_icon].member[ci2].file_path); if(strstr(aufile, ".mp3")!=NULL || strstr(aufile, ".MP3")!=NULL) { if(max_mp3>=MAX_MP3) break; max_mp3++; sprintf(mp3_playlist[max_mp3].path, "%s", aufile); } } main_mp3((char*) mp3_playlist[1].path); } else if(exist(aufile)) goto retry_showtime_xmb; } if(xmb_icon==5 && ( (xmb[xmb_icon].member[xmb[xmb_icon].first].type==3) || xmb[xmb_icon].first<2) && net_used_ignore()) //video for showtime { sprintf(filename, "%s/XMB Video", app_usrdir); if(!exist(filename)) mkdir(filename, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); if(xmb[xmb_icon].first==0) { char linkfile[512]; max_dir_l=0; sprintf(filename, "%s/XMB Video", app_usrdir); if(exist(filename)) del_temp(filename); ps3_home_scan_bare2((char*)"/dev_hdd0/video", pane_l, &max_dir_l); ps3_home_scan_bare2((char*)"/dev_hdd0/VIDEO", pane_l, &max_dir_l); for(int ret_f=0; ret_f<max_dir_l; ret_f++) if( is_video(pane_l[ret_f].name) ) { sprintf(linkfile, "%s/%s", pane_l[ret_f].path, pane_l[ret_f].name); sprintf(filename, "%s/XMB Video/%s", app_usrdir, pane_l[ret_f].name); link(linkfile, filename); } } retry_showtime_xmb: sprintf(filename, "%s/SHOWTIME.SELF", app_usrdir); if(exist(filename)) { if(xmb[xmb_icon].first<2 && net_used_ignore()) { unload_modules(); sprintf(filename, "%s/SHOWTIME.SELF", app_usrdir); sys_game_process_exitspawn2(filename, NULL, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } FILE *flist; sprintf(string1, "%s/TEMP/SHOWTIME.TXT", app_usrdir); remove(string1); flist = fopen(string1, "w"); sprintf(filename, "file://%s", xmb[xmb_icon].member[xmb[xmb_icon].first].file_path);fputs (filename, flist ); fclose(flist); if(net_used_ignore()) { unload_modules(); sprintf(filename, "%s/SHOWTIME.SELF", app_usrdir); sys_game_process_exitspawn2(filename, NULL, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } } else { cellMsgDialogAbort(); dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_no, (const char*) STR_DL_ST, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) { sprintf(filename, "%s/SHOWTIME.SELF", app_usrdir); sprintf(string1, "%s/SHOWTIME.SELF", url_base); download_file(string1, filename, 1); goto retry_showtime_xmb; } } } if(xmb_icon==8) { // emulators if(xmb[xmb_icon].first==0) { if(!is_retro_loading) { xmb[xmb_icon].init=0; xmb[xmb_icon].size=0; free_all_buffers(); sprintf(string1, "%s/XMBS.008", app_usrdir); remove(string1); xmb[xmb_icon].group=0; sprintf(xmb[8].name, "%s", (const char*) STR_GRP_RETRO); draw_xmb_icon_text(8); add_emulator_column(); } } else { if(xmb[xmb_icon].member[xmb[xmb_icon].first].type== 8) launch_snes_emu(xmb[xmb_icon].member[xmb[xmb_icon].first].file_path); else if(xmb[xmb_icon].member[xmb[xmb_icon].first].type== 9) launch_fceu_emu(xmb[xmb_icon].member[xmb[xmb_icon].first].file_path); else if(xmb[xmb_icon].member[xmb[xmb_icon].first].type==10) launch_vba_emu (xmb[xmb_icon].member[xmb[xmb_icon].first].file_path); else if(xmb[xmb_icon].member[xmb[xmb_icon].first].type==11) launch_genp_emu(xmb[xmb_icon].member[xmb[xmb_icon].first].file_path); else if(xmb[xmb_icon].member[xmb[xmb_icon].first].type==12) launch_fba_emu(xmb[xmb_icon].member[xmb[xmb_icon].first].file_path); } } if(xmb_icon==3) { //photo{ while(is_decoding_jpg){ draw_whole_xmb(xmb_icon);}//just wait for threaded decoding to finish int current_image=xmb[xmb_icon].first; char image_file[512]; long slide_time=0; int slide_show=0; int show_info=0; sprintf(image_file, "%s", xmb[xmb_icon].member[current_image].file_path); if(strstr(image_file, ".jpg")!=NULL || strstr(image_file, ".JPG")!=NULL || strstr(image_file, ".jpeg")!=NULL || strstr(image_file, ".JPEG")!=NULL || strstr(image_file, ".png")!=NULL || strstr(image_file, ".PNG")!=NULL) { int to_break=0, slide_dir=0; float pic_zoom=1.0f; int pic_reload=1, pic_posY=0, pic_posX=0, pic_X=0, pic_Y=0; char pic_info[512]; mouseYDR=mouseXDR=mouseYDL=mouseXDL=0.0000f; while(1) { // Picture Viewer Mode use_analog=1; sprintf(image_file, "%s", xmb[xmb_icon].member[current_image].file_path); if(strstr(image_file, ".jpg")!=NULL || strstr(image_file, ".JPG")!=NULL || strstr(image_file, ".jpeg")!=NULL || strstr(image_file, ".JPEG")!=NULL) { //cellDbgFontDrawGcm(); ClearSurface(); if(pic_reload!=0){ cellDbgFontDrawGcm(); pic_zoom=-1.0f; if(strstr(xmb[xmb_icon].member[current_image].file_path,"/pvd_usb")!=NULL) //ntfs { sprintf(image_file, "%s/TEMP/net_view.bin", app_usrdir); file_copy(xmb[xmb_icon].member[current_image].file_path, image_file, 0); } load_jpg_texture(text_bmp, image_file, 1920); slide_time=0; } png_w2=png_w; png_h2=png_h; if(pic_zoom==-1.0f){ pic_zoom=1.0f; if(png_h!=0 && png_h>=png_w && (float)png_h/(float)png_w>=1.77f) pic_zoom=float (1080.0f / png_h); if(png_h!=0 && png_h>=png_w && (float)png_h/(float)png_w<1.77f) pic_zoom=float (1920.0f / png_h); else if(png_w!=0 && png_h!=0 && png_w>png_h && (float)png_w/(float)png_h>=1.77f) pic_zoom=float (1920.0f / png_w); else if(png_w!=0 && png_h!=0 && png_w>png_h && (float)png_w/(float)png_h<1.77f) pic_zoom=float (1080.0f / png_h); } if(pic_zoom>4.f) pic_zoom=4.f; png_h2=(int) (png_h2*pic_zoom); png_w2=(int) (png_w2*pic_zoom); if(pic_reload!=0) { if(slide_dir==0) for(int slide_in=1920; slide_in>=0; slide_in-=128) { flip(); if(key_repeat && abs(slide_in)>640) break; ClearSurface(); set_texture( text_bmp, 1920, 1080); display_img((int)((1920-png_w2)/2)+pic_posX+slide_in, (int)((1080-png_h2)/2)+pic_posY, png_w2, png_h2, png_w, png_h, 0.0f, 1920, 1080); } else for(int slide_in=-1920; slide_in<=0; slide_in+=128) { flip(); if(key_repeat && abs(slide_in)>640) break; ClearSurface(); set_texture( text_bmp, 1920, 1080); display_img((int)((1920-png_w2)/2)+pic_posX+slide_in, (int)((1080-png_h2)/2)+pic_posY, png_w2, png_h2, png_w, png_h, 0.0f, 1920, 1080); } } else { ClearSurface(); set_texture( text_bmp, 1920, 1080); display_img((int)((1920-png_w2)/2)+pic_posX, (int)((1080-png_h2)/2)+pic_posY, png_w2, png_h2, png_w, png_h, 0.0f, 1920, 1080); } } if(strstr(image_file, ".png")!=NULL || strstr(image_file, ".PNG")!=NULL) { cellDbgFontDrawGcm(); if(pic_reload!=0){ if(strstr(xmb[xmb_icon].member[current_image].file_path,"/pvd_usb")!=NULL) //ntfs { sprintf(image_file, "%s/TEMP/net_view.bin", app_usrdir); file_copy(xmb[xmb_icon].member[current_image].file_path, image_file, 0); } load_png_texture(text_bmp, image_file, 1920); slide_time=0; } png_w2=png_w; png_h2=png_h; if(pic_zoom==-1.0f){ pic_zoom=1.0f; if(png_h!=0 && png_h>=png_w && (float)png_h/(float)png_w>=1.77f) pic_zoom=float (1080.0f / png_h); if(png_h!=0 && png_h>=png_w && (float)png_h/(float)png_w<1.77f) pic_zoom=float (1920.0f / png_h); else if(png_w!=0 && png_h!=0 && png_w>png_h && (float)png_w/(float)png_h>=1.77f) pic_zoom=float (1920.0f / png_w); else if(png_w!=0 && png_h!=0 && png_w>png_h && (float)png_w/(float)png_h<1.77f) pic_zoom=float (1080.0f / png_h); } if(pic_zoom>4.f)pic_zoom=4; png_h2=(int) (png_h2*pic_zoom); png_w2=(int) (png_w2*pic_zoom); pic_X=(int)((1920-png_w2)/2)+pic_posX; pic_Y=(int)((1080-png_h2)/2)+pic_posY; if(pic_reload!=0) { if(slide_dir==0) for(int slide_in=1920; slide_in>=0; slide_in-=128) { flip(); if(key_repeat && abs(slide_in)>640) break; ClearSurface(); set_texture( text_bmp, 1920, 1080); display_img((int)((1920-png_w2)/2)+pic_posX+slide_in, (int)((1080-png_h2)/2)+pic_posY, png_w2, png_h2, png_w, png_h, 0.0f, 1920, 1080); } else for(int slide_in=-1920; slide_in<=0; slide_in+=128) { flip(); if(key_repeat && abs(slide_in)>640) break; ClearSurface(); set_texture( text_bmp, 1920, 1080); display_img((int)((1920-png_w2)/2)+pic_posX+slide_in, (int)((1080-png_h2)/2)+pic_posY, png_w2, png_h2, png_w, png_h, 0.0f, 1920, 1080); } } else { ClearSurface(); set_texture( text_bmp, 1920, 1080); display_img(pic_X, pic_Y, png_w2, png_h2, png_w, png_h, 0.0f, 1920, 1080); } } int ci=current_image; to_break=0; char ss_status[8]; while(1){ pad_read(); ClearSurface(); set_texture( text_bmp, 1920, 1080); if(strstr(image_file, ".png")!=NULL || strstr(image_file, ".PNG")!=NULL) display_img(pic_X, pic_Y, png_w2, png_h2, png_w, png_h, 0.0f, 1920, 1080); else display_img((int)((1920-png_w2)/2)+pic_posX, (int)((1080-png_h2)/2)+pic_posY, png_w2, png_h2, png_w, png_h, 0.0f, 1920, 1080); if(show_info==1){ if(slide_show) sprintf(ss_status, "%s", "Stop"); else sprintf(ss_status, "%s", "Start"); sprintf(pic_info," Name: %s", xmb[xmb_icon].member[current_image].name); pic_info[95]=0; draw_text_stroke( 0.04f+0.025f, 0.867f, 0.7f ,0xc0a0a0a0, pic_info); if(strstr(image_file, ".png")!=NULL || strstr(image_file, ".PNG")!=NULL) sprintf(pic_info," Info: PNG %ix%i (Zoom: %3.0f)\n Date: %s\n[START]: %s slideshow", png_w, png_h, pic_zoom*100.0f, xmb[xmb_icon].member[current_image].subname, ss_status); else sprintf(pic_info," Info: JPEG %ix%i (Zoom: %3.0f)\n Date: %s\n[START]: %s slideshow", png_w, png_h, pic_zoom*100.0f, xmb[xmb_icon].member[current_image].subname, ss_status); draw_text_stroke( 0.04f+0.025f, 0.89f, 0.7f ,0xc0a0a0a0, pic_info); cellDbgFontDrawGcm(); } flip(); if ( new_pad & BUTTON_SELECT ) {show_info=1-show_info; pic_reload=0; break;}//new_pad=0; old_pad=0; if ( new_pad & BUTTON_START ) { slide_time=0; //new_pad=0; old_pad=0; slide_show=1-slide_show; slide_dir=0; } if(slide_show==1) slide_time++; if ( ( new_pad & BUTTON_TRIANGLE ) || ( new_pad & BUTTON_CIRCLE ) ) {new_pad=0; to_break=1;break;}// old_pad=0; if ( ( new_pad & BUTTON_RIGHT ) || ( new_pad & BUTTON_R1 ) || ( new_pad & BUTTON_CROSS ) || (slide_show==1 && slide_time>600) ) { //find next image in the list for(ci=current_image+1; ci<xmb[xmb_icon].size; ci++) { sprintf(image_file, "%s", xmb[xmb_icon].member[ci].file_path); if(strstr(image_file, ".jpg")!=NULL || strstr(image_file, ".JPG")!=NULL || strstr(image_file, ".jpeg")!=NULL || strstr(image_file, ".JPEG")!=NULL || strstr(image_file, ".png")!=NULL || strstr(image_file, ".PNG")!=NULL) { current_image=ci; xmb[xmb_icon].first=ci; pic_zoom=1.0f; pic_reload=1; pic_posX=pic_posY=0; slide_time=0; slide_dir=0; break; } } if(current_image>=xmb[xmb_icon].size || ci>=xmb[xmb_icon].size) current_image=0;//to_break=1; // || current_image==xmb[xmb_icon].first break; } if ( ( new_pad & BUTTON_LEFT ) || ( new_pad & BUTTON_L1 ) ) { //find previous image in the list if(current_image==0) current_image=xmb[xmb_icon].size; int one_time2=1; check_from_start2: for(ci=current_image-1; ci>=0; ci--) { sprintf(image_file, "%s", xmb[xmb_icon].member[ci].file_path); if(strstr(image_file, ".jpg")!=NULL || strstr(image_file, ".JPG")!=NULL || strstr(image_file, ".jpeg")!=NULL || strstr(image_file, ".JPEG")!=NULL || strstr(image_file, ".png")!=NULL || strstr(image_file, ".PNG")!=NULL) { current_image=ci; xmb[xmb_icon].first=ci; pic_zoom=1.0f; pic_reload=1; pic_posX=pic_posY=0; slide_show=0; slide_dir=1; break; } } if((current_image<0 || ci<0) && one_time2) {one_time2=0; current_image=xmb[xmb_icon].size; goto check_from_start2;}// to_break=1; // || current_image==e break; } if (( new_pad & BUTTON_L3 ) || ( new_pad & BUTTON_DOWN )) { if(png_w!=0 && pic_zoom==1.0f) pic_zoom=float (1920.0f / png_w); else pic_zoom=1.0f; pic_reload=0; pic_posX=pic_posY=0; new_pad=0; break; } if (( new_pad & BUTTON_R3 ) || ( new_pad & BUTTON_UP )) { if(png_h!=0 && pic_zoom==1.0f) pic_zoom=float (1080.0f / png_h); else pic_zoom=1.0f; pic_reload=0; pic_posX=pic_posY=0; new_pad=0; break; } if (mouseXDL!=0.0f && png_w2>1920) { pic_posX-=(int) (mouseXDL*1920.0f); pic_reload=0; if( pic_posX<(int)((1920-png_w2)/2) ) pic_posX=(int)((1920-png_w2)/2); if( ((int)((1920-png_w2)/2)+pic_posX)>0 ) pic_posX=0-(int)((1920-png_w2)/2); break; } if (mouseYDL!=0.0f && png_h2>1080) { pic_posY-=(int) (mouseYDL*1080.0f); if( pic_posY<(int)((1080-png_h2)/2) ) pic_posY=(int)((1080-png_h2)/2); if( ((int)((1080-png_h2)/2)+pic_posY)>0 ) pic_posY=0-(int)((1080-png_h2)/2); pic_reload=0; break; } if (( new_pad & BUTTON_L2 ) || mouseXDR> 0.003f || mouseYDR> 0.003f) { if ( new_pad & BUTTON_L2 ) pic_zoom-=0.045f; else pic_zoom-=0.010f; if(pic_zoom<1.0f) pic_zoom=1.000f; pic_reload=0; png_h2=(int) (png_h2*pic_zoom); png_w2=(int) (png_w2*pic_zoom); if( pic_posX<(int)((1920-png_w2)/2) ) pic_posX=(int)((1920-png_w2)/2); if( ((int)((1920-png_w2)/2)+pic_posX)>0 ) pic_posX=0; if( pic_posY<(int)((1080-png_h2)/2) ) pic_posY=(int)((1080-png_h2)/2); if( ((int)((1080-png_h2)/2)+pic_posY)>0 ) pic_posY=0; break; } if (( new_pad & BUTTON_R2 ) || mouseXDR< -0.003f || mouseYDR< -0.003f) { if (new_pad & BUTTON_R2) pic_zoom+=0.045f; else pic_zoom+=0.010f; pic_reload=0; png_h2=(int) (png_h2*pic_zoom); png_w2=(int) (png_w2*pic_zoom); if( pic_posX<(int)((1920-png_w2)/2) ) pic_posX=(int)((1920-png_w2)/2); if( ((int)((1920-png_w2)/2)+pic_posX)>0 ) pic_posX=0; if( pic_posY<(int)((1080-png_h2)/2) ) pic_posY=(int)((1080-png_h2)/2); if( ((int)((1080-png_h2)/2)+pic_posY)>0 ) pic_posY=0; break; } } new_pad=0; if(to_break==1) break; } //picture viewer new_pad=0; use_analog=0; } load_texture(text_bmp, xmbbg, 1920); } } if (new_pad & BUTTON_CROSS && game_sel>=0 && (((mode_list==0) && max_menu_list>0)) && strstr(menu_list[game_sel].path,"/pvd_usb")==NULL && ( (cover_mode!=8 && cover_mode!=4) || ((cover_mode==8 || cover_mode==4) && ( (xmb_icon==6 && xmb[xmb_icon].member[xmb[xmb_icon].first].type==1 && xmb[xmb_icon].size>1) || (xmb_icon==7 && xmb[xmb_icon].size) || (xmb_icon==5 && xmb[xmb_icon].member[xmb[xmb_icon].first].type==2)))) ) { start_title: join_copy=0; c_opacity_delta=16; dimc=0; dim=1; if(parental_level<menu_list[game_sel].plevel && parental_level>0) { sprintf(string1, (const char*) STR_GAME_PIN, menu_list[game_sel].plevel ); OutputInfo.result = CELL_OSKDIALOG_INPUT_FIELD_RESULT_OK; OutputInfo.numCharsResultString = 128; OutputInfo.pResultString = Result_Text_Buffer; open_osk(3, (char*) string1); while(1){ sprintf(string1, "::: %s :::\n\n\nSelected game is restricted with parental level %i.\n\nPlease enter four alphanumeric parental password code:", menu_list[game_sel].title, menu_list[game_sel].plevel); ClearSurface(); draw_square(-1.0f, 1.0f, 2.0f, 2.0f, 0.9f, 0xd0000080); cellDbgFontPrintf( 0.10f, 0.10f, 1.0f, 0xffffffff, string1); setRenderColor(); cellDbgFontDrawGcm(); flip(); if(osk_dialog==1 || osk_dialog==-1) break; } ClearSurface(); flip(); ClearSurface(); flipc(60); osk_open=0; if(osk_dialog!=0) { char pin_result[32]; wchar_t *pin_result2; pin_result2 = (wchar_t*)OutputInfo.pResultString; wcstombs(pin_result, pin_result2, 4); if(strlen(pin_result)==4) { if(strcmp(pin_result, parental_pass)==0) { goto pass_ok; } } } dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_PIN_ERR, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); goto skip_1; } pass_ok: direct_launch_forced=0; if( (old_pad & BUTTON_SELECT) || (menu_list[game_sel].user & IS_DBOOT)) direct_launch_forced=1; char fileboot[1024]; memset(fileboot, 0, 1023); if( (menu_list[game_sel].flags & 2048) && net_used_ignore()) { flip(); if(direct_launch_forced && !(menu_list[game_sel].user & IS_DBOOT)) { sprintf(filename, "%s/PS3_GAME/USRDIR/EBOOT.BIN", menu_list[game_sel].path); if(exist(filename)) { sprintf(fileboot, "%s/PS3_GAME/USRDIR/EBOOT.BIN", menu_list[game_sel].path); if( ( (payload==0 && sc36_path_patch==0) || (menu_list[game_sel].user & IS_DISC) ) && !exist((char*)"/dev_bdvd")) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_back, (const char*) STR_PS3DISC, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==3 || !exist((char*)"/dev_bdvd")) goto cancel_exit_2; } else if(payload==0 && sc36_path_patch==1 && !exist((char*)"/dev_bdvd")) { //dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, "Start your game from [* /app_home] menu.\n\nShould you run into problems - insert an original Playstation(R)3 game disc next time!", dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); poke_sc36_path( (char *) "/app_home" ); } dialog_ret=0; if(menu_list[game_sel].user & IS_DBOOT) { write_last_play( (char *)fileboot, (char *)menu_list[game_sel].path, (char *)menu_list[game_sel].title, (char *)menu_list[game_sel].title_id, 1); unload_modules(); //if(payload==0) //sys_game_process_exitspawn2((char *) fileboot, NULL, NULL, NULL, 0, 1001, SYS_PROCESS_PRIMARY_STACK_SIZE_128K); //else sprintf(string1, "%s", menu_list[game_sel].path); sprintf(fileboot, "%s/PS3_GAME/USRDIR/EBOOT.BIN", menu_list[game_sel].path); syscall_mount( string1, mount_bdvd); sys_game_process_exitspawn2((char *) fileboot, NULL, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_128K); // sys_game_process_exitspawn2((char *) "/app_home/PS3_GAME/USRDIR/EBOOT.BIN", NULL, NULL, NULL, 0, 1001, SYS_PROCESS_PRIMARY_STACK_SIZE_128K); } else { write_last_play( (char *)fileboot, (char *)menu_list[game_sel].path, (char *)menu_list[game_sel].title, (char *)menu_list[game_sel].title_id, 0); unload_modules(); sprintf(string1, "%s", menu_list[game_sel].path); syscall_mount( string1, mount_bdvd); sys_process_exit(1); break; } } } else { reset_mount_points(); ret = unload_modules(); sys_process_exit(1); } } if( (strstr(menu_list[game_sel].content,"AVCHD")!=NULL || strstr(menu_list[game_sel].content,"BDMV")!=NULL) && net_used_ignore()) // Rename/activate USB HDD AVCHD folder { if(strstr(menu_list[game_sel].content,"BDMV")!=NULL && strstr(menu_list[game_sel].path,"/dev_hdd0")!=NULL) { sprintf(filename, (const char*) STR_BD2AVCHD3, menu_list[game_sel].title, menu_list[game_sel].entry, menu_list[game_sel].details); dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaab, NULL ); wait_dialog(); if(dialog_ret==1) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_no, (const char*) STR_BD2AVCHD2, dialog_fun2, (void*)0x0000aaab, NULL ); flipc(60); char path[512], cfile[512], ffile[512], cfile0[16]; for(int n=0;n<128;n++){ sprintf(path, "%s/BDMV/CLIPINF", menu_list[game_sel].path); dir=opendir (path); while(1) { struct dirent *entry=readdir (dir); if(!entry) break; sprintf(cfile0, "%s", entry->d_name); if(strstr (cfile0,".clpi")!=NULL) {cfile0[5]=0; sprintf(cfile, "%s/%s.CPI", path, cfile0); sprintf(ffile, "%s/%s", path, entry->d_name); rename(ffile, cfile);}}closedir(dir); sprintf(path, "%s/BDMV/BACKUP/CLIPINF", menu_list[game_sel].path); dir=opendir (path); while(1) { struct dirent *entry=readdir (dir); if(!entry) break; sprintf(cfile0, "%s", entry->d_name); if(strstr (cfile0,".clpi")!=NULL) {cfile0[5]=0; sprintf(cfile, "%s/%s.CPI", path, cfile0); sprintf(ffile, "%s/%s", path, entry->d_name); rename(ffile, cfile);}}closedir(dir); sprintf(path, "%s/BDMV/PLAYLIST", menu_list[game_sel].path); dir=opendir (path); while(1) { struct dirent *entry=readdir (dir); if(!entry) break; sprintf(cfile0, "%s", entry->d_name); if(strstr (cfile0,".mpls")!=NULL) {cfile0[5]=0; sprintf(cfile, "%s/%s.MPL", path, cfile0); sprintf(ffile, "%s/%s", path, entry->d_name); rename(ffile, cfile);}}closedir(dir); sprintf(path, "%s/BDMV/BACKUP/PLAYLIST", menu_list[game_sel].path); dir=opendir (path); while(1) { struct dirent *entry=readdir (dir); if(!entry) break; sprintf(cfile0, "%s", entry->d_name); if(strstr (cfile0,".mpls")!=NULL) {cfile0[5]=0; sprintf(cfile, "%s/%s.MPL", path, cfile0); sprintf(ffile, "%s/%s", path, entry->d_name); rename(ffile, cfile);}}closedir(dir); sprintf(path, "%s/BDMV/STREAM", menu_list[game_sel].path); dir=opendir (path); while(1) { struct dirent *entry=readdir (dir); if(!entry) break; sprintf(cfile0, "%s", entry->d_name); if(strstr (cfile0,".m2ts")!=NULL) {cfile0[5]=0; sprintf(cfile, "%s/%s.MTS", path, cfile0); sprintf(ffile, "%s/%s", path, entry->d_name); rename(ffile, cfile);}}closedir(dir); sprintf(path, "%s/BDMV/index.bdmv", menu_list[game_sel].path); sprintf(cfile, "%s/BDMV/INDEX.BDM", menu_list[game_sel].path); rename(path, cfile); sprintf(path, "%s/BDMV/BACKUP/index.bdmv", menu_list[game_sel].path); sprintf(cfile, "%s/BDMV/BACKUP/INDEX.BDM", menu_list[game_sel].path); rename(path, cfile); sprintf(path, "%s/BDMV/MovieObject.bdmv", menu_list[game_sel].path); sprintf(cfile, "%s/BDMV/MOVIEOBJ.BDM", menu_list[game_sel].path); rename(path, cfile); sprintf(path, "%s/BDMV/BACKUP/MovieObject.bdmv", menu_list[game_sel].path); sprintf(cfile, "%s/BDMV/BACKUP/MOVIEOBJ.BDM", menu_list[game_sel].path); rename(path, cfile); } sprintf(menu_list[game_sel].content, "AVCHD"); cellMsgDialogAbort(); } } if(strstr(menu_list[game_sel].content,"BDMV")!=NULL && payload!=0) { sprintf(filename, (const char*) STR_ACT_BDMV, menu_list[game_sel].title, menu_list[game_sel].entry, menu_list[game_sel].details); dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaab, NULL ); wait_dialog(); if(dialog_ret==1) { syscall_mount2((char *)"/dev_bdvd", (char *)menu_list[game_sel].path); ret = unload_modules(); sys_process_exit(1); break; } else goto skip_1; } //BDMV if(strstr(menu_list[game_sel].content,"AVCHD")!=NULL) { sprintf(filename, (const char*) STR_ACT_AVCHD, menu_list[game_sel].title); //, menu_list[game_sel].entry, menu_list[game_sel].details dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaab, NULL ); wait_dialog(); if(dialog_ret==1) { if(strstr(menu_list[game_sel].path,"/dev_hdd0")!=NULL) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_no, (const char*) STR_ACT_AVCHD2, dialog_fun2, (void*)0x0000aaab, NULL ); flipc(60); char usb_save[32]="/none"; usb_save[5]=0; sprintf(filename, "/dev_sd"); if(exist(filename)) { sprintf(usb_save, "/dev_sd/PRIVATE"); if(!exist(usb_save)) mkdir(usb_save, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); } if(!exist(usb_save)) { sprintf(filename, "/dev_ms"); if(exist(filename)) { sprintf(usb_save, "/dev_ms"); } } if(!exist(usb_save)) { for(int n=0;n<9;n++){ sprintf(filename, "/dev_usb00%i", n); if(exist(filename)) { sprintf(usb_save, "%s", filename); break; } } } if(exist(usb_save)) { sprintf(filename, "%s/AVCHD", usb_save); if(!exist(filename)) mkdir(filename, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sprintf(filename, "%s/AVCHD/BDMV", usb_save); if(!exist(filename)) mkdir(filename, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); sprintf(filename, "%s/AVCHD/BDMV/INDEX.BDM", usb_save); if(!exist(filename)) file_copy((char *) avchdIN, (char *) filename, 0); sprintf(filename, "%s/AVCHD/BDMV/MOVIEOBJ.BDM", usb_save); if(!exist(filename)) file_copy((char *) avchdMV, (char *) filename, 0); sprintf(filename, "%s/AVCHD", usb_save); sprintf(usb_save, "%s", filename); cellMsgDialogAbort(); syscall_mount2((char *)usb_save, (char *)menu_list[game_sel].path); ret = unload_modules(); sys_process_exit(1); break; } else { dialog_ret=0; cellMsgDialogAbort(); ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_ATT_USB, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); goto skip_1; } } char usb_ROOT[12]; char avchd_OLD[64]; char avchd_OLD_path[128]; char avchd_ROOT[64]; char avchd_CURRENT[64]; char title_backup[64]; char line[64]; char CrLf[2]; CrLf [0]=13; CrLf [1]=10; CrLf[2]=0; FILE *fpA; strncpy(usb_ROOT, menu_list[game_sel].path, 11); usb_ROOT[11]=0; sprintf(avchd_ROOT, "%s/AVCHD", usb_ROOT); sprintf(avchd_CURRENT, "%s", menu_list[game_sel].path); sprintf(avchd_OLD, "AVCHD_VIDEO_[%i]", (int)(time(NULL))); sprintf(avchd_OLD_path, "%s/%s", usb_ROOT, avchd_OLD); if(strcmp(avchd_CURRENT, avchd_ROOT)) { if(exist(avchd_ROOT)) // AVCHD exists and has to be renamed { sprintf(title_backup, "%s/TitleBackup.txt", avchd_ROOT); if(!exist(title_backup)) { fpA = fopen ( title_backup, "w" ); fputs ( avchd_OLD, fpA );fputs ( CrLf, fpA ); fclose(fpA); } else { fpA = fopen ( title_backup, "r" ); if ( fpA != NULL ) { while ( fgets ( line, sizeof line, fpA ) != NULL ) { if(strlen(line)>2) { strncpy(avchd_OLD, line, strlen(line)-2);avchd_OLD[strlen(line)-2]=0; sprintf(avchd_OLD_path, "%s/%s", usb_ROOT, avchd_OLD); break; } } fclose(fpA); } } ret=cellFsRename(avchd_ROOT, avchd_OLD_path); } // AVCHD doesn't exist and selected folder can be renamed sprintf(title_backup, "%s/TitleBackup.txt", avchd_CURRENT); fpA = fopen ( title_backup, "w" ); fputs ( menu_list[game_sel].entry, fpA ); fputs ( CrLf, fpA ); fclose(fpA); ret=cellFsRename(avchd_CURRENT, avchd_ROOT); } if(!exist(avchd_ROOT)) { sprintf(line, (const char*) STR_ERR_MVAV, ret, avchd_CURRENT, avchd_ROOT); dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, line, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } else // Exit to XMB after AVCHD rename { unload_modules(); syscall_mount( (char *) "/dev_bdvd", mount_bdvd); sys_process_exit(1); break; } } } } else { if(game_sel>=0 && max_menu_list>0 && net_used_ignore()) { int selx=0; if((menu_list[game_sel].title[0]=='_' || menu_list[game_sel].split) && payload!=1) { if(!menu_list[game_sel].split) { game_last_page=-1; old_fi=-1; }; menu_list[game_sel].split=1; dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*)STR_NOSPLIT2, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } else { again_sc8: reset_mount_points(); sprintf(filename, "%s/PS3_GAME/PARAM.SFO", menu_list[game_sel].path); if(!exist(filename)) sprintf(filename, "%s/PARAM.SFO", menu_list[game_sel].path); char c_split[512]; c_split[0]=0; char c_cached[512]; c_cached[0]=0; char s_tmp2[512]; u8 use_cache=0; if(exist(filename)) { if(strstr(filename, "/dev_hdd0/")==NULL && strstr(filename, "/dev_bdvd/")==NULL && (verify_data==2 || (verify_data==1)) ) // && payload==1 { abort_copy=0; dialog_ret=0; cellMsgDialogOpen2( type_dialog_no, (const char*) STR_VERIFYING, dialog_fun2, (void*)0x0000aaab, NULL ); flipc(60); sprintf(s_tmp2, "%s/PS3_GAME/USRDIR", menu_list[game_sel].path); join_copy= (payload==1 ? 1 : 0); max_joined=0; global_device_bytes=0; num_directories= file_counter= num_files_big= num_files_split= 0; time_start= time(NULL); my_game_test(s_tmp2, 2); cellMsgDialogAbort(); flip(); if( ((num_files_big || num_files_split) && payload!=1) || (num_files_big>10) ) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*)STR_NOSPLIT3, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); if(!menu_list[game_sel].split) { game_last_page=-1; old_fi=-1; }; menu_list[game_sel].split=1; goto cancel_mount2; } if(num_files_big<=10 && max_joined<10 && payload==1) { abort_rec=0; //sys8_perm_mode(1); fix_perm_recursive(game_cache_dir); int reprocess=0; for(int sfj=0; sfj<max_joined; sfj++) { char *p=file_to_join[sfj].split_file; sprintf(c_cached, "%s/%s/%s", game_cache_dir, menu_list[game_sel].title_id, p+strlen(menu_list[game_sel].path)+17); sprintf(c_split, "%s", p+strlen(menu_list[game_sel].path)); sprintf(file_to_join[sfj].cached_file, "%s", c_cached); sprintf(file_to_join[sfj].split_file, "%s", c_split); if(!exist(c_cached)) reprocess=1; } // check cache dialog_ret=0; if(reprocess==1) { cellMsgDialogOpen2( type_dialog_yes_no, (const char*) STR_PREPROCESS, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(!menu_list[game_sel].split) { game_last_page=-1; old_fi=-1; }; menu_list[game_sel].split=1; if(dialog_ret!=1) goto cancel_mount2; abort_copy=0; char s_tmp[512]; sprintf(s_tmp, "%s/%s", game_cache_dir, menu_list[game_sel].title_id); mkdir(s_tmp, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(s_tmp, CELL_FS_S_IFDIR | 0777); my_game_delete(s_tmp); mkdir(s_tmp, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(s_tmp, CELL_FS_S_IFDIR | 0777); cellFsGetFreeSize((char*)"/dev_hdd0", &blockSize, &freeSize); freeSpace = ( (uint64_t) (blockSize * freeSize) ); abort_copy=0; if((uint64_t)global_device_bytes>(uint64_t)freeSpace && freeSpace!=0) my_game_delete(game_cache_dir); cellFsGetFreeSize((char*)"/dev_hdd0", &blockSize, &freeSize); freeSpace = ( (uint64_t) (blockSize * freeSize) ); if((uint64_t)global_device_bytes>(uint64_t)freeSpace && freeSpace!=0) { sprintf(string1, (const char*) STR_ERR_NOSPACE0, (double) ((freeSpace)/1048576.00f), (double) ((global_device_bytes-freeSpace)/1048576.00f) ); dialog_ret=0;cellMsgDialogOpen2( type_dialog_ok, string1, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); goto cancel_mount2; } sprintf(string1, "%s/%s", game_cache_dir, menu_list[game_sel].title_id); mkdir(string1, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(string1, CELL_FS_S_IFDIR | 0777); char tb_name[512]; sprintf(tb_name, "%s/PS3NAME.DAT", string1); remove(tb_name); FILE *fpA; fpA = fopen ( tb_name, "w" ); if(fpA!=NULL) { fprintf(fpA, "%.0fGB: %s", (double) ((global_device_bytes)/1073741824.00f), (menu_list[game_sel].title[0]=='_' ? menu_list[game_sel].title+1 :menu_list[game_sel].title)); fclose(fpA); } //dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_no, filename, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); dialog_ret=0; cellMsgDialogOpen2( type_dialog_back, (const char*) STR_SET_ACCESS1, dialog_fun2, (void*)0x0000aaab, NULL ); flipc(62); sprintf(tb_name, "%s", menu_list[game_sel].path); //sys8_perm_mode(1); abort_rec=0; fix_perm_recursive(tb_name); new_pad=0; cellMsgDialogAbort(); flipc(62); time_start= time(NULL); abort_copy=0; initConsole(); file_counter=0; copy_mode=0; max_joined=0; char s_source[512]; char s_destination[512]; sprintf(s_source, "%s/PS3_GAME/USRDIR", menu_list[game_sel].path); sprintf(s_destination, "%s/%s", game_cache_dir, menu_list[game_sel].title_id); join_copy=1; my_game_copy((char*)s_source, (char*)s_destination); cellMsgDialogAbort(); termConsole(); join_copy=0; new_pad=0; if(abort_copy) { sprintf(s_destination, "%s/%s", game_cache_dir, menu_list[game_sel].title_id); abort_copy=0; my_game_delete(s_destination); rmdir(s_destination); dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_CANCELED, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); max_joined=0; goto cancel_mount2; } sprintf(s_destination, "%s", game_cache_dir); //, menu_list[game_sel].title_id cellFsChmod(s_destination, CELL_FS_S_IFDIR | 0777); abort_rec=0; fix_perm_recursive(s_destination); goto again_sc8; } use_cache=1; //dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_back, file_to_join, dialog_fun1, (void*)0x0000aaaa, NULL );wait_dialog(); //goto cancel_mount2; } } if( ( (payload==0 && sc36_path_patch==0) || (menu_list[game_sel].user & IS_DISC) ) && !exist((char*)"/dev_bdvd")) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_back, (const char*) STR_PS3DISC, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==3 || !exist((char*)"/dev_bdvd")) goto cancel_exit_2; } else if(payload==0 && sc36_path_patch==1 && !exist((char*)"/dev_bdvd")) { //dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, "Start your game from [* /app_home] menu.\n\nShould you run into problems - insert an original Playstation(R)3 game disc next time!", dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); poke_sc36_path( (char *) "/app_home" ); } selx=0; get_game_flags(game_sel); FILE *fpA; if(strstr(menu_list[game_sel].path, "/dev_usb")!=NULL && ( c_firmware==3.15f || c_firmware==3.41f || c_firmware==3.55f) && ((direct_launch_forced==1 && !(menu_list[game_sel].user & IS_DBOOT)) || (menu_list[game_sel].user & IS_BDMIRROR)) ) { if(c_firmware!=3.55f && c_firmware!=3.41f && c_firmware!=3.15f) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_NOTSUPPORTED, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); goto cancel_mount2; } ret = mod_mount_table((char *) "restore", 0); //restore if(!exist((char*)"/dev_bdvd/PS3_GAME/PARAM.SFO") && (menu_list[game_sel].user & IS_DISC)) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_yes_back, (const char*) STR_PS3DISC, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==3 || !exist((char*)"/dev_bdvd")) goto cancel_exit_2; } selx=1; char just_drive[32]; char usb_mount0[512], usb_mount1[512], usb_mount2[512]; char path_backup[512], path_bup[512]; ret = mod_mount_table((char *) "restore", 0); //restore if(ret) { strncpy(just_drive, menu_list[game_sel].path, 11); just_drive[11]=0; sprintf(filename, "%s/PS3_GAME/PARAM.SFO", menu_list[game_sel].path); change_param_sfo_version(filename); sprintf(usb_mount1, "%s/PS3_GAME", just_drive); if(exist(usb_mount1)) { //restore PS3_GAME back to USB game folder sprintf(path_bup, "%s/PS3PATH.BUP", usb_mount1); if(exist(path_bup)) { fpA = fopen ( path_bup, "r" ); if(fgets ( usb_mount2, 512, fpA )==NULL) sprintf(usb_mount2, "%s/PS3_GAME_OLD", just_drive); fclose(fpA); strncpy(usb_mount2, just_drive, 11); //always use current device } else sprintf(usb_mount2, "%s/PS3_GAME_OLD", just_drive); int pl, n; char tempname[512]; pl=strlen(usb_mount2); for(n=0;n<pl;n++) { tempname[n]=usb_mount2[n]; tempname[n+1]=0; if(usb_mount2[n]==0x2F && !exist(tempname)) { mkdir(tempname, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(tempname, 0777); } } if(!exist(usb_mount2)) rename (usb_mount1, usb_mount2); } if(!exist(usb_mount1)) { sprintf(usb_mount0, "%s/PS3_GAME", menu_list[game_sel].path); sprintf(path_backup, "%s/PS3PATH.BUP", usb_mount0); remove(path_backup); fpA = fopen ( path_backup, "w" ); fputs ( usb_mount0, fpA ); fclose(fpA); menu_list[game_sel].user|=IS_BDMIRROR; set_game_flags(game_sel); rename (usb_mount0, usb_mount1); ret = mod_mount_table(just_drive, 1); //modify if(ret) { if(use_cache) mount_with_cache(menu_list[game_sel].path, max_joined, menu_list[game_sel].user, menu_list[game_sel].title_id); unload_modules(); sys_process_exit(1); } else { mod_mount_table((char *) "reset", 0); //reset rename (usb_mount1, usb_mount0); dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_ERR_MNT, dialog_fun2, (void*)0x0000aaab, NULL );; wait_dialog(); rename (usb_mount1, usb_mount0); goto cancel_mount2; } } else { dialog_ret=0; mod_mount_table((char *) "reset", 0); //reset ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_ERR_MVGAME, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } } else { dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_ERR_MNT, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } cancel_mount2: use_cache=0; join_copy=0; new_pad=0; dialog_ret=0; goto skip_1; } sprintf(filename, "%s/USRDIR/RELOAD.SELF", menu_list[game_sel].path); if(exist(filename)) { unload_modules(); sys_game_process_exitspawn2((char *) filename, NULL, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } if(strstr(menu_list[game_sel].path, "/dev_usb")==NULL && ((menu_list[game_sel].user & IS_BDMIRROR) || (menu_list[game_sel].user & IS_USB && !(menu_list[game_sel].user & IS_HDD)) ) ) { dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_HDD_ERR, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); goto cancel_exit_2; } if(strstr(menu_list[game_sel].path, "/dev_hdd")==NULL && ( (menu_list[game_sel].user & IS_HDD && !(menu_list[game_sel].user & IS_USB)) ) ) { dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, (const char*) STR_USB_ERR, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); goto cancel_exit_2; } sprintf(filename, "%s/PS3_GAME/PARAM.SFO", menu_list[game_sel].path); change_param_sfo_version(filename); if((menu_list[game_sel].user & IS_PATCHED) && c_firmware==3.41f) pokeq(0x80000000000505d0ULL, memvalnew); char filename2[1024]; sprintf(filename2, "%s/PS3_GAME/USRDIR/EBOOT.BIN", menu_list[game_sel].path); if((menu_list[game_sel].user & IS_DBOOT) || direct_launch_forced) { menu_list[game_sel].user|=IS_DBOOT; set_game_flags(game_sel); write_last_play( filename2, menu_list[game_sel].path, menu_list[game_sel].title, menu_list[game_sel].title_id, 1); char s_source[512]; char s_destination[512]; sprintf(s_source, "%s/PS3_GAME/TROPDIR", menu_list[game_sel].path); sprintf(s_destination, "%s/TROPDIR", app_usrdir); mkdir(s_destination, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(s_destination, 0777); sprintf(s_destination, "%s/TROPDIR", app_homedir); my_game_copy((char*)s_source, (char*)s_destination); sprintf(s_source, "%s/PS3_GAME/LICDIR/LIC.DAT", menu_list[game_sel].path); sprintf(s_destination, "%s/LICDIR", app_homedir); mkdir(s_destination, S_IRWXO | S_IRWXU | S_IRWXG | S_IFDIR); cellFsChmod(s_destination, 0777); sprintf(s_destination, "%s/LICDIR/LIC.DAT", app_homedir); file_copy((char*)s_source, (char*)s_destination, 0); unload_modules(); sprintf(filename2, "%s/PS3_GAME/USRDIR/EBOOT.BIN", menu_list[game_sel].path); //if(stat("/dev_bdvd/PS3_GAME/USRDIR/EBOOT.BIN", &s3)>=0) sprintf(filename, "%s", "/dev_bdvd/PS3_GAME/USRDIR/EBOOT.BIN"); //else if(stat("/app_home/PS3_GAME/USRDIR/EBOOT.BIN", &s3)>=0) sprintf(filename, "%s", "/app_home/PS3_GAME/USRDIR/EBOOT.BIN"); sprintf(fileboot, "%s", menu_list[game_sel].path); if(use_cache) mount_with_cache(menu_list[game_sel].path, max_joined, menu_list[game_sel].user, menu_list[game_sel].title_id); else mount_with_ext_data(menu_list[game_sel].path, menu_list[game_sel].user); //syscall_mount(fileboot, mount_bdvd); sys_game_process_exitspawn2((char *) filename2, NULL, NULL, NULL, 0, 64, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } else { write_last_play( filename, menu_list[game_sel].path, menu_list[game_sel].title, menu_list[game_sel].title_id, 0); unload_modules(); sprintf(fileboot, "%s", menu_list[game_sel].path); if(use_cache) mount_with_cache(menu_list[game_sel].path, max_joined, menu_list[game_sel].user, menu_list[game_sel].title_id); else mount_with_ext_data(menu_list[game_sel].path, menu_list[game_sel].user);//syscall_mount(fileboot, mount_bdvd); sys_process_exit(1); } } else { if(strstr(menu_list[game_sel].content,"DVD")!=NULL) { sprintf(filename, "DVD-Video disc loaded. Insert any DVD-R disc and play the VOB videos from XMB\xE2\x84\xA2 Video tab.\n\n[%s]",menu_list[game_sel].path); dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, filename, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); syscall_mount( menu_list[game_sel].path, mount_bdvd); ret = unload_modules(); exit(0);//sys_process_exit(1); } if(strstr(menu_list[game_sel].content,"PS2")!=NULL && payload!=0) { dialog_ret=0; cellMsgDialogOpen2( type_dialog_no, "Loading game disc, please wait...", dialog_fun2, (void*)0x0000aaab, NULL ); flipc(60); reset_mount_points(); uint64_t ret2=0x00ULL; ret2 = syscall_838("/dev_bdvd"); ret2 = syscall_838("/dev_ps2disc"); ret2 = syscall_837("CELL_FS_IOS:BDVD_DRIVE", "CELL_FS_UDF", "/dev_ps2disc", 0, 1, 0, 0, 0); ret2 = syscall_837("CELL_FS_IOS:BDVD_DRIVE", "CELL_FS_UDF", "/dev_bdvd", 0, 1, 0, 0, 0); syscall_mount( menu_list[game_sel].path, mount_bdvd); // ret2 = syscall_837("CELL_FS_IOS:BDVD_DRIVE", "CELL_FS_SIMPLE", "/dev_ps2disc", 0, 1, 0, 0, 0); // ret2 = syscall_837("CELL_FS_IOS:BDVD_DRIVE", "CELL_FS_SIMPLE", "/dev_ps2disc1", 0, 1, 0, 0, 0); // ret2 = syscall_837("CELL_FS_IOS:PATA0_BDVD_DRIVE", "CELL_FS_UDF", "/dev_bdvd", 0, 1, 0, 0, 0); if(payload==1) { ret=sys8_path_table(0ULL); dest_table_addr= 0x80000000007FF000ULL-((sizeof(path_open_table)+15) & ~15); open_table.entries[0].compare_addr= ((uint64_t) &open_table.arena[0]) - ((uint64_t) &open_table) + dest_table_addr; open_table.entries[0].replace_addr= ((uint64_t) &open_table.arena[0x800])- ((uint64_t) &open_table) + dest_table_addr; open_table.entries[1].compare_addr= 0ULL; // the last entry always 0 strncpy(&open_table.arena[0], "/dev_ps2disc", 0x100); // compare 1 strncpy(&open_table.arena[0x800], menu_list[game_sel].path, 0x800); // replace 1 open_table.entries[0].compare_len= strlen(&open_table.arena[0]); // 1 open_table.entries[0].replace_len= strlen(&open_table.arena[0x800]); sys8_memcpy(dest_table_addr, (uint64_t) &open_table, sizeof(path_open_table)); ret=sys8_path_table( dest_table_addr); } if(payload==2) { ret=syscall35((char *)"/dev_ps2disc", (char *)menu_list[game_sel].path); } cellMsgDialogAbort(); sprintf(filename, "PLAYSTATION\xC2\xAE\x32 game disc loaded!\n\n[%s]\n\n(experimental)",menu_list[game_sel].path); dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, filename, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); ret = unload_modules(); sys_process_exit(1); } else { if(strstr(menu_list[game_sel].path,"/pvd_usb")!=NULL) sprintf(string1, "::: %s :::\n\nYou can't load games from selected device!", menu_list[game_sel].title); else sprintf(string1, "::: %s :::\n\n%s not found", menu_list[game_sel].title, filename); dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_ok, string1, dialog_fun2, (void*)0x0000aaab, NULL ); wait_dialog(); } } } } } } cancel_exit_2: skip_1: skip_to_FM: if((new_pad & BUTTON_SQUARE) && cover_mode==8 && (xmb_icon==4 || (xmb_icon==6 || xmb_icon==8)) && !is_retro_loading && !is_game_loading &&!is_video_loading) { // grouping bool use_ab= (old_pad & BUTTON_SELECT) || xmb_icon==4; u8 main_group=xmb[xmb_icon].group & 0x0f; u8 alpha_group=xmb[xmb_icon].group>>4 & 0x0f; if(use_ab) alpha_group++; else main_group++; //alpha_group&=0x0f; if(alpha_group>14) alpha_group=0; main_group&=0x0f; if(xmb_icon==8) { if(main_group>5) main_group=0; if(main_group) { read_xmb_column_type(8, main_group+7, alpha_group); if(alpha_group) sprintf(xmb[8].name, "%s (%s)", retro_groups[main_group], alpha_groups[alpha_group]); else sprintf(xmb[8].name, "%s", retro_groups[main_group]); } else { read_xmb_column(8, alpha_group); if(alpha_group) sprintf(xmb[8].name, "%s (%s)", xmb_columns[8], alpha_groups[alpha_group]); else sprintf(xmb[8].name, "%s", xmb_columns[8]); } redraw_column_texts(xmb_icon); draw_xmb_icon_text(xmb_icon); xmb[8].member[0].data=-1; xmb[8].member[0].status=2; xmb[8].member[0].icon=xmb[0].data; sort_xmb_col(xmb[8].member, xmb[8].size, 1); if(xmb[8].size) xmb[8].first=1; } else if(xmb_icon==4) { read_xmb_column(4, alpha_group); if(alpha_group) sprintf(xmb[4].name, "%s (%s)", xmb_columns[4], alpha_groups[alpha_group]); else sprintf(xmb[4].name, "%s", xmb_columns[4]); redraw_column_texts(xmb_icon); draw_xmb_icon_text(xmb_icon); sort_xmb_col(xmb[4].member, xmb[4].size, 0); } else if(xmb_icon==6 || xmb_icon==7) // game/faves { xmb[6].init=0; xmb[7].init=0; xmb[xmb_icon].group= (alpha_group<<4) | (main_group); add_game_column(menu_list, max_menu_list, game_sel, 0); if(main_group) { if(alpha_group) sprintf(xmb[6].name, "%s (%s)", genre[(xmb[6].group&0xf)], alpha_groups[alpha_group]); else sprintf(xmb[6].name, "%s", genre[(xmb[6].group&0xf)]); } else { if(alpha_group) sprintf(xmb[6].name, "%s (%s)", xmb_columns[6], alpha_groups[alpha_group]); else sprintf(xmb[6].name, "%s", xmb_columns[6]); } redraw_column_texts(xmb_icon); draw_xmb_icon_text(xmb_icon); } xmb[xmb_icon].group= (alpha_group<<4) | (main_group); free_text_buffers(); xmb_bg_counter=200; xmb_bg_show=0; new_pad=0; } if((new_pad & BUTTON_SQUARE) && cover_mode==8) {egg=1-egg; use_drops=(egg==1);} if ( ( ((new_pad & BUTTON_SQUARE) && cover_mode!=5 && cover_mode!=8) || ((new_pad & BUTTON_TRIANGLE) && cover_mode==8)) && game_sel<max_menu_list && max_menu_list>0 && (cover_mode!=8 || (cover_mode==8 && ( (xmb_icon==6 && xmb[xmb_icon].member[xmb[xmb_icon].first].type==1 && xmb[xmb_icon].size>1) || (xmb_icon==5 && xmb[xmb_icon].member[xmb[xmb_icon].first].type==2) || (xmb_icon==7 && xmb[xmb_icon].size)))) ) { new_pad=0; if(cover_mode==4) { sprintf(auraBG, "%s/AUR5.JPG", app_usrdir); load_texture(text_bmp, auraBG, 1920);} int ret_f=open_submenu(text_bmp, &game_sel); old_fi=-1; if(ret_f) {slide_screen_left(text_FONT);memset(text_bmp, 0, FB(1));} if(cover_mode==8 || cover_mode==4) { {xmb[6].init=0; xmb[7].init=0;}init_xmb_icons(menu_list, max_menu_list, game_sel );} if(cover_mode==3) load_texture(text_FONT, userBG, 1920); if(ret_f==1 && disable_options!=2 && disable_options!=3) goto copy_title; if(ret_f==2 && disable_options!=1 && disable_options!=3) goto delete_title; if(ret_f==3) goto rename_title; if(ret_f==4) goto update_title; if(ret_f==5) goto test_title; if(ret_f==6) goto setperm_title; if(ret_f==7) goto start_title; goto force_reload; } if ( new_pad & BUTTON_CIRCLE && cover_mode!=5 && cover_mode!=8 && net_used_ignore()) { new_pad=0; c_opacity_delta=16; dimc=0; dim=1; dialog_ret=0; ret = cellMsgDialogOpen2( type_dialog_yes_no, (const char*) STR_QUIT1, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) { reset_mount_points(); char list_file2[128]; int i; sprintf(list_file2, "%s/LLIST.TXT", app_usrdir); FILE *flist; remove(list_file2); flist = fopen(list_file2, "w"); sprintf(filename, "%s", "\xEF\xBB\xBF"); fputs (filename, flist ); for(i=0;i<max_menu_list;i++) { sprintf(filename, "[%s] %s\r\n", menu_list[i].title_id, menu_list[i].title); fputs (filename, flist ); sprintf(filename, " --> %s\r\n", menu_list[i].path); fputs (filename, flist ); sprintf(filename, "%s", "\r\n"); fputs (filename, flist ); } fclose(flist); unload_modules(); sys_process_exit(1); break; } } ClearSurface(); c_opacity2=c_opacity; if(c_opacity2>0xc0) c_opacity2=0xc0; if(c_opacity2<0x21) c_opacity2=0x00; //mouse pointer if(cover_mode==5) { mouseX+=mouseXD; mouseY+=mouseYD; if(mouseX>0.995f) {mouseX=0.995f;mouseXD=0.0f;} if(mouseX<0.0f) {mouseX=0.0f;mouseXD=0.0f;} if(mouseY>0.990f) {mouseY=0.990f;mouseYD=0.0f;} if(mouseY<0.0f) {mouseY=0.0f;mouseYD=0.0f;} } if(!no_video) { if(game_sel>=0 && (((mode_list==0) /*&& max_menu_list>0*/)) ) // && png_w!=0 && png_h!=0 { if(cover_mode==0 && max_menu_list>0) { set_texture( text_bmpS, 320, 320); //ICON0.PNG if(offX<0 || offY<0 || offX>31 || offY>31 || animation==0 || animation==2) {offX=0; offY=0;} if(animation==0 || animation==2) incZ=0; {offX=0; offY=0; incZ=0;} offY+=(float)(incZ*0.5625f); offX+=incZ; if(offX>30) {incZ=-0.25f;};if(offX<1) {incZ=0.25f;}; display_img((int)(1440-offX), (int)(80-offY), 320+(int)(offX*2.0f), 176+(int)(offY*2.0f), 320, 176, 0.0f, 320, 320); } if((cover_mode==1 || cover_mode==6 || cover_mode==7) && max_menu_list>0) { set_texture( text_bmp, 1920, 1080); //PIC1.PNG display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); } if(cover_mode==2 && max_menu_list>0) { set_texture( text_bmpS, 320, 320); if(offX<0 || offY<0 || offX>31 || animation==0 || animation==2) {offX=0; offY=0;} // offY>31 || if(animation==0 || animation==2) incZ=0; if(cover_available==1) offY+=(float)(incZ*1.1538f); else offY+=(float)(incZ*0.5500f); offX+=incZ; if(offX>30) {incZ=-0.3f;};if(offX<1) {incZ=0.3f;}; if(cover_available==1) display_img((int)(1540-offX), (int)(80-offY), 260+(int)(offX*2.0f), 300+(int)(offY*2.0f), 260, 300, -0.5f, 320, 320); else display_img((int)(1440-offX), (int)(80-offY), 320+(int)(offX*2.0f), 176+(int)(offY*2.0f), 320, 176, -0.5f, 320, 320); set_texture( text_bmp, 1920, 1080); //PIC1.PNG display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); } if(cover_mode==3 && max_menu_list>0) { if(cover_available==1) { set_texture( text_bmpS, 320, 320); //cover display_img(1602, 80, 260, 300, 260, 300, 0.0f, 320, 320); } if(game_bg_overlay==1) { set_texture( text_bmp, 1920, 1080); //PIC1.PNG incZ=64; offX+=incZ; if(offX>0 || animation==0 || animation==1) {incZ=0; offX=0;} display_img((int)(offX), 80, 1547, 844, 1920, 1080, 0.0f, 1920, 1080); } set_texture( text_FONT, 1920, 1080); //PICBG.PNG display_img(0, 0, 1920, 1080, 1920, 1080, 0.0f, 1920, 1080); } if(cover_mode==4 && max_menu_list>0) { if(!xmb[6].init) init_xmb_icons(menu_list, max_menu_list, game_sel); xmb_icon=6; draw_coverflow_icons(xmb, xmb_icon, xmb_slide_y); } if(cover_mode==8) draw_whole_xmb(0); if(cover_mode==5) { if ( (new_pad & BUTTON_LEFT ) && mouseX>=0.026f ) {mouseX-=0.026f;} if ( (new_pad & BUTTON_RIGHT) && mouseX<=0.974f ) {mouseX+=0.026f;} if ( ((old_pad & BUTTON_R2) || (old_pad & BUTTON_L2)) && (new_pad & BUTTON_UP) ) { state_draw=1; if(mouseX<0.54f) first_left=0; else first_right=0; new_pad=0;}// if ( ((old_pad & BUTTON_R2) || (old_pad & BUTTON_L2)) && (new_pad & BUTTON_DOWN) ) { state_draw=1; if(mouseX<0.54f) first_left=max_dir_l-20; else first_right=max_dir_r-20; new_pad=0;}// if ( ((new_pad & BUTTON_UP) && mouseY>=(0.12f+0.025f) && mouseY<=(0.12f+0.025f+0.026f)) ) { state_draw=1; if(mouseX<0.54f) {first_left-=1; if(first_left>1) {new_pad=0;}} else {first_right-=1; if(first_right>1) {new_pad=0;} } } if ( ((new_pad & BUTTON_DOWN) && mouseY>=(0.614f+0.025f) && mouseY<=(0.614f+0.025f+0.026f)) ) { state_draw=1; if(mouseX<0.54f) {first_left+=1; if(first_left+18<max_dir_l){new_pad=0;} } else {first_right+=1; if(first_right+18<max_dir_r){new_pad=0;} }} if ( (new_pad & BUTTON_UP ) && mouseY>=0.026f ) {mouseY-=0.026f;} if ( (new_pad & BUTTON_DOWN ) && mouseY<=0.974f ) {mouseY+=0.026f;} if ( (new_pad & BUTTON_L2) ) { state_draw=1; if(mouseX<0.54f) first_left-=12; else first_right-=12; new_pad=0;} if ( (new_pad & BUTTON_R2) ) { state_draw=1; if(mouseX<0.54f) first_left+=12; else first_right+=12; new_pad=0;} fm_sel=0x0; if(mouseX>=0.035f+0.025f && mouseX<=0.13f+0.025f && mouseY>=0.027f+0.025f && mouseY<=0.068f+0.025f) //games { fm_sel=1; if(((new_pad & BUTTON_CROSS) || (new_pad & BUTTON_CIRCLE))) { load_texture(text_legend, legend, 1665); load_texture(text_bmpUPSR, playBGR, 1920); sprintf(auraBG, "%s/AUR5.JPG", app_usrdir); load_texture(text_bmp, auraBG, 1920); if ((new_pad & BUTTON_CROSS)) { if(cover_mode==initial_cover_mode) cover_mode=0; else cover_mode=initial_cover_mode; } else cover_mode=4; if(lock_display_mode!=-1) cover_mode=lock_display_mode; cover_mode--; if(cover_mode<0) cover_mode=8; goto next_for_FM; } } if(mouseX>=0.139f+0.025f && mouseX<=0.245f+0.025f && mouseY>=0.027f+0.025f && mouseY<=0.068f+0.025f) //update { fm_sel=1<<1; if ((new_pad & BUTTON_CROSS)) { new_pad=0; force_update_check=1; } } //if(c_opacity2>0x00) if(mouseX>=0.525f+0.025f && mouseX<=0.610f+0.025f && mouseY>=0.027f+0.025f && mouseY<=0.068f+0.025f) //themes { fm_sel=1<<4; if ((new_pad & BUTTON_CROSS)) { new_pad=0; sprintf(current_right_pane, "%s", themes_dir); state_read=1; state_draw=1; } } float pane_x_l=0.04f+0.025f; float pane_x_r=0.54f; if(first_left>max_dir_l) first_left=0; if(first_right>max_dir_r) first_right=0; if(first_left<0) first_left=0; if(first_right<0) first_right=0; int help_open=0, about_open=0; if(mouseX>=0.41f+0.025f && mouseX<=0.495f+0.025f && mouseY>=0.027f+0.025f && mouseY<=0.068f+0.025f) { help_open=1; //help fm_sel=1<<3; } if(mouseX>=0.275f+0.025f && mouseX<=0.38f+0.025f && mouseY>=0.027f+0.025f && mouseY<=0.068f+0.025f) about_open=1; //about if(c_opacity2==0x00) {help_open=0; about_open=0;} if((help_open || about_open)) { new_pad=0; if(about_open) { fm_sel=1<<2; draw_square((0.250f-0.5f)*2.0f, (0.5f-0.210)*2.0f, 1.0f, 1.0f, -0.2f, 0x10101000); draw_square((0.240f-0.5f)*2.0f, (0.5f-0.200)*2.0f, 1.04f, 1.04f, -0.2f, 0x00080ff40); sprintf(string1, "About multiMAN\n ver %s\n", current_version); cellDbgFontPrintf( 0.43f, 0.25f, 0.7f, 0xa0a0a0a0, string1); cellDbgFontPrintf( 0.28f, 0.44f, 0.7f, 0xa0c0c0c0, " multiMAN is a hobby project, distributed in the\nhope that it will be useful, but WITHOUT ANY\nWARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."); cellDbgFontPrintf( 0.28f, 0.64f, 0.7f, 0xa0c0c0c0, " Copyleft (c) 2011"); } if(help_open)// && stat(helpNAV, &s3)<0 && stat(helpMME, &s3)<0) { fm_sel=1<<3; draw_square((0.250f-0.5f)*2.0f, (0.5f-0.210)*2.0f, 1.0f, 1.0f, -0.2f, 0x10101000); draw_square((0.240f-0.5f)*2.0f, (0.5f-0.200)*2.0f, 1.04f, 1.04f, -0.2f, 0x00080ff40); cellDbgFontPrintf( 0.38f, 0.25f, 0.9f, 0xa0a0a0a0, "Navigation and keys"); if(confirm_with_x) { cellDbgFontPrintf( 0.28f, 0.300f, 0.7f, 0xa0c0c0c0, "[D-PAD ] - move mouse in fixed increments\n[STICKS] - move mouse pointer\n\n[O] - Open command menu\n\n[R1] - Switch to next GAMES display mode\n[L1] - Switch to prev GAMES display mode\n[L2] - Page up\n[R2] - Page down"); cellDbgFontPrintf( 0.28f, 0.52f, 0.7f, 0xa0c0c0c0, "[X] - Enter selected folder\n[X] - View image or play music/video file\n\n[R2]+[UP] - Scroll to top of file list\n[R2]+[DOWN] - Scroll to bottom of file list"); cellDbgFontPrintf( 0.28f, 0.64f, 0.7f, 0xa0c0c0c0, "[X] - Load device folders in left pane\n[O] - Load device folders in right pane" ); } else { cellDbgFontPrintf( 0.28f, 0.300f, 0.7f, 0xa0c0c0c0, "[D-PAD ] - move mouse in fixed increments\n[STICKS] - move mouse pointer\n\n[X] - Open command menu\n\n[R1] - Switch to next GAMES display mode\n[L1] - Switch to prev GAMES display mode\n[L2] - Page up\n[R2] - Page down"); cellDbgFontPrintf( 0.28f, 0.52f, 0.7f, 0xa0c0c0c0, "[O] - Enter selected folder\n[O] - View image or play music/video file\n\n[R2]+[UP] - Scroll to top of file list\n[R2]+[DOWN] - Scroll to bottom of file list"); cellDbgFontPrintf( 0.28f, 0.64f, 0.7f, 0xa0c0c0c0, "[O] - Load device folders in left pane\n[X] - Load device folders in right pane" ); } } } // else { //if(c_opacity2>0x20 && viewer_open==0) { if(state_read) { if(!exist(current_left_pane) && strstr(current_left_pane, "/pvd_usb")==NULL && strstr(current_left_pane, "/ps3_home")==NULL && strstr(current_left_pane, "/net_host")==NULL) {sprintf(current_left_pane,"%s", "/");state_read=1; state_draw=1;} if(!exist(current_right_pane) && strstr(current_right_pane, "/pvd_usb")==NULL && strstr(current_right_pane, "/ps3_home")==NULL && strstr(current_right_pane, "/net_host")==NULL) {sprintf(current_right_pane,"%s","/");state_read=1; state_draw=1;} if(strstr(current_left_pane, "/pvd_usb")!=NULL && !pfs_enabled) {sprintf(current_left_pane,"%s", "/");state_read=1; state_draw=1;} if(strstr(current_right_pane, "/pvd_usb")!=NULL && !pfs_enabled) {sprintf(current_right_pane,"%s", "/");state_read=1; state_draw=1;} if(state_read==1 || state_read==2) read_dir(current_left_pane, pane_l, &max_dir_l); if(state_read==1 || state_read==3) read_dir(current_right_pane, pane_r, &max_dir_r); } // if(state_read || state_draw) { state_read=0; max_ttf_label=0; draw_dir_pane( pane_l, max_dir_l, first_left, 22-(int)((1080*0.025f)/18.0f+1), pane_x_l); draw_dir_pane( pane_r, max_dir_r, first_right, 22-(int)((1080*0.025f)/18.0f+1), pane_x_r); if(state_read==1 || state_read==2) read_dir(current_left_pane, pane_l, &max_dir_l); if(state_read==1 || state_read==3) read_dir(current_right_pane, pane_r, &max_dir_r); } if(state_draw || state_read) { if(state_read==1 || state_read==2) read_dir(current_left_pane, pane_l, &max_dir_l); if(state_read==1 || state_read==3) read_dir(current_right_pane, pane_r, &max_dir_r); if(state_read) { max_ttf_label=0; draw_dir_pane( pane_l, max_dir_l, first_left, 22-(int)((1080*0.025f)/18.0f+1), pane_x_l); draw_dir_pane( pane_r, max_dir_r, first_right, 22-(int)((1080*0.025f)/18.0f+1), pane_x_r); } for(int fsr=0; fsr<V_WIDTH*V_HEIGHT*4; fsr+=4) *(uint32_t*) ((uint8_t*)(text_bmpUPSR)+fsr)=0x32323280; flush_ttf(text_bmpUPSR, V_WIDTH, V_HEIGHT); max_ttf_label=0; sprintf(string1,"[%s]", current_left_pane); string1[56]=0x2e; string1[57]=0x2e; string1[58]=0x5d; string1[59]=0; print_label( 0.04f+0.025f, 0.085f+0.025f, 0.8f, 0xc0c0c0c0, string1, 1.04f, 0.0f, 17); sprintf(string1,"[%s]", current_right_pane); string1[56]=0x2e; string1[57]=0x2e; string1[58]=0x5d; string1[59]=0; print_label( 0.54f, 0.085f+0.025f, 0.8f, 0xc0c0c0c0, string1, 1.04f, 0.0f, 17); flush_ttf(text_bmpUPSR, V_WIDTH, V_HEIGHT); state_draw=0; } max_ttf_label=0; } if ( (ss_timer>=(ss_timeout*60) && ss_timeout) ) screen_saver(); } if ( (new_pad & BUTTON_CROSS) && mouseX>=0.89459375f && mouseX<=0.9195f && mouseY>=0.05222f && mouseY<=0.09666f && net_used_ignore()) { dialog_ret=0; new_pad=0; ret = cellMsgDialogOpen2( type_dialog_yes_no, (const char*) STR_QUIT1, dialog_fun1, (void*)0x0000aaaa, NULL ); wait_dialog(); if(dialog_ret==1) { reset_mount_points(); unload_modules(); sys_process_exit(1); break; } new_pad=0; } time ( &rawtime ); timeinfo = localtime ( &rawtime ); float y = 0.83f-0.053f; char str[256]; int ok=0, n=0; float len; float x=0.07; char sizer[255]; char path[255]; int xZOOM=0; for(n=0;n<17;n++) { ok=0; if(n==11 && hide_bd==1) continue; if((fdevices>>n) & 1) ok=1; if( ok || n==12 || (n==16 && mount_hdd1==1) ) { switch(n) { case 0: sprintf(str, "HDD"); sprintf(path, "/dev_hdd0"); break; case 16: sprintf(str, "HDD#1"); sprintf(path, "/dev_hdd1"); break; case 7: sprintf(str, "USB#%i", n-5); sprintf(path, "/dev_usb00%d", n-1); break; case 11: sprintf(str, "%s", menu_list[0].title); sprintf(path, "/dev_bdvd"); break; case 12: if(cellNetCtlGetInfo(16, &net_info) < 0 || net_avail<0) {str[0]=0; path[0]=0; break;} sprintf(str, "PSX Store"); sprintf(path, "/web"); break; case 13: sprintf(str, "USB disk"); sprintf(path, "/pvd_usb000"); break; case 14: sprintf(str, "SDHC card"); sprintf(path, "/dev_sd"); break; case 15: sprintf(str, "MS card"); sprintf(path, "/dev_ms"); break; default: sprintf(str, "USB#%i", n); sprintf(path, "/dev_usb00%d", n-1); break; } len=0.03f*(float)(strlen(str)); xZOOM=0; if(mouseX>=x && mouseX<=x+0.05f && mouseY>=y-0.044f && mouseY<=y+0.05) xZOOM=32; if(xZOOM>0) { draw_text_stroke( (x+0.025f)-(float)((0.0094f*(float)(strlen(str)))/2), y-0.115f, 0.75f, 0xffc0c0c0, str); if ( ((old_pad & BUTTON_CROSS) || (old_pad & BUTTON_L3) || (old_pad & BUTTON_CIRCLE) || (old_pad & BUTTON_R3)) && strstr(path, "/web")!=NULL) {new_pad=0; launch_web_browser((char*)"http://www.psxstore.com/");} if ( (old_pad & BUTTON_CROSS)) {state_draw=1; state_read=2; sprintf(current_left_pane, "%s", path); new_pad=0;} if ( (old_pad & BUTTON_CIRCLE)) {state_draw=1; state_read=3; sprintf(current_right_pane, "%s", path); new_pad=0;} } if(n!=11){ if(n!=12 && n!=13) { cellFsGetFreeSize(path, &blockSize, &freeSize); freeSpace = ( ((uint64_t)blockSize * freeSize)); sprintf(sizer, "%.2fGB", (double) (freeSpace / 1073741824.00f)); draw_text_stroke( (x+0.025f)-(float)((0.009f*(float)(strlen(sizer)))/2), y+0.045f, 0.75f, COL_LEGEND, sizer); } if(n==13) { sprintf(sizer, "PFS Drive"); draw_text_stroke( (x+0.025f)-(float)((0.009f*(float)(strlen(sizer)))/2), y+0.045f, 0.75f, COL_LEGEND, sizer); } } else { sprintf(sizer, "%s", "BD-ROM"); if(strstr(menu_list[0].content, "PS3")!=NULL) sprintf(sizer, "%s", "PS3 Disc"); else if(strstr(menu_list[0].content, "PS2")!=NULL) sprintf(sizer, "%s", "PS2 Disc"); else if(strstr(menu_list[0].content, "DVD")!=NULL) sprintf(sizer, "%s", "DVD Video"); else if(strstr(menu_list[0].content, "AVCHD")!=NULL) sprintf(sizer, "%s", "AVCHD"); else if(strstr(menu_list[0].content, "BDMV")!=NULL) sprintf(sizer, "%s", "Blu-ray"); draw_text_stroke( (x+0.025f)-(float)((0.009f*(float)(strlen(sizer)))/2), y+0.045f, 0.75f, COL_LEGEND, sizer); } switch(n) { case 0: set_texture( text_HDD, 320, 320); display_img((int)(x*1920)-(int)(xZOOM/2), (int) (y*1080)-48-xZOOM, 96+xZOOM, 96+xZOOM, 96, 96, 0.0f, 320, 320); break; case 16: set_texture( text_HDD, 320, 320); display_img((int)(x*1920)-(int)(xZOOM/2), (int) (y*1080)-48-xZOOM, 96+xZOOM, 96+xZOOM, 96, 96, 0.0f, 320, 320); break; case 7: set_texture( text_USB, 320, 320); display_img((int)(x*1920)-(int)(xZOOM/2), (int) (y*1080)-48-xZOOM, 96+xZOOM, 96+xZOOM, 96, 96, 0.0f, 320, 320); break; case 11: set_texture( text_BLU_1, 320, 320); display_img((int)(x*1920)-(int)(xZOOM/2), (int) (y*1080)-48-xZOOM, 96+xZOOM, 96+xZOOM, 96, 96, 0.0f, 320, 320); break; case 12: if(net_avail < 0) {x-=0.13; str[0]=0; break;} else { sprintf(sizer, "%s", net_info.ip_address); draw_text_stroke( (x+0.025f)-(float)((0.008f*(float)(strlen(sizer)))/2), y+0.046f, 0.65f, COL_LEGEND, sizer); set_texture( text_NET_6, 320, 320); display_img((int)(x*1920)-(int)(xZOOM/2), (int) (y*1080)-48-xZOOM, 96+xZOOM, 96+xZOOM, 96, 96, 0.0f, 320, 320); break; } case 13: // set_texture( text_CFC_3, 320, 320); set_texture( text_USB, 320, 320); display_img((int)(x*1920)-(int)(xZOOM/2), (int) (y*1080)-48-xZOOM, 96+xZOOM, 96+xZOOM, 96, 96, 0.0f, 320, 320); break; case 14: set_texture( text_SDC_4, 320, 320); display_img((int)(x*1920)-(int)(xZOOM/2), (int) (y*1080)-48-xZOOM, 96+xZOOM, 96+xZOOM, 96, 96, 0.0f, 320, 320); break; case 15: set_texture( text_MSC_5, 320, 320); display_img((int)(x*1920)-(int)(xZOOM/2), (int) (y*1080)-48-xZOOM, 96+xZOOM, 96+xZOOM, 96, 96, 0.0f, 320, 320); break; default: set_texture( text_USB, 320, 320); display_img((int)(x*1920)-(int)(xZOOM/2), (int) (y*1080)-48-xZOOM, 96+xZOOM, 96+xZOOM, 96, 96, 0.0f, 320, 320); break; } x+=0.13; } } //sliding background draw_fileman(); if(date_format==0) sprintf(string1, "%02d/%02d/%04d", timeinfo->tm_mday, timeinfo->tm_mon+1, timeinfo->tm_year+1900); else if(date_format==1) sprintf(string1, "%02d/%02d/%04d", timeinfo->tm_mon+1, timeinfo->tm_mday, timeinfo->tm_year+1900); else if(date_format==2) sprintf(string1, "%04d/%02d/%02d", timeinfo->tm_year+1900, timeinfo->tm_mon+1, timeinfo->tm_mday ); cellDbgFontPrintf( 0.83f, 0.895f, 0.7f ,COL_HEXVIEW, "%s\n %s:%02d:%02d ", string1, tmhour(timeinfo->tm_hour), timeinfo->tm_min, timeinfo->tm_sec); } //end cover_mode==5 fileman } setRenderColor(); if(status_info[0] && debug_mode) cellDbgFontPrintf( 0.01f, 0.98f, 0.5f,0x60606080, status_info); if(patchmode==1 && (c_opacity2>0x00)) { if(cover_mode<3) cellDbgFontPrintf( 0.78f, 0.03f, 0.7f,0x90909080," USB patch"); else if(cover_mode!=5) cellDbgFontPrintf( 0.85f, 0.03f, 0.7f,0x90909080," USB patch"); } if(mode_list==0) { if(dim==1) c_opacity+=c_opacity_delta; if(c_opacity<0x20) c_opacity=0x20; if(c_opacity>0xff) c_opacity=0xff; if(cover_mode!=8) { draw_device_list(fdevices | ((game_sel>=0 && max_menu_list>0) ? (menu_list[game_sel].flags<<16) : 0), cover_mode, c_opacity2, menu_list[0].content); if(game_sel>=0 && max_menu_list>0) { if(cover_mode==0 || cover_mode==2) { if(cover_mode==0) draw_square(-0.9f, 0.9f, 2.0f-(0.70f-(0*2)), 2.0-0.50f-(2.0*0), 0.7f, 0x2080ff30); draw_list_text( text_bmp, 1920, 1080, menu_list, max_menu_list, game_sel | (0x10000 * ((menu_list[0].flags & 2048)!=0)), dir_mode, display_mode, cover_mode, c_opacity, 0); set_texture( text_bmp, 1920, 1080); display_img(0, 0, 1920, 1080, 1920, 1080, -0.2f, 1920, 1080); } else { draw_list( menu_list, max_menu_list, game_sel | (0x10000 * ((menu_list[0].flags & 2048)!=0)), dir_mode, display_mode, cover_mode, game_sel_last, c_opacity); } } else if(cover_mode!=5 && cover_mode!=8) cellDbgFontPrintf( 0.08f, 0.1f, 1.0f, 0x80808080, "Insert Blu-ray game disc...\n\nPress [TRIANGLE] to access system menu.\nEdit options.ini if necessary!\n\nPress [SELECT]+[START] for File Manager mode."); } } } cellDbgFontDrawGcm(); if(cover_mode==5) draw_mouse_pointer(0); if(!first_launch) flip(); } //end of main loop reset_mount_points(); ret = unload_modules(); sys_process_exit(1); return 0; } //end of main void flip(void) { cellSysutilCheckCallback(); cellDbgFontPrintf( 0.99f, 0.98f, 0.5f,0x10101010, payloadT); cellDbgFontDrawGcm(); cellConsolePoll(); cellGcmResetFlipStatus(); // if(max_ttf_label) flush_ttf((uint8_t*)(color_base_addr)+video_buffer*(c_frame_index), V_WIDTH, V_HEIGHT); cellGcmSetFlip(gCellGcmCurrentContext, frame_index); cellGcmFlush(gCellGcmCurrentContext); setDrawEnv(); setRenderColor(); cellGcmSetWaitFlip(gCellGcmCurrentContext); frame_index = 1- frame_index;// (frame_index+1) & 1; setRenderTarget(); vert_indx=0; // reset the vertex index vert_texture_indx=0; angle+=3.6f; if(angle>=360.f) angle=0.f; /* if(cover_mode==8 && !key_repeat) { if(abs(xmb_slide_y) && abs(xmb_slide_y)<100) sys_timer_usleep( 6673 ); else if(abs(xmb_slide) && abs(xmb_slide)<100) sys_timer_usleep( 6673 ); }*/ } void change_bri(u8 *buffer, int delta, u32 size) { u32 pixel; u32 deltaR; u32 deltaG; u32 deltaB; float delta2=1.0f; //positive increases brightness if(delta<0) delta2=0.f; //negative decreases brightness delta=abs(delta); //size=+/-% for(u32 fsr=0; fsr<size; fsr+=4) { pixel=*(uint32_t*) ((uint8_t*)(buffer)+fsr); deltaR = ((u32)((float)((pixel>>24)&0xff)*(delta2+(float)delta/100.f)));if(deltaR>0xff) deltaR=0xff; deltaG = ((u32)((float)((pixel>>16)&0xff)*(delta2+(float)delta/100.f)));if(deltaG>0xff) deltaG=0xff; deltaB = ((u32)((float)((pixel>> 8)&0xff)*(delta2+(float)delta/100.f)));if(deltaB>0xff) deltaB=0xff; *(uint32_t*) ((uint8_t*)(buffer)+fsr)= deltaR<<24 | deltaG<<16 | deltaB<<8 | pixel&0xff; } } static void png_thread_entry( uint64_t arg ) { (void)arg; is_decoding_png=1; if(init_finished) { int _xmb_icon=arg&0xf; int cn=arg>>8; if(xmb[_xmb_icon].member[cn].status==1) { load_png_texture_th( xmb[_xmb_icon].member[cn].icon, xmb[_xmb_icon].member[cn].icon_path);//, _xmb_icon==8?408:xmb[_xmb_icon].member[cn].iconw); if(png_w_th && png_h_th && ((png_w_th+png_h_th)<=(XMB_THUMB_WIDTH+XMB_THUMB_HEIGHT)) && (xmb[_xmb_icon].member[cn].status==1)) { xmb[_xmb_icon].member[cn].iconw=png_w_th; xmb[_xmb_icon].member[cn].iconh=png_h_th; xmb[_xmb_icon].member[cn].status=2; if(_xmb_icon==7) put_texture_with_alpha_gen( xmb[_xmb_icon].member[cn].icon, xmb_icon_star_small, 32, 32, 32, 320, 283, 5); } else { xmb[_xmb_icon].member[cn].status=2; if(cover_mode==8) { if(_xmb_icon==6) xmb[_xmb_icon].member[cn].icon=xmb[6].data; else if(_xmb_icon==7) xmb[_xmb_icon].member[cn].icon=xmb[7].data; else if(_xmb_icon==5) xmb[_xmb_icon].member[cn].icon=xmb_icon_film; else if(_xmb_icon==3) xmb[_xmb_icon].member[cn].icon=xmb_icon_photo; else if(_xmb_icon==8) xmb[_xmb_icon].member[cn].icon=xmb_icon_retro; } else { if(xmb[_xmb_icon].member[cn].type==2) xmb[_xmb_icon].member[cn].icon=xmb_icon_film; else xmb[_xmb_icon].member[cn].icon=xmb[6].data; } } } } is_decoding_png=0; sys_ppu_thread_exit(0); } static void jpg_thread_entry( uint64_t arg ) { (void)arg; is_decoding_jpg=1; if(init_finished) { int _xmb_icon=arg&0xf; int cn=arg>>8; if(xmb[_xmb_icon].member[cn].status==1) { scale_icon_h=176; load_jpg_texture_th( xmb[_xmb_icon].member[cn].icon, xmb[_xmb_icon].member[cn].icon_path, xmb[_xmb_icon].member[cn].iconw); if(jpg_w && jpg_h && ((jpg_w+jpg_h)<=(XMB_THUMB_WIDTH+XMB_THUMB_HEIGHT)) && (xmb[_xmb_icon].member[cn].status==1)) { xmb[_xmb_icon].member[cn].iconw=jpg_w; xmb[_xmb_icon].member[cn].iconh=jpg_h; xmb[_xmb_icon].member[cn].status=2; } else { xmb[_xmb_icon].member[cn].status=2; if(_xmb_icon==5) xmb[_xmb_icon].member[cn].icon=xmb_icon_film; else if(_xmb_icon==3) xmb[_xmb_icon].member[cn].icon=xmb_icon_photo; else if(_xmb_icon==8) xmb[_xmb_icon].member[cn].icon=xmb_icon_retro; } } } scale_icon_h=0; is_decoding_jpg=0; sys_ppu_thread_exit(0); } void load_jpg_threaded(int _xmb_icon, int cn) { if(is_decoding_jpg) return; is_decoding_jpg=1; sys_ppu_thread_create( &jpgdec_thr_id, jpg_thread_entry, (_xmb_icon | (cn<<8) ), misc_thr_prio-100, app_stack_size, 0, "multiMAN_jpeg" ); } void load_png_threaded(int _xmb_icon, int cn) { if(is_decoding_png) return; is_decoding_png=1; sys_ppu_thread_create( &pngdec_thr_id, png_thread_entry, (_xmb_icon | (cn<<8) ), misc_thr_prio-100, app_stack_size,//misc_thr_prio 0, "multiMAN_png" ); } static void download_thread_entry( uint64_t arg ) { (void)arg; while(init_finished) { for(int n=0;n<MAX_DOWN_LIST;n++) { if(downloads[n].status==1) { downloads[n].status=2; if(!exist(downloads[n].local)) { download_file_th(downloads[n].url, downloads[n].local, 0); } sys_timer_usleep(1000*1000); } sys_timer_usleep(3336); } sys_ppu_thread_yield(); sys_timer_usleep(5000*1000); } sys_ppu_thread_exit( 0 ); } static void misc_thread_entry( uint64_t arg ) { (void)arg; while(init_finished) { if(force_mp3) { if(main_mp3_th(force_mp3_file, 0)) force_mp3=false; else { if(max_mp3!=0) { current_mp3++; if(current_mp3>max_mp3) current_mp3=1; sprintf(force_mp3_file, "%s", mp3_playlist[current_mp3].path); force_mp3=true; } } } sys_timer_usleep(3336); if(cover_mode==8 && is_game_loading && !drawing_xmb && !first_launch) { drawing_xmb=1; xmb_bg_counter=200; xmb_bg_show=0; draw_whole_xmb(xmb_icon); sys_ppu_thread_yield(); } //cellConsolePoll(); sys_ppu_thread_yield(); } sys_ppu_thread_exit( 0 ); }
C++
#include "hvcall.h" #include "peek_poke.h" int lv1_insert_htab_entry(u64 htab_id, u64 hpte_group, u64 hpte_v, u64 hpte_r, u64 bolted_flag, u64 flags, u64 * hpte_index, u64 * hpte_evicted_v, u64 * hpte_evicted_r) { INSTALL_HVSC_REDIRECT(0x9E); // redirect to hvcall 158 // call lv1_insert_htab_entry u64 ret = 0, ret_hpte_index = 0, ret_hpte_evicted_v = 0, ret_hpte_evicted_r = 0; __asm__ __volatile__("mr %%r3, %4;" "mr %%r4, %5;" "mr %%r5, %6;" "mr %%r6, %7;" "mr %%r7, %8;" "mr %%r8, %9;" SYSCALL(HVSC_SYSCALL) "mr %0, %%r3;" "mr %1, %%r4;" "mr %2, %%r5;" "mr %3, %%r6;":"=r"(ret), "=r"(ret_hpte_index), "=r"(ret_hpte_evicted_v), "=r"(ret_hpte_evicted_r) :"r"(htab_id), "r"(hpte_group), "r"(hpte_v), "r"(hpte_r), "r"(bolted_flag), "r"(flags) :"r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "lr", "ctr", "xer", "cr0", "cr1", "cr5", "cr6", "cr7", "memory"); REMOVE_HVSC_REDIRECT(); *hpte_index = ret_hpte_index; *hpte_evicted_v = ret_hpte_evicted_v; *hpte_evicted_r = ret_hpte_evicted_r; return (int)ret; } int lv1_allocate_memory(u64 size, u64 page_size_exp, u64 flags, u64 * addr, u64 * muid) { INSTALL_HVSC_REDIRECT(0x0); // redirect to hvcall 0 // call lv1_allocate_memory u64 ret = 0, ret_addr = 0, ret_muid = 0; __asm__ __volatile__("mr %%r3, %3;" "mr %%r4, %4;" "li %%r5, 0;" "mr %%r6, %5;" SYSCALL(HVSC_SYSCALL) "mr %0, %%r3;" "mr %1, %%r4;" "mr %2, %%r5;":"=r"(ret), "=r"(ret_addr), "=r"(ret_muid) :"r"(size), "r"(page_size_exp), "r"(flags) :"r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "lr", "ctr", "xer", "cr0", "cr1", "cr5", "cr6", "cr7", "memory"); REMOVE_HVSC_REDIRECT(); *addr = ret_addr; *muid = ret_muid; return (int)ret; } int lv1_undocumented_function_114(u64 start, u64 page_size, u64 size, u64 * lpar_addr) { INSTALL_HVSC_REDIRECT(0x72); // redirect to hvcall 114 // call lv1_undocumented_function_114 u64 ret = 0, ret_lpar_addr = 0; __asm__ __volatile__("mr %%r3, %2;" "mr %%r4, %3;" "mr %%r5, %4;" SYSCALL(HVSC_SYSCALL) "mr %0, %%r3;" "mr %1, %%r4;":"=r"(ret), "=r"(ret_lpar_addr) :"r"(start), "r"(page_size), "r"(size) :"r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "lr", "ctr", "xer", "cr0", "cr1", "cr5", "cr6", "cr7", "memory"); REMOVE_HVSC_REDIRECT(); *lpar_addr = ret_lpar_addr; return (int)ret; } void lv1_undocumented_function_115(u64 lpar_addr) { INSTALL_HVSC_REDIRECT(0x73); // redirect to hvcall 115 // call lv1_undocumented_function_115 __asm__ __volatile__("mr %%r3, %0;" SYSCALL(HVSC_SYSCALL) : // no return registers :"r"(lpar_addr) :"r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "lr", "ctr", "xer", "cr0", "cr1", "cr5", "cr6", "cr7", "memory"); REMOVE_HVSC_REDIRECT(); } u64 lv2_alloc(u64 size, u64 pool) { // setup syscall to redirect to alloc func u64 original_syscall_code_1 = lv2_peek(HVSC_SYSCALL_ADDR); u64 original_syscall_code_2 = lv2_peek(HVSC_SYSCALL_ADDR + 8); u64 original_syscall_code_3 = lv2_peek(HVSC_SYSCALL_ADDR + 16); lv2_poke(HVSC_SYSCALL_ADDR, 0x7C0802A67C140378ULL); lv2_poke(HVSC_SYSCALL_ADDR + 8, 0x4BECB6317E80A378ULL); lv2_poke(HVSC_SYSCALL_ADDR + 16, 0x7C0803A64E800020ULL); u64 ret = 0; __asm__ __volatile__("mr %%r3, %1;" "mr %%r4, %2;" SYSCALL(HVSC_SYSCALL) "mr %0, %%r3;":"=r"(ret) :"r"(size), "r"(pool) :"r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "lr", "ctr", "xer", "cr0", "cr1", "cr5", "cr6", "cr7", "memory"); // restore original syscall code lv2_poke(HVSC_SYSCALL_ADDR, original_syscall_code_1); lv2_poke(HVSC_SYSCALL_ADDR + 8, original_syscall_code_2); lv2_poke(HVSC_SYSCALL_ADDR + 16, original_syscall_code_3); return ret; }
C++
// _I_.h : main header file for the _I_ application // #if !defined(AFX__I__H__5161CB99_70DA_47CD_AED4_CDECAAA8D92B__INCLUDED_) #define AFX__I__H__5161CB99_70DA_47CD_AED4_CDECAAA8D92B__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #ifndef __AFXWIN_H__ #error include 'stdafx.h' before including this file for PCH #endif #include "resource.h" // main symbols ///////////////////////////////////////////////////////////////////////////// // C_I_App: // See _I_.cpp for the implementation of this class // class C_I_App : public CWinApp { public: C_I_App(); // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(C_I_App) public: virtual BOOL InitInstance(); //}}AFX_VIRTUAL // Implementation //{{AFX_MSG(C_I_App) afx_msg void OnAppAbout(); // NOTE - the ClassWizard will add and remove member functions here. // DO NOT EDIT what you see in these blocks of generated code ! //}}AFX_MSG DECLARE_MESSAGE_MAP() }; ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX__I__H__5161CB99_70DA_47CD_AED4_CDECAAA8D92B__INCLUDED_)
C++
// MainFrm.h : interface of the CMainFrame class // ///////////////////////////////////////////////////////////////////////////// #if !defined(AFX_MAINFRM_H__E63E34E0_F1D1_4B0B_9A9F_F995B64D0005__INCLUDED_) #define AFX_MAINFRM_H__E63E34E0_F1D1_4B0B_9A9F_F995B64D0005__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 class CMainFrame : public CFrameWnd { protected: // create from serialization only CMainFrame(); DECLARE_DYNCREATE(CMainFrame) // Attributes public: // Operations public: // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CMainFrame) virtual BOOL PreCreateWindow(CREATESTRUCT& cs); //}}AFX_VIRTUAL // Implementation public: virtual ~CMainFrame(); #ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; #endif protected: // control bar embedded members CToolBar m_wndToolBar; public: void LoadNewIcon(UINT nIconID); CTime m_tnow; CTime m_tstart; CStatusBar m_wndStatusBar; // Generated message map functions protected: afx_msg void OnContextMenu(CWnd*, CPoint point); //{{AFX_MSG(CMainFrame) afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnTimer(UINT nIDEvent); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_MAINFRM_H__E63E34E0_F1D1_4B0B_9A9F_F995B64D0005__INCLUDED_)
C++
// _I_Doc.h : interface of the C_I_Doc class // ///////////////////////////////////////////////////////////////////////////// #if !defined(AFX__I_DOC_H__26FAAC3C_F2B1_44CF_9407_3E1633F04A29__INCLUDED_) #define AFX__I_DOC_H__26FAAC3C_F2B1_44CF_9407_3E1633F04A29__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 class C_I_Doc : public CDocument { protected: // create from serialization only C_I_Doc(); DECLARE_DYNCREATE(C_I_Doc) // Attributes public: // Operations public: // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(C_I_Doc) public: virtual BOOL OnNewDocument(); virtual void Serialize(CArchive& ar); virtual void DeleteContents(); //}}AFX_VIRTUAL // Implementation public: int m_ncoins; virtual ~C_I_Doc(); #ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; #endif protected: // Generated message map functions protected: //{{AFX_MSG(C_I_Doc) afx_msg void OnAddcoins(); afx_msg void OnSubcoins(); afx_msg void OnUpdateSubcoins(CCmdUI* pCmdUI); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX__I_DOC_H__26FAAC3C_F2B1_44CF_9407_3E1633F04A29__INCLUDED_)
C++
// stdafx.cpp : source file that includes just the standard includes // _I_.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h"
C++
// _I_View.h : interface of the C_I_View class // ///////////////////////////////////////////////////////////////////////////// #if !defined(AFX__I_VIEW_H__75D881CE_AE01_44F7_8ABF_062050986ABD__INCLUDED_) #define AFX__I_VIEW_H__75D881CE_AE01_44F7_8ABF_062050986ABD__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "MainFrm.h" class C_I_View : public CView { protected: // create from serialization only C_I_View(); DECLARE_DYNCREATE(C_I_View) // Attributes public: C_I_Doc* GetDocument(); // Operations public: // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(C_I_View) public: virtual void OnDraw(CDC* pDC); // overridden to draw this view virtual BOOL PreCreateWindow(CREATESTRUCT& cs); protected: virtual BOOL OnPreparePrinting(CPrintInfo* pInfo); virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo); virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo); //}}AFX_VIRTUAL // Implementation public: virtual ~C_I_View(); #ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; #endif protected: // Generated message map functions protected: //{{AFX_MSG(C_I_View) afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); afx_msg void OnMouseMove(UINT nFlags, CPoint point); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; #ifndef _DEBUG // debug version in _I_View.cpp inline C_I_Doc* C_I_View::GetDocument() { return (C_I_Doc*)m_pDocument; } #endif ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX__I_VIEW_H__75D881CE_AE01_44F7_8ABF_062050986ABD__INCLUDED_)
C++
// _I_.cpp : Defines the class behaviors for the application. // #include "stdafx.h" #include "_I_.h" #include "MainFrm.h" #include "_I_Doc.h" #include "_I_View.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // C_I_App BEGIN_MESSAGE_MAP(C_I_App, CWinApp) //{{AFX_MSG_MAP(C_I_App) ON_COMMAND(ID_APP_ABOUT, OnAppAbout) // NOTE - the ClassWizard will add and remove mapping macros here. // DO NOT EDIT what you see in these blocks of generated code! //}}AFX_MSG_MAP // Standard file based document commands ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew) ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen) // Standard print setup command ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // C_I_App construction C_I_App::C_I_App() { // TODO: add construction code here, // Place all significant initialization in InitInstance } ///////////////////////////////////////////////////////////////////////////// // The one and only C_I_App object C_I_App theApp; ///////////////////////////////////////////////////////////////////////////// // C_I_App initialization BOOL C_I_App::InitInstance() { AfxEnableControlContainer(); // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need. #ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL #else Enable3dControlsStatic(); // Call this when linking to MFC statically #endif // Change the registry key under which our settings are stored. // TODO: You should modify this string to be something appropriate // such as the name of your company or organization. SetRegistryKey(_T("Local AppWizard-Generated Applications")); LoadStdProfileSettings(); // Load standard INI file options (including MRU) // Register the application's document templates. Document templates // serve as the connection between documents, frame windows and views. CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(C_I_Doc), RUNTIME_CLASS(CMainFrame), // main SDI frame window RUNTIME_CLASS(C_I_View)); AddDocTemplate(pDocTemplate); // Parse command line for standard shell commands, DDE, file open CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // Dispatch commands specified on the command line if (!ProcessShellCommand(cmdInfo)) return FALSE; // The one and only window has been initialized, so show and update it. m_pMainWnd->ShowWindow(SW_SHOW); m_pMainWnd->UpdateWindow(); return TRUE; } ///////////////////////////////////////////////////////////////////////////// // CAboutDlg dialog used for App About class CAboutDlg : public CDialog { public: CAboutDlg(); // Dialog Data //{{AFX_DATA(CAboutDlg) enum { IDD = IDD_ABOUTBOX }; //}}AFX_DATA // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CAboutDlg) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation protected: //{{AFX_MSG(CAboutDlg) // No message handlers //}}AFX_MSG DECLARE_MESSAGE_MAP() }; CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) { //{{AFX_DATA_INIT(CAboutDlg) //}}AFX_DATA_INIT } void CAboutDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CAboutDlg) //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) //{{AFX_MSG_MAP(CAboutDlg) // No message handlers //}}AFX_MSG_MAP END_MESSAGE_MAP() // App command to run the dialog void C_I_App::OnAppAbout() { CAboutDlg aboutDlg; aboutDlg.DoModal(); } ///////////////////////////////////////////////////////////////////////////// // C_I_App message handlers
C++
// SC.h : main header file for the SC application // #if !defined(AFX_SC_H__31046A8F_CDB6_43A4_A4E7_77300BF8E218__INCLUDED_) #define AFX_SC_H__31046A8F_CDB6_43A4_A4E7_77300BF8E218__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #ifndef __AFXWIN_H__ #error include 'stdafx.h' before including this file for PCH #endif #include "resource.h" // main symbols ///////////////////////////////////////////////////////////////////////////// // CSCApp: // See SC.cpp for the implementation of this class // class CSCApp : public CWinApp { public: CSCApp(); // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CSCApp) public: virtual BOOL InitInstance(); //}}AFX_VIRTUAL // Implementation //{{AFX_MSG(CSCApp) // NOTE - the ClassWizard will add and remove member functions here. // DO NOT EDIT what you see in these blocks of generated code ! //}}AFX_MSG DECLARE_MESSAGE_MAP() }; ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_SC_H__31046A8F_CDB6_43A4_A4E7_77300BF8E218__INCLUDED_)
C++
// stdafx.cpp : source file that includes just the standard includes // SC.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h"
C++
// HaarDWT.h : main header file for the HAARDWT application // #if !defined(AFX_HAARDWT_H__928D14AE_D76A_43B2_AD51_CB15BC20FB53__INCLUDED_) #define AFX_HAARDWT_H__928D14AE_D76A_43B2_AD51_CB15BC20FB53__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #ifndef __AFXWIN_H__ #error include 'stdafx.h' before including this file for PCH #endif #include "resource.h" // main symbols ///////////////////////////////////////////////////////////////////////////// // CHaarDWTApp: // See HaarDWT.cpp for the implementation of this class // class CHaarDWTApp : public CWinApp { public: CHaarDWTApp(); // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CHaarDWTApp) public: virtual BOOL InitInstance(); //}}AFX_VIRTUAL // Implementation //{{AFX_MSG(CHaarDWTApp) // NOTE - the ClassWizard will add and remove member functions here. // DO NOT EDIT what you see in these blocks of generated code ! //}}AFX_MSG DECLARE_MESSAGE_MAP() }; ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_HAARDWT_H__928D14AE_D76A_43B2_AD51_CB15BC20FB53__INCLUDED_)
C++
// HaarDWT.cpp : Defines the class behaviors for the application. // #include "stdafx.h" #include "HaarDWT.h" #include "HaarDWTDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CHaarDWTApp BEGIN_MESSAGE_MAP(CHaarDWTApp, CWinApp) //{{AFX_MSG_MAP(CHaarDWTApp) // NOTE - the ClassWizard will add and remove mapping macros here. // DO NOT EDIT what you see in these blocks of generated code! //}}AFX_MSG ON_COMMAND(ID_HELP, CWinApp::OnHelp) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CHaarDWTApp construction CHaarDWTApp::CHaarDWTApp() { // TODO: add construction code here, // Place all significant initialization in InitInstance } ///////////////////////////////////////////////////////////////////////////// // The one and only CHaarDWTApp object CHaarDWTApp theApp; ///////////////////////////////////////////////////////////////////////////// // CHaarDWTApp initialization BOOL CHaarDWTApp::InitInstance() { AfxEnableControlContainer(); // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need. #ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL #else Enable3dControlsStatic(); // Call this when linking to MFC statically #endif CHaarDWTDlg dlg; m_pMainWnd = &dlg; int nResponse = dlg.DoModal(); if (nResponse == IDOK) { // TODO: Place code here to handle when the dialog is // dismissed with OK } else if (nResponse == IDCANCEL) { // TODO: Place code here to handle when the dialog is // dismissed with Cancel } // Since the dialog has been closed, return FALSE so that we exit the // application, rather than start the application's message pump. return FALSE; }
C++
#if !defined(AFX_LOADDATA_H__F0E2AFF9_767E_49AC_8462_9173D1AF04C6__INCLUDED_) #define AFX_LOADDATA_H__F0E2AFF9_767E_49AC_8462_9173D1AF04C6__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // loaddata.h : header file // #include "HaarDWTDlg.h" ///////////////////////////////////////////////////////////////////////////// // Cloaddata dialog class Cloaddata : public CDialog { // Construction public: int inputmodel; int indextemp; double Maxcount; int lentemp; CString inputdatafile; double databuf[MAXLEN]; Cloaddata(CWnd* pParent = NULL); // standard constructor // Dialog Data //{{AFX_DATA(Cloaddata) enum { IDD = IDD_INPUTDIG }; CListCtrl m_buflist; CEdit m_input; double m_rprint; //}}AFX_DATA // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(Cloaddata) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation protected: // Generated message map functions //{{AFX_MSG(Cloaddata) virtual void OnOK(); afx_msg void OnFileadd(); afx_msg void OnAdddta(); virtual BOOL OnInitDialog(); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_LOADDATA_H__F0E2AFF9_767E_49AC_8462_9173D1AF04C6__INCLUDED_)
C++
// stdafx.cpp : source file that includes just the standard includes // HaarDWT.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h"
C++
#include "stdio.h" #include "stdlib.h" #include "string.h" typedef unsigned char T_U8; /* unsigned 8 bit integer */ typedef char T_S8; /* unsigned 8 bit integer */ typedef unsigned int T_U32,T_BOOL; /* unsigned 32 bit integer */ typedef signed int T_S32; /* signed 32 bit integer */ typedef void T_VOID; #define AK_FALSE 0 #define AK_TRUE 1 #define AK_NULL NULL static T_VOID U64_Add_Dump(T_S8 *tips, T_U8 *valBuf, T_U8 msb) { T_U8 strbuf[22]; T_U8 i =0; memset(strbuf,0,22); for (i=0;i<msb;i++) { strbuf[i] = valBuf[msb-1-i] + '0'; } printf("%s%015s \n",tips,strbuf); } #if 0 /** * @BRIEF long integer add * @AUTHOR wang xi * @DATE 2010-10-28 * @PARAM sumBuf - a long integer buffer and for restory the sum . * augendBuf - a long integer buffer for add to sumBuf * msb - most hight bit * base - mathematic base number(must between 2 and 255) * @RETURN T_S32 * @RETVAL the msb of sum */ T_S32 LongInt_Add(T_U8 *sumBuf,const T_U8 *augendBuf,T_S32 msb,T_U8 base) { T_S32 i = 0 , tmpVal = 0; T_S32 mostHighBit = msb; T_BOOL bExistCarry = AK_FALSE; for (i=0;i<mostHighBit;i++) { sumBuf[i] = sumBuf[i] + augendBuf[i]; } do { bExistCarry = AK_FALSE; for (i=0;i<mostHighBit;i++) { tmpVal = sumBuf[i]; if (tmpVal >= base) { bExistCarry = AK_TRUE; sumBuf[i] = tmpVal%base; sumBuf[i+1] = sumBuf[i+1] + tmpVal/base; if (mostHighBit < (i+2)) { mostHighBit = (i+2); } } } } while(bExistCarry); return mostHighBit; } /** * @BRIEF 64 bit integer tanslate to Ascii string * @AUTHOR wang xi * @DATE 2010-10-28 * @PARAM high /low - 64 bit integer high 32 bit and low 32 bit * srcBuf - restore the translate result * @RETURN T_S32 * @RETVAL 0 - translate successful * @RETVAL other - Failed */ T_S32 U64_Int2Str(T_U32 high, T_U32 low, T_U8 *strBuf) { T_U8 val1[22] = {0}; T_U8 val2[22] = {0}; T_U8 i=0; T_U32 tmpVal = 0; T_U32 length = 0; T_U8 mostBit = 0; if (AK_NULL == strBuf) { return -1; } memset(val1,0,sizeof(val1)); if (high > 0) { memset(val2,0,sizeof(val2)); // "4294967296" 2^32 val2[0] = 6;val2[1] = 9;val2[2] = 2;val2[3] = 7;val2[4] = 6; val2[5] = 9;val2[6] = 4;val2[7] = 9;val2[8] = 2;val2[9] = 4; mostBit = 10; length = high; while(length--) { U64_Add_Dump("+",val2,10); mostBit = LongInt_Add(val1,val2,mostBit,10); U64_Add_Dump("=",val1,mostBit); } } tmpVal = low; i = 0; memset(val2,0,sizeof(val2)); while(tmpVal>=10) { val2[i] = tmpVal%10; tmpVal = tmpVal/10; i++; } val2[i] = tmpVal; U64_Add_Dump("*",val2,i+1); if (mostBit < (i+1)) { mostBit = i+1; } mostBit = LongInt_Add(val1,val2,mostBit,10); U64_Add_Dump("=",val1,mostBit); for (i=0;i<mostBit;i++) { strBuf[i] = val1[mostBit-1-i] + '0'; } return 0; } #endif /** * @BRIEF long integer add * @AUTHOR wang xi * @DATE 2010-10-28 * @PARAM sumBuf - a long integer buffer and for restory the sum . * augendBuf - a long integer buffer for add to sumBuf * msb - most hight bit * base - mathematic base number(must between 2 and 255) * @RETURN T_S32 * @RETVAL the msb of sum */ T_S32 LongInt_Add(T_U8 *sumBuf,const T_U8 *augendBuf,T_S32 msb,T_U8 base) { T_S32 i = 0 , tmpVal = 0; T_S32 mostHighBit = msb; T_BOOL bExistCarry = AK_FALSE; for (i=0;i<mostHighBit;i++) { sumBuf[i] = sumBuf[i] + augendBuf[i]; } do { bExistCarry = AK_FALSE; for (i=0;i<mostHighBit;i++) { tmpVal = sumBuf[i]; if (tmpVal >= base) { bExistCarry = AK_TRUE; sumBuf[i] = tmpVal%base; sumBuf[i+1] = sumBuf[i+1] + tmpVal/base; if (mostHighBit < (i+2)) { mostHighBit = (i+2); } } } } while(bExistCarry); return mostHighBit; } /** * @BRIEF 64 bit integer tanslate to Ascii string(base number is 10) * @AUTHOR wang xi * @DATE 2010-10-28 * @PARAM high /low - value of 64 bit integer high / low 32 bit * strBuf - restore the translate result * @RETURN T_S32 * @RETVAL 0 - translate successful * @RETVAL other - Failed */ T_S32 U64_Int2Str(T_S8 *strBuf,T_U32 high , T_U32 low) { T_U8 sumbuf[22] = {0}; T_U8 augendbuf[22] = {0}; T_U8 i=0; T_U32 tmpVal = 0; T_U32 length = 0; T_U8 mostBit = 0; if (AK_NULL == strBuf) { return -1; } memset(sumbuf,0,sizeof(sumbuf)); if (high > 0) { memset(augendbuf,0,sizeof(augendbuf)); // "4294967296" 2^32 augendbuf[0] = 6;augendbuf[1] = 9;augendbuf[2] = 2;augendbuf[3] = 7;augendbuf[4] = 6; augendbuf[5] = 9;augendbuf[6] = 4;augendbuf[7] = 9;augendbuf[8] = 2;augendbuf[9] = 4; mostBit = 10; length = high; while(length--) { mostBit = (T_U8)LongInt_Add(sumbuf,augendbuf,mostBit,10); } } tmpVal = low; i = 0; memset(augendbuf,0,sizeof(augendbuf)); while (tmpVal >= 10) { augendbuf[i] = (T_U8)(tmpVal%10); tmpVal = tmpVal/10; i++; } augendbuf[i] = (T_U8)tmpVal; if (mostBit < (i+1)) { mostBit = i+1; } mostBit = (T_U8)LongInt_Add(sumbuf,augendbuf,mostBit,10); for (i=0;i<mostBit;i++) { strBuf[i] = sumbuf[mostBit-1-i] + '0'; } return 0; } #define MAX_STR_LEN 100 int main() { T_S8 val1[MAX_STR_LEN] = {0}; memset(val1,0,sizeof(val1)); U64_Int2Str(val1,0,0); printf("%s\n",val1); return 0; }
C++
/** * @FILE: * @BRIEF: * @Copyright (C) 2011 . * @AUTHOR: WX * @DATE: 2011-02-28 * @VERSION: 1.0 * @REF:this file depends by STL and WIN API. */ #include <windows.h> #include <iostream> #include <string> #include <list> using namespace std; #define ENABLE_DEBUG_OUTPUT #define Debug_OutPut(s) \ {\ cout << s << endl;\ } #define MyFileApi(_fun_) (File_##_fun_) /** * @BRIEF: Get Sub Dir (without recursion ) * @AUTHOR: WX * @DATE: 2011-02-28 * @PARAM string searchPathRoot:root dir for search * @PARAM list<string> & pathlist:Sting List For Store The All SubDir FullPath Of Search Result * @RETURN int:The Count Of Search Result */ int MyFileApi(SearchSubDir)(string searchPathRoot,list<string> &pathlist) { WIN32_FIND_DATA FindFileData; HANDLE hFind=NULL; int count = 0; string fullPath; searchPathRoot += "\\"; fullPath = searchPathRoot + "*.*"; hFind=FindFirstFile(fullPath.c_str(),&FindFileData); if (INVALID_HANDLE_VALUE == hFind) { #ifdef ENABLE_DEBUG_OUTPUT cout << "Error:" << fullPath << "Find Nothing" <<endl; #endif return 0; } do { if ('.' == FindFileData.cFileName[0]) { continue; } if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { count++; fullPath = searchPathRoot + FindFileData.cFileName; pathlist.push_back(fullPath); #ifdef ENABLE_DEBUG_OUTPUT Debug_OutPut(fullPath); #endif } } while(FindNextFile(hFind, &FindFileData)); FindClose(hFind); return count; } /** * @BRIEF: Get Sub Dir With Depth limit * @AUTHOR: WX * @DATE: 2011-02-28 * @PARAM string searchPath:root dir for search * @PARAM list<string> &Searchlist:Sting List For Store The All SubDir FullPath Of Search Result * @PARAM maxDepth:the max Depth of Search Level.(if maxDepth eque 0,that meaning without any limit) * @RETURN int:The Count Of Search Result */ int MyFileApi(FindAllSubDir)(string searchPath,list<string> &Searchlist,int maxDepth) { string tmpPath; int i,j,SubDirCount,count; list<string> pathlist; list<string>::iterator pathIterator; pathlist.push_front(searchPath); SubDirCount = 0; count = 0; for (i=0;(i<maxDepth) || (0 == maxDepth);i++) { SubDirCount = 0; while (!pathlist.empty()) { pathIterator = pathlist.begin(); SubDirCount += MyFileApi(SearchSubDir)(*pathIterator,Searchlist); pathlist.pop_front(); } if ((!Searchlist.empty()) && (SubDirCount > 0)) { count += SubDirCount; pathIterator = Searchlist.end(); for (j=0;j<SubDirCount;j++) { pathIterator--; pathlist.push_front(*pathIterator); } } else { #ifdef ENABLE_DEBUG_OUTPUT cout << "############# Find Finished ["<< count << "]Dirs ############" <<endl; #endif break; } } return count; } int main() { list<string> pathlist; File_FindAllSubDir("C:",pathlist,0);//C:\\TestDir return 0; }
C++
#include "stdio.h" #include "test_define.h" struct st_List{ char first;//4 short second;//2 char third;//1 long fouth;//4 char fifth;//1 }; void main() { unsigned long pad_cnt = 0; struct_pad_dump(struct st_List, first, offsetof(struct st_List, second), pad_cnt); struct_pad_dump(struct st_List, second, offsetof(struct st_List, third), pad_cnt); struct_pad_dump(struct st_List, third, offsetof(struct st_List, fouth), pad_cnt); struct_pad_dump(struct st_List, fouth, offsetof(struct st_List, fifth), pad_cnt); struct_pad_dump(struct st_List, fifth, sizeof(struct st_List), pad_cnt); }
C++
#include<stdio.h> #include<string.h> #include<iostream.h> void main() { double d=12345.65898; char *p; p="hello"; sprintf(p,"lf",d); cout<<p<<endl; }
C++
#include <stdio.h> struct st_bittype_a{ struct { int a:6; int b:4; int c:4; int d:3; } test; int e:1; }; struct st_bittype_b{ int a:6; int b:4; int c:4; int d:3; int e:1; }; void main() { int a=0x00070001; int b=0x000007ff; int c=a|b; printf("%08X | %08X = %08x \n",a, b, c); printf("struct_size:%d,%d\n", sizeof(st_bittype_a), sizeof(st_bittype_b)); }
C++
// WPDlg.h : header file // #if !defined(AFX_WPDLG_H__189E2E5A_4C20_45AD_815C_5E8E8980D318__INCLUDED_) #define AFX_WPDLG_H__189E2E5A_4C20_45AD_815C_5E8E8980D318__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 ///////////////////////////////////////////////////////////////////////////// // CWPDlg dialog class CWPDlg : public CDialog { // Construction public: int getStrLineNum(char *str,int len); int m_cmdval_read; int ReadCmdVal(); BOOL WriteCmdVal(int val); int m_cmdval; BOOL m_isReading; void ShowCmdStr(char* str,BOOL isShow); BOOL m_isSeting; CString m_cmd_strbuf; int m_isShengDian; CWPDlg(CWnd* pParent = NULL); // standard constructor // Dialog Data //{{AFX_DATA(CWPDlg) enum { IDD = IDD_WP_DIALOG }; CListCtrl m_list_down; CListCtrl m_list_up; //}}AFX_DATA // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CWPDlg) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation protected: HICON m_hIcon; // Generated message map functions //{{AFX_MSG(CWPDlg) virtual BOOL OnInitDialog(); afx_msg void OnSysCommand(UINT nID, LPARAM lParam); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); afx_msg void OnBnSd(); afx_msg void OnBnDd(); afx_msg void OnBnSz(); afx_msg void OnBnTz(); afx_msg void OnBnCd(); afx_msg void OnTimer(UINT nIDEvent); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_WPDLG_H__189E2E5A_4C20_45AD_815C_5E8E8980D318__INCLUDED_)
C++
// WP.h : main header file for the WP application // #if !defined(AFX_WP_H__4E72150A_D583_4280_BE28_7EF7EB0AB988__INCLUDED_) #define AFX_WP_H__4E72150A_D583_4280_BE28_7EF7EB0AB988__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #ifndef __AFXWIN_H__ #error include 'stdafx.h' before including this file for PCH #endif #include "resource.h" // main symbols ///////////////////////////////////////////////////////////////////////////// // CWPApp: // See WP.cpp for the implementation of this class // class CWPApp : public CWinApp { public: CWPApp(); // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CWPApp) public: virtual BOOL InitInstance(); //}}AFX_VIRTUAL // Implementation //{{AFX_MSG(CWPApp) // NOTE - the ClassWizard will add and remove member functions here. // DO NOT EDIT what you see in these blocks of generated code ! //}}AFX_MSG DECLARE_MESSAGE_MAP() }; ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_WP_H__4E72150A_D583_4280_BE28_7EF7EB0AB988__INCLUDED_)
C++
// WP.cpp : Defines the class behaviors for the application. // #$Author: helloworld $ #$Date: 2011-08-25 23:21:24 +0800 (星期四, 25 八月 2011) $ #$Rev: 11 $ #$URL: https://virtualxp-54269:8443/svn/wp_vc/WPVC/WP.cpp $ #include "stdafx.h" #include "WP.h" #include "WPDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CWPApp BEGIN_MESSAGE_MAP(CWPApp, CWinApp) //{{AFX_MSG_MAP(CWPApp) // NOTE - the ClassWizard will add and remove mapping macros here. // DO NOT EDIT what you see in these blocks of generated code! //}}AFX_MSG ON_COMMAND(ID_HELP, CWinApp::OnHelp) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CWPApp construction CWPApp::CWPApp() { // TODO: add construction code here, // Place all significant initialization in InitInstance } ///////////////////////////////////////////////////////////////////////////// // The one and only CWPApp object CWPApp theApp; ///////////////////////////////////////////////////////////////////////////// // CWPApp initialization BOOL CWPApp::InitInstance() { AfxEnableControlContainer(); // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need. #ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL #else Enable3dControlsStatic(); // Call this when linking to MFC statically #endif CWPDlg dlg; m_pMainWnd = &dlg; int nResponse = dlg.DoModal(); if (nResponse == IDOK) { // TODO: Place code here to handle when the dialog is // dismissed with OK } else if (nResponse == IDCANCEL) { // TODO: Place code here to handle when the dialog is // dismissed with Cancel } // Since the dialog has been closed, return FALSE so that we exit the // application, rather than start the application's message pump. return FALSE; }
C++
// stdafx.cpp : source file that includes just the standard includes // WP.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h"
C++
#include<iostream.h> void main() { //short int i=5,k=5,j=5; // cout<<sizeof(short int)<<endl; // while(k--) // { cout<<i<<endl;i=!i;} // i=j; // cout<<"endl>>>> "<<i<<endl; double i=-1.01; signed int j; unsigned int k; int l; l=(int)i; k=(unsigned int)i; j=(signed int)i; cout<<"double is :"<<i<<endl; cout<<"int\t "<<l<<"\nunsigned int "<<k<<"\n signed int "<<j<<endl; double ii=55555.453,jj=55555.875; cout<<(int)(ii*10)<<"\n"<<(int)(jj*10)<<endl; }
C++
#include "stdio.h" #include "stdlib.h" #include "string.h" int main(int argc,char**argv) { char *filename = NULL,*keystr = NULL; FILE *fp = NULL; char *headbuf = NULL; int i = 0,j=0,z =0,headlen = 0,keylen = 0,blkcnt=0; printf(" %0x\n",argc); printf(" %s\n",argv[0]); if (NULL != (filename = argv[1])) { printf("File is %s.\n",filename); } else { printf("no file input!\n"); return 0; } if (NULL != argv[2]) { headlen = atoi(argv[2]); if (headlen <= 0) { printf("headlen is invalid!\n"); return 0; } printf("File Head len is %d Byte%s.\n",headlen,(headlen>1)?"s":""); } else { printf("no headlen input!\n"); return 0; } if (NULL == argv[3]) { printf("no key input!\n"); return 0; } else { keystr = argv[3]; keylen = strlen(keystr); } if ((keylen <= 0) || (headlen < keylen) || 0!=(headlen%keylen)) { printf("key is invalid<keylen=%d>!\n",keylen); return 0; } else { printf("key is [%s].<len = %d>\n",keystr,keylen); } fp = fopen(filename,"rb+"); if (NULL == fp) { printf(" Open file error!\n"); return 0; } headbuf = (char*)malloc(headlen+2); if (NULL == headbuf) { fclose(fp); printf("Malloc error!\n"); return 0; } fseek(fp,0,SEEK_SET); i = fread(headbuf,1,headlen,fp); if (headlen != i) { fclose(fp); free(headbuf); printf("fread error <read %d of %d>!\n",i,headlen); return 0; } blkcnt = headlen/keylen; for (i=0;i< blkcnt;i++) { z = keylen*i; for (j=0;j<keylen;j++) { headbuf[z+j] = headbuf[z+j]^keystr[j]; } } fseek(fp,0,SEEK_SET); if (headlen != fwrite(headbuf,1,headlen,fp)) { printf("write error!\n"); } else { printf("successful!\n"); } free(headbuf); fclose(fp); return 0; }
C++
#include "iostream.h" #include "math.h" void main() { int row=4; int col=3; int **A_val,**D_val; A_val=new int*[row]; D_val=new int*[row]; int i,j; for(i=0;i<row;i++) { A_val[i]=new int[col]; D_val[i]=new int[col]; } for(i=0;i<row;i++) for(j=0;j<col;j++) { A_val[i][j]=8; D_val[i][j]=10; cout<<A_val[i][j]<<"\n"<<D_val[i][j]<<endl; } cout<<i<<" "<<j<<endl; for(int ii=0;ii<row;ii++) { delete []A_val[ii]; delete []D_val[ii]; } delete []A_val; delete []D_val; }
C++
#include <stdio.h> #include <math.h> void Int2Str(unsigned char str[],float var) { float num=(float)var; int t=(int)num; int j=(int)((num-t)*100); int i,k; for(i=4;i>=0;i--) { k=(int)pow(10,i); str[4-i]=(unsigned char)((t/k)+48); t=t%k; } str[5]='.'; str[6]=(unsigned char)((j/10)+48); str[7]=(unsigned char)((j%10)+48); str[8]='\0'; } void main() { int i=5; float var=(float)12345.568; while(i--) {unsigned char mystr[9]; var+=0.01; Int2Str(mystr,var); printf("%s\n",mystr); } }
C++
#include <iostream.h> void main (void) { int keycode = 0xff; int row; int col; for(col=0;col<4;col++) { for(row=0;row<4;row++) { keycode = row*10+col; cout<<keycode<<endl; } } }
C++
#include "stdio.h" #include "stdlib.h" #include "string.h" typedef unsigned char T_U8; /* unsigned 8 bit integer */ typedef char T_S8; /* unsigned 8 bit integer */ typedef unsigned int T_U32,T_BOOL; /* unsigned 32 bit integer */ typedef signed int T_S32; /* signed 32 bit integer */ typedef void T_VOID; #define AK_FALSE 0 #define AK_TRUE 1 #define AK_NULL NULL static T_VOID U64_Add_Dump(T_S8 *tips, T_U8 *valBuf, T_U8 msb) { T_U8 strbuf[22]; T_U8 i =0; memset(strbuf,0,22); for (i=0;i<msb;i++) { strbuf[i] = valBuf[msb-1-i] + '0'; } printf("%s%015s \n",tips,strbuf); } /** * @BRIEF long integer add * @AUTHOR wang xi * @DATE 2010-10-28 * @PARAM sumBuf - a long integer buffer and for restory the sum . * augendBuf - a long integer buffer for add to sumBuf * msb - most hight bit * base - mathematic base number(must between 2 and 255) * @RETURN T_S32 * @RETVAL the msb of sum */ T_S32 LongInt_Add(T_U8 *sumBuf,const T_U8 *augendBuf,T_S32 msb,T_U8 base) { T_S32 i = 0 , tmpVal = 0; T_S32 mostHighBit = msb; T_BOOL bExistCarry = AK_FALSE; for (i=0;i<mostHighBit;i++) { sumBuf[i] = sumBuf[i] + augendBuf[i]; } do { bExistCarry = AK_FALSE; for (i=0;i<mostHighBit;i++) { tmpVal = sumBuf[i]; if (tmpVal >= base) { bExistCarry = AK_TRUE; sumBuf[i] = tmpVal%base; sumBuf[i+1] = sumBuf[i+1] + tmpVal/base; if (mostHighBit < (i+2)) { mostHighBit = (i+2); } } } } while(bExistCarry); return mostHighBit; } /** * @BRIEF 64 bit integer tanslate to Ascii string * @AUTHOR wang xi * @DATE 2010-10-28 * @PARAM high /low - 64 bit integer high 32 bit and low 32 bit * srcBuf - restore the translate result * @RETURN T_S32 * @RETVAL 0 - translate successful * @RETVAL other - Failed */ T_S32 U64_Int2Str(T_U32 high, T_U32 low, T_U8 *strBuf) { T_U8 val1[22] = {0}; T_U8 val2[22] = {0}; T_U8 i=0; T_U32 tmpVal = 0; T_U32 length = 0; T_U8 mostBit = 0; if (AK_NULL == strBuf) { return -1; } memset(val1,0,sizeof(val1)); if (high > 0) { memset(val2,0,sizeof(val2)); // "4294967296" 2^32 val2[0] = 6;val2[1] = 9;val2[2] = 2;val2[3] = 7;val2[4] = 6; val2[5] = 9;val2[6] = 4;val2[7] = 9;val2[8] = 2;val2[9] = 4; mostBit = 10; length = high; while(length--) { U64_Add_Dump("+",val2,10); mostBit = LongInt_Add(val1,val2,mostBit,10); U64_Add_Dump("=",val1,mostBit); } } tmpVal = low; i = 0; memset(val2,0,sizeof(val2)); while(tmpVal>=10) { val2[i] = tmpVal%10; tmpVal = tmpVal/10; i++; } val2[i] = tmpVal; U64_Add_Dump("*",val2,i+1); if (mostBit < (i+1)) { mostBit = i+1; } mostBit = LongInt_Add(val1,val2,mostBit,10); U64_Add_Dump("=",val1,mostBit); for (i=0;i<mostBit;i++) { strBuf[i] = val1[mostBit-1-i] + '0'; } return 0; } #define MAX_STR_LEN 100 int main() { T_U8 val1[MAX_STR_LEN] = {0}; memset(val1,0,MAX_STR_LEN); U64_Int2Str(4,0,val1); printf("\n#%s\n",val1); return 0; }
C++
#line 1 "skinMainView.tmpl" #include "content.h" #line 2 "skinMainView.tmpl" #include "constants.h" #line 3 "skinMainView.tmpl" namespace my_skin { #line 5 "skinMainView.tmpl" struct master :public cppcms::base_view #line 5 "skinMainView.tmpl" { #line 5 "skinMainView.tmpl" cppcms::base_content &content; #line 5 "skinMainView.tmpl" master(std::ostream &_s,cppcms::base_content &_content): cppcms::base_view(_s),content(_content) #line 5 "skinMainView.tmpl" { #line 5 "skinMainView.tmpl" } #line 6 "skinMainView.tmpl" virtual void menu() { #line 9 "skinMainView.tmpl" out()<<"\n" " <div id=\"menu\">\n" " <ul>\n" " <li><a href=\""; #line 9 "skinMainView.tmpl" out()<<ROOT #line 10 "skinMainView.tmpl" out()<<"/overview\">overview</a></li>\n" " <li><a href=\""; #line 10 "skinMainView.tmpl" out()<<ROOT #line 11 "skinMainView.tmpl" out()<<"/clients\">clients</a></li>\n" " <li><a href=\""; #line 11 "skinMainView.tmpl" out()<<ROOT #line 14 "skinMainView.tmpl" out()<<"/services\">services</a></li>\n" " </ul>\n" " </div>\n" " "; #line 14 "skinMainView.tmpl" } // end of template menu #line 15 "skinMainView.tmpl" virtual void head() { #line 18 "skinMainView.tmpl" out()<<"\n" " <head>\n" " <title>11z-zpr-netspy</title>\n" " "; #line 18 "skinMainView.tmpl" css(); #line 19 "skinMainView.tmpl" out()<<"\n" " "; #line 19 "skinMainView.tmpl" javascript(); #line 21 "skinMainView.tmpl" out()<<"\n" " </head>\n" " "; #line 21 "skinMainView.tmpl" } // end of template head #line 22 "skinMainView.tmpl" virtual void javascript() { #line 23 "skinMainView.tmpl" out()<<"\n" " <script type=\"text/javascript\" src=\""; #line 23 "skinMainView.tmpl" out()<<ROOT; #line 24 "skinMainView.tmpl" out()<<"/../script/default.js\"></script>\n" " "; #line 24 "skinMainView.tmpl" } // end of template javascript #line 25 "skinMainView.tmpl" virtual void css() { #line 26 "skinMainView.tmpl" out()<<"\n" " <link rel=\"stylesheet\" href=\""; #line 26 "skinMainView.tmpl" out()<<ROOT; #line 27 "skinMainView.tmpl" out()<<"/../style/default.css\" type=\"text/css\" media=\"all\" />\n" " "; #line 27 "skinMainView.tmpl" } // end of template css #line 28 "skinMainView.tmpl" virtual void link_comp(std::string &label,std::string &id) { #line 29 "skinMainView.tmpl" out()<<"\n" " <a href=\""; #line 29 "skinMainView.tmpl" out()<<ROOT #line 29 "skinMainView.tmpl" out()<<"/comp/"; #line 29 "skinMainView.tmpl" out()<<id; #line 29 "skinMainView.tmpl" out()<<"\">"; #line 29 "skinMainView.tmpl" out()<<label; #line 30 "skinMainView.tmpl" out()<<"</a>\n" " "; #line 30 "skinMainView.tmpl" } // end of template link_comp #line 31 "skinMainView.tmpl" }; // end of class master #line 33 "skinMainView.tmpl" struct services :public master #line 33 "skinMainView.tmpl" { #line 33 "skinMainView.tmpl" content::services &content; #line 33 "skinMainView.tmpl" services(std::ostream &_s,content::services &_content): master(_s,_content),content(_content) #line 33 "skinMainView.tmpl" { #line 33 "skinMainView.tmpl" } #line 34 "skinMainView.tmpl" virtual void render() { #line 36 "skinMainView.tmpl" out()<<" \n" " <html>\n" " "; #line 36 "skinMainView.tmpl" master::head(); #line 38 "skinMainView.tmpl" out()<<"\n" " <body>\n" " "; #line 38 "skinMainView.tmpl" master::menu(); #line 46 "skinMainView.tmpl" out()<<"\n" " <table>\n" " <thead>\n" " <tr>\n" " <td>service description</td>\n" " </tr>\n" " </thead>\n" " <tbody>\n" " "; #line 46 "skinMainView.tmpl" for(int i=0; i<content.size; ++i){ #line 48 "skinMainView.tmpl" out()<<"\n" " <tr>\n" " <td><a href=\""; #line 48 "skinMainView.tmpl" out()<<ROOT #line 48 "skinMainView.tmpl" out()<<"/service/"; #line 48 "skinMainView.tmpl" out()<<content.id.at(i) ; #line 48 "skinMainView.tmpl" out()<<"\">"; #line 48 "skinMainView.tmpl" out()<<content.description.at(i) ; #line 50 "skinMainView.tmpl" out()<<"</a></td>\n" " </tr>\n" " "; #line 50 "skinMainView.tmpl" } #line 55 "skinMainView.tmpl" out()<<"\n" " </tbody>\n" " </table>\n" " </body> \n" " <html> \n" " "; #line 55 "skinMainView.tmpl" } // end of template render #line 56 "skinMainView.tmpl" }; // end of class services #line 58 "skinMainView.tmpl" struct overview :public master #line 58 "skinMainView.tmpl" { #line 58 "skinMainView.tmpl" content::overview &content; #line 58 "skinMainView.tmpl" overview(std::ostream &_s,content::overview &_content): master(_s,_content),content(_content) #line 58 "skinMainView.tmpl" { #line 58 "skinMainView.tmpl" } #line 59 "skinMainView.tmpl" virtual void render() { #line 61 "skinMainView.tmpl" out()<<" \n" " <html> \n" " "; #line 61 "skinMainView.tmpl" master::head(); #line 63 "skinMainView.tmpl" out()<<"\n" " <body>\n" " "; #line 63 "skinMainView.tmpl" master::menu(); #line 77 "skinMainView.tmpl" out()<<"\n" " <table>\n" " <thead>\n" " <tr>\n" " <td>ip</td>\n" " <td>port</td>\n" " <td>client remarks</td>\n" " <td>service</td>\n" " <td>timestamp</td>\n" " <td>status</td>\n" " <td></td>\n" " </tr>\n" " </thead>\n" " <tbody>\n" " "; #line 77 "skinMainView.tmpl" for(int i=0; i<content.size; ++i){ #line 78 "skinMainView.tmpl" out()<<"\n" " <tr class=\""; #line 78 "skinMainView.tmpl" out()<<content.status.at(i); #line 79 "skinMainView.tmpl" out()<<"\">\n" " <td><a href=\""; #line 79 "skinMainView.tmpl" out()<<ROOT #line 79 "skinMainView.tmpl" out()<<"/comp/"; #line 79 "skinMainView.tmpl" out()<<content.comp_id.at(i); #line 79 "skinMainView.tmpl" out()<<"\">"; #line 79 "skinMainView.tmpl" out()<<content.ip.at(i) ; #line 80 "skinMainView.tmpl" out()<<"</a></td> \n" " <td>"; #line 80 "skinMainView.tmpl" out()<<content.port.at(i) ; #line 81 "skinMainView.tmpl" out()<<"</td>\n" " <td>"; #line 81 "skinMainView.tmpl" out()<<content.remarks.at(i) ; #line 82 "skinMainView.tmpl" out()<<"</td>\n" " <td><a href=\""; #line 82 "skinMainView.tmpl" out()<<ROOT #line 82 "skinMainView.tmpl" out()<<"/service/"; #line 82 "skinMainView.tmpl" out()<<content.service_id.at(i); #line 82 "skinMainView.tmpl" out()<<"\">"; #line 82 "skinMainView.tmpl" out()<<content.service.at(i); #line 83 "skinMainView.tmpl" out()<<"</a></td>\n" " <td>"; #line 83 "skinMainView.tmpl" out()<<content.timestamp.at(i) ; #line 84 "skinMainView.tmpl" out()<<"</td>\n" " <td>"; #line 84 "skinMainView.tmpl" out()<<content.status.at(i) ; #line 85 "skinMainView.tmpl" out()<<"</td>\n" " <td><a href=\""; #line 85 "skinMainView.tmpl" out()<<ROOT #line 85 "skinMainView.tmpl" out()<<"/service/"; #line 85 "skinMainView.tmpl" out()<<content.service_id.at(i); #line 85 "skinMainView.tmpl" out()<<"/comp/"; #line 85 "skinMainView.tmpl" out()<<content.comp_id.at(i); #line 87 "skinMainView.tmpl" out()<<"\">history</a></td>\n" " </tr>\n" " "; #line 87 "skinMainView.tmpl" } #line 92 "skinMainView.tmpl" out()<<"\n" " </tbody>\n" " </table>\n" " </body> \n" " <html> \n" " "; #line 92 "skinMainView.tmpl" } // end of template render #line 93 "skinMainView.tmpl" }; // end of class overview #line 96 "skinMainView.tmpl" struct clients :public master #line 96 "skinMainView.tmpl" { #line 96 "skinMainView.tmpl" content::clients &content; #line 96 "skinMainView.tmpl" clients(std::ostream &_s,content::clients &_content): master(_s,_content),content(_content) #line 96 "skinMainView.tmpl" { #line 96 "skinMainView.tmpl" } #line 97 "skinMainView.tmpl" virtual void render() { #line 99 "skinMainView.tmpl" out()<<" \n" " <html>\n" " "; #line 99 "skinMainView.tmpl" master::head(); #line 101 "skinMainView.tmpl" out()<<"\n" " <body>\n" " "; #line 101 "skinMainView.tmpl" master::menu(); #line 111 "skinMainView.tmpl" out()<<"\n" " <table>\n" " <thead>\n" " <tr>\n" " <td>ip</td>\n" " <td>port</td>\n" " <td>client remarks</td>\n" " </tr>\n" " </thead>\n" " <tbody>\n" " "; #line 111 "skinMainView.tmpl" for(int i=0; i<content.size; ++i){ #line 113 "skinMainView.tmpl" out()<<"\n" " <tr>\n" " <td><a href=\""; #line 113 "skinMainView.tmpl" out()<<ROOT #line 113 "skinMainView.tmpl" out()<<"/comp/"; #line 113 "skinMainView.tmpl" out()<<content.id.at(i); #line 113 "skinMainView.tmpl" out()<<"\">"; #line 113 "skinMainView.tmpl" out()<<content.ip.at(i) ; #line 114 "skinMainView.tmpl" out()<<"</a></td>\n" " <td>"; #line 114 "skinMainView.tmpl" out()<<content.port.at(i) ; #line 115 "skinMainView.tmpl" out()<<"</td>\n" " <td>"; #line 115 "skinMainView.tmpl" out()<<content.remarks.at(i) ; #line 117 "skinMainView.tmpl" out()<<"</td>\n" " </tr>\n" " "; #line 117 "skinMainView.tmpl" } #line 122 "skinMainView.tmpl" out()<<"\n" " </tbody>\n" " </table>\n" " </body> \n" " <html> \n" " "; #line 122 "skinMainView.tmpl" } // end of template render #line 123 "skinMainView.tmpl" }; // end of class clients #line 125 "skinMainView.tmpl" struct history :public master #line 125 "skinMainView.tmpl" { #line 125 "skinMainView.tmpl" content::history &content; #line 125 "skinMainView.tmpl" history(std::ostream &_s,content::history &_content): master(_s,_content),content(_content) #line 125 "skinMainView.tmpl" { #line 125 "skinMainView.tmpl" } #line 126 "skinMainView.tmpl" virtual void render() { #line 128 "skinMainView.tmpl" out()<<" \n" " <html>\n" " "; #line 128 "skinMainView.tmpl" master::head(); #line 130 "skinMainView.tmpl" out()<<"\n" " <body>\n" " "; #line 130 "skinMainView.tmpl" master::menu(); #line 133 "skinMainView.tmpl" out()<<"\n" " <table>\n" " <caption>\n" " "; #line 133 "skinMainView.tmpl" out()<<cppcms::filters::escape(content.ip); #line 133 "skinMainView.tmpl" out()<<" "; #line 133 "skinMainView.tmpl" out()<<cppcms::filters::escape(content.port); #line 133 "skinMainView.tmpl" out()<<" ("; #line 133 "skinMainView.tmpl" out()<<cppcms::filters::escape(content.remarks); #line 133 "skinMainView.tmpl" out()<<") - "; #line 133 "skinMainView.tmpl" out()<<cppcms::filters::escape(content.service); #line 142 "skinMainView.tmpl" out()<<"\n" " </caption>\n" " <thead>\n" " <tr>\n" " <td>timestamp</td>\n" " <td>status</td>\n" " </tr>\n" " </thead>\n" " <tbody>\n" " "; #line 142 "skinMainView.tmpl" for(int i=0; i<content.size; ++i){ #line 143 "skinMainView.tmpl" out()<<"\n" " <tr class=\""; #line 143 "skinMainView.tmpl" out()<<content.status.at(i); #line 144 "skinMainView.tmpl" out()<<"\">\n" " <td>"; #line 144 "skinMainView.tmpl" out()<<content.timestamp.at(i) ; #line 145 "skinMainView.tmpl" out()<<"</td>\n" " <td>"; #line 145 "skinMainView.tmpl" out()<<content.status.at(i) ; #line 147 "skinMainView.tmpl" out()<<"</td>\n" " </tr>\n" " "; #line 147 "skinMainView.tmpl" } #line 152 "skinMainView.tmpl" out()<<"\n" " </tbody>\n" " </table>\n" " </body> \n" " <html> \n" " "; #line 152 "skinMainView.tmpl" } // end of template render #line 153 "skinMainView.tmpl" }; // end of class history #line 156 "skinMainView.tmpl" } // end of namespace my_skin #line 156 "skinMainView.tmpl" namespace { #line 156 "skinMainView.tmpl" cppcms::views::generator my_generator; #line 156 "skinMainView.tmpl" struct loader { #line 156 "skinMainView.tmpl" loader() { #line 156 "skinMainView.tmpl" my_generator.name("my_skin"); #line 156 "skinMainView.tmpl" my_generator.add_view<my_skin::master,cppcms::base_content>("master",true); #line 156 "skinMainView.tmpl" my_generator.add_view<my_skin::services,content::services>("services",true); #line 156 "skinMainView.tmpl" my_generator.add_view<my_skin::overview,content::overview>("overview",true); #line 156 "skinMainView.tmpl" my_generator.add_view<my_skin::clients,content::clients>("clients",true); #line 156 "skinMainView.tmpl" my_generator.add_view<my_skin::history,content::history>("history",true); #line 156 "skinMainView.tmpl" cppcms::views::pool::instance().add(my_generator); #line 156 "skinMainView.tmpl" } #line 156 "skinMainView.tmpl" ~loader() { cppcms::views::pool::instance().remove(my_generator); } #line 156 "skinMainView.tmpl" } a_loader; #line 156 "skinMainView.tmpl" } // anon
C++
#include <cppcms/view.h> #include <string> /** * This namespace defines the structures used for information exchange between * the controller and view. */ namespace content { struct master : public cppcms::base_content{ }; struct overview : public cppcms::base_content { int size; std::vector<std::string> ip; std::vector<std::string> comp_id; std::vector<std::string> service_id; std::vector<std::string> port; std::vector<std::string> remarks; std::vector<std::string> timestamp; std::vector<std::string> service; std::vector<std::string> status; }; struct services : public cppcms::base_content { int size; std::vector<std::string> description; std::vector<std::string> id; }; struct clients : public cppcms::base_content{ int size; std::vector<int> id; std::vector<std::string> ip; std::vector<std::string> port; std::vector<std::string> remarks; }; struct history : public cppcms::base_content{ int size; std::string ip; std::string port; std::string remarks; std::string service; std::vector<std::string> timestamp; std::vector<std::string> status; }; }
C++
#include <cppcms/application.h> #include <cppcms/applications_pool.h> #include <cppcms/service.h> #include <cppcms/http_response.h> #include <cppcms/url_dispatcher.h> #include <iostream> #include <cppdb/frontend.h> #include <ctime> #include "content.h" #include "constants.h" using namespace std; /** * Klasa aplikacji webowej. * @param srv */ class netspy : public cppcms::application { private: cppdb::session sql; public: /** * Konstruktor inicjalizujący routing oraz połączenie z bazą danych. * @param srv */ netspy(cppcms::service &srv) : cppcms::application(srv) { sql = cppdb::session(string("mysql:database=") + string(DATABASE) + string(";user=") + string(USER) + string(";password=") + string(PASSWORD)); dispatcher().assign("/service/(\\d+)/comp/(\\d+)", &netspy::history, this, 1, 2); dispatcher().assign("/comp/(\\d+)/service/(\\d+)", &netspy::history, this, 2, 1); dispatcher().assign("/overview", &netspy::overview, this); dispatcher().assign("", &netspy::overview, this); dispatcher().assign("/", &netspy::overview, this); dispatcher().assign("/comp/(\\d+)", &netspy::overview_comp, this, 1); dispatcher().assign("/service/(\\d+)", &netspy::overview_service, this, 1); dispatcher().assign("/clients", &netspy::clientsList, this); dispatcher().assign("/services", &netspy::servicesList, this); } virtual ~netspy() { sql.close(); } void overview() { this->overview(""); } void overview_comp(std::string comp) { this->overview(std::string("record.client_id=") + comp); } void overview_service(std::string service) { this->overview(std::string("record.service_id=") + service); } void overview(std::string condition) { try { std::string temp; std::string query = "select * from record " "right join (select max(timestamp) as last, client_id, service_id from record group by client_id, service_id) as refer on (record.timestamp=refer.last and record.client_id=refer.client_id and record.service_id=refer.service_id) " "left join reply on (record.reply_id=reply._id) " "left join service on (record.service_id = service._id) " "left join client on (record.client_id = client._id)"; if ((&condition) != NULL && strlen(condition.c_str()) > 0) { query += " where " + condition; } cppdb::statement stat = sql << query; cppdb::result res = stat.query(); content::overview o; o.size = stat.affected(); while (res.next()) { o.ip.push_back(res.get<std::string > ("ip")); o.port.push_back(res.fetch("port", temp) ? temp : ""); o.timestamp.push_back(res.get<std::string > ("timestamp")); o.status.push_back(res.get<std::string > ("message")); o.remarks.push_back(res.fetch("remarks", temp) ? temp : ""); o.service.push_back(res.get<std::string > ("description")); o.comp_id.push_back(res.get<std::string > ("client_id")); o.service_id.push_back(res.get<std::string > ("service_id")); } render("overview", o); } catch (std::exception const &e) { response().out() << e.what() << std::endl; } } void servicesList() { try { content::services s; cppdb::statement stat = sql << "SELECT * from service"; cppdb::result res = stat.query(); s.size = stat.affected(); while (res.next()) { s.description.push_back(res.get<std::string > ("description")); s.id.push_back(res.get<std::string > ("_id")); } render("services", s); } catch (std::exception const &e) { response().out() << "ERROR: " << e.what() << std::endl; } } void clientsList() { std::string temp; try { content::clients c; cppdb::statement stat = sql << "SELECT * from client"; cppdb::result res = stat.query(); c.size = stat.affected(); while (res.next()) { c.id.push_back(res.get<int>("_id")); c.ip.push_back(res.get<std::string > ("ip")); c.port.push_back(res.fetch("port", temp) ? temp : ""); c.remarks.push_back(res.fetch("remarks", temp) ? temp : ""); } render("clients", c); } catch (std::exception const &e) { response().out() << "ERROR: " << e.what() << std::endl; } } void history(std::string s_id, std::string c_id) { try { std::string temp; std::string query = std::string("select * from record left join reply on (record.reply_id=reply._id) " "left join client on (record.client_id=client._id) left join service on (record.service_id = service._id) where service_id=") + s_id + std::string(" and client_id=") + c_id + std::string(" order by timestamp desc"); cppdb::statement stat = sql << query; cppdb::result res = stat.query(); content::history h; h.size = stat.affected(); bool first_loop = true; while (res.next()) { if (first_loop) { h.ip = res.get<std::string > ("ip"); h.port = res.fetch("port", temp) ? temp : ""; h.remarks = res.fetch("remarks", temp) ? temp : ""; h.service = res.get<std::string > ("description"); first_loop = false; } h.status.push_back(res.get<std::string > ("message")); h.timestamp.push_back(res.get<std::string > ("timestamp")); } render("history", h); } catch (std::exception const &e) { std::cerr << "ERROR: " << e.what() << std::endl; } } void dbtest() { response().out() << "We will rock u <br />"; try { cppdb::result res = sql << "SELECT * FROM client"; while (res.next()) { int id = res.get<int>("_id"); std::string ip = res.get<std::string > ("ip"); response().out() << id << " " << ip << std::endl; } } catch (std::exception const &e) { response().out() << "ERROR: " << e.what() << std::endl; } } }; int main(int argc, char ** argv) { try { cppcms::service srv(argc, argv); srv.applications_pool().mount(cppcms::applications_factory<netspy > ()); srv.run(); } catch (std::exception const &e) { std::cerr << e.what() << std::endl; } }
C++
#ifndef TYPES_HPP #define TYPES_HPP #include <boost/smart_ptr.hpp> #include <boost/asio.hpp> namespace netspy { typedef boost::shared_ptr<boost::asio::ip::tcp::socket> socket_ptr; typedef char char_t; typedef unsigned char uchar_t; typedef short int16_t; typedef unsigned short uint16_t; typedef int int32_t; typedef unsigned int uint32_t; const int DATA_MAX_LENGTH = 2056; } #endif
C++
#include "DataProxy.h" #include <sstream> #include <iostream> #include <boost/lexical_cast.hpp> #include <vector> #include <string> #include <boost/thread.hpp> #include "Config.hpp" using namespace netspy::db; using namespace std; using namespace boost; mutex DataProxy::singletonWatchdog; shared_ptr<DataProxy> DataProxy::instance; shared_ptr<DataProxy> DataProxy::getInstance(){ if(DataProxy::instance==NULL){ DataProxy::singletonWatchdog.lock(); if(DataProxy::instance==NULL){ Config & config = Config::getInstance(); DataProxy::instance = shared_ptr<DataProxy>(new DataProxy( string(config.getDatabaseName()), string(config.getDatabaseUser()), string(config.getDatabasePass()) )); } DataProxy::singletonWatchdog.unlock(); } return DataProxy::instance; } DataProxy::DataProxy(string database, string user, string pass) { this->db = cppdb::session("mysql:database=" + database + ";user=" + user + ";password=" + pass); } DataProxy::DataProxy(const DataProxy& orig) { this->db = orig.db; } DataProxy::~DataProxy() { db.close(); } boost::shared_ptr<const std::vector<boost::shared_ptr<Client> > > DataProxy::getClients() const{ return resToClients(query("client")); } boost::shared_ptr<const vector<boost::shared_ptr<Reply> > > DataProxy::getReplies() const { return resToReplies(query("reply")); } boost::shared_ptr<Client> DataProxy::getClient(unsigned int id) const{ return resToClient(query("client", "_id", boost::lexical_cast<string > (id))); } boost::shared_ptr<Client> DataProxy::getClient(string hash) const{ return resToClient(query("client", "hash", hash)); } boost::shared_ptr<Service> DataProxy::getService(unsigned int id) const { return resToService(query("service", "_id", boost::lexical_cast<string > (id))); } boost::shared_ptr<const vector<boost::shared_ptr<Service> > > DataProxy::getServices() const { return resToServices(query("service")); } boost::shared_ptr<const vector<boost::shared_ptr<Service> > > DataProxy::getServices(string description) const { return resToServices(query("service", "description", description)); } boost::shared_ptr<const vector<boost::shared_ptr<Service> > > DataProxy::getServicesForClient(std::string hash) const { boost::shared_ptr<Client> c = getClient(hash); return getServicesForClient(c.get()!=NULL ? c->id : -1); } boost::shared_ptr<const vector<boost::shared_ptr<Service> > > DataProxy::getServicesForClient(unsigned int id) const { boost::shared_ptr<cppdb::result> res = query( "service left join client_service on(service._id=client_service.service_id)", "is_active = TRUE and client_id", boost::lexical_cast<string > (id) ); return resToServices(res); } void DataProxy::setClientService(unsigned int client_id, unsigned int service_id, bool enable) { resetQuery(); queryString << "select count(*) as number from client_service where client_id=" << client_id << " and service_id=" << service_id; cppdb::statement stat = db << queryString.str(); cppdb::result res = stat.query(); res.next(); if (res.get<int>("number") > 0) { resetQuery(); queryString << "update client_service set is_active=" << enable << " where service_id=" << service_id << " and client_id=" << client_id; stat = db << queryString.str(); } else { resetQuery(); queryString << "insert into client_service values (null," << client_id << "," << service_id << "," << enable << ")"; stat = db << queryString.str(); } cout << "will exec: " << queryString.str() << endl; stat.exec(); } void DataProxy::setClientService(string client_hash, unsigned int service_id, bool enable) { setClientService(getClient(client_hash)->id, service_id, enable); } void DataProxy::addRecord(unsigned int client_id, unsigned int service_id, unsigned int reply_id) { resetQuery(); queryString << "insert into record values (null,now(),1," << client_id << "," << service_id << "," << reply_id << ")"; cppdb::statement stat = db << queryString.str(); stat.exec(); } void DataProxy::addRecord(string client_hash, unsigned int service_id, unsigned int reply_id) { addRecord(getClient(client_hash)->id, service_id, reply_id); } unsigned int DataProxy::addClient(std::string ip, unsigned short port, std::string hash, std::string remarks){ shared_ptr<Client> c = getClient(hash); if(c.get()!=NULL){ return c->id; } else{ resetQuery(); queryString << "insert into client values (null,'"<<ip<<"',"<<port<<",'"<<hash<<"','"<<remarks<<"')"; cppdb::statement stat = db<<queryString.str(); stat.exec(); return getClient(hash)->id; } } boost::shared_ptr<Service > DataProxy::resToService(boost::shared_ptr<cppdb::result> res) const{ Service* s = NULL; if (res->next()) { s=new Service(); res->fetch("_id", s->id); res->fetch("description", s->description); } return boost::shared_ptr<Service>(s);; } boost::shared_ptr<const std::vector<boost::shared_ptr<Service> > > DataProxy::resToServices(boost::shared_ptr<cppdb::result> res) const { shared_ptr<vector<shared_ptr<Service> > > v(new vector<shared_ptr<Service> >); while (res->next()) { v->push_back(shared_ptr<Service>(new Service())); res->fetch("_id", (*(*v)[v->size()-1]).id); res->fetch("description", (*(*v)[v->size()-1]).description); } return v; } shared_ptr<const vector<boost::shared_ptr<Reply> > > DataProxy::resToReplies(boost::shared_ptr<cppdb::result> res) const { shared_ptr<vector<shared_ptr<Reply> > > v(new vector<shared_ptr<Reply> >); while (res->next()) { v->push_back(shared_ptr<Reply>(new Reply())); res->fetch("_id", (*(*v)[v->size()-1]).id); res->fetch("message", (*(*v)[v->size()-1]).message); } return v; } boost::shared_ptr<Client> DataProxy::resToClient(boost::shared_ptr<cppdb::result> res) const { Client* c = NULL; if (res->next()) { c=new Client(); res->fetch("hash", c->hash); res->fetch("_id", c->id); res->fetch("ip", c->ip); res->fetch("remarks", c->remarks); res->fetch("port", c->port); } return boost::shared_ptr<Client>(c); } boost::shared_ptr<const std::vector<boost::shared_ptr<Client> > > DataProxy::resToClients(boost::shared_ptr<cppdb::result> res) const { shared_ptr<vector<shared_ptr<Client> > > v(new vector<shared_ptr<Client> >); while (res->next()) { v->push_back(shared_ptr<Client>(new Client())); res->fetch("_id", (*(*v)[v->size()-1]).id); res->fetch("hash", (*(*v)[v->size()-1]).hash); res->fetch("ip", (*(*v)[v->size()-1]).ip); res->fetch("remarks", (*(*v)[v->size()-1]).remarks); res->fetch("port", (*(*v)[v->size()-1]).port); } return v; } boost::shared_ptr<cppdb::result> DataProxy::query(string table) const{ return query(table, "", ""); } boost::shared_ptr<cppdb::result> DataProxy::query(string table, string column, string value) const { DataProxy * fake_this = const_cast<DataProxy*>(this); fake_this->resetQuery(); fake_this->queryString << "select * from " << table; if (column.length() > 0) { fake_this->queryString << " where " << column << "='" << value << "'"; } boost::shared_ptr<cppdb::result> res(new cppdb::result()); *res = fake_this->db << (fake_this->queryString.str()); return res; } void DataProxy::deleteClientsData(int client_id){ resetQuery(); queryString<<"delete from client_service where client_id="<<client_id<<"; "; cppdb::statement stat = db << queryString.str(); stat.exec(); resetQuery(); queryString<<"delete from record where client_id="<<client_id<<"; "; stat = db << queryString.str(); stat.exec(); resetQuery(); queryString<<"delete from client where _id="<<client_id<<";"; stat = db << queryString.str(); stat.exec(); resetQuery(); } int DataProxy::addService(std::string description){ shared_ptr<const vector<shared_ptr<Service> > > matches = this->getServices(description); if(matches.get()!=NULL && matches->size()>0){ return (*matches->begin())->id; }else{ resetQuery(); queryString<<"insert into service values(null,'"<<description<<"')"<<endl; cppdb::statement stat = db<<queryString.str(); stat.exec(); return this->addService(description); } }
C++
#include "ClientRegistrar.hpp" #include <boost/bind.hpp> #include <boost/smart_ptr.hpp> #include "JSONParser.hpp" #include "Message.hpp" #include "Types.hpp" #include "ClientManager.hpp" #include <cstdlib> #include <sstream> #include "Config.hpp" using boost::asio::ip::tcp; namespace netspy { void ClientRegistrar::setPort(const uint16_t &portNumber) { portNumber_=portNumber; } void ClientRegistrar::registerSession(socket_ptr sock) { try { char data[DATA_MAX_LENGTH]; memset(data,0,DATA_MAX_LENGTH); boost::system::error_code error; sock->read_some(boost::asio::buffer(data), error); if (error == boost::asio::error::eof) return; // Connection closed cleanly by peer. else if (error) throw boost::system::system_error(error); // Some other error. Message message = JSONParser::unpack(data); if (message.command.compare(getCommandString(REGISTER)) == 0) { if (Config::getInstance().isVerbose()) { std::cout << "Received request" << std:: endl; std::cout << "\tCommand: " << message.command << std::endl; message.info.ip = sock->remote_endpoint().address().to_string(); std::cout << "\tHost info: " << "ip: " << message.info.ip << " port: " << message.info.port << std::endl; std::cout << "\tHost info: " << "hash: " << message.info.hash << std:: endl; std::string services; for (ServiceList::const_iterator it=message.service_list.begin(); it != message.service_list.end(); ++it) { services += (*it); services += std::string(" "); } std::cout << "\tHost info: " << "services_to_check: " << services << std::endl; } std::stringstream ss; switch(ClientManager::getInstance().checkClient(message)) { case ClientManager::NEW_CLIENT: { message.info.hash= ClientManager::getInstance().registerClient(message); ss<<"NEW CLIENT - hash - " << message.info.hash << std::endl; message.info.status = 1; break; } case ClientManager::FORCE_NEW_CLIENT: { ss<<"FORCING CLIENT REGISTRATION"<<std::endl; message.info.status = 2; break; } case ClientManager::REUSE_CLIENT_HASH: { ss<<"CLIENT ALREADY REGISTERED - REUSING"<<std::endl; message.info.status = 0; break; } case ClientManager::CLIENT_REJECTED: { message.info.status = -1; break; } } if (Config::getInstance().isVerbose()) { std::cout<<"Decision: " << ss.str(); } } else { message.command=getCommandString(UNKNOWN); } std::string answer=JSONParser::pack(message); boost::asio::write(*sock,boost::asio::buffer(answer.c_str(),answer.length())); } catch (std::exception& e) { std::cerr << "Exception in thread: " << e.what() << "\n"; } } void ClientRegistrar::registerProcess() { tcp::acceptor acceptor(registerService_, tcp::endpoint(tcp::v4(), portNumber_)); for (;;) { socket_ptr sock(new tcp::socket(registerService_)); acceptor.accept(*sock); boost::thread t(&ClientRegistrar::registerSession,this, sock); } } bool ClientRegistrar::run() { if (portNumber_ == 0) return false; if (isRunning_) return false; registerThread_ = boost::thread(&ClientRegistrar::registerProcess, this); isRunning_ = true; return true; } }
C++
#include "Message.hpp" namespace netspy { const char * getCommandString(const Command &command) { switch(command) { case UNKNOWN: return NULL; case REGISTER: return "register"; case CHECK_STATUS: return "check_status"; default: return NULL; } } }
C++
#ifndef CLIENT_REGISTRAR_HPP #define CLIENT_REGISTRAR_HPP #include "Types.hpp" #include <boost/asio.hpp> #include <boost/thread/thread.hpp> namespace netspy { /** * @brief Obsługuje rejestrację klientów * * Klasa obsługuje połączenia przychodzące - rejestrację klientów (w osobnych wątkach). Zaimplementowana jako singlegon. * */ class ClientRegistrar { public: static ClientRegistrar &getInstance() { static ClientRegistrar registrar; return registrar; } /** * * Ustawia numer portu na którym serwer ma oczekiwać na rejestrację * */ void setPort(const uint16_t &portNumber); bool run(); private: ClientRegistrar():isRunning_(false),portNumber_(0) {} ClientRegistrar(const ClientRegistrar &); ClientRegistrar& operator=(const ClientRegistrar&); /** * Nasłuchuje na połaczenie */ void registerProcess(); /// Funkcja obsługująca sesję komunikacji, działa w osobnym wątku, odpalana w momencie przyjęcia połączenia void registerSession(socket_ptr sock); bool isRunning_; boost::asio::io_service registerService_; uint16_t portNumber_; boost::thread registerThread_; }; } #endif
C++
#ifndef CLIENT_CHECKER_HPP #define CLIENT_CHECKER_HPP #include <boost/thread.hpp> namespace netspy { /** * Klasa opakowujaca wątki odpytujące klientów */ class ClientChecker { public: static ClientChecker & getInstance() { static ClientChecker checker; return checker; } /** * Uruchamia zadaną ilość wątków obsługujących zapytania o stan klientów */ void runCheckers(unsigned int checkersAmount); /** * Obsługuje proces sesji komunikacyjnej z klientem. Opalany w osobnym wątku. Oczekuje na zgłoszenia na kolejce reqeustów, * za pomocą interfejsu klasy RequestManager. */ void checkerSession(); private: ClientChecker(ClientChecker &cl); ClientChecker():isRunning_(false){}; bool isRunning_; boost::thread_group checkerGroup_; }; } #endif
C++
#ifndef MESSAGE_HPP #define MESSAGE_HPP #include<string> #include "Structures.hpp" #include <boost/unordered_map.hpp> #include <boost/shared_ptr.hpp> #include <vector> using namespace netspy::db; namespace netspy { enum Command { UNKNOWN=0, REGISTER, CHECK_STATUS }; const char * getCommandString(const Command &command); typedef std::vector<std::string> ServiceList; typedef boost::unordered_map<std::string,int> ServiceStatus; struct Message { std::string command; Client info; ServiceList service_list; ServiceStatus status_map; }; typedef boost::shared_ptr<Message> message_ptr; } #endif
C++
#ifndef STRUCTURES_HPP #define STRUCTURES_HPP #include <string> namespace netspy { namespace db { struct Client { unsigned int id; std::string ip; std::string hash; unsigned short port; std::string remarks; int status; // for communication purposes }; struct Service { unsigned int id; std::string description; }; struct Reply { unsigned int id; std::string message; }; } } #endif
C++
#include "Message.hpp" #include "DataTypes.hpp" #include "boost/shared_ptr.hpp" #include "boost/thread.hpp" namespace netspy { class RequestManager { public: static RequestManager & getInstance() { static RequestManager requestManager; return requestManager; } /// do pobierania wiadomości przez wątek shared_msg getRequest(); /// do zapisu wiadomości void storeResult(shared_msg result); void run(); private: /// wiadomości otrzymane od klientów MessageQueue results_; /// wiadomości wysłane do klientów MessageQueue requests_; void generateRequests(); void saveResults(); bool isRunning_; client_vec_ptr clients; service_vec_ptr services; client_service_map_ptr serviceMap; boost::thread requestHandler_; boost::thread resultHandler_; RequestManager():isRunning_(false){} RequestManager(RequestManager &req); RequestManager& operator=(const RequestManager&); }; }
C++
#ifndef CLIENT_MANAGER_HPP #define CLIENT_MANAGER_HPP #include "DataTypes.hpp" #include "Message.hpp" #include <string> #include <boost/thread/mutex.hpp> namespace netspy { /** * @brief Klasa odpowiedzialna za bufforowanie klientów. Dostarcza interfejsy umożliwiające * rejestrację nowych klientów, sprawdzenie czy klient jest aktualnie w bazie danych * */ class ClientManager { public: /** Możliwe statusy przyjęcia klienta */ enum RegisterStatus { CLIENT_REJECTED = -1, /// odrzucenie klienta NEW_CLIENT = 0, /// rejestracja nowego klienta FORCE_NEW_CLIENT = 1, /// wymuszenie ponownej rejestracij REUSE_CLIENT_HASH = 2 /// reużycie sesji }; static ClientManager & getInstance() { static ClientManager clientManager; return clientManager; } /** Funkcja inicjująca bufor zawartością bazy danych */ void initialize(); /** @return */ RegisterStatus checkClient(const Message &message); /** @return */ std::string registerClient(const Message &message); /** Sprawdza stan ostatniej rejestracji @return zwraca true, jeśli odbyła się rejestracja nowego klienta */ bool isClientUpdated() const; bool isServiceUpdated() const; client_vec_ptr getClients(); service_vec_ptr getServices(); client_service_map_ptr getClientServiceMap(); private: ClientManager(){}; ClientManager(ClientManager &cm); ClientManager& operator=(const ClientManager&); /** Funkcja generuje losowy hash dla nowo rejestrowanych klientów. @return Zwraca 32znakowy string z hashem. */ std::string generateHash(); boost::mutex resouceMutex_; volatile bool isClientUpdated_; volatile bool isServiceUpdated_; client_vec_ptr clientBuffer_; service_vec_ptr serviceBuffer_; client_service_map_ptr serviceMapBuffer_; }; } #endif
C++
#include "ClientManager.hpp" #include "DataProxy.h" //#include <boost/random/random_device.hpp> //#include <boost/random/uniform_int_distribution.hpp> #include "DataProxy.h" #include <boost/nondet_random.hpp> #include <sstream> namespace netspy { bool ClientManager::isClientUpdated() const { return isClientUpdated_; } bool ClientManager::isServiceUpdated() const { return isServiceUpdated_; } std::string ClientManager::generateHash() { std::string chars( "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "1234567890" "!@#$%^&*()" "~-_=+[{]{,<.>/? "); boost::random_device rng; std::stringstream str; for(int i = 0; i < 32; ++i) { str << chars[rng()%chars.length()]; } return str.str(); } void ClientManager::initialize() { clientBuffer_ = client_vec_ptr(new client_vec()); serviceBuffer_ = service_vec_ptr(new service_vec()); serviceMapBuffer_ = client_service_map_ptr(new client_service_map()); boost::shared_ptr <DataProxy> db = DataProxy::getInstance(); boost::shared_ptr<const std::vector<boost::shared_ptr<Client> > > clients = db->getClients(); for(client_vec::const_iterator it=clients->begin(); it!=clients->end(); ++it) { clientBuffer_->push_back(*it); } boost::shared_ptr<const std::vector<boost::shared_ptr<Service> > > services = db->getServices(); if (services.get()!=NULL) { for(service_vec::const_iterator it=services->begin(); it!=services->end(); ++it) { serviceBuffer_->push_back(*it); } } for(client_vec::const_iterator it=clients->begin(); it!=clients->end(); ++it) { boost::shared_ptr<const std::vector<boost::shared_ptr<Service> > > clientServices = db->getServicesForClient((*it)->id); service_vec_ptr clientNewServices(new service_vec()); for(service_vec::const_iterator cs=clientServices->begin(); cs!=clientServices->end(); ++cs) { for(service_vec::const_iterator as=serviceBuffer_->begin(); as!=serviceBuffer_->end(); ++as) { if ((*cs)->description.compare((*as)->description)==0) { clientNewServices->push_back((*as)); } } } serviceMapBuffer_->insert(make_pair((*it)->hash,clientNewServices)); } } ClientManager::RegisterStatus ClientManager::checkClient(const Message &message) { if (message.info.hash.empty()) return NEW_CLIENT; boost::mutex::scoped_lock (resourceMutex_); for(client_vec::const_iterator it=clientBuffer_->begin(); it!=clientBuffer_->end(); ++it) { if ((*it)->hash.compare(message.info.hash) == 0) { isClientUpdated_=true; return REUSE_CLIENT_HASH; } } return FORCE_NEW_CLIENT; } std::string ClientManager::registerClient(const Message &message) { boost::mutex::scoped_lock (resouceMutex_); for(client_vec::const_iterator it=clientBuffer_->begin(); it!=clientBuffer_->end(); ++it) { if ((*it)->hash.compare(message.info.hash) == 0) return std::string(""); } client_ptr newClient(new Client(message.info)); newClient->hash = generateHash(); boost::shared_ptr <DataProxy> db = DataProxy::getInstance(); newClient->id = db->addClient(newClient->ip,newClient->port,newClient->hash,newClient->remarks); clientBuffer_->push_back(newClient); bool knownService = false; service_vec_ptr clientService(new service_vec()); for(std::vector<std::string>::const_iterator it=message.service_list.begin(); it!=message.service_list.end(); ++it) { for(service_vec::const_iterator s=serviceBuffer_->begin(); s!=serviceBuffer_->end(); ++s) { if ((*it).compare((*s)->description) == 0 ) { knownService = true; clientService->push_back((*s)); db->setClientService(newClient->id,(*s)->id,true); break; } } if (!knownService) { service_ptr service(new Service()); service->description = (*it); service->id=db->addService(service->description); serviceBuffer_->push_back(service); clientService->push_back(service); db->setClientService(newClient->id,service->id,true); } } serviceMapBuffer_->insert(make_pair(newClient->hash,clientService)); std::cout<<serviceMapBuffer_->size()<<std::endl; isClientUpdated_ = true; isServiceUpdated_ = true; return newClient->hash; } client_vec_ptr ClientManager::getClients() { boost::mutex::scoped_lock (resourceMutex_); client_vec_ptr clients(new client_vec()); for (client_vec::const_iterator it=clientBuffer_->begin(); it!=clientBuffer_->end(); ++it) { clients->push_back((*it)); } isClientUpdated_ = false; return clients; } client_service_map_ptr ClientManager::getClientServiceMap() { return serviceMapBuffer_; } service_vec_ptr ClientManager::getServices() { boost::mutex::scoped_lock (resourceMutex_); service_vec_ptr services(new service_vec()); if (serviceBuffer_.get()!=NULL) { for (service_vec::const_iterator it=serviceBuffer_->begin(); it!=serviceBuffer_->end(); ++it) { services->push_back((*it)); } } isServiceUpdated_ = false; return services; } }
C++
#include "Config.hpp" #include <boost/program_options.hpp> namespace po = boost::program_options; namespace netspy { Config::Config() { setDefaultValues(); } void Config::parseCommandLine(int argc, char *argv[]) throw (int) { po::options_description desc("Available options"); desc.add_options() ("help", "prints this help") ("interval", po::value<unsigned int>(), "sets interval time (should be given in seconds)") ("verbose", "sets verbose mode -> server printouts everything he can ") ("port",po::value<unsigned int>(), "changes registration port (default = 5000) ") ; po::variables_map vm; po::store(po::parse_command_line(argc, argv, desc), vm); po::notify(vm); if (vm.count("help")) { std::cout << desc << "\n"; throw 0; } if (vm.count("interval")) { checkPeriod_ = vm["interval"].as<unsigned int>(); } if (vm.count("verbose")) { isVerbose_=true; } if(vm.count("port")) { registerPort_ = vm["port"].as<unsigned int>(); } } void Config::setDefaultValues() { checkPeriod_ = defaultCheckPeriod; registerPort_ = defaultRegisterPort; isVerbose_ = defaultVerbose; checkerThreadNumber_ = defaultCheckerThreadNumber; databaseName_ = defaultDatabaseName(); databaseUser_ = defaultDatabaseUser(); databasePass_ = defaultDatabasePass(); } bool Config::isVerbose() const { return isVerbose_; } uint32_t Config::getCheckPeriod() const { return checkPeriod_; } uint16_t Config::getRegisterPort() const { return registerPort_; } const char * Config::getDatabaseName() const{ return databaseName_; } const char * Config::getDatabasePass() const { return databasePass_; } const char * Config::getDatabaseUser() const { return databaseUser_; } uint32_t Config::getCheckerThreadNumber() const { return checkerThreadNumber_; } }
C++
#include "ClientChecker.hpp" #include <cstdlib> #include <iostream> #include <boost/asio.hpp> #include <boost/lexical_cast.hpp> #include "Types.hpp" #include <cstdlib> #include "Message.hpp" #include "JSONParser.hpp" #include "RequestManager.hpp" #include "Config.hpp" using boost::asio::ip::tcp; namespace netspy { void ClientChecker::runCheckers(uint32_t checkerThreadNumber) { if (!isRunning_) { for (uint32_t i=0; i<checkerThreadNumber; ++i) { checkerGroup_.create_thread(boost::bind(&ClientChecker::checkerSession,this)); } } isRunning_= true; } void ClientChecker::checkerSession() { for(;;) { message_ptr message = RequestManager::getInstance().getRequest(); message->command=getCommandString(CHECK_STATUS); message_ptr ans(new Message((*message))); if(Config::getInstance().isVerbose()) { std::cout << "Sending command" << std:: endl; std::cout << "\tCommand: " << message->command << std::endl; std::cout << "\tHost info: " << "ip: " << message->info.ip << " port: " << message->info.port << std::endl; std::cout << "\tHost info: " << "hash: " << message->info.hash << std:: endl; } try{ boost::asio::io_service io_service; boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::address::from_string(message->info.ip), message->info.port); socket_ptr sock(new tcp::socket(io_service)); sock->connect(endpoint); std::string query = JSONParser::pack((*message)); boost::asio::write((*sock), boost::asio::buffer(query.c_str(),query.length())); char data[DATA_MAX_LENGTH]; memset(data,0,DATA_MAX_LENGTH); boost::system::error_code error; sock->read_some(boost::asio::buffer(data), error); if (error) throw boost::system::system_error(error); // Some other error. ans = message_ptr(new Message(JSONParser::unpack(data))); ans->info.hash=message->info.hash; if(Config::getInstance().isVerbose()) { for (ServiceList::const_iterator it=ans->service_list.begin(); it != ans->service_list.end(); ++it) { std::cout << "\tHost info: " << "Service: " << (*it) << " Status: " << ans->status_map[(*it)] << std::endl; } } RequestManager::getInstance().storeResult(ans); } catch (std::exception& e) { // std::cerr << "Exception: " << e.what() << "\n"; ans->service_list.clear(); if (Config::getInstance().isVerbose()) { std::cout << "\tHost info: dead" << std::endl; RequestManager::getInstance().storeResult(ans); } } } } }
C++
#ifndef JSON_PARSER_HPP #define JSON_PARSER_HPP #include "Message.hpp" #include <string> namespace netspy { /** * Klasa parsująca stringi na obiekty JSON a następnie na wewnętrzne struktury rozumiane przez aplikację i na odwrót. * */ class JSONParser { public: /** * @return zwraca strukturę Message zbudowaną na podstawie stringu */ static Message unpack(const std::string &stringMessage); /** * @return zwraca string zserializowanego obiektu JSON powstałego na bazie Message */ static std::string pack(const Message &message); }; } #endif
C++
#ifndef DATA_TYPES_HPP #define DATA_TYPES_HPP #include "Types.hpp" #include "Structures.hpp" #include "Message.hpp" #include "SynchronizedQueue.hpp" #include <boost/shared_ptr.hpp> #include <vector> #include <map> namespace netspy { typedef boost::shared_ptr<Reply> reply_ptr; typedef boost::shared_ptr<Client> client_ptr; typedef boost::shared_ptr<Service> service_ptr; typedef boost::shared_ptr<Message> message_ptr; typedef std::vector<reply_ptr> reply_vec; typedef std::vector<client_ptr> client_vec; typedef std::vector<service_ptr> service_vec; typedef std::vector<message_ptr> message_vev; typedef boost::shared_ptr<service_vec> service_vec_ptr; typedef boost::shared_ptr<client_vec> client_vec_ptr; typedef std::map<std::string,service_vec_ptr> client_service_map; typedef boost::shared_ptr<client_service_map> client_service_map_ptr; typedef boost::shared_ptr<Message> shared_msg; typedef SynchronizedQueue<shared_msg> MessageQueue; } #endif
C++
#include "RequestManager.hpp" #include "ClientManager.hpp" #include "Message.hpp" #include "DataProxy.h" #include "Config.hpp" #include <boost/thread/thread.hpp> namespace netspy { void RequestManager::generateRequests() { for(;;) { boost::this_thread::sleep(boost::posix_time::seconds(Config::getInstance().getCheckPeriod())); if (ClientManager::getInstance().isClientUpdated()) { clients = ClientManager::getInstance().getClients(); serviceMap = ClientManager::getInstance().getClientServiceMap(); } for(client_vec::const_iterator it=clients->begin(); it!=clients->end(); ++it) { Message *message = new Message(); message->command=getCommandString(CHECK_STATUS); message->info=(*(*it)); message_ptr mess(message); requests_.push(mess); } } } void RequestManager::saveResults() { for(;;) { boost::shared_ptr <DataProxy> db = DataProxy::getInstance(); message_ptr mess; results_.waitAndPop(mess); if (ClientManager::getInstance().isServiceUpdated()) { services = ClientManager::getInstance().getServices(); serviceMap = ClientManager::getInstance().getClientServiceMap(); } service_vec_ptr ss = (*serviceMap)[mess->info.hash]; if(mess->service_list.empty()) { for (service_vec::const_iterator it=ss->begin(); it!=ss->end(); ++it) { db->addRecord(mess->info.hash, (*it)->id, 2); } } else { for (service_vec::const_iterator it=ss->begin(); it!=ss->end(); ++it) { db->addRecord(mess->info.hash, (*it)->id, 1); } } } } shared_msg RequestManager::getRequest() { shared_msg request; requests_.waitAndPop(request); return request; } void RequestManager::storeResult(shared_msg result) { results_.push(result); } void RequestManager::run() { if(!isRunning_) { clients = ClientManager::getInstance().getClients(); services = ClientManager::getInstance().getServices(); serviceMap = ClientManager::getInstance().getClientServiceMap(); requestHandler_ = boost::thread(boost::bind(&RequestManager::generateRequests,this)); resultHandler_= boost::thread(boost::bind(&RequestManager::saveResults,this)); } isRunning_=true; } }
C++
#include <cppcms/json.h> #include <iostream> #include <sstream> #include "JSONParser.hpp" using namespace netspy; namespace cppcms { namespace json { // // We specilize cppcms::json::traits structure to convert // objects to and from json values // template<> struct traits<Message> { // this function should throw // cppcms::json::bad_value_cast in case // of invalid or impossible conversion, // this would give an easy way to substitute // a default value in case of fault static Message get(value const &v) { Message message; if(v.type()!=is_object) throw bad_value_cast(); message.command=v.get<std::string>("command"); if (message.command.compare("register") == 0 ) { if (v.find("payload.hash").type() == is_string) { message.info.hash = v.get<std::string>("payload.hash"); } else if (v.find("payload.hash").type() == is_null) { message.info.hash = std::string(""); } if (v.find("payload.port").type() == is_string) { message.info.port = atoi(v.get<std::string>("payload.port").c_str()); } else { message.info.port = v.get<unsigned short>("payload.port"); } message.service_list = v.get<std::vector<std::string> >("payload.service_list"); return message; } else if (message.command.compare("check_status") == 0 ) { std::vector<value> values = v.get<std::vector<value> >("payload.check_result"); for(std::vector<value>::const_iterator it=values.begin(); it!=values.end(); it++) { message.service_list.push_back((* (*it).object().begin()).first.str()); message.status_map.insert(std::make_pair((* (*it).object().begin()).first.str(),(* (*it).object().begin()).second.get_value<int>())); } } return message; } static void set(value &v, Message const &in) { v.set("command",in.command); if (in.command.compare("register") == 0) { v.set("payload.hash",in.info.hash); v.set("payload.status",in.info.status); } else if (in.command.compare("check_status") == 0) { } } }; } // json } // cppcms namespace netspy { Message JSONParser::unpack(const std::string &stringMessage) { std::stringstream mess(stringMessage); cppcms::json::value object; object.load(mess,true); return object.get_value<Message>(); } std::string JSONParser::pack(const Message &message) { std::stringstream result; cppcms::json::value object = message; result << object; return result.str(); } int json_test() { cppcms::json::value my_object; cppcms::json::value inner_object; inner_object["hash"]="1"; inner_object["status"]=0; inner_object["port"]=6666; inner_object["service_list"][0]="alive"; inner_object["service_list"][1]="ftp"; // Create object data my_object["command"]="register"; my_object["payload"]=inner_object; // Get values using path. std::string name=my_object.get<std::string>("command"); // load person object from the object // using above traits Message request = my_object.get_value<Message>(); std::cout << "Req.command = " << request.command << std::endl; std::cout << "Req.info: hash = " << request.info.hash << " port = " << request.info.port << std::endl; std::cout << "Pack test: " << JSONParser::pack(request) << std::endl; // save person object to json objectdd cppcms::json::value other = request; // write data to output std::cout << other << std::endl; // write data formatter nicely my_object.save(std::cout,cppcms::json::readable); // save object to stream and load it back std::stringstream tmp; tmp << my_object; cppcms::json::value reloaded; reloaded.load(tmp,true); return 0; } }
C++
#ifndef DATAPROXY_H #define DATAPROXY_H #include <cppdb/frontend.h> #include <vector> #include <sstream> #include <boost/shared_ptr.hpp> #include "Structures.hpp" #include <boost/thread.hpp> namespace netspy { namespace db { /** * Klasa umożliwiająca komunikację z bazą danych w zakresie określonym specyfiką aplikacji. * Pozwala uzyskać informacje o wszystkich klientach (komputerach), usługach oraz potencjalnych * odpowiedziach zwracanych przez klientów. */ class DataProxy { public: /** * Zwraca shared_ptr do obiektu pośrednika bazodanowego * @return shared_ptr<DataProxy> */ static boost::shared_ptr<DataProxy> getInstance(); virtual ~DataProxy(); /** * Pozwala pobrać informację o wszystkich odpowiedziach zdefiniowanych w bazie danych. * @return wskaźnik do wektora wskaźników na obiekty struktury Reply */ boost::shared_ptr<const std::vector<boost::shared_ptr<Reply> > > getReplies() const; /** * Pozwala pobrać informację o zarejestrowanych klientach * @return wskaźnik na wektor wskaźników na obiekty struktury Client */ boost::shared_ptr<const std::vector<boost::shared_ptr<Client> > > getClients() const; /** * Pozwala pobrać informację o kliencie identyfikowanym numerem id * @param id numer id z bazy danych * @return wskaźnik na obiekt struktury Client */ boost::shared_ptr<Client> getClient(unsigned int id) const; /** * Pozwala pobrać informację o kliencje identyfikowanym jego hashem * @param hash hash przypisany klientowi * @return wskaźnik do struktury Client */ boost::shared_ptr<Client> getClient(std::string hash) const; /** * Pozwala pobrać informację o wszystkich usługach, pod kątem których odpytywani są klienci * @return Wskaźnik na wektor wskaźników na obiekty struktury Service */ boost::shared_ptr<const std::vector<boost::shared_ptr<Service> > > getServices() const; /** * Pozwala pobrać informację o wybranej, określonej numerem id usłudze. * @param id numer id przypisany danej usłudze * @return wskaźnik na obiekt struktury Service */ boost::shared_ptr<Service> getService(unsigned int id) const; /** * Pozwala pobrać informację o usługach o podanym opisie * @param description opis usług zapisany w bazie danych * @return wskaźnik na wektor wskaźników do obiektów struktury Service */ boost::shared_ptr<const std::vector<boost::shared_ptr<Service> > > getServices(std::string description) const; /** * Pozwala pobrać informację o aktywnych usługach świadczonych przez danego klienta. * @param hash hash identyfikujący klienta * @return wskaźnik na wektor wskaźników do obiektów struktury Service */ boost::shared_ptr<const std::vector<boost::shared_ptr<Service> > > getServicesForClient(std::string hash) const; /** * Pozwala pobrać informację o aktywnych usługach świadczonych przez danego klienta. * @param id numer id klienta zapisany w bazie danych * @return wskaźnik na wektor wskaźników do obiektów struktury Service */ boost::shared_ptr<const std::vector<boost::shared_ptr<Service> > > getServicesForClient(unsigned int id) const; /** * Pozwala skojarzyć klienta z określoną usługą lub zmienić status usługi już klientowi przypisanyej * @param client_id id klienta * @param service_id id usługi * @param enable prawda, jeśli chcemy, aby usługa była aktywowana * @return */ void setClientService(unsigned int client_id, unsigned int service_id, bool enable); /** * Pozwala skojarzyć klienta z określoną usługą lub zmienić status usługi już klientowi przypisanyej * @param client_hash hash klienta * @param service_id id usługi * @param enable prawda, jeśli chcemy, aby usługa była aktywowana * @return */ void setClientService(std::string client_hash, unsigned int service_id, bool enable); /** * Pozwala dodać do bazy danych elementarny zapis o dostępności określonej usługi na określonym komputerze * @param client_id id klienta * @param service_id id usługi * @param reply_id kod odpowiedzi * @return */ void addRecord(unsigned int client_id, unsigned int service_id, unsigned int reply_id); /** * Pozwala dodać do bazy danych elementarny zapis o dostępności określonej usługi na określonym komputerze * @param client_hash hash klienta * @param service_id numer id klienta * @param reply_id kod odpowiedzi * @return */ void addRecord(std::string client_hash, unsigned int service_id, unsigned int reply_id); /** * Usuwa wszystkie przechowywane informacje o danym kliencie * @param client_id */ void deleteClientsData(int client_id); /** * Pozwala wprowadzić nową usługę do bazy, o ile usługa o podanym opisie nie zostanie znaleziona. * W obu przypadkach zwraca id usługi. * @param description opis nowo dodawanej usługi * @return */ int addService(std::string description); /** * Opakowuje procedurę rejestracji klienta w bazie danych. Dla nowych klientów dodaje wpis i zwraca id klienta, * zaś w przypadku natrafienia na klienta o podanym hashu - zwraca jego id z bazy. * @param ip * @param port * @param hash hash klienta * @param remarks opis, komentarz * @return przydzielony nowemu klientowi numer id. -1 - błąd */ unsigned int addClient(std::string ip, unsigned short port, std::string hash, std::string remarks); private: static boost::shared_ptr<DataProxy> instance; static boost::mutex singletonWatchdog; /** * * @param database nazwa bazy danych * @param user nazwa użytkownika * @param pass hasło dostępu do bazy danych */ DataProxy(std::string database, std::string user, std::string pass); DataProxy(const DataProxy& orig); cppdb::session db; std::stringstream queryString; boost::shared_ptr<Service> resToService(boost::shared_ptr<cppdb::result> res) const; boost::shared_ptr<const std::vector<boost::shared_ptr<Service> > > resToServices(boost::shared_ptr<cppdb::result> res) const; boost::shared_ptr<const std::vector<boost::shared_ptr<Reply> > > resToReplies(boost::shared_ptr<cppdb::result> res) const; boost::shared_ptr<Client> resToClient(boost::shared_ptr<cppdb::result> res) const; boost::shared_ptr<const std::vector<boost::shared_ptr<Client> > > resToClients(boost::shared_ptr<cppdb::result> res) const; boost::shared_ptr<cppdb::result> query(std::string table) const; boost::shared_ptr<cppdb::result> query(std::string table, std::string column, std::string value) const; void resetQuery(){ queryString.clear(); queryString.str(""); } }; } } #endif /* DATAPROXY_H */
C++
#include <cstdlib> #include "DataProxy.h" #include "Structures.hpp" //#include "Request.hpp" #include <iostream> #include <boost/shared_ptr.hpp> using namespace std; using namespace netspy::db; using namespace boost; void queryAll(shared_ptr<DataProxy> db) { //get all clients int i = 1; shared_ptr<Client> c; while (c.get()!=NULL){ c = db->getClient(i++); cout << c->ip << ", " << c->remarks << endl; } //get all services cout << "getting all services" << endl; shared_ptr<const vector<shared_ptr<netspy::db::Service> > > v = db->getServices(); for (vector<shared_ptr<netspy::db::Service> >::const_iterator iter = v->begin(); iter != v->end(); ++iter) { cout << (*iter)->id << ": " << (*iter)->description << endl; } cout << "getting pings" << endl; v = db->getServices("ping"); for (vector<shared_ptr<netspy::db::Service> >::const_iterator iter = v->begin(); iter != v->end(); ++iter) { cout << (*iter)->id << ": " << (*iter)->description << endl; } cout << "getting services for client id=1" << endl; v = db->getServicesForClient(1); for (vector<shared_ptr<netspy::db::Service> >::const_iterator iter = v->begin(); iter != v->end(); ++iter) { cout << (*iter)->id << ": " << (*iter)->description << endl; } //test possible replies cout << "getting possible replies" << endl; boost::shared_ptr<const vector<shared_ptr<netspy::db::Reply> > > r = db->getReplies(); for (vector<shared_ptr<netspy::db::Reply> >::const_iterator iter = r->begin(); iter != r->end(); ++iter) { cout << (*iter)->id << ", " << (*iter)->message << endl; } } int main(int argc, char** argv) { string newIP("123.143.111"); string newHash("46FBYN"); unsigned short newPort(70); string newRemark("a test driver"); shared_ptr <DataProxy> db = DataProxy::getInstance(); // DODANIE NOWEGO KOMPUTERA unsigned int newId = db->addClient(newIP,newPort,newHash,newRemark); // WERYFIKACJA unsigned int newId2 = db->addClient(newIP,newPort,newHash,newRemark); cout<<"Duplicate clients test: "; assert(newId == newId2); cout<<"OK"<<endl; //DODANIE NOWEJ USŁUGI I WERYFIKACJA POPRAWNOŚĆI DZIAŁANIA FUNKCJI PRZY PRÓBIE PONOWNEGO DODANIA int sid = db->addService(string("test")); int sid2 = db->addService(string("test")); cout<<"Service creation test: "; assert(sid==sid2); cout<<"OK"<<endl; //WERYFIKACJA PRZYPISANYCH USŁUG cout<<"Assigned services test (by id): "; assert((db->getServicesForClient(newId)->size())==0); cout<<"OK"<<endl; cout<<"Assigned services test (by hash): "; assert(db->getServicesForClient(newHash)->size()==0); cout<<"OK"<<endl; //DOPISANIE JAKICHŚ USŁUG. db->setClientService(newId,1,true); db->setClientService(newId,sid,true); cout<<"Assigned services count upon set (by hash): "; assert(db->getServicesForClient(newHash)->size()==2); cout<<"OK"<<endl; db->setClientService(newId,sid,false); cout<<"Assigned services count upon disabling one (by id): "; assert(db->getServicesForClient(newId)->size()==1); cout<<"OK"<<endl; db->setClientService(newHash,sid,true); cout<<"Assigned services count upon re0enabling one (by id): "; assert(db->getServicesForClient(newId)->size()==2); cout<<"OK"<<endl; cout<<"Will insert some records about services availability"<<endl; //get the Replies shared_ptr<const vector<shared_ptr<Reply> > > r = db->getReplies(); int alive=0, dead=0, none=0; for (vector<shared_ptr<netspy::db::Reply> >::const_iterator iter = r->begin(); iter != r->end(); ++iter) { if((*iter)->message.compare(string("alive"))==0){ alive=(*iter)->id; cout<<"alive: "<<alive<<endl; }else if((*iter)->message.compare(string("dead"))==0){ dead=(*iter)->id; cout<<"dead: "<<dead<<endl; }else{ none=(*iter)->id; cout<<"none: "<<none<<endl; } } for(int i=0; i<100; ++i){ if(rand()<RAND_MAX*0.75){ if(rand()>RAND_MAX*0.7){ db->addRecord(newId,(*db->getServicesForClient(newHash)->begin())->id,none); }else{ db->addRecord(newId,(*db->getServicesForClient(newHash)->begin())->id,alive); } }else{ db->addRecord(newId,(*db->getServicesForClient(newHash)->begin())->id,dead); } sleep(1); } cout<<"Hit enter to delete the newly added data and proceed with tests"<<endl; cin.ignore(1); //USUNIĘCIE NOWO DODANEGO KLIENTA I WSZYSTKICH JEGO DANYCH db->deleteClientsData(newId); cout<<"Get client by id upon deletion: "; assert(db->getClient(newId).get()==NULL); cout<<"OK"<<endl; cout<<"Get client by hash upon deletion: "; assert(db->getClient(newHash).get()==NULL); cout<<"OK"<<endl; //WERYFIKACJA PRZYPISANYCH USŁUG cout<<"Assigned services upon deletion test (by id): "; assert((db->getServicesForClient(newId)->size())==0); cout<<"OK"<<endl; cout<<"Assigned services upon deletion test (by hash): "; assert(db->getServicesForClient(newHash)->size()==0); cout<<"OK"<<endl; return 0; }
C++
#include <iostream> #include "Config.hpp" #include "ClientRegistrar.hpp" #include "ClientManager.hpp" #include "RequestManager.hpp" #include "ClientChecker.hpp" #include "Types.hpp" /** * @mainpage * @author Marcin Ciechowicz * Main Loop for Net-Spy * */ using namespace netspy; int main(int argc, char* argv[]) { // załadowanie domyślnej konfiguracji Config &config = Config::getInstance(); try { // ew. zczytanie dodatkowego info z linii poleceń config.parseCommandLine(argc,argv); // singletony incjalizowane/uruchamiane w jednym wątku // żeby uniknąć problemów z synchronizacja ClientManager::getInstance().initialize(); // ladowanie informacji z bazy danych RequestManager::getInstance().run(); // uruchomienie zarzadcy komunikatow ClientRegistrar::getInstance().setPort(config.getRegisterPort()); ClientRegistrar::getInstance().run(); // uruchomienie Rejstratora Klientów ClientChecker::getInstance().runCheckers(config.getCheckerThreadNumber()); // uruchomienie wątków sprawdzających Klientów for(;;){} // i latamy sobie w kółko } catch (std::exception& e) { std::cerr << "What a Terrible Failure: " << e.what() << "\n"; } catch (int) // można ładniej ale działa { // drukuje helpa, ale gdzie indziej :) } return 0; }
C++
#ifndef CONFIG_HPP #define CONFIG_HPP #include "Types.hpp" #include <string> namespace netspy { class Config { public: static Config &getInstance() { static Config config; return config; } void parseCommandLine(int argc, char *argv[]) throw(int); void setDefaultValues(); bool isVerbose() const; uint32_t getCheckPeriod() const; uint16_t getRegisterPort() const; const char * getDatabaseName() const; const char * getDatabaseUser() const; const char * getDatabasePass() const; uint32_t getCheckerThreadNumber() const; private: Config(); Config(const Config &); Config& operator=(const Config&); uint32_t checkPeriod_; uint16_t registerPort_; bool isVerbose_; const char * databaseName_; const char * databaseUser_; const char * databasePass_; uint32_t checkerThreadNumber_; static const uint32_t defaultCheckPeriod = 60; // seconds static const uint32_t defaultCheckerThreadNumber = 10; static const char * configFilename() { return "spynet-server.conf"; } static const bool defaultVerbose = true; static const uint16_t defaultRegisterPort = 5000; static const char * defaultDatabaseName(){ return "netspy"; } static const char * defaultDatabaseUser(){ return "root"; } static const char * defaultDatabasePass(){ return "root"; } }; } #endif
C++
#ifndef SYNCHRONIZED_QUEUE_HPP #define SYNCHORNIZED_QUEUE_HPP #include <queue> #include <boost/thread.hpp> template<typename Data> class SynchronizedQueue { private: std::queue<Data> queue_; mutable boost::mutex mutex_; boost::condition_variable conditionVariable_; public: void push(Data const& data) { boost::mutex::scoped_lock lock(mutex_); queue_.push(data); lock.unlock(); conditionVariable_.notify_one(); } bool empty() const { boost::mutex::scoped_lock lock(mutex_); return queue_.empty(); } bool tryToPop(Data& data) { boost::mutex::scoped_lock lock(mutex_); if(queue_.empty()) { return false; } data=queue_.front(); queue_.pop(); return true; } void waitAndPop(Data& data) { boost::mutex::scoped_lock lock(mutex_); while(queue_.empty()) { conditionVariable_.wait(lock); } data=queue_.front(); queue_.pop(); } }; #endif
C++
/* COMPILING: * If you're compiling this with MSVC2010, you'll need to change the include and library directory * paths for opencv to reflect the path on your computer. I think that's all you have to do, but * I may be overlooking something. * * RUNNING: * Several dlls must be in the bin directory for this program to run without error: * opencv_core244.dll * opencv_core244d.dll * opencv_highgui244.dll * opencv_highgui244d.dll * opencv_imgproc244.dll * opencv_imgproc244d.dll * opencv_objdetect244.dll * opencv_objdetect244d.dll */ #include <iostream> #include <opencv2/objdetect/objdetect.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> int main(int argc, char* argv[]) { // Load in the haarcascade file that we'll use for face detection. const std::string FACE_CASCADE_NAME("haarcascade_frontalface_alt.xml"); cv::CascadeClassifier face_cascade(FACE_CASCADE_NAME); if(face_cascade.empty()) { std::cerr << "Failed to load " << FACE_CASCADE_NAME << std::endl; return -1; } // Load in an image containing a face. const std::string INPUT_IMAGE_NAME("lena.bmp"); cv::Mat input_image = cv::imread(INPUT_IMAGE_NAME); if(input_image.empty()) { std::cerr << "Failed to load" << INPUT_IMAGE_NAME << std::endl; return -1; } // Convert the image to grayscale and equalize the histogram. cv::Mat image_gray; cv::cvtColor(input_image, image_gray, CV_BGR2GRAY); cv::equalizeHist(image_gray, image_gray); // Attempt to detect one or more faces. std::vector<cv::Rect> faces; face_cascade.detectMultiScale(image_gray, faces, 1.1, 2, 0|CV_HAAR_SCALE_IMAGE, cv::Size(30, 30)); // Iterate over the detected faces and surround each one with an ellipse. std::for_each(faces.begin(), faces.end(), [&input_image](const cv::Rect& face_rect) { cv::Point center(face_rect.x + static_cast<int>(face_rect.width*0.5f), face_rect.y + static_cast<int>(face_rect.height*0.5f)); cv::ellipse(input_image, center, cv::Size(static_cast<int>(face_rect.width*0.5f), static_cast<int>(face_rect.height*0.5f)), 0, 0, 360, cv::Scalar(0, 0, 255), 4, 8, 0); }); cv::imshow("Face Detector", input_image); // Delay termination until some key is pressed. We want to give the user time to view the output. cv::waitKey(); return 0; }
C++
#include <cmath> #include <iostream> #include <QVBoxLayout> #include <QFileDialog> #include <QDir> #include <QSize> #include <QSizePolicy> #include "Panel.hpp" #include "Drawing.hpp" Panel::Panel(QWidget *parent) : QWidget(parent) { QVBoxLayout *vbox; QHBoxLayout *box; vbox = new QVBoxLayout(); file = new QGroupBox("File"); vbox->addWidget(file); box = new QHBoxLayout; name = new QLabel("Name:"); name->setFixedWidth(200); box->addWidget(name); open = new QPushButton("Open..."); open->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); box->addWidget(open); file->setLayout(box); front = new QGroupBox("Direction"); vbox->addWidget(front); box = new QHBoxLayout; cw = new QRadioButton("Clockwise"); box->addWidget(cw); ccw = new QRadioButton("Counter-Clockwise"); box->addWidget(ccw); ccw->setChecked(true); front->setLayout(box); front->setEnabled(false); view = new QGroupBox("Primitive"); vbox->addWidget(view); box = new QHBoxLayout; point = new QRadioButton("Point"); box->addWidget(point); frame = new QRadioButton("Frame"); box->addWidget(frame); solid = new QRadioButton("Solid"); box->addWidget(solid); frame->setChecked(true); view->setLayout(box); view->setEnabled(false); color = new QGroupBox("Color"); vbox->addWidget(color); box = new QHBoxLayout; red = new QSpinBox(); red->setPrefix("R = "); red->setRange(0, 255); red->setValue(255); red->setSingleStep(5); box->addWidget(red); green = new QSpinBox(); green->setPrefix("G = "); green->setRange(0, 255); green->setValue(255); green->setSingleStep(5); box->addWidget(green); blue = new QSpinBox(); blue->setPrefix("B = "); blue->setRange(0, 255); blue->setValue(255); blue->setSingleStep(5); box->addWidget(blue); color->setLayout(box); color->setEnabled(false); trans = new QGroupBox("Translation"); vbox->addWidget(trans); box = new QHBoxLayout; movx = new QDoubleSpinBox(); movx->setPrefix("X = "); box->addWidget(movx); movy = new QDoubleSpinBox(); movy->setPrefix("Y = "); box->addWidget(movy); movz = new QDoubleSpinBox(); movz->setPrefix("Z = "); box->addWidget(movz); trans->setLayout(box); trans->setEnabled(false); rotat = new QGroupBox("Rotate"); vbox->addWidget(rotat); box = new QHBoxLayout; rotx = new QDoubleSpinBox(); rotx->setPrefix("X = "); rotx->setRange(0, 360); rotx->setSingleStep(5); rotx->setWrapping(true); box->addWidget(rotx); roty = new QDoubleSpinBox(); roty->setPrefix("Y = "); roty->setRange(0, 360); roty->setSingleStep(5); roty->setWrapping(true); box->addWidget(roty); rotz = new QDoubleSpinBox(); rotz->setPrefix("Z = "); rotz->setRange(0, 360); rotz->setSingleStep(5); rotz->setWrapping(true); box->addWidget(rotz); rotat->setLayout(box); rotat->setEnabled(false); QHBoxLayout *hbox = new QHBoxLayout; vbox->addLayout(hbox); clip = new QGroupBox("Clipping"); hbox->addWidget(clip); box = new QHBoxLayout; nearer = new QDoubleSpinBox(); nearer->setPrefix("Near = "); nearer->setRange(0, 255); box->addWidget(nearer); farer = new QDoubleSpinBox(); farer->setPrefix("Far = "); farer->setRange(0, 255); box->addWidget(farer); clip->setLayout(box); clip->setEnabled(false); reset = new QPushButton("Reset\nCamera"); reset->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); reset->setEnabled(false); hbox->addWidget(reset); setLayout(vbox); sigmap = new QSignalMapper; connect(sigmap, SIGNAL(mapped(QString)), this, SLOT(getvalue(QString))); connect(open, SIGNAL(clicked()), this, SLOT(openfile())); connect(cw, SIGNAL(clicked()), sigmap, SLOT(map())); connect(ccw, SIGNAL(clicked()), sigmap, SLOT(map())); connect(point, SIGNAL(clicked()), sigmap, SLOT(map())); connect(frame, SIGNAL(clicked()), sigmap, SLOT(map())); connect(solid, SIGNAL(clicked()), sigmap, SLOT(map())); connect(red, SIGNAL(valueChanged(int)), sigmap, SLOT(map())); connect(green, SIGNAL(valueChanged(int)), sigmap, SLOT(map())); connect(blue, SIGNAL(valueChanged(int)), sigmap, SLOT(map())); connect(movx, SIGNAL(valueChanged(double)), sigmap, SLOT(map())); connect(movy, SIGNAL(valueChanged(double)), sigmap, SLOT(map())); connect(movz, SIGNAL(valueChanged(double)), sigmap, SLOT(map())); connect(rotx, SIGNAL(valueChanged(double)), sigmap, SLOT(map())); connect(roty, SIGNAL(valueChanged(double)), sigmap, SLOT(map())); connect(rotz, SIGNAL(valueChanged(double)), sigmap, SLOT(map())); connect(nearer, SIGNAL(valueChanged(double)), sigmap, SLOT(map())); connect(farer, SIGNAL(valueChanged(double)), sigmap, SLOT(map())); connect(reset, SIGNAL(clicked()), this, SLOT(resetpara())); sigmap->setMapping(cw, "struct"); sigmap->setMapping(ccw, "struct"); sigmap->setMapping(point, "struct"); sigmap->setMapping(frame, "struct"); sigmap->setMapping(solid, "struct"); sigmap->setMapping(red, "color"); sigmap->setMapping(green, "color"); sigmap->setMapping(blue, "color"); sigmap->setMapping(movx, "trans"); sigmap->setMapping(movy, "trans"); sigmap->setMapping(movz, "trans"); sigmap->setMapping(rotx, "rotat"); sigmap->setMapping(roty, "rotat"); sigmap->setMapping(rotz, "rotat"); sigmap->setMapping(nearer, "clip"); sigmap->setMapping(farer, "clip"); } void Panel::openfile() { QString filename = QFileDialog::getOpenFileName(this, "Open File ...", QDir::currentPath(), "Input (*.in);;All (*.*)"); if(filename.isNull()) return; QString labeltxt = "Name: " + filename.section('/', -1); QFontMetrics metrics(name->font()); QString shortlabel = metrics.elidedText(labeltxt, Qt::ElideRight, name->width()); name->setText(shortlabel); emit setfilename(filename.toStdString().c_str()); } inline double min3(double x, double y, double z) { x = x < y ? x : y; return x < z ? x : z; } inline double step(double r) { return floor(r) / 50; } void Panel::initpara(double movxmin, double movxmax, double movymin, double movymax, double movzmin, double movzmax, double nearmin, double farmax) { reset->setEnabled(true); front->setEnabled(true); view->setEnabled(true); color->setEnabled(true); trans->setEnabled(true); rotat->setEnabled(true); clip->setEnabled(true); movx->setRange(movxmin, movxmax); movy->setRange(movymin, movymax); movz->setRange(movzmin, movzmax); movx->setSingleStep(step(min3(movxmax - movxmin, movymax - movymin, movzmax - movzmin))); movy->setSingleStep(step(min3(movxmax - movxmin, movymax - movymin, movzmax - movzmin))); movz->setSingleStep(step(min3(movxmax - movxmin, movymax - movymin, movzmax - movzmin))); nearer->setRange(nearmin, farmax); farer->setRange(nearmin, farmax); nearer->setSingleStep(step(farmax - nearmin)); farer->setSingleStep(step(farmax - nearmin)); getvalue("struct"); getvalue("color"); resetpara(); } void Panel::resetpara() { movx->setValue(0); movy->setValue(0); movz->setValue(0); rotx->setValue(0); roty->setValue(0); rotz->setValue(0); nearer->setValue(nearer->minimum()); farer->setValue(farer->maximum()); getvalue("trans"); getvalue("rotat"); getvalue("rotat"); getvalue("clip"); emit resetcam(); } void Panel::getvalue(const QString &v) { if(v == "struct") emit setstruct(cw->isChecked(), 'p' * point->isChecked() + 'f' * frame->isChecked() + 's' * solid->isChecked()); else if(v == "color") emit setcolor(red->value(), green->value(), blue->value()); else if(v == "trans") emit settrans(movx->value(), movy->value(), movz->value()); else if(v == "rotat") emit setrotat(rotx->value(), roty->value(), rotz->value()); else if(v == "clip"){ nearer->setMaximum(farer->value()); farer->setMinimum(nearer->value()); emit setclip(nearer->value(), farer->value()); }else std::cerr << "Panel::getvalue(): Unknown value " << v.toStdString() << std::endl; }
C++
#include "Parameter.hpp" #include <GL/gl.h> #include <iostream> #include <cstdio> #include <cmath> #include <cstdlib> void UserParameter::init() { facefront = GL_CCW; for(int i = 0;i<3;i++){ color[i]=255; rotation[i]=0; translation[i]=0; } nearer = 0.1; farer = 6; primitive = GL_LINE; rotated = false; } void UserParameter::reset() { settrans(0,0,0); setrotat(0,0,0); setrotat(0,0,0); //setclip(nearmin,farmax); } void UserParameter::setstruct(bool clockwise, char view) { if(clockwise==TRUE){ facefront =GL_CW; std::cout << "Clockwise: " << clockwise << '\t' << "View: "; } else facefront = GL_CCW; switch(view){ case 'p': primitive = GL_POINT; std::cout << "Point" << std::endl; break; case 'f': primitive = GL_LINE; std::cout << "Frame" << std::endl; break; case 's': primitive = GL_FILL; std::cout << "Solid" << std::endl; break; default: std::cout << "Unknown" << std::endl; break; } emit refresh(); } void UserParameter::setcolor(int red, int green, int blue) { color[0]=red; color[1]=green; color[2]=blue; std::cout << "Color: " << red << ", " << green << ", " << blue << std::endl; emit refresh(); } void UserParameter::settrans(float x, float y, float z) { translation[0]=x; translation[1]=y; translation[2]=z; std::cout << "Translation: " << x << ", " << y << ", " << z << std::endl; emit refresh(); } void UserParameter::setrotat(float x, float y, float z) { rotationold[0] = rotation[0]; rotationold[1] = rotation[1]; rotationold[2] = rotation[2]; rotation[0] = x; rotation[1] = y; rotation[2] = z; std::cout << "Rotation: " << x << ", " << y << ", " << z << std::endl; rotated = true; emit refresh(); rotated = false; } void UserParameter::setclip(float n, float f) { nearer = n; farer = f; std::cout << "Near: " << n << '\t' << "Far" << f << std::endl; emit refresh(); } inline float fmax(float x, float y) { return x>y?x:y; } inline float fmin(float x, float y) { return x<y?x:y; } void InputParameter::readfile(const char *FileName) { char ch; FILE* fp = fopen(FileName,"r"); if (fp==NULL) { printf("ERROR: unable to open TriObj [%s]!\n",FileName); exit(1); } fscanf(fp, "%c", &ch); while(ch!= '\n') // skip the first line fscanf(fp, "%c", &ch); fscanf(fp,"# triangles = %d\n", &trinum); // read # of triangles fscanf(fp,"Material count = %d\n", &marnum); // read material count // mat.resize(marnum); for(int i=0; i<marnum; i++) { fscanf(fp, "ambient color %f %f %f\n", &mat[i].acolor[0], &mat[i].acolor[1], &mat[i].acolor[2]); fscanf(fp, "diffuse color %f %f %f\n", &mat[i].dcolor[0], &mat[i].dcolor[1], &mat[i].dcolor[2]); fscanf(fp, "specular color %f %f %f\n", &mat[i].scolor[0], &mat[i].scolor[1], &mat[i].scolor[2]); fscanf(fp, "material shine %f\n", &mat[i].shine); } // fscanf(fp, "%c", &ch); while(ch!= '\n') // skip documentation line fscanf(fp, "%c", &ch); printf ("Reading in %s (%d triangles). . .\n", FileName, trinum); tri.resize(trinum); for (int i=0; i<trinum; i++) // read triangles { for (int j=0;j<3;j++) { fscanf(fp, "v%c %f %f %f %f %f %f %d\n", &ch, &(tri[i].v[j].pos[0]), &(tri[i].v[j].pos[1]), &(tri[i].v[j].pos[2]), &(tri[i].v[j].norm[0]), &(tri[i].v[j].norm[1]), &(tri[i].v[j].norm[2]), &(tri[i].v[j].matind)); tri[i].color[j] =(unsigned char)(int)(255*(mat[tri[i].v[0].matind].dcolor[j]));//Since very vertex use the same material index, so here I take the first vertex as its color } fscanf(fp, "face normal %f %f %f\n", &(tri[i].fnorm[0]), &(tri[i].fnorm[1]), &(tri[i].fnorm[2])); } // get the max and min of the object in x y z for(int i = 0; i < 3; i++) pmax[i] = pmin[i] = tri[0].v[0].pos[i]; for(int i = 0; i < trinum; i++) { for(int j = 0; j < 3; j++) { for(int k = 0; k < 3; k++) { if(tri[i].v[j].pos[k] < pmin[k]) pmin[k] = tri[i].v[j].pos[k]; else if(tri[i].v[j].pos[k] > pmax[k]) pmax[k] = tri[i].v[j].pos[k]; } } } distance = fmax(pmax[1] - pmin[1],pmax[0] - pmin[0])* sqrt(3.0); float translate_scaler[3]; translate_scaler[0] = fmin(fmin(pmax[0] - pmin[0],pmax[1] - pmin[1]),pmax[2] -pmin[2]); translate_scaler[1] = translate_scaler[0]; translate_scaler[2] = translate_scaler[0]; float nearer_scaler = distance; float farer_scaler = distance; fclose(fp); emit initpara(-10*translate_scaler[0], 10*translate_scaler[0], -10*translate_scaler[1], 10*translate_scaler[1], -10*translate_scaler[2], 10*translate_scaler[2], 0.1*nearer_scaler, 5*farer_scaler); emit reset(); }
C++
#ifndef MATRIXDRAWING_HPP #define MATRIXDRAWING_HPP #include <QtOpenGL/QGLWidget> #include <string> #include <vector> #include <QGLShaderProgram> #include <QGLShader> using std::vector; using std::string; class MatrixDrawing : public QGLWidget { Q_OBJECT public: float u[3],v[3],n[3]; float translate[3]; float last_translate[3]; float rotation[3]; float last_rotation[3]; float translate_scaler[3]; float nearer_scaler; float farer_scaler; float fovy; float aspect; explicit MatrixDrawing(QWidget *parent = 0); QSize sizeHint() const; void initializeGL(); void paintGL(); void resizeGL(int width, int height); void CameraRotation(); void readfile(const char *Filename); struct userparameter { GLenum facefront; float color[3]; float rotation[3]; float translation[3]; float nearer; float farer; GLenum primitive; userparameter(); }; userparameter uipara; struct parameter { struct material { float acolor[3]; float dcolor[3]; float scolor[3]; float shine; }; struct triangle { struct vertex { float pos[3]; float norm[3]; int matind; }; vertex v[3]; float fnorm[3]; float color[3]; }; string name; int trinum; int marnum; vector<material> mat; vector<triangle> tri; float pmax[3], pmin[3]; float distance; }; parameter para; struct cameraparameter { float eye[3]; float center[3]; float up[3]; }; cameraparameter cpara; struct matrix { float m[16]; matrix(); void MatrixMult(float* b); // a = b* a void IdentityMatrix(); }; matrix modelviewmat,projectionmat; void getTMatrix(float x, float y, float z, GLfloat* temp); void getRMatrix(float x, float y, float z, GLfloat* temp); void CalcProjectionMatrix(); struct matrixshader { QGLShaderProgram program; GLint modelview_loc, projection_loc; }; matrixshader mshader; void LoadShaders(); private: signals: void initpara(double movxmin, double movxmax, double movymin, double movymax, double movzmin, double movzmax, double nearmin, double farmax); public slots: void Initalvalue(); void setfilename(const char *fn); void setstruct(bool clockwise, char view); void setcolor(int red, int green, int blue); void settrans(float x, float y, float z); void setrotat(float x, float y, float z); void setclip(float nearer, float farer); }; #endif // MATRIXDRAWING_HPP
C++
#ifndef __unix__ #include <windows.h> #endif #include <GL/glu.h> #include <QColor> #include <QSizePolicy> #include <QtOpenGL/QtOpenGL> #include "Drawing.hpp" #include <iostream> #include <fstream> #include <string> #include <vector> #include <cstdio> #include <math.h> void Drawing::reset() { cameraorientation[0] = cameraorientation[5] = cameraorientation[10] =cameraorientation[15] = 1; cameraorientation[1] = cameraorientation[2] = cameraorientation[3] =cameraorientation[4] =cameraorientation[6] = cameraorientation[7] = cameraorientation[8] =cameraorientation[9] =cameraorientation[11] = cameraorientation[12] = cameraorientation[13] =cameraorientation[14] =0; u[0]=v[1]=n[2]=1; u[1]=u[2]=v[0]=v[2]=n[1]=n[0]=0; for(int i=0;i<3;i++) { rotation[i]=0; translate[i]=0; } refresh(); } void Drawing::CameraRotation() { glPushMatrix(); glMatrixMode(GL_MODELVIEW_MATRIX); glLoadIdentity(); glRotatef(rotation[0],1,0,0); glRotatef(rotation[1],0,1,0); glRotatef(rotation[2],0,0,1); glMultMatrixf(cameraorientation); glGetFloatv(GL_MODELVIEW_MATRIX,cameraorientation); glPopMatrix(); for(int i=0;i<3;i++) { u[i]=cameraorientation[4*i]; v[i]=cameraorientation[4*i+1]; n[i]=cameraorientation[4*i+2]; } } Drawing::Drawing(QWidget *parent) : QGLWidget(QGLFormat(QGL::SampleBuffers), parent) { setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); } QSize Drawing::sizeHint() const { return QSize(256, 256); } void Drawing::initializeGL() { makeCurrent(); glShadeModel(GL_SMOOTH); glClearColor(1.0,1.0,1.0,0.0); glClearDepth(1.0); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST); } void Drawing::paintGL() { makeCurrent(); //glUseProgram(0); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); glMatrixMode(GL_MODELVIEW); glColor3ub(uipara->color[0],uipara->color[1],uipara->color[2]); glPolygonMode(GL_FRONT,uipara->primitive); glFrontFace(uipara->facefront); for(int i=0;i<inpara->trinum;i++) { glBegin(GL_TRIANGLES); glVertex3f(inpara->tri[i].v[0].pos[0],inpara->tri[i].v[0].pos[1],inpara->tri[i].v[0].pos[2]); glVertex3f(inpara->tri[i].v[1].pos[0],inpara->tri[i].v[1].pos[1],inpara->tri[i].v[1].pos[2]); glVertex3f(inpara->tri[i].v[2].pos[0],inpara->tri[i].v[2].pos[1],inpara->tri[i].v[2].pos[2]); glEnd(); } glCullFace(GL_BACK); } void Drawing::resizeGL(int width, int height) { makeCurrent(); glViewport(0,0,width,height); glClearColor(0,0,0,0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt((inpara->pmax[0]+inpara->pmin[0])/2+translate[0], (inpara->pmax[1]+inpara->pmin[1])/2+translate[1], (inpara->pmax[2]+inpara->pmin[2])/2+translate[2]+inpara->distance, (inpara->pmax[0]+inpara->pmin[0])/2+translate[0]-n[0], (inpara->pmax[1]+inpara->pmin[1])/2+translate[1]-n[1], (inpara->pmax[2]+inpara->pmin[2])/2+translate[2]+inpara->distance-n[2], v[0],v[1],v[2]); /* GLfloat temp[16]; glGetFloatv(GL_MODELVIEW_MATRIX,temp); std::cout<<"GM:"; for(int ii =0; ii<16; ii++) std::cout<<temp[ii]<<' '; std::cout<<std::endl; */ glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(60.0,width/height,uipara->nearer,uipara->farer); } void Drawing::refresh() { for(int i=0;i<3;i++){ translate[i] = uipara->translation[0]*u[i] +uipara->translation[1]*v[i] +uipara->translation[2]*n[i]; } if(uipara->rotated){ cout << "rotate: "; for(int i = 0; i < 3; i++){ rotation[i] = uipara->rotation[i] - uipara->rotationold[i]; cout << rotation[i] << ','; } cout << endl; CameraRotation(); } resizeGL(width(), height()); updateGL(); }
C++
#include <QGLWidget> #include <QtOpenGL/QtOpenGL> #include <QColor> #include <QSizePolicy> #include <QFileInfo> #include <iostream> #include <fstream> #include <cstdio> //#include <string> //#include <vector> #include "MatrixDrawing.hpp" #include <GL/glu.h> #include <GL/gl.h> #include <QMatrix4x4> void MatrixDrawing::Initalvalue() { u[0]=v[1]=n[2]=1.0f; u[1]=u[2]=v[0]=v[2]=n[1]=n[0]=0.0f; for(int i=0;i<3;i++) { rotation[i]=0.0f; last_rotation[i]=0.0f; translate[i]=0.0f; last_translate[i]=0.0f; uipara.rotation[i]=0.0f; uipara.translation[i]=0.0f; } fovy = 60.0/180.0*3.1415926; aspect = width()/height(); modelviewmat.IdentityMatrix(); GLfloat temp[16]; getTMatrix(-(para.pmin[0]+para.pmax[0])/2,-(para.pmin[1]+para.pmax[1])/2,-(para.pmax[2]+para.pmin[2])/2-para.distance,temp); modelviewmat.MatrixMult(temp); projectionmat.IdentityMatrix(); CalcProjectionMatrix(); } MatrixDrawing::userparameter::userparameter() { facefront = GL_CCW; for(int i = 0;i<3;i++) { color[i]=255; rotation[i]=0.0f; translation[i]=0.0f; } nearer = 0.1; farer = 6.0; primitive = GL_LINE; } MatrixDrawing::matrix::matrix() { IdentityMatrix(); } void MatrixDrawing::matrix::IdentityMatrix() { for(int ii=0;ii<16;ii++) m[ii]=0.0f; for(int ii = 0;ii<4;ii++) m[5*ii]=1.0f; } void MatrixDrawing::matrix::MatrixMult(GLfloat* b) // a = b* a { float temp[16]; for(int ii=0; ii<16; ii++){ temp[ii]=m[ii]; m[ii] = 0.0f; } for(int ii=0; ii<4; ii++) for (int jj = 0;jj<4;jj++) for(int kk = 0;kk<4;kk++) m[4*jj+ii] += b[4*kk+ii]*temp[4*jj+kk]; } void MatrixDrawing::getTMatrix(float x, float y, float z, GLfloat* temp) { glPushMatrix(); glMatrixMode(GL_MODELVIEW_MATRIX); glLoadIdentity(); glTranslatef(x,y,z); glGetFloatv(GL_MODELVIEW_MATRIX,temp); glPopMatrix(); } void MatrixDrawing::getRMatrix(float x, float y, float z, GLfloat *temp) { glPushMatrix(); glMatrixMode(GL_MODELVIEW_MATRIX); glLoadIdentity(); glRotatef(x,1.0f,0.0f,0.0f); glRotatef(y,0.0f,1.0f,0.0f); glRotatef(z,0.0f,0.0f,1.0f); glGetFloatv(GL_MODELVIEW_MATRIX,temp); glPopMatrix(); } void MatrixDrawing::CalcProjectionMatrix() { GLfloat f = 1/tan(fovy/2); projectionmat.IdentityMatrix(); projectionmat.m[0]=f/aspect; projectionmat.m[5]=f; projectionmat.m[10]=(uipara.farer+uipara.nearer)/(uipara.nearer-uipara.farer); projectionmat.m[11]=-1.0; projectionmat.m[14]=2*uipara.farer*uipara.nearer/(uipara.nearer-uipara.farer); projectionmat.m[15]=0.0; } void MatrixDrawing::CameraRotation() { GLfloat temp[16]; getRMatrix(rotation[0],rotation[1],rotation[2],temp); modelviewmat.MatrixMult(temp); //update camera for(int i=0;i<3;i++) { u[i]=modelviewmat.m[4*i]; v[i]=modelviewmat.m[4*i+1]; n[i]=modelviewmat.m[4*i+2]; } } inline float fmax(float x, float y) { return x>y?x:y; } inline float fmin(float x, float y) { return x<y?x:y; } void MatrixDrawing::readfile(const char *FileName) { Initalvalue(); char ch; FILE* fp = fopen(FileName,"r"); if (fp==NULL) { printf("ERROR: unable to open TriObj [%s]!\n",FileName); exit(1); } fscanf(fp, "%c", &ch); while(ch!= '\n') // skip the first line fscanf(fp, "%c", &ch); fscanf(fp,"# triangles = %d\n", &para.trinum); // read # of triangles fscanf(fp,"Material count = %d\n", &para.marnum); // read material count // para.mat.resize(para.marnum); for(int i=0; i<para.marnum; i++) { fscanf(fp, "ambient color %f %f %f\n", &para.mat[i].acolor[0], &para.mat[i].acolor[1], &para.mat[i].acolor[2]); fscanf(fp, "diffuse color %f %f %f\n", &para.mat[i].dcolor[0], &para.mat[i].dcolor[1], &para.mat[i].dcolor[2]); fscanf(fp, "specular color %f %f %f\n", &para.mat[i].scolor[0], &para.mat[i].scolor[1], &para.mat[i].scolor[2]); fscanf(fp, "material shine %f\n", &para.mat[i].shine); } // fscanf(fp, "%c", &ch); while(ch!= '\n') // skip documentation line fscanf(fp, "%c", &ch); printf ("Reading in %s (%d triangles). . .\n", FileName, para.trinum); para.tri.resize(para.trinum); for (int i=0; i<para.trinum; i++) // read triangles { for (int j=0;j<3;j++) { fscanf(fp, "v%c %f %f %f %f %f %f %d\n", &ch, &(para.tri[i].v[j].pos[0]), &(para.tri[i].v[j].pos[1]), &(para.tri[i].v[j].pos[2]), &(para.tri[i].v[j].norm[0]), &(para.tri[i].v[j].norm[1]), &(para.tri[i].v[j].norm[2]), &(para.tri[i].v[j].matind)); para.tri[i].color[j] =(unsigned char)(int)(255*(para.mat[para.tri[i].v[0].matind].dcolor[j]));//Since very vertex use the same material index, so here I take the first vertex as its color } fscanf(fp, "face normal %f %f %f\n", &(para.tri[i].fnorm[0]), &(para.tri[i].fnorm[1]), &(para.tri[i].fnorm[2])); } // get the max and min of the object in x y z for(int i = 0; i < 3; i++) para.pmax[i] = para.pmin[i] = para.tri[0].v[0].pos[i]; for(int i = 0; i < para.trinum; i++) { for(int j = 0; j < 3; j++) { for(int k = 0; k < 3; k++) { if(para.tri[i].v[j].pos[k] < para.pmin[k]) para.pmin[k] = para.tri[i].v[j].pos[k]; else if(para.tri[i].v[j].pos[k] > para.pmax[k]) para.pmax[k] = para.tri[i].v[j].pos[k]; } } } para.distance = fmax(para.pmax[1] - para.pmin[1],para.pmax[0] - para.pmin[0])* sqrt(3.0); translate_scaler[0] = fmin(fmin(para.pmax[0] - para.pmin[0],para.pmax[1] - para.pmin[1]),para.pmax[2] -para.pmin[2]); translate_scaler[1] = translate_scaler[0]; translate_scaler[2] = translate_scaler[0]; nearer_scaler = para.distance; farer_scaler = para.distance; fclose(fp); modelviewmat.IdentityMatrix(); GLfloat temp[16]; getTMatrix(-(para.pmin[0]+para.pmax[0])/2,-(para.pmin[1]+para.pmax[1])/2,-(para.pmax[2]+para.pmin[2])/2-para.distance,temp); modelviewmat.MatrixMult(temp); projectionmat.IdentityMatrix(); CalcProjectionMatrix(); std::cout<<"SMReadfile:"; for(int ii =0; ii<16; ii++) std::cout<<modelviewmat.m[ii]<<' '; std::cout<<std::endl; } MatrixDrawing::MatrixDrawing(QWidget *parent) : QGLWidget(QGLFormat(QGL::SampleBuffers), parent) { setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); } QSize MatrixDrawing::sizeHint() const { return QSize(256, 256); } void MatrixDrawing::initializeGL() { makeCurrent(); LoadShaders(); glShadeModel(GL_SMOOTH); glClearColor(1.0,1.0,1.0,0.0); glClearDepth(1.0); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST); } void MatrixDrawing::paintGL() { makeCurrent(); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); CalcProjectionMatrix(); glColor3ub(uipara.color[0],uipara.color[1],uipara.color[2]); glPolygonMode(GL_FRONT,uipara.primitive); glFrontFace(uipara.facefront); glBegin(GL_TRIANGLES); for(int i=0;i<para.trinum;i++) { glVertex3f(para.tri[i].v[0].pos[0],para.tri[i].v[0].pos[1],para.tri[i].v[0].pos[2]); glVertex3f(para.tri[i].v[1].pos[0],para.tri[i].v[1].pos[1],para.tri[i].v[1].pos[2]); glVertex3f(para.tri[i].v[2].pos[0],para.tri[i].v[2].pos[1],para.tri[i].v[2].pos[2]); } glEnd(); glCullFace(GL_BACK); //mshader.program.release(); //mshader.program.removeAllShaders(); } void MatrixDrawing::resizeGL(int width, int height) { makeCurrent(); glViewport(0,0,width,height); glClearColor(0,0,0,0); projectionmat.IdentityMatrix(); CalcProjectionMatrix(); mshader.modelview_loc = mshader.program.uniformLocation("modelviewmat"); mshader.projection_loc = mshader.program.uniformLocation("projectionmat"); mshader.program.setUniformValue(mshader.modelview_loc,QMatrix4x4((const qreal*)modelviewmat.m).transposed()); mshader.program.setUniformValue(mshader.projection_loc,QMatrix4x4((const qreal*)projectionmat.m).transposed()); std::cout<<"SM:"; for(int ii =0; ii<16; ii++) std::cout<<modelviewmat.m[ii]<<' '; std::cout<<std::endl; /* std::cout<<"shader projection"; for(int ii =0; ii<15; ii++) std::cout<<projectionmat.m[ii]<<' '; std::cout<<std::endl;*/ } void MatrixDrawing::setfilename(const char *fn) { readfile(fn); // std::cout << "Open File: " << fn << std::endl; //emit initpara(-10*translate_scaler[0], 10*translate_scaler[0], -10*translate_scaler[1], 10*translate_scaler[1], -10*translate_scaler[2], 10*translate_scaler[2], 0.1*nearer_scaler, 5*farer_scaler); //initializeGL(); makeCurrent(); resizeGL(width(), height()); // paintGL(); updateGL(); /* glewInit(); if (glewIsSupported("GL_VERSION_2_0")) printf("Ready for OpenGL 2.0\n"); else { printf("OpenGL 2.0 not supported\n"); exit(1); }*/ } void MatrixDrawing::setstruct(bool clockwise, char view) { if(clockwise==TRUE){ uipara.facefront =GL_CW; std::cout << "Clockwise: " << clockwise << '\t' << "View: "; } else uipara.facefront = GL_CCW; switch(view){ case 'p': uipara.primitive = GL_POINT; std::cout << "Point" << std::endl; break; case 'f': uipara.primitive = GL_LINE; std::cout << "Frame" << std::endl; break; case 's': uipara.primitive = GL_FILL; std::cout << "Solid" << std::endl; break; default: std::cout << "Unknown" << std::endl; break; } resizeGL(width(), height()); //paintGL(); updateGL(); } void MatrixDrawing::setcolor(int red, int green, int blue) { uipara.color[0]=red; uipara.color[1]=green; uipara.color[2]=blue; resizeGL(width(), height()); //paintGL(); updateGL(); // setShaders(); //std::cout << "Color: " << red << ", " << green << ", " << blue << std::endl; } void MatrixDrawing::settrans(float x, float y, float z) { for(int i=0;i<3;i++) { translate[i]=0; } uipara.translation[0]=x; uipara.translation[1]=y; uipara.translation[2]=z; /* for(int i=0;i<3;i++) { translate[i] = (uipara.translation[0]-last_translate[0])*u[i] +(uipara.translation[1]-last_translate[1])*v[i] +(uipara.translation[2]-last_translate[2])*n[i]; } */ for(int i=0;i<3;i++) { translate[i] = uipara.translation[i]-last_translate[i]; } last_translate[0]=x; last_translate[1]=y; last_translate[2]=z; GLfloat temp[16]; getTMatrix(-translate[0],-translate[1],-translate[2],temp); modelviewmat.MatrixMult(temp); /* for(int ii = 12;ii<15;ii++) modelviewmat.m[ii]=0; getTMatrix(-(para.pmin[0]+para.pmax[0])/2,-(para.pmin[1]+para.pmax[1])/2,-(para.pmax[2]+para.pmin[2])/2-para.distance,temp2); modelviewmat.MatrixMult(temp2); modelviewmat.MatrixMult(temp1);*/ resizeGL(width(), height()); //paintGL(); updateGL(); // setShaders(); //std::cout << "Translation: " << x << ", " << y << ", " << z << std::endl; } void MatrixDrawing::setrotat(float x, float y, float z) { rotation[0] = x-uipara.rotation[0]; rotation[1] = y-uipara.rotation[1]; rotation[2] = z-uipara.rotation[2]; uipara.rotation[0] = x; uipara.rotation[1] = y; uipara.rotation[2] = z; CameraRotation(); resizeGL(width(), height()); // paintGL(); updateGL(); // setShaders(); //std::cout << "Rotation: " << x << ", " << y << ", " << z << std::endl; } void MatrixDrawing::setclip(float nearer, float farer) { uipara.nearer = nearer; uipara.farer = farer; resizeGL(width(), height()); //paintGL(); updateGL(); // setShaders(); //std::cout << "Near: " << nearer << '\t' << "Far" << farer << std::endl; } void MatrixDrawing::LoadShaders() { std::cout<< "LoadShaders()" << std::endl; /* char *vs = NULL,*fs = NULL; QGLShader vshader(QGLShader::Vertex); QGLShader fshader(QGLShader::Fragment); vs = textFileRead("vertexshader.txt"); fs = textFileRead("fragshader.txt"); vshader.compileSourceCode(vs); fshader.compileSourceCode(fs); vshader.log(); fshader.log(); if(mshader.program) { mshader.program.release(); mshader.program.removeAllShaders(); } else mshader.program = new QGLShaderProgram; */ if(!mshader.program.isLinked()) { if(!mshader.program.addShaderFromSourceCode(QGLShader::Vertex, "uniform mat4 modelviewmat, projectionmat;\n" "void main(void)\n" "{\n" " gl_FrontColor = gl_Color;\n" " gl_Position = projectionmat*modelviewmat*gl_Vertex;\n" "}\n")) { qWarning()<<"Vertex Shader source file"<<mshader.program.log(); } if(!mshader.program.addShaderFromSourceCode(QGLShader::Fragment, "void main(void)\n" "{\n" " gl_FragColor = gl_Color;" "}\n")) { qWarning()<<"Fragment Shader source file"<<mshader.program.log(); } if(!mshader.program.link()) { qWarning()<<"Shader Program Linker Error" << mshader.program.log(); } mshader.program.bind(); } }
C++
#ifndef PANEL_HPP #define PANEL_HPP #include <QWidget> #include <QSignalMapper> #include <QLabel> #include <QGroupBox> #include <QPushButton> #include <QRadioButton> #include <QSpinBox> #include <QDoubleSpinBox> class Panel : public QWidget { Q_OBJECT public: explicit Panel(QWidget *parent = 0); QSignalMapper *sigmap; QGroupBox *file; QLabel *name; QPushButton *open; QPushButton *reset; QGroupBox *front; QRadioButton *cw; QRadioButton *ccw; QGroupBox *view; QRadioButton *point; QRadioButton *frame; QRadioButton *solid; QGroupBox *color; QSpinBox *red; QSpinBox *green; QSpinBox *blue; QGroupBox *trans; QDoubleSpinBox *movx; QDoubleSpinBox *movy; QDoubleSpinBox *movz; QGroupBox *rotat; QDoubleSpinBox *rotx; QDoubleSpinBox *roty; QDoubleSpinBox *rotz; QGroupBox *clip; QDoubleSpinBox *nearer; QDoubleSpinBox *farer; signals: void setfilename(const char *fn); void setstruct(bool clockwise, char viewtype); void setcolor(int red, int green, int blue); void settrans(float x, float y, float z); void setrotat(float x, float y, float z); void setclip(float n, float f); void resetcam(); public slots: void initpara(double movxmin, double movxmax, double movymin, double movymax, double movzmin, double movzmax, double nearmin, double farmax); void openfile(); void getvalue(const QString &v); void resetpara(); }; #endif // PANEL_HPP
C++
#ifndef DEBUG_H #define DEBUG_H #include <iostream> #define OUT(x) std::cout << x << std::endl #endif // DEBUG_H
C++
#ifndef PARAMETER_HPP #define PARAMETER_HPP #include <QObject> #include <GL/gl.h> #include <vector> #include <string> using namespace std; class UserParameter : public QObject { Q_OBJECT public: GLenum facefront; float color[3]; float rotation[3]; float rotationold[3]; bool rotated; float translation[3]; float nearer; float farer; GLenum primitive; void init(); UserParameter(){init();} signals: void refresh(); public slots: void reset(); void setstruct(bool clockwise, char view); void setcolor(int red, int green, int blue); void settrans(float x, float y, float z); void setrotat(float x, float y, float z); void setclip(float n, float f); }; class InputParameter : public QObject { Q_OBJECT public: struct material { float acolor[3]; float dcolor[3]; float scolor[3]; float shine; }; struct triangle { struct vertex { float pos[3]; float norm[3]; int matind; }; vertex v[3]; float fnorm[3]; float color[3]; }; string name; int trinum; int marnum; vector<material> mat; vector<triangle> tri; float pmax[3], pmin[3]; float distance; signals: void initpara(double movxmin, double movxmax, double movymin, double movymax, double movzmin, double movzmax, double nearmin, double farmax); void reset(); public slots: void readfile(const char* file); }; #endif // PARAMETER_HPP
C++
#ifndef MAINWINDOW_HPP #define MAINWINDOW_HPP #include <QMainWindow> #include <QtGui> #include "Panel.hpp" #include "Drawing.hpp" #include "MatrixDrawing.hpp" class MainWindow : public QMainWindow { Q_OBJECT public: Panel *bottom; Drawing *left; MatrixDrawing *right; UserParameter uipara; InputParameter inpara; MainWindow(QWidget *parent = 0); ~MainWindow(); public slots: }; #endif // MAINWINDOW_HPP
C++
#include "MainWindow.hpp" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { setCentralWidget(new QFrame); QVBoxLayout *vbox = new QVBoxLayout; QHBoxLayout *hbox = new QHBoxLayout; left = new Drawing; left->uipara = &uipara; left->inpara = &inpara; right = new MatrixDrawing; bottom = new Panel; left->initializeGL(); //right->initializeGL(); hbox->addWidget(left); hbox->addWidget(right); vbox->addLayout(hbox); vbox->addWidget(bottom); centralWidget()->setLayout(vbox); connect(bottom, SIGNAL(setfilename(const char*)), &inpara, SLOT(readfile(const char*))); connect(&inpara, SIGNAL(initpara(double,double,double,double,double,double,double,double)), bottom, SLOT(initpara(double,double,double,double,double,double,double,double))); connect(bottom, SIGNAL(setstruct(bool,char)), &uipara, SLOT(setstruct(bool,char))); connect(bottom, SIGNAL(setcolor(int,int,int)), &uipara, SLOT(setcolor(int,int,int))); connect(bottom, SIGNAL(settrans(float,float,float)), &uipara, SLOT(settrans(float,float,float))); connect(bottom, SIGNAL(setrotat(float,float,float)), &uipara, SLOT(setrotat(float,float,float))); connect(bottom, SIGNAL(setclip(float,float)), &uipara, SLOT(setclip(float,float))); connect(&uipara, SIGNAL(refresh()), left, SLOT(refresh())); connect(&inpara, SIGNAL(reset()), left, SLOT(reset())); connect(bottom, SIGNAL(resetcam()), left, SLOT(reset())); //connect(bottom, SIGNAL(initialdrawing()), left, SLOT(Initalvalue())); /* // connect(right, SIGNAL(initpara(double,double,double,double,double,double,double,double)), // bottom, SLOT(initpara(double,double,double,double,double,double,double,double))); connect(bottom, SIGNAL(setfilename(const char*)), right, SLOT(setfilename(const char*))); connect(bottom, SIGNAL(setstruct(bool,char)), right, SLOT(setstruct(bool,char))); connect(bottom, SIGNAL(setcolor(int,int,int)), right, SLOT(setcolor(int,int,int))); connect(bottom, SIGNAL(settrans(float,float,float)), right, SLOT(settrans(float,float,float))); connect(bottom, SIGNAL(setrotat(float,float,float)), right, SLOT(setrotat(float,float,float))); connect(bottom, SIGNAL(setclip(float,float)), right, SLOT(setclip(float,float))); //connect(bottom, SIGNAL(initialmatrixdrawing()), right, SLOT(Initalvalue())); */ } MainWindow::~MainWindow() { }
C++
#include <QApplication> #include "MainWindow.hpp" int main(int argc, char *argv[]) { QApplication app(argc, argv); MainWindow w; //Window w; w.show(); return app.exec(); }
C++
#ifndef DRAWING_HPP #define DRAWING_HPP #include <QtOpenGL/QGLWidget> #include <string> #include <vector> #include "Parameter.hpp" using std::vector; using std::string; class Drawing : public QGLWidget { Q_OBJECT public: explicit Drawing(QWidget *parent = 0); void initializeGL(); UserParameter *uipara; InputParameter *inpara; private: float cameraorientation[16]; float u[3],v[3],n[3]; float translate[3]; float rotation[3]; QSize sizeHint() const; void paintGL(); void resizeGL(int width, int height); void CameraRotation(); public slots: void reset(); void refresh(); }; #endif // DRAWING_HPP
C++
/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <stdlib.h> namespace latinime { struct LatinCapitalSmallPair { unsigned short capital; unsigned short small; }; // Generated from http://unicode.org/Public/UNIDATA/UnicodeData.txt // // 1. Run the following code. Bascially taken from // Dictionary::toLowerCase(unsigned short c) in dictionary.cpp. // Then, get the list of chars where cc != ccc. // // unsigned short c, cc, ccc, ccc2; // for (c = 0; c < 0xFFFF ; c++) { // if (c < sizeof(BASE_CHARS) / sizeof(BASE_CHARS[0])) { // cc = BASE_CHARS[c]; // } else { // cc = c; // } // // // tolower // int isBase = 0; // if (cc >='A' && cc <= 'Z') { // ccc = (cc | 0x20); // ccc2 = ccc; // isBase = 1; // } else if (cc > 0x7F) { // ccc = u_tolower(cc); // ccc2 = latin_tolower(cc); // } else { // ccc = cc; // ccc2 = ccc; // } // if (!isBase && cc != ccc) { // wprintf(L" 0x%04X => 0x%04X => 0x%04X %lc => %lc => %lc \n", // c, cc, ccc, c, cc, ccc); // //assert(ccc == ccc2); // } // } // // Initially, started with an empty latin_tolower() as below. // // unsigned short latin_tolower(unsigned short c) { // return c; // } // // // 2. Process the list obtained by 1 by the following perl script and apply // 'sort -u' as well. Get the SORTED_CHAR_MAP[]. // Note that '$1' in the perl script is 'cc' in the above C code. // // while(<>) { // / 0x\w* => 0x(\w*) =/; // open(HDL, "grep -iw ^" . $1 . " UnicodeData.txt | "); // $line = <HDL>; // chomp $line; // @cols = split(/;/, $line); // print " { 0x$1, 0x$cols[13] }, // $cols[1]\n"; // } // // // 3. Update the latin_tolower() function above with SORTED_CHAR_MAP. Enable // the assert(ccc == ccc2) above and confirm the function exits successfully. // static const struct LatinCapitalSmallPair SORTED_CHAR_MAP[] = { { 0x00C4, 0x00E4 }, // LATIN CAPITAL LETTER A WITH DIAERESIS { 0x00C5, 0x00E5 }, // LATIN CAPITAL LETTER A WITH RING ABOVE { 0x00C6, 0x00E6 }, // LATIN CAPITAL LETTER AE { 0x00D0, 0x00F0 }, // LATIN CAPITAL LETTER ETH { 0x00D5, 0x00F5 }, // LATIN CAPITAL LETTER O WITH TILDE { 0x00D6, 0x00F6 }, // LATIN CAPITAL LETTER O WITH DIAERESIS { 0x00D8, 0x00F8 }, // LATIN CAPITAL LETTER O WITH STROKE { 0x00DC, 0x00FC }, // LATIN CAPITAL LETTER U WITH DIAERESIS { 0x00DE, 0x00FE }, // LATIN CAPITAL LETTER THORN { 0x0110, 0x0111 }, // LATIN CAPITAL LETTER D WITH STROKE { 0x0126, 0x0127 }, // LATIN CAPITAL LETTER H WITH STROKE { 0x0141, 0x0142 }, // LATIN CAPITAL LETTER L WITH STROKE { 0x014A, 0x014B }, // LATIN CAPITAL LETTER ENG { 0x0152, 0x0153 }, // LATIN CAPITAL LIGATURE OE { 0x0166, 0x0167 }, // LATIN CAPITAL LETTER T WITH STROKE { 0x0181, 0x0253 }, // LATIN CAPITAL LETTER B WITH HOOK { 0x0182, 0x0183 }, // LATIN CAPITAL LETTER B WITH TOPBAR { 0x0184, 0x0185 }, // LATIN CAPITAL LETTER TONE SIX { 0x0186, 0x0254 }, // LATIN CAPITAL LETTER OPEN O { 0x0187, 0x0188 }, // LATIN CAPITAL LETTER C WITH HOOK { 0x0189, 0x0256 }, // LATIN CAPITAL LETTER AFRICAN D { 0x018A, 0x0257 }, // LATIN CAPITAL LETTER D WITH HOOK { 0x018B, 0x018C }, // LATIN CAPITAL LETTER D WITH TOPBAR { 0x018E, 0x01DD }, // LATIN CAPITAL LETTER REVERSED E { 0x018F, 0x0259 }, // LATIN CAPITAL LETTER SCHWA { 0x0190, 0x025B }, // LATIN CAPITAL LETTER OPEN E { 0x0191, 0x0192 }, // LATIN CAPITAL LETTER F WITH HOOK { 0x0193, 0x0260 }, // LATIN CAPITAL LETTER G WITH HOOK { 0x0194, 0x0263 }, // LATIN CAPITAL LETTER GAMMA { 0x0196, 0x0269 }, // LATIN CAPITAL LETTER IOTA { 0x0197, 0x0268 }, // LATIN CAPITAL LETTER I WITH STROKE { 0x0198, 0x0199 }, // LATIN CAPITAL LETTER K WITH HOOK { 0x019C, 0x026F }, // LATIN CAPITAL LETTER TURNED M { 0x019D, 0x0272 }, // LATIN CAPITAL LETTER N WITH LEFT HOOK { 0x019F, 0x0275 }, // LATIN CAPITAL LETTER O WITH MIDDLE TILDE { 0x01A2, 0x01A3 }, // LATIN CAPITAL LETTER OI { 0x01A4, 0x01A5 }, // LATIN CAPITAL LETTER P WITH HOOK { 0x01A6, 0x0280 }, // LATIN LETTER YR { 0x01A7, 0x01A8 }, // LATIN CAPITAL LETTER TONE TWO { 0x01A9, 0x0283 }, // LATIN CAPITAL LETTER ESH { 0x01AC, 0x01AD }, // LATIN CAPITAL LETTER T WITH HOOK { 0x01AE, 0x0288 }, // LATIN CAPITAL LETTER T WITH RETROFLEX HOOK { 0x01B1, 0x028A }, // LATIN CAPITAL LETTER UPSILON { 0x01B2, 0x028B }, // LATIN CAPITAL LETTER V WITH HOOK { 0x01B3, 0x01B4 }, // LATIN CAPITAL LETTER Y WITH HOOK { 0x01B5, 0x01B6 }, // LATIN CAPITAL LETTER Z WITH STROKE { 0x01B7, 0x0292 }, // LATIN CAPITAL LETTER EZH { 0x01B8, 0x01B9 }, // LATIN CAPITAL LETTER EZH REVERSED { 0x01BC, 0x01BD }, // LATIN CAPITAL LETTER TONE FIVE { 0x01E4, 0x01E5 }, // LATIN CAPITAL LETTER G WITH STROKE { 0x01EA, 0x01EB }, // LATIN CAPITAL LETTER O WITH OGONEK { 0x01F6, 0x0195 }, // LATIN CAPITAL LETTER HWAIR { 0x01F7, 0x01BF }, // LATIN CAPITAL LETTER WYNN { 0x021C, 0x021D }, // LATIN CAPITAL LETTER YOGH { 0x0220, 0x019E }, // LATIN CAPITAL LETTER N WITH LONG RIGHT LEG { 0x0222, 0x0223 }, // LATIN CAPITAL LETTER OU { 0x0224, 0x0225 }, // LATIN CAPITAL LETTER Z WITH HOOK { 0x0226, 0x0227 }, // LATIN CAPITAL LETTER A WITH DOT ABOVE { 0x022E, 0x022F }, // LATIN CAPITAL LETTER O WITH DOT ABOVE { 0x023A, 0x2C65 }, // LATIN CAPITAL LETTER A WITH STROKE { 0x023B, 0x023C }, // LATIN CAPITAL LETTER C WITH STROKE { 0x023D, 0x019A }, // LATIN CAPITAL LETTER L WITH BAR { 0x023E, 0x2C66 }, // LATIN CAPITAL LETTER T WITH DIAGONAL STROKE { 0x0241, 0x0242 }, // LATIN CAPITAL LETTER GLOTTAL STOP { 0x0243, 0x0180 }, // LATIN CAPITAL LETTER B WITH STROKE { 0x0244, 0x0289 }, // LATIN CAPITAL LETTER U BAR { 0x0245, 0x028C }, // LATIN CAPITAL LETTER TURNED V { 0x0246, 0x0247 }, // LATIN CAPITAL LETTER E WITH STROKE { 0x0248, 0x0249 }, // LATIN CAPITAL LETTER J WITH STROKE { 0x024A, 0x024B }, // LATIN CAPITAL LETTER SMALL Q WITH HOOK TAIL { 0x024C, 0x024D }, // LATIN CAPITAL LETTER R WITH STROKE { 0x024E, 0x024F }, // LATIN CAPITAL LETTER Y WITH STROKE { 0x0370, 0x0371 }, // GREEK CAPITAL LETTER HETA { 0x0372, 0x0373 }, // GREEK CAPITAL LETTER ARCHAIC SAMPI { 0x0376, 0x0377 }, // GREEK CAPITAL LETTER PAMPHYLIAN DIGAMMA { 0x0391, 0x03B1 }, // GREEK CAPITAL LETTER ALPHA { 0x0392, 0x03B2 }, // GREEK CAPITAL LETTER BETA { 0x0393, 0x03B3 }, // GREEK CAPITAL LETTER GAMMA { 0x0394, 0x03B4 }, // GREEK CAPITAL LETTER DELTA { 0x0395, 0x03B5 }, // GREEK CAPITAL LETTER EPSILON { 0x0396, 0x03B6 }, // GREEK CAPITAL LETTER ZETA { 0x0397, 0x03B7 }, // GREEK CAPITAL LETTER ETA { 0x0398, 0x03B8 }, // GREEK CAPITAL LETTER THETA { 0x0399, 0x03B9 }, // GREEK CAPITAL LETTER IOTA { 0x039A, 0x03BA }, // GREEK CAPITAL LETTER KAPPA { 0x039B, 0x03BB }, // GREEK CAPITAL LETTER LAMDA { 0x039C, 0x03BC }, // GREEK CAPITAL LETTER MU { 0x039D, 0x03BD }, // GREEK CAPITAL LETTER NU { 0x039E, 0x03BE }, // GREEK CAPITAL LETTER XI { 0x039F, 0x03BF }, // GREEK CAPITAL LETTER OMICRON { 0x03A0, 0x03C0 }, // GREEK CAPITAL LETTER PI { 0x03A1, 0x03C1 }, // GREEK CAPITAL LETTER RHO { 0x03A3, 0x03C3 }, // GREEK CAPITAL LETTER SIGMA { 0x03A4, 0x03C4 }, // GREEK CAPITAL LETTER TAU { 0x03A5, 0x03C5 }, // GREEK CAPITAL LETTER UPSILON { 0x03A6, 0x03C6 }, // GREEK CAPITAL LETTER PHI { 0x03A7, 0x03C7 }, // GREEK CAPITAL LETTER CHI { 0x03A8, 0x03C8 }, // GREEK CAPITAL LETTER PSI { 0x03A9, 0x03C9 }, // GREEK CAPITAL LETTER OMEGA { 0x03CF, 0x03D7 }, // GREEK CAPITAL KAI SYMBOL { 0x03D8, 0x03D9 }, // GREEK LETTER ARCHAIC KOPPA { 0x03DA, 0x03DB }, // GREEK LETTER STIGMA { 0x03DC, 0x03DD }, // GREEK LETTER DIGAMMA { 0x03DE, 0x03DF }, // GREEK LETTER KOPPA { 0x03E0, 0x03E1 }, // GREEK LETTER SAMPI { 0x03E2, 0x03E3 }, // COPTIC CAPITAL LETTER SHEI { 0x03E4, 0x03E5 }, // COPTIC CAPITAL LETTER FEI { 0x03E6, 0x03E7 }, // COPTIC CAPITAL LETTER KHEI { 0x03E8, 0x03E9 }, // COPTIC CAPITAL LETTER HORI { 0x03EA, 0x03EB }, // COPTIC CAPITAL LETTER GANGIA { 0x03EC, 0x03ED }, // COPTIC CAPITAL LETTER SHIMA { 0x03EE, 0x03EF }, // COPTIC CAPITAL LETTER DEI { 0x03F7, 0x03F8 }, // GREEK CAPITAL LETTER SHO { 0x03FA, 0x03FB }, // GREEK CAPITAL LETTER SAN { 0x03FD, 0x037B }, // GREEK CAPITAL REVERSED LUNATE SIGMA SYMBOL { 0x03FE, 0x037C }, // GREEK CAPITAL DOTTED LUNATE SIGMA SYMBOL { 0x03FF, 0x037D }, // GREEK CAPITAL REVERSED DOTTED LUNATE SIGMA SYMBOL { 0x0402, 0x0452 }, // CYRILLIC CAPITAL LETTER DJE { 0x0404, 0x0454 }, // CYRILLIC CAPITAL LETTER UKRAINIAN IE { 0x0405, 0x0455 }, // CYRILLIC CAPITAL LETTER DZE { 0x0406, 0x0456 }, // CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I { 0x0408, 0x0458 }, // CYRILLIC CAPITAL LETTER JE { 0x0409, 0x0459 }, // CYRILLIC CAPITAL LETTER LJE { 0x040A, 0x045A }, // CYRILLIC CAPITAL LETTER NJE { 0x040B, 0x045B }, // CYRILLIC CAPITAL LETTER TSHE { 0x040F, 0x045F }, // CYRILLIC CAPITAL LETTER DZHE { 0x0410, 0x0430 }, // CYRILLIC CAPITAL LETTER A { 0x0411, 0x0431 }, // CYRILLIC CAPITAL LETTER BE { 0x0412, 0x0432 }, // CYRILLIC CAPITAL LETTER VE { 0x0413, 0x0433 }, // CYRILLIC CAPITAL LETTER GHE { 0x0414, 0x0434 }, // CYRILLIC CAPITAL LETTER DE { 0x0415, 0x0435 }, // CYRILLIC CAPITAL LETTER IE { 0x0416, 0x0436 }, // CYRILLIC CAPITAL LETTER ZHE { 0x0417, 0x0437 }, // CYRILLIC CAPITAL LETTER ZE { 0x0418, 0x0438 }, // CYRILLIC CAPITAL LETTER I { 0x041A, 0x043A }, // CYRILLIC CAPITAL LETTER KA { 0x041B, 0x043B }, // CYRILLIC CAPITAL LETTER EL { 0x041C, 0x043C }, // CYRILLIC CAPITAL LETTER EM { 0x041D, 0x043D }, // CYRILLIC CAPITAL LETTER EN { 0x041E, 0x043E }, // CYRILLIC CAPITAL LETTER O { 0x041F, 0x043F }, // CYRILLIC CAPITAL LETTER PE { 0x0420, 0x0440 }, // CYRILLIC CAPITAL LETTER ER { 0x0421, 0x0441 }, // CYRILLIC CAPITAL LETTER ES { 0x0422, 0x0442 }, // CYRILLIC CAPITAL LETTER TE { 0x0423, 0x0443 }, // CYRILLIC CAPITAL LETTER U { 0x0424, 0x0444 }, // CYRILLIC CAPITAL LETTER EF { 0x0425, 0x0445 }, // CYRILLIC CAPITAL LETTER HA { 0x0426, 0x0446 }, // CYRILLIC CAPITAL LETTER TSE { 0x0427, 0x0447 }, // CYRILLIC CAPITAL LETTER CHE { 0x0428, 0x0448 }, // CYRILLIC CAPITAL LETTER SHA { 0x0429, 0x0449 }, // CYRILLIC CAPITAL LETTER SHCHA { 0x042A, 0x044A }, // CYRILLIC CAPITAL LETTER HARD SIGN { 0x042B, 0x044B }, // CYRILLIC CAPITAL LETTER YERU { 0x042C, 0x044C }, // CYRILLIC CAPITAL LETTER SOFT SIGN { 0x042D, 0x044D }, // CYRILLIC CAPITAL LETTER E { 0x042E, 0x044E }, // CYRILLIC CAPITAL LETTER YU { 0x042F, 0x044F }, // CYRILLIC CAPITAL LETTER YA { 0x0460, 0x0461 }, // CYRILLIC CAPITAL LETTER OMEGA { 0x0462, 0x0463 }, // CYRILLIC CAPITAL LETTER YAT { 0x0464, 0x0465 }, // CYRILLIC CAPITAL LETTER IOTIFIED E { 0x0466, 0x0467 }, // CYRILLIC CAPITAL LETTER LITTLE YUS { 0x0468, 0x0469 }, // CYRILLIC CAPITAL LETTER IOTIFIED LITTLE YUS { 0x046A, 0x046B }, // CYRILLIC CAPITAL LETTER BIG YUS { 0x046C, 0x046D }, // CYRILLIC CAPITAL LETTER IOTIFIED BIG YUS { 0x046E, 0x046F }, // CYRILLIC CAPITAL LETTER KSI { 0x0470, 0x0471 }, // CYRILLIC CAPITAL LETTER PSI { 0x0472, 0x0473 }, // CYRILLIC CAPITAL LETTER FITA { 0x0474, 0x0475 }, // CYRILLIC CAPITAL LETTER IZHITSA { 0x0478, 0x0479 }, // CYRILLIC CAPITAL LETTER UK { 0x047A, 0x047B }, // CYRILLIC CAPITAL LETTER ROUND OMEGA { 0x047C, 0x047D }, // CYRILLIC CAPITAL LETTER OMEGA WITH TITLO { 0x047E, 0x047F }, // CYRILLIC CAPITAL LETTER OT { 0x0480, 0x0481 }, // CYRILLIC CAPITAL LETTER KOPPA { 0x048A, 0x048B }, // CYRILLIC CAPITAL LETTER SHORT I WITH TAIL { 0x048C, 0x048D }, // CYRILLIC CAPITAL LETTER SEMISOFT SIGN { 0x048E, 0x048F }, // CYRILLIC CAPITAL LETTER ER WITH TICK { 0x0490, 0x0491 }, // CYRILLIC CAPITAL LETTER GHE WITH UPTURN { 0x0492, 0x0493 }, // CYRILLIC CAPITAL LETTER GHE WITH STROKE { 0x0494, 0x0495 }, // CYRILLIC CAPITAL LETTER GHE WITH MIDDLE HOOK { 0x0496, 0x0497 }, // CYRILLIC CAPITAL LETTER ZHE WITH DESCENDER { 0x0498, 0x0499 }, // CYRILLIC CAPITAL LETTER ZE WITH DESCENDER { 0x049A, 0x049B }, // CYRILLIC CAPITAL LETTER KA WITH DESCENDER { 0x049C, 0x049D }, // CYRILLIC CAPITAL LETTER KA WITH VERTICAL STROKE { 0x049E, 0x049F }, // CYRILLIC CAPITAL LETTER KA WITH STROKE { 0x04A0, 0x04A1 }, // CYRILLIC CAPITAL LETTER BASHKIR KA { 0x04A2, 0x04A3 }, // CYRILLIC CAPITAL LETTER EN WITH DESCENDER { 0x04A4, 0x04A5 }, // CYRILLIC CAPITAL LIGATURE EN GHE { 0x04A6, 0x04A7 }, // CYRILLIC CAPITAL LETTER PE WITH MIDDLE HOOK { 0x04A8, 0x04A9 }, // CYRILLIC CAPITAL LETTER ABKHASIAN HA { 0x04AA, 0x04AB }, // CYRILLIC CAPITAL LETTER ES WITH DESCENDER { 0x04AC, 0x04AD }, // CYRILLIC CAPITAL LETTER TE WITH DESCENDER { 0x04AE, 0x04AF }, // CYRILLIC CAPITAL LETTER STRAIGHT U { 0x04B0, 0x04B1 }, // CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE { 0x04B2, 0x04B3 }, // CYRILLIC CAPITAL LETTER HA WITH DESCENDER { 0x04B4, 0x04B5 }, // CYRILLIC CAPITAL LIGATURE TE TSE { 0x04B6, 0x04B7 }, // CYRILLIC CAPITAL LETTER CHE WITH DESCENDER { 0x04B8, 0x04B9 }, // CYRILLIC CAPITAL LETTER CHE WITH VERTICAL STROKE { 0x04BA, 0x04BB }, // CYRILLIC CAPITAL LETTER SHHA { 0x04BC, 0x04BD }, // CYRILLIC CAPITAL LETTER ABKHASIAN CHE { 0x04BE, 0x04BF }, // CYRILLIC CAPITAL LETTER ABKHASIAN CHE WITH DESCENDER { 0x04C0, 0x04CF }, // CYRILLIC LETTER PALOCHKA { 0x04C3, 0x04C4 }, // CYRILLIC CAPITAL LETTER KA WITH HOOK { 0x04C5, 0x04C6 }, // CYRILLIC CAPITAL LETTER EL WITH TAIL { 0x04C7, 0x04C8 }, // CYRILLIC CAPITAL LETTER EN WITH HOOK { 0x04C9, 0x04CA }, // CYRILLIC CAPITAL LETTER EN WITH TAIL { 0x04CB, 0x04CC }, // CYRILLIC CAPITAL LETTER KHAKASSIAN CHE { 0x04CD, 0x04CE }, // CYRILLIC CAPITAL LETTER EM WITH TAIL { 0x04D4, 0x04D5 }, // CYRILLIC CAPITAL LIGATURE A IE { 0x04D8, 0x04D9 }, // CYRILLIC CAPITAL LETTER SCHWA { 0x04E0, 0x04E1 }, // CYRILLIC CAPITAL LETTER ABKHASIAN DZE { 0x04E8, 0x04E9 }, // CYRILLIC CAPITAL LETTER BARRED O { 0x04F6, 0x04F7 }, // CYRILLIC CAPITAL LETTER GHE WITH DESCENDER { 0x04FA, 0x04FB }, // CYRILLIC CAPITAL LETTER GHE WITH STROKE AND HOOK { 0x04FC, 0x04FD }, // CYRILLIC CAPITAL LETTER HA WITH HOOK { 0x04FE, 0x04FF }, // CYRILLIC CAPITAL LETTER HA WITH STROKE { 0x0500, 0x0501 }, // CYRILLIC CAPITAL LETTER KOMI DE { 0x0502, 0x0503 }, // CYRILLIC CAPITAL LETTER KOMI DJE { 0x0504, 0x0505 }, // CYRILLIC CAPITAL LETTER KOMI ZJE { 0x0506, 0x0507 }, // CYRILLIC CAPITAL LETTER KOMI DZJE { 0x0508, 0x0509 }, // CYRILLIC CAPITAL LETTER KOMI LJE { 0x050A, 0x050B }, // CYRILLIC CAPITAL LETTER KOMI NJE { 0x050C, 0x050D }, // CYRILLIC CAPITAL LETTER KOMI SJE { 0x050E, 0x050F }, // CYRILLIC CAPITAL LETTER KOMI TJE { 0x0510, 0x0511 }, // CYRILLIC CAPITAL LETTER REVERSED ZE { 0x0512, 0x0513 }, // CYRILLIC CAPITAL LETTER EL WITH HOOK { 0x0514, 0x0515 }, // CYRILLIC CAPITAL LETTER LHA { 0x0516, 0x0517 }, // CYRILLIC CAPITAL LETTER RHA { 0x0518, 0x0519 }, // CYRILLIC CAPITAL LETTER YAE { 0x051A, 0x051B }, // CYRILLIC CAPITAL LETTER QA { 0x051C, 0x051D }, // CYRILLIC CAPITAL LETTER WE { 0x051E, 0x051F }, // CYRILLIC CAPITAL LETTER ALEUT KA { 0x0520, 0x0521 }, // CYRILLIC CAPITAL LETTER EL WITH MIDDLE HOOK { 0x0522, 0x0523 }, // CYRILLIC CAPITAL LETTER EN WITH MIDDLE HOOK { 0x0524, 0x0525 }, // CYRILLIC CAPITAL LETTER PE WITH DESCENDER { 0x0531, 0x0561 }, // ARMENIAN CAPITAL LETTER AYB { 0x0532, 0x0562 }, // ARMENIAN CAPITAL LETTER BEN { 0x0533, 0x0563 }, // ARMENIAN CAPITAL LETTER GIM { 0x0534, 0x0564 }, // ARMENIAN CAPITAL LETTER DA { 0x0535, 0x0565 }, // ARMENIAN CAPITAL LETTER ECH { 0x0536, 0x0566 }, // ARMENIAN CAPITAL LETTER ZA { 0x0537, 0x0567 }, // ARMENIAN CAPITAL LETTER EH { 0x0538, 0x0568 }, // ARMENIAN CAPITAL LETTER ET { 0x0539, 0x0569 }, // ARMENIAN CAPITAL LETTER TO { 0x053A, 0x056A }, // ARMENIAN CAPITAL LETTER ZHE { 0x053B, 0x056B }, // ARMENIAN CAPITAL LETTER INI { 0x053C, 0x056C }, // ARMENIAN CAPITAL LETTER LIWN { 0x053D, 0x056D }, // ARMENIAN CAPITAL LETTER XEH { 0x053E, 0x056E }, // ARMENIAN CAPITAL LETTER CA { 0x053F, 0x056F }, // ARMENIAN CAPITAL LETTER KEN { 0x0540, 0x0570 }, // ARMENIAN CAPITAL LETTER HO { 0x0541, 0x0571 }, // ARMENIAN CAPITAL LETTER JA { 0x0542, 0x0572 }, // ARMENIAN CAPITAL LETTER GHAD { 0x0543, 0x0573 }, // ARMENIAN CAPITAL LETTER CHEH { 0x0544, 0x0574 }, // ARMENIAN CAPITAL LETTER MEN { 0x0545, 0x0575 }, // ARMENIAN CAPITAL LETTER YI { 0x0546, 0x0576 }, // ARMENIAN CAPITAL LETTER NOW { 0x0547, 0x0577 }, // ARMENIAN CAPITAL LETTER SHA { 0x0548, 0x0578 }, // ARMENIAN CAPITAL LETTER VO { 0x0549, 0x0579 }, // ARMENIAN CAPITAL LETTER CHA { 0x054A, 0x057A }, // ARMENIAN CAPITAL LETTER PEH { 0x054B, 0x057B }, // ARMENIAN CAPITAL LETTER JHEH { 0x054C, 0x057C }, // ARMENIAN CAPITAL LETTER RA { 0x054D, 0x057D }, // ARMENIAN CAPITAL LETTER SEH { 0x054E, 0x057E }, // ARMENIAN CAPITAL LETTER VEW { 0x054F, 0x057F }, // ARMENIAN CAPITAL LETTER TIWN { 0x0550, 0x0580 }, // ARMENIAN CAPITAL LETTER REH { 0x0551, 0x0581 }, // ARMENIAN CAPITAL LETTER CO { 0x0552, 0x0582 }, // ARMENIAN CAPITAL LETTER YIWN { 0x0553, 0x0583 }, // ARMENIAN CAPITAL LETTER PIWR { 0x0554, 0x0584 }, // ARMENIAN CAPITAL LETTER KEH { 0x0555, 0x0585 }, // ARMENIAN CAPITAL LETTER OH { 0x0556, 0x0586 }, // ARMENIAN CAPITAL LETTER FEH { 0x10A0, 0x2D00 }, // GEORGIAN CAPITAL LETTER AN { 0x10A1, 0x2D01 }, // GEORGIAN CAPITAL LETTER BAN { 0x10A2, 0x2D02 }, // GEORGIAN CAPITAL LETTER GAN { 0x10A3, 0x2D03 }, // GEORGIAN CAPITAL LETTER DON { 0x10A4, 0x2D04 }, // GEORGIAN CAPITAL LETTER EN { 0x10A5, 0x2D05 }, // GEORGIAN CAPITAL LETTER VIN { 0x10A6, 0x2D06 }, // GEORGIAN CAPITAL LETTER ZEN { 0x10A7, 0x2D07 }, // GEORGIAN CAPITAL LETTER TAN { 0x10A8, 0x2D08 }, // GEORGIAN CAPITAL LETTER IN { 0x10A9, 0x2D09 }, // GEORGIAN CAPITAL LETTER KAN { 0x10AA, 0x2D0A }, // GEORGIAN CAPITAL LETTER LAS { 0x10AB, 0x2D0B }, // GEORGIAN CAPITAL LETTER MAN { 0x10AC, 0x2D0C }, // GEORGIAN CAPITAL LETTER NAR { 0x10AD, 0x2D0D }, // GEORGIAN CAPITAL LETTER ON { 0x10AE, 0x2D0E }, // GEORGIAN CAPITAL LETTER PAR { 0x10AF, 0x2D0F }, // GEORGIAN CAPITAL LETTER ZHAR { 0x10B0, 0x2D10 }, // GEORGIAN CAPITAL LETTER RAE { 0x10B1, 0x2D11 }, // GEORGIAN CAPITAL LETTER SAN { 0x10B2, 0x2D12 }, // GEORGIAN CAPITAL LETTER TAR { 0x10B3, 0x2D13 }, // GEORGIAN CAPITAL LETTER UN { 0x10B4, 0x2D14 }, // GEORGIAN CAPITAL LETTER PHAR { 0x10B5, 0x2D15 }, // GEORGIAN CAPITAL LETTER KHAR { 0x10B6, 0x2D16 }, // GEORGIAN CAPITAL LETTER GHAN { 0x10B7, 0x2D17 }, // GEORGIAN CAPITAL LETTER QAR { 0x10B8, 0x2D18 }, // GEORGIAN CAPITAL LETTER SHIN { 0x10B9, 0x2D19 }, // GEORGIAN CAPITAL LETTER CHIN { 0x10BA, 0x2D1A }, // GEORGIAN CAPITAL LETTER CAN { 0x10BB, 0x2D1B }, // GEORGIAN CAPITAL LETTER JIL { 0x10BC, 0x2D1C }, // GEORGIAN CAPITAL LETTER CIL { 0x10BD, 0x2D1D }, // GEORGIAN CAPITAL LETTER CHAR { 0x10BE, 0x2D1E }, // GEORGIAN CAPITAL LETTER XAN { 0x10BF, 0x2D1F }, // GEORGIAN CAPITAL LETTER JHAN { 0x10C0, 0x2D20 }, // GEORGIAN CAPITAL LETTER HAE { 0x10C1, 0x2D21 }, // GEORGIAN CAPITAL LETTER HE { 0x10C2, 0x2D22 }, // GEORGIAN CAPITAL LETTER HIE { 0x10C3, 0x2D23 }, // GEORGIAN CAPITAL LETTER WE { 0x10C4, 0x2D24 }, // GEORGIAN CAPITAL LETTER HAR { 0x10C5, 0x2D25 }, // GEORGIAN CAPITAL LETTER HOE { 0x1E00, 0x1E01 }, // LATIN CAPITAL LETTER A WITH RING BELOW { 0x1E02, 0x1E03 }, // LATIN CAPITAL LETTER B WITH DOT ABOVE { 0x1E04, 0x1E05 }, // LATIN CAPITAL LETTER B WITH DOT BELOW { 0x1E06, 0x1E07 }, // LATIN CAPITAL LETTER B WITH LINE BELOW { 0x1E08, 0x1E09 }, // LATIN CAPITAL LETTER C WITH CEDILLA AND ACUTE { 0x1E0A, 0x1E0B }, // LATIN CAPITAL LETTER D WITH DOT ABOVE { 0x1E0C, 0x1E0D }, // LATIN CAPITAL LETTER D WITH DOT BELOW { 0x1E0E, 0x1E0F }, // LATIN CAPITAL LETTER D WITH LINE BELOW { 0x1E10, 0x1E11 }, // LATIN CAPITAL LETTER D WITH CEDILLA { 0x1E12, 0x1E13 }, // LATIN CAPITAL LETTER D WITH CIRCUMFLEX BELOW { 0x1E14, 0x1E15 }, // LATIN CAPITAL LETTER E WITH MACRON AND GRAVE { 0x1E16, 0x1E17 }, // LATIN CAPITAL LETTER E WITH MACRON AND ACUTE { 0x1E18, 0x1E19 }, // LATIN CAPITAL LETTER E WITH CIRCUMFLEX BELOW { 0x1E1A, 0x1E1B }, // LATIN CAPITAL LETTER E WITH TILDE BELOW { 0x1E1C, 0x1E1D }, // LATIN CAPITAL LETTER E WITH CEDILLA AND BREVE { 0x1E1E, 0x1E1F }, // LATIN CAPITAL LETTER F WITH DOT ABOVE { 0x1E20, 0x1E21 }, // LATIN CAPITAL LETTER G WITH MACRON { 0x1E22, 0x1E23 }, // LATIN CAPITAL LETTER H WITH DOT ABOVE { 0x1E24, 0x1E25 }, // LATIN CAPITAL LETTER H WITH DOT BELOW { 0x1E26, 0x1E27 }, // LATIN CAPITAL LETTER H WITH DIAERESIS { 0x1E28, 0x1E29 }, // LATIN CAPITAL LETTER H WITH CEDILLA { 0x1E2A, 0x1E2B }, // LATIN CAPITAL LETTER H WITH BREVE BELOW { 0x1E2C, 0x1E2D }, // LATIN CAPITAL LETTER I WITH TILDE BELOW { 0x1E2E, 0x1E2F }, // LATIN CAPITAL LETTER I WITH DIAERESIS AND ACUTE { 0x1E30, 0x1E31 }, // LATIN CAPITAL LETTER K WITH ACUTE { 0x1E32, 0x1E33 }, // LATIN CAPITAL LETTER K WITH DOT BELOW { 0x1E34, 0x1E35 }, // LATIN CAPITAL LETTER K WITH LINE BELOW { 0x1E36, 0x1E37 }, // LATIN CAPITAL LETTER L WITH DOT BELOW { 0x1E38, 0x1E39 }, // LATIN CAPITAL LETTER L WITH DOT BELOW AND MACRON { 0x1E3A, 0x1E3B }, // LATIN CAPITAL LETTER L WITH LINE BELOW { 0x1E3C, 0x1E3D }, // LATIN CAPITAL LETTER L WITH CIRCUMFLEX BELOW { 0x1E3E, 0x1E3F }, // LATIN CAPITAL LETTER M WITH ACUTE { 0x1E40, 0x1E41 }, // LATIN CAPITAL LETTER M WITH DOT ABOVE { 0x1E42, 0x1E43 }, // LATIN CAPITAL LETTER M WITH DOT BELOW { 0x1E44, 0x1E45 }, // LATIN CAPITAL LETTER N WITH DOT ABOVE { 0x1E46, 0x1E47 }, // LATIN CAPITAL LETTER N WITH DOT BELOW { 0x1E48, 0x1E49 }, // LATIN CAPITAL LETTER N WITH LINE BELOW { 0x1E4A, 0x1E4B }, // LATIN CAPITAL LETTER N WITH CIRCUMFLEX BELOW { 0x1E4C, 0x1E4D }, // LATIN CAPITAL LETTER O WITH TILDE AND ACUTE { 0x1E4E, 0x1E4F }, // LATIN CAPITAL LETTER O WITH TILDE AND DIAERESIS { 0x1E50, 0x1E51 }, // LATIN CAPITAL LETTER O WITH MACRON AND GRAVE { 0x1E52, 0x1E53 }, // LATIN CAPITAL LETTER O WITH MACRON AND ACUTE { 0x1E54, 0x1E55 }, // LATIN CAPITAL LETTER P WITH ACUTE { 0x1E56, 0x1E57 }, // LATIN CAPITAL LETTER P WITH DOT ABOVE { 0x1E58, 0x1E59 }, // LATIN CAPITAL LETTER R WITH DOT ABOVE { 0x1E5A, 0x1E5B }, // LATIN CAPITAL LETTER R WITH DOT BELOW { 0x1E5C, 0x1E5D }, // LATIN CAPITAL LETTER R WITH DOT BELOW AND MACRON { 0x1E5E, 0x1E5F }, // LATIN CAPITAL LETTER R WITH LINE BELOW { 0x1E60, 0x1E61 }, // LATIN CAPITAL LETTER S WITH DOT ABOVE { 0x1E62, 0x1E63 }, // LATIN CAPITAL LETTER S WITH DOT BELOW { 0x1E64, 0x1E65 }, // LATIN CAPITAL LETTER S WITH ACUTE AND DOT ABOVE { 0x1E66, 0x1E67 }, // LATIN CAPITAL LETTER S WITH CARON AND DOT ABOVE { 0x1E68, 0x1E69 }, // LATIN CAPITAL LETTER S WITH DOT BELOW AND DOT ABOVE { 0x1E6A, 0x1E6B }, // LATIN CAPITAL LETTER T WITH DOT ABOVE { 0x1E6C, 0x1E6D }, // LATIN CAPITAL LETTER T WITH DOT BELOW { 0x1E6E, 0x1E6F }, // LATIN CAPITAL LETTER T WITH LINE BELOW { 0x1E70, 0x1E71 }, // LATIN CAPITAL LETTER T WITH CIRCUMFLEX BELOW { 0x1E72, 0x1E73 }, // LATIN CAPITAL LETTER U WITH DIAERESIS BELOW { 0x1E74, 0x1E75 }, // LATIN CAPITAL LETTER U WITH TILDE BELOW { 0x1E76, 0x1E77 }, // LATIN CAPITAL LETTER U WITH CIRCUMFLEX BELOW { 0x1E78, 0x1E79 }, // LATIN CAPITAL LETTER U WITH TILDE AND ACUTE { 0x1E7A, 0x1E7B }, // LATIN CAPITAL LETTER U WITH MACRON AND DIAERESIS { 0x1E7C, 0x1E7D }, // LATIN CAPITAL LETTER V WITH TILDE { 0x1E7E, 0x1E7F }, // LATIN CAPITAL LETTER V WITH DOT BELOW { 0x1E80, 0x1E81 }, // LATIN CAPITAL LETTER W WITH GRAVE { 0x1E82, 0x1E83 }, // LATIN CAPITAL LETTER W WITH ACUTE { 0x1E84, 0x1E85 }, // LATIN CAPITAL LETTER W WITH DIAERESIS { 0x1E86, 0x1E87 }, // LATIN CAPITAL LETTER W WITH DOT ABOVE { 0x1E88, 0x1E89 }, // LATIN CAPITAL LETTER W WITH DOT BELOW { 0x1E8A, 0x1E8B }, // LATIN CAPITAL LETTER X WITH DOT ABOVE { 0x1E8C, 0x1E8D }, // LATIN CAPITAL LETTER X WITH DIAERESIS { 0x1E8E, 0x1E8F }, // LATIN CAPITAL LETTER Y WITH DOT ABOVE { 0x1E90, 0x1E91 }, // LATIN CAPITAL LETTER Z WITH CIRCUMFLEX { 0x1E92, 0x1E93 }, // LATIN CAPITAL LETTER Z WITH DOT BELOW { 0x1E94, 0x1E95 }, // LATIN CAPITAL LETTER Z WITH LINE BELOW { 0x1E9E, 0x00DF }, // LATIN CAPITAL LETTER SHARP S { 0x1EA0, 0x1EA1 }, // LATIN CAPITAL LETTER A WITH DOT BELOW { 0x1EA2, 0x1EA3 }, // LATIN CAPITAL LETTER A WITH HOOK ABOVE { 0x1EA4, 0x1EA5 }, // LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND ACUTE { 0x1EA6, 0x1EA7 }, // LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND GRAVE { 0x1EA8, 0x1EA9 }, // LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE { 0x1EAA, 0x1EAB }, // LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND TILDE { 0x1EAC, 0x1EAD }, // LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND DOT BELOW { 0x1EAE, 0x1EAF }, // LATIN CAPITAL LETTER A WITH BREVE AND ACUTE { 0x1EB0, 0x1EB1 }, // LATIN CAPITAL LETTER A WITH BREVE AND GRAVE { 0x1EB2, 0x1EB3 }, // LATIN CAPITAL LETTER A WITH BREVE AND HOOK ABOVE { 0x1EB4, 0x1EB5 }, // LATIN CAPITAL LETTER A WITH BREVE AND TILDE { 0x1EB6, 0x1EB7 }, // LATIN CAPITAL LETTER A WITH BREVE AND DOT BELOW { 0x1EB8, 0x1EB9 }, // LATIN CAPITAL LETTER E WITH DOT BELOW { 0x1EBA, 0x1EBB }, // LATIN CAPITAL LETTER E WITH HOOK ABOVE { 0x1EBC, 0x1EBD }, // LATIN CAPITAL LETTER E WITH TILDE { 0x1EBE, 0x1EBF }, // LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND ACUTE { 0x1EC0, 0x1EC1 }, // LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND GRAVE { 0x1EC2, 0x1EC3 }, // LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE { 0x1EC4, 0x1EC5 }, // LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND TILDE { 0x1EC6, 0x1EC7 }, // LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND DOT BELOW { 0x1EC8, 0x1EC9 }, // LATIN CAPITAL LETTER I WITH HOOK ABOVE { 0x1ECA, 0x1ECB }, // LATIN CAPITAL LETTER I WITH DOT BELOW { 0x1ECC, 0x1ECD }, // LATIN CAPITAL LETTER O WITH DOT BELOW { 0x1ECE, 0x1ECF }, // LATIN CAPITAL LETTER O WITH HOOK ABOVE { 0x1ED0, 0x1ED1 }, // LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND ACUTE { 0x1ED2, 0x1ED3 }, // LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND GRAVE { 0x1ED4, 0x1ED5 }, // LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE { 0x1ED6, 0x1ED7 }, // LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND TILDE { 0x1ED8, 0x1ED9 }, // LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND DOT BELOW { 0x1EDA, 0x1EDB }, // LATIN CAPITAL LETTER O WITH HORN AND ACUTE { 0x1EDC, 0x1EDD }, // LATIN CAPITAL LETTER O WITH HORN AND GRAVE { 0x1EDE, 0x1EDF }, // LATIN CAPITAL LETTER O WITH HORN AND HOOK ABOVE { 0x1EE0, 0x1EE1 }, // LATIN CAPITAL LETTER O WITH HORN AND TILDE { 0x1EE2, 0x1EE3 }, // LATIN CAPITAL LETTER O WITH HORN AND DOT BELOW { 0x1EE4, 0x1EE5 }, // LATIN CAPITAL LETTER U WITH DOT BELOW { 0x1EE6, 0x1EE7 }, // LATIN CAPITAL LETTER U WITH HOOK ABOVE { 0x1EE8, 0x1EE9 }, // LATIN CAPITAL LETTER U WITH HORN AND ACUTE { 0x1EEA, 0x1EEB }, // LATIN CAPITAL LETTER U WITH HORN AND GRAVE { 0x1EEC, 0x1EED }, // LATIN CAPITAL LETTER U WITH HORN AND HOOK ABOVE { 0x1EEE, 0x1EEF }, // LATIN CAPITAL LETTER U WITH HORN AND TILDE { 0x1EF0, 0x1EF1 }, // LATIN CAPITAL LETTER U WITH HORN AND DOT BELOW { 0x1EF2, 0x1EF3 }, // LATIN CAPITAL LETTER Y WITH GRAVE { 0x1EF4, 0x1EF5 }, // LATIN CAPITAL LETTER Y WITH DOT BELOW { 0x1EF6, 0x1EF7 }, // LATIN CAPITAL LETTER Y WITH HOOK ABOVE { 0x1EF8, 0x1EF9 }, // LATIN CAPITAL LETTER Y WITH TILDE { 0x1EFA, 0x1EFB }, // LATIN CAPITAL LETTER MIDDLE-WELSH LL { 0x1EFC, 0x1EFD }, // LATIN CAPITAL LETTER MIDDLE-WELSH V { 0x1EFE, 0x1EFF }, // LATIN CAPITAL LETTER Y WITH LOOP { 0x1F08, 0x1F00 }, // GREEK CAPITAL LETTER ALPHA WITH PSILI { 0x1F09, 0x1F01 }, // GREEK CAPITAL LETTER ALPHA WITH DASIA { 0x1F0A, 0x1F02 }, // GREEK CAPITAL LETTER ALPHA WITH PSILI AND VARIA { 0x1F0B, 0x1F03 }, // GREEK CAPITAL LETTER ALPHA WITH DASIA AND VARIA { 0x1F0C, 0x1F04 }, // GREEK CAPITAL LETTER ALPHA WITH PSILI AND OXIA { 0x1F0D, 0x1F05 }, // GREEK CAPITAL LETTER ALPHA WITH DASIA AND OXIA { 0x1F0E, 0x1F06 }, // GREEK CAPITAL LETTER ALPHA WITH PSILI AND PERISPOMENI { 0x1F0F, 0x1F07 }, // GREEK CAPITAL LETTER ALPHA WITH DASIA AND PERISPOMENI { 0x1F18, 0x1F10 }, // GREEK CAPITAL LETTER EPSILON WITH PSILI { 0x1F19, 0x1F11 }, // GREEK CAPITAL LETTER EPSILON WITH DASIA { 0x1F1A, 0x1F12 }, // GREEK CAPITAL LETTER EPSILON WITH PSILI AND VARIA { 0x1F1B, 0x1F13 }, // GREEK CAPITAL LETTER EPSILON WITH DASIA AND VARIA { 0x1F1C, 0x1F14 }, // GREEK CAPITAL LETTER EPSILON WITH PSILI AND OXIA { 0x1F1D, 0x1F15 }, // GREEK CAPITAL LETTER EPSILON WITH DASIA AND OXIA { 0x1F28, 0x1F20 }, // GREEK CAPITAL LETTER ETA WITH PSILI { 0x1F29, 0x1F21 }, // GREEK CAPITAL LETTER ETA WITH DASIA { 0x1F2A, 0x1F22 }, // GREEK CAPITAL LETTER ETA WITH PSILI AND VARIA { 0x1F2B, 0x1F23 }, // GREEK CAPITAL LETTER ETA WITH DASIA AND VARIA { 0x1F2C, 0x1F24 }, // GREEK CAPITAL LETTER ETA WITH PSILI AND OXIA { 0x1F2D, 0x1F25 }, // GREEK CAPITAL LETTER ETA WITH DASIA AND OXIA { 0x1F2E, 0x1F26 }, // GREEK CAPITAL LETTER ETA WITH PSILI AND PERISPOMENI { 0x1F2F, 0x1F27 }, // GREEK CAPITAL LETTER ETA WITH DASIA AND PERISPOMENI { 0x1F38, 0x1F30 }, // GREEK CAPITAL LETTER IOTA WITH PSILI { 0x1F39, 0x1F31 }, // GREEK CAPITAL LETTER IOTA WITH DASIA { 0x1F3A, 0x1F32 }, // GREEK CAPITAL LETTER IOTA WITH PSILI AND VARIA { 0x1F3B, 0x1F33 }, // GREEK CAPITAL LETTER IOTA WITH DASIA AND VARIA { 0x1F3C, 0x1F34 }, // GREEK CAPITAL LETTER IOTA WITH PSILI AND OXIA { 0x1F3D, 0x1F35 }, // GREEK CAPITAL LETTER IOTA WITH DASIA AND OXIA { 0x1F3E, 0x1F36 }, // GREEK CAPITAL LETTER IOTA WITH PSILI AND PERISPOMENI { 0x1F3F, 0x1F37 }, // GREEK CAPITAL LETTER IOTA WITH DASIA AND PERISPOMENI { 0x1F48, 0x1F40 }, // GREEK CAPITAL LETTER OMICRON WITH PSILI { 0x1F49, 0x1F41 }, // GREEK CAPITAL LETTER OMICRON WITH DASIA { 0x1F4A, 0x1F42 }, // GREEK CAPITAL LETTER OMICRON WITH PSILI AND VARIA { 0x1F4B, 0x1F43 }, // GREEK CAPITAL LETTER OMICRON WITH DASIA AND VARIA { 0x1F4C, 0x1F44 }, // GREEK CAPITAL LETTER OMICRON WITH PSILI AND OXIA { 0x1F4D, 0x1F45 }, // GREEK CAPITAL LETTER OMICRON WITH DASIA AND OXIA { 0x1F59, 0x1F51 }, // GREEK CAPITAL LETTER UPSILON WITH DASIA { 0x1F5B, 0x1F53 }, // GREEK CAPITAL LETTER UPSILON WITH DASIA AND VARIA { 0x1F5D, 0x1F55 }, // GREEK CAPITAL LETTER UPSILON WITH DASIA AND OXIA { 0x1F5F, 0x1F57 }, // GREEK CAPITAL LETTER UPSILON WITH DASIA AND PERISPOMENI { 0x1F68, 0x1F60 }, // GREEK CAPITAL LETTER OMEGA WITH PSILI { 0x1F69, 0x1F61 }, // GREEK CAPITAL LETTER OMEGA WITH DASIA { 0x1F6A, 0x1F62 }, // GREEK CAPITAL LETTER OMEGA WITH PSILI AND VARIA { 0x1F6B, 0x1F63 }, // GREEK CAPITAL LETTER OMEGA WITH DASIA AND VARIA { 0x1F6C, 0x1F64 }, // GREEK CAPITAL LETTER OMEGA WITH PSILI AND OXIA { 0x1F6D, 0x1F65 }, // GREEK CAPITAL LETTER OMEGA WITH DASIA AND OXIA { 0x1F6E, 0x1F66 }, // GREEK CAPITAL LETTER OMEGA WITH PSILI AND PERISPOMENI { 0x1F6F, 0x1F67 }, // GREEK CAPITAL LETTER OMEGA WITH DASIA AND PERISPOMENI { 0x1F88, 0x1F80 }, // GREEK CAPITAL LETTER ALPHA WITH PSILI AND PROSGEGRAMMENI { 0x1F89, 0x1F81 }, // GREEK CAPITAL LETTER ALPHA WITH DASIA AND PROSGEGRAMMENI { 0x1F8A, 0x1F82 }, // GREEK CAPITAL LETTER ALPHA WITH PSILI AND VARIA AND PROSGEGRAMMENI { 0x1F8B, 0x1F83 }, // GREEK CAPITAL LETTER ALPHA WITH DASIA AND VARIA AND PROSGEGRAMMENI { 0x1F8C, 0x1F84 }, // GREEK CAPITAL LETTER ALPHA WITH PSILI AND OXIA AND PROSGEGRAMMENI { 0x1F8D, 0x1F85 }, // GREEK CAPITAL LETTER ALPHA WITH DASIA AND OXIA AND PROSGEGRAMMENI { 0x1F8E, 0x1F86 }, // GREEK CAPITAL LETTER ALPHA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI { 0x1F8F, 0x1F87 }, // GREEK CAPITAL LETTER ALPHA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI { 0x1F98, 0x1F90 }, // GREEK CAPITAL LETTER ETA WITH PSILI AND PROSGEGRAMMENI { 0x1F99, 0x1F91 }, // GREEK CAPITAL LETTER ETA WITH DASIA AND PROSGEGRAMMENI { 0x1F9A, 0x1F92 }, // GREEK CAPITAL LETTER ETA WITH PSILI AND VARIA AND PROSGEGRAMMENI { 0x1F9B, 0x1F93 }, // GREEK CAPITAL LETTER ETA WITH DASIA AND VARIA AND PROSGEGRAMMENI { 0x1F9C, 0x1F94 }, // GREEK CAPITAL LETTER ETA WITH PSILI AND OXIA AND PROSGEGRAMMENI { 0x1F9D, 0x1F95 }, // GREEK CAPITAL LETTER ETA WITH DASIA AND OXIA AND PROSGEGRAMMENI { 0x1F9E, 0x1F96 }, // GREEK CAPITAL LETTER ETA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI { 0x1F9F, 0x1F97 }, // GREEK CAPITAL LETTER ETA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI { 0x1FA8, 0x1FA0 }, // GREEK CAPITAL LETTER OMEGA WITH PSILI AND PROSGEGRAMMENI { 0x1FA9, 0x1FA1 }, // GREEK CAPITAL LETTER OMEGA WITH DASIA AND PROSGEGRAMMENI { 0x1FAA, 0x1FA2 }, // GREEK CAPITAL LETTER OMEGA WITH PSILI AND VARIA AND PROSGEGRAMMENI { 0x1FAB, 0x1FA3 }, // GREEK CAPITAL LETTER OMEGA WITH DASIA AND VARIA AND PROSGEGRAMMENI { 0x1FAC, 0x1FA4 }, // GREEK CAPITAL LETTER OMEGA WITH PSILI AND OXIA AND PROSGEGRAMMENI { 0x1FAD, 0x1FA5 }, // GREEK CAPITAL LETTER OMEGA WITH DASIA AND OXIA AND PROSGEGRAMMENI { 0x1FAE, 0x1FA6 }, // GREEK CAPITAL LETTER OMEGA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI { 0x1FAF, 0x1FA7 }, // GREEK CAPITAL LETTER OMEGA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI { 0x1FB8, 0x1FB0 }, // GREEK CAPITAL LETTER ALPHA WITH VRACHY { 0x1FB9, 0x1FB1 }, // GREEK CAPITAL LETTER ALPHA WITH MACRON { 0x1FBA, 0x1F70 }, // GREEK CAPITAL LETTER ALPHA WITH VARIA { 0x1FBB, 0x1F71 }, // GREEK CAPITAL LETTER ALPHA WITH OXIA { 0x1FBC, 0x1FB3 }, // GREEK CAPITAL LETTER ALPHA WITH PROSGEGRAMMENI { 0x1FC8, 0x1F72 }, // GREEK CAPITAL LETTER EPSILON WITH VARIA { 0x1FC9, 0x1F73 }, // GREEK CAPITAL LETTER EPSILON WITH OXIA { 0x1FCA, 0x1F74 }, // GREEK CAPITAL LETTER ETA WITH VARIA { 0x1FCB, 0x1F75 }, // GREEK CAPITAL LETTER ETA WITH OXIA { 0x1FCC, 0x1FC3 }, // GREEK CAPITAL LETTER ETA WITH PROSGEGRAMMENI { 0x1FD8, 0x1FD0 }, // GREEK CAPITAL LETTER IOTA WITH VRACHY { 0x1FD9, 0x1FD1 }, // GREEK CAPITAL LETTER IOTA WITH MACRON { 0x1FDA, 0x1F76 }, // GREEK CAPITAL LETTER IOTA WITH VARIA { 0x1FDB, 0x1F77 }, // GREEK CAPITAL LETTER IOTA WITH OXIA { 0x1FE8, 0x1FE0 }, // GREEK CAPITAL LETTER UPSILON WITH VRACHY { 0x1FE9, 0x1FE1 }, // GREEK CAPITAL LETTER UPSILON WITH MACRON { 0x1FEA, 0x1F7A }, // GREEK CAPITAL LETTER UPSILON WITH VARIA { 0x1FEB, 0x1F7B }, // GREEK CAPITAL LETTER UPSILON WITH OXIA { 0x1FEC, 0x1FE5 }, // GREEK CAPITAL LETTER RHO WITH DASIA { 0x1FF8, 0x1F78 }, // GREEK CAPITAL LETTER OMICRON WITH VARIA { 0x1FF9, 0x1F79 }, // GREEK CAPITAL LETTER OMICRON WITH OXIA { 0x1FFA, 0x1F7C }, // GREEK CAPITAL LETTER OMEGA WITH VARIA { 0x1FFB, 0x1F7D }, // GREEK CAPITAL LETTER OMEGA WITH OXIA { 0x1FFC, 0x1FF3 }, // GREEK CAPITAL LETTER OMEGA WITH PROSGEGRAMMENI { 0x2126, 0x03C9 }, // OHM SIGN { 0x212A, 0x006B }, // KELVIN SIGN { 0x212B, 0x00E5 }, // ANGSTROM SIGN { 0x2132, 0x214E }, // TURNED CAPITAL F { 0x2160, 0x2170 }, // ROMAN NUMERAL ONE { 0x2161, 0x2171 }, // ROMAN NUMERAL TWO { 0x2162, 0x2172 }, // ROMAN NUMERAL THREE { 0x2163, 0x2173 }, // ROMAN NUMERAL FOUR { 0x2164, 0x2174 }, // ROMAN NUMERAL FIVE { 0x2165, 0x2175 }, // ROMAN NUMERAL SIX { 0x2166, 0x2176 }, // ROMAN NUMERAL SEVEN { 0x2167, 0x2177 }, // ROMAN NUMERAL EIGHT { 0x2168, 0x2178 }, // ROMAN NUMERAL NINE { 0x2169, 0x2179 }, // ROMAN NUMERAL TEN { 0x216A, 0x217A }, // ROMAN NUMERAL ELEVEN { 0x216B, 0x217B }, // ROMAN NUMERAL TWELVE { 0x216C, 0x217C }, // ROMAN NUMERAL FIFTY { 0x216D, 0x217D }, // ROMAN NUMERAL ONE HUNDRED { 0x216E, 0x217E }, // ROMAN NUMERAL FIVE HUNDRED { 0x216F, 0x217F }, // ROMAN NUMERAL ONE THOUSAND { 0x2183, 0x2184 }, // ROMAN NUMERAL REVERSED ONE HUNDRED { 0x24B6, 0x24D0 }, // CIRCLED LATIN CAPITAL LETTER A { 0x24B7, 0x24D1 }, // CIRCLED LATIN CAPITAL LETTER B { 0x24B8, 0x24D2 }, // CIRCLED LATIN CAPITAL LETTER C { 0x24B9, 0x24D3 }, // CIRCLED LATIN CAPITAL LETTER D { 0x24BA, 0x24D4 }, // CIRCLED LATIN CAPITAL LETTER E { 0x24BB, 0x24D5 }, // CIRCLED LATIN CAPITAL LETTER F { 0x24BC, 0x24D6 }, // CIRCLED LATIN CAPITAL LETTER G { 0x24BD, 0x24D7 }, // CIRCLED LATIN CAPITAL LETTER H { 0x24BE, 0x24D8 }, // CIRCLED LATIN CAPITAL LETTER I { 0x24BF, 0x24D9 }, // CIRCLED LATIN CAPITAL LETTER J { 0x24C0, 0x24DA }, // CIRCLED LATIN CAPITAL LETTER K { 0x24C1, 0x24DB }, // CIRCLED LATIN CAPITAL LETTER L { 0x24C2, 0x24DC }, // CIRCLED LATIN CAPITAL LETTER M { 0x24C3, 0x24DD }, // CIRCLED LATIN CAPITAL LETTER N { 0x24C4, 0x24DE }, // CIRCLED LATIN CAPITAL LETTER O { 0x24C5, 0x24DF }, // CIRCLED LATIN CAPITAL LETTER P { 0x24C6, 0x24E0 }, // CIRCLED LATIN CAPITAL LETTER Q { 0x24C7, 0x24E1 }, // CIRCLED LATIN CAPITAL LETTER R { 0x24C8, 0x24E2 }, // CIRCLED LATIN CAPITAL LETTER S { 0x24C9, 0x24E3 }, // CIRCLED LATIN CAPITAL LETTER T { 0x24CA, 0x24E4 }, // CIRCLED LATIN CAPITAL LETTER U { 0x24CB, 0x24E5 }, // CIRCLED LATIN CAPITAL LETTER V { 0x24CC, 0x24E6 }, // CIRCLED LATIN CAPITAL LETTER W { 0x24CD, 0x24E7 }, // CIRCLED LATIN CAPITAL LETTER X { 0x24CE, 0x24E8 }, // CIRCLED LATIN CAPITAL LETTER Y { 0x24CF, 0x24E9 }, // CIRCLED LATIN CAPITAL LETTER Z { 0x2C00, 0x2C30 }, // GLAGOLITIC CAPITAL LETTER AZU { 0x2C01, 0x2C31 }, // GLAGOLITIC CAPITAL LETTER BUKY { 0x2C02, 0x2C32 }, // GLAGOLITIC CAPITAL LETTER VEDE { 0x2C03, 0x2C33 }, // GLAGOLITIC CAPITAL LETTER GLAGOLI { 0x2C04, 0x2C34 }, // GLAGOLITIC CAPITAL LETTER DOBRO { 0x2C05, 0x2C35 }, // GLAGOLITIC CAPITAL LETTER YESTU { 0x2C06, 0x2C36 }, // GLAGOLITIC CAPITAL LETTER ZHIVETE { 0x2C07, 0x2C37 }, // GLAGOLITIC CAPITAL LETTER DZELO { 0x2C08, 0x2C38 }, // GLAGOLITIC CAPITAL LETTER ZEMLJA { 0x2C09, 0x2C39 }, // GLAGOLITIC CAPITAL LETTER IZHE { 0x2C0A, 0x2C3A }, // GLAGOLITIC CAPITAL LETTER INITIAL IZHE { 0x2C0B, 0x2C3B }, // GLAGOLITIC CAPITAL LETTER I { 0x2C0C, 0x2C3C }, // GLAGOLITIC CAPITAL LETTER DJERVI { 0x2C0D, 0x2C3D }, // GLAGOLITIC CAPITAL LETTER KAKO { 0x2C0E, 0x2C3E }, // GLAGOLITIC CAPITAL LETTER LJUDIJE { 0x2C0F, 0x2C3F }, // GLAGOLITIC CAPITAL LETTER MYSLITE { 0x2C10, 0x2C40 }, // GLAGOLITIC CAPITAL LETTER NASHI { 0x2C11, 0x2C41 }, // GLAGOLITIC CAPITAL LETTER ONU { 0x2C12, 0x2C42 }, // GLAGOLITIC CAPITAL LETTER POKOJI { 0x2C13, 0x2C43 }, // GLAGOLITIC CAPITAL LETTER RITSI { 0x2C14, 0x2C44 }, // GLAGOLITIC CAPITAL LETTER SLOVO { 0x2C15, 0x2C45 }, // GLAGOLITIC CAPITAL LETTER TVRIDO { 0x2C16, 0x2C46 }, // GLAGOLITIC CAPITAL LETTER UKU { 0x2C17, 0x2C47 }, // GLAGOLITIC CAPITAL LETTER FRITU { 0x2C18, 0x2C48 }, // GLAGOLITIC CAPITAL LETTER HERU { 0x2C19, 0x2C49 }, // GLAGOLITIC CAPITAL LETTER OTU { 0x2C1A, 0x2C4A }, // GLAGOLITIC CAPITAL LETTER PE { 0x2C1B, 0x2C4B }, // GLAGOLITIC CAPITAL LETTER SHTA { 0x2C1C, 0x2C4C }, // GLAGOLITIC CAPITAL LETTER TSI { 0x2C1D, 0x2C4D }, // GLAGOLITIC CAPITAL LETTER CHRIVI { 0x2C1E, 0x2C4E }, // GLAGOLITIC CAPITAL LETTER SHA { 0x2C1F, 0x2C4F }, // GLAGOLITIC CAPITAL LETTER YERU { 0x2C20, 0x2C50 }, // GLAGOLITIC CAPITAL LETTER YERI { 0x2C21, 0x2C51 }, // GLAGOLITIC CAPITAL LETTER YATI { 0x2C22, 0x2C52 }, // GLAGOLITIC CAPITAL LETTER SPIDERY HA { 0x2C23, 0x2C53 }, // GLAGOLITIC CAPITAL LETTER YU { 0x2C24, 0x2C54 }, // GLAGOLITIC CAPITAL LETTER SMALL YUS { 0x2C25, 0x2C55 }, // GLAGOLITIC CAPITAL LETTER SMALL YUS WITH TAIL { 0x2C26, 0x2C56 }, // GLAGOLITIC CAPITAL LETTER YO { 0x2C27, 0x2C57 }, // GLAGOLITIC CAPITAL LETTER IOTATED SMALL YUS { 0x2C28, 0x2C58 }, // GLAGOLITIC CAPITAL LETTER BIG YUS { 0x2C29, 0x2C59 }, // GLAGOLITIC CAPITAL LETTER IOTATED BIG YUS { 0x2C2A, 0x2C5A }, // GLAGOLITIC CAPITAL LETTER FITA { 0x2C2B, 0x2C5B }, // GLAGOLITIC CAPITAL LETTER IZHITSA { 0x2C2C, 0x2C5C }, // GLAGOLITIC CAPITAL LETTER SHTAPIC { 0x2C2D, 0x2C5D }, // GLAGOLITIC CAPITAL LETTER TROKUTASTI A { 0x2C2E, 0x2C5E }, // GLAGOLITIC CAPITAL LETTER LATINATE MYSLITE { 0x2C60, 0x2C61 }, // LATIN CAPITAL LETTER L WITH DOUBLE BAR { 0x2C62, 0x026B }, // LATIN CAPITAL LETTER L WITH MIDDLE TILDE { 0x2C63, 0x1D7D }, // LATIN CAPITAL LETTER P WITH STROKE { 0x2C64, 0x027D }, // LATIN CAPITAL LETTER R WITH TAIL { 0x2C67, 0x2C68 }, // LATIN CAPITAL LETTER H WITH DESCENDER { 0x2C69, 0x2C6A }, // LATIN CAPITAL LETTER K WITH DESCENDER { 0x2C6B, 0x2C6C }, // LATIN CAPITAL LETTER Z WITH DESCENDER { 0x2C6D, 0x0251 }, // LATIN CAPITAL LETTER ALPHA { 0x2C6E, 0x0271 }, // LATIN CAPITAL LETTER M WITH HOOK { 0x2C6F, 0x0250 }, // LATIN CAPITAL LETTER TURNED A { 0x2C70, 0x0252 }, // LATIN CAPITAL LETTER TURNED ALPHA { 0x2C72, 0x2C73 }, // LATIN CAPITAL LETTER W WITH HOOK { 0x2C75, 0x2C76 }, // LATIN CAPITAL LETTER HALF H { 0x2C7E, 0x023F }, // LATIN CAPITAL LETTER S WITH SWASH TAIL { 0x2C7F, 0x0240 }, // LATIN CAPITAL LETTER Z WITH SWASH TAIL { 0x2C80, 0x2C81 }, // COPTIC CAPITAL LETTER ALFA { 0x2C82, 0x2C83 }, // COPTIC CAPITAL LETTER VIDA { 0x2C84, 0x2C85 }, // COPTIC CAPITAL LETTER GAMMA { 0x2C86, 0x2C87 }, // COPTIC CAPITAL LETTER DALDA { 0x2C88, 0x2C89 }, // COPTIC CAPITAL LETTER EIE { 0x2C8A, 0x2C8B }, // COPTIC CAPITAL LETTER SOU { 0x2C8C, 0x2C8D }, // COPTIC CAPITAL LETTER ZATA { 0x2C8E, 0x2C8F }, // COPTIC CAPITAL LETTER HATE { 0x2C90, 0x2C91 }, // COPTIC CAPITAL LETTER THETHE { 0x2C92, 0x2C93 }, // COPTIC CAPITAL LETTER IAUDA { 0x2C94, 0x2C95 }, // COPTIC CAPITAL LETTER KAPA { 0x2C96, 0x2C97 }, // COPTIC CAPITAL LETTER LAULA { 0x2C98, 0x2C99 }, // COPTIC CAPITAL LETTER MI { 0x2C9A, 0x2C9B }, // COPTIC CAPITAL LETTER NI { 0x2C9C, 0x2C9D }, // COPTIC CAPITAL LETTER KSI { 0x2C9E, 0x2C9F }, // COPTIC CAPITAL LETTER O { 0x2CA0, 0x2CA1 }, // COPTIC CAPITAL LETTER PI { 0x2CA2, 0x2CA3 }, // COPTIC CAPITAL LETTER RO { 0x2CA4, 0x2CA5 }, // COPTIC CAPITAL LETTER SIMA { 0x2CA6, 0x2CA7 }, // COPTIC CAPITAL LETTER TAU { 0x2CA8, 0x2CA9 }, // COPTIC CAPITAL LETTER UA { 0x2CAA, 0x2CAB }, // COPTIC CAPITAL LETTER FI { 0x2CAC, 0x2CAD }, // COPTIC CAPITAL LETTER KHI { 0x2CAE, 0x2CAF }, // COPTIC CAPITAL LETTER PSI { 0x2CB0, 0x2CB1 }, // COPTIC CAPITAL LETTER OOU { 0x2CB2, 0x2CB3 }, // COPTIC CAPITAL LETTER DIALECT-P ALEF { 0x2CB4, 0x2CB5 }, // COPTIC CAPITAL LETTER OLD COPTIC AIN { 0x2CB6, 0x2CB7 }, // COPTIC CAPITAL LETTER CRYPTOGRAMMIC EIE { 0x2CB8, 0x2CB9 }, // COPTIC CAPITAL LETTER DIALECT-P KAPA { 0x2CBA, 0x2CBB }, // COPTIC CAPITAL LETTER DIALECT-P NI { 0x2CBC, 0x2CBD }, // COPTIC CAPITAL LETTER CRYPTOGRAMMIC NI { 0x2CBE, 0x2CBF }, // COPTIC CAPITAL LETTER OLD COPTIC OOU { 0x2CC0, 0x2CC1 }, // COPTIC CAPITAL LETTER SAMPI { 0x2CC2, 0x2CC3 }, // COPTIC CAPITAL LETTER CROSSED SHEI { 0x2CC4, 0x2CC5 }, // COPTIC CAPITAL LETTER OLD COPTIC SHEI { 0x2CC6, 0x2CC7 }, // COPTIC CAPITAL LETTER OLD COPTIC ESH { 0x2CC8, 0x2CC9 }, // COPTIC CAPITAL LETTER AKHMIMIC KHEI { 0x2CCA, 0x2CCB }, // COPTIC CAPITAL LETTER DIALECT-P HORI { 0x2CCC, 0x2CCD }, // COPTIC CAPITAL LETTER OLD COPTIC HORI { 0x2CCE, 0x2CCF }, // COPTIC CAPITAL LETTER OLD COPTIC HA { 0x2CD0, 0x2CD1 }, // COPTIC CAPITAL LETTER L-SHAPED HA { 0x2CD2, 0x2CD3 }, // COPTIC CAPITAL LETTER OLD COPTIC HEI { 0x2CD4, 0x2CD5 }, // COPTIC CAPITAL LETTER OLD COPTIC HAT { 0x2CD6, 0x2CD7 }, // COPTIC CAPITAL LETTER OLD COPTIC GANGIA { 0x2CD8, 0x2CD9 }, // COPTIC CAPITAL LETTER OLD COPTIC DJA { 0x2CDA, 0x2CDB }, // COPTIC CAPITAL LETTER OLD COPTIC SHIMA { 0x2CDC, 0x2CDD }, // COPTIC CAPITAL LETTER OLD NUBIAN SHIMA { 0x2CDE, 0x2CDF }, // COPTIC CAPITAL LETTER OLD NUBIAN NGI { 0x2CE0, 0x2CE1 }, // COPTIC CAPITAL LETTER OLD NUBIAN NYI { 0x2CE2, 0x2CE3 }, // COPTIC CAPITAL LETTER OLD NUBIAN WAU { 0x2CEB, 0x2CEC }, // COPTIC CAPITAL LETTER CRYPTOGRAMMIC SHEI { 0x2CED, 0x2CEE }, // COPTIC CAPITAL LETTER CRYPTOGRAMMIC GANGIA { 0xA640, 0xA641 }, // CYRILLIC CAPITAL LETTER ZEMLYA { 0xA642, 0xA643 }, // CYRILLIC CAPITAL LETTER DZELO { 0xA644, 0xA645 }, // CYRILLIC CAPITAL LETTER REVERSED DZE { 0xA646, 0xA647 }, // CYRILLIC CAPITAL LETTER IOTA { 0xA648, 0xA649 }, // CYRILLIC CAPITAL LETTER DJERV { 0xA64A, 0xA64B }, // CYRILLIC CAPITAL LETTER MONOGRAPH UK { 0xA64C, 0xA64D }, // CYRILLIC CAPITAL LETTER BROAD OMEGA { 0xA64E, 0xA64F }, // CYRILLIC CAPITAL LETTER NEUTRAL YER { 0xA650, 0xA651 }, // CYRILLIC CAPITAL LETTER YERU WITH BACK YER { 0xA652, 0xA653 }, // CYRILLIC CAPITAL LETTER IOTIFIED YAT { 0xA654, 0xA655 }, // CYRILLIC CAPITAL LETTER REVERSED YU { 0xA656, 0xA657 }, // CYRILLIC CAPITAL LETTER IOTIFIED A { 0xA658, 0xA659 }, // CYRILLIC CAPITAL LETTER CLOSED LITTLE YUS { 0xA65A, 0xA65B }, // CYRILLIC CAPITAL LETTER BLENDED YUS { 0xA65C, 0xA65D }, // CYRILLIC CAPITAL LETTER IOTIFIED CLOSED LITTLE YUS { 0xA65E, 0xA65F }, // CYRILLIC CAPITAL LETTER YN { 0xA662, 0xA663 }, // CYRILLIC CAPITAL LETTER SOFT DE { 0xA664, 0xA665 }, // CYRILLIC CAPITAL LETTER SOFT EL { 0xA666, 0xA667 }, // CYRILLIC CAPITAL LETTER SOFT EM { 0xA668, 0xA669 }, // CYRILLIC CAPITAL LETTER MONOCULAR O { 0xA66A, 0xA66B }, // CYRILLIC CAPITAL LETTER BINOCULAR O { 0xA66C, 0xA66D }, // CYRILLIC CAPITAL LETTER DOUBLE MONOCULAR O { 0xA680, 0xA681 }, // CYRILLIC CAPITAL LETTER DWE { 0xA682, 0xA683 }, // CYRILLIC CAPITAL LETTER DZWE { 0xA684, 0xA685 }, // CYRILLIC CAPITAL LETTER ZHWE { 0xA686, 0xA687 }, // CYRILLIC CAPITAL LETTER CCHE { 0xA688, 0xA689 }, // CYRILLIC CAPITAL LETTER DZZE { 0xA68A, 0xA68B }, // CYRILLIC CAPITAL LETTER TE WITH MIDDLE HOOK { 0xA68C, 0xA68D }, // CYRILLIC CAPITAL LETTER TWE { 0xA68E, 0xA68F }, // CYRILLIC CAPITAL LETTER TSWE { 0xA690, 0xA691 }, // CYRILLIC CAPITAL LETTER TSSE { 0xA692, 0xA693 }, // CYRILLIC CAPITAL LETTER TCHE { 0xA694, 0xA695 }, // CYRILLIC CAPITAL LETTER HWE { 0xA696, 0xA697 }, // CYRILLIC CAPITAL LETTER SHWE { 0xA722, 0xA723 }, // LATIN CAPITAL LETTER EGYPTOLOGICAL ALEF { 0xA724, 0xA725 }, // LATIN CAPITAL LETTER EGYPTOLOGICAL AIN { 0xA726, 0xA727 }, // LATIN CAPITAL LETTER HENG { 0xA728, 0xA729 }, // LATIN CAPITAL LETTER TZ { 0xA72A, 0xA72B }, // LATIN CAPITAL LETTER TRESILLO { 0xA72C, 0xA72D }, // LATIN CAPITAL LETTER CUATRILLO { 0xA72E, 0xA72F }, // LATIN CAPITAL LETTER CUATRILLO WITH COMMA { 0xA732, 0xA733 }, // LATIN CAPITAL LETTER AA { 0xA734, 0xA735 }, // LATIN CAPITAL LETTER AO { 0xA736, 0xA737 }, // LATIN CAPITAL LETTER AU { 0xA738, 0xA739 }, // LATIN CAPITAL LETTER AV { 0xA73A, 0xA73B }, // LATIN CAPITAL LETTER AV WITH HORIZONTAL BAR { 0xA73C, 0xA73D }, // LATIN CAPITAL LETTER AY { 0xA73E, 0xA73F }, // LATIN CAPITAL LETTER REVERSED C WITH DOT { 0xA740, 0xA741 }, // LATIN CAPITAL LETTER K WITH STROKE { 0xA742, 0xA743 }, // LATIN CAPITAL LETTER K WITH DIAGONAL STROKE { 0xA744, 0xA745 }, // LATIN CAPITAL LETTER K WITH STROKE AND DIAGONAL STROKE { 0xA746, 0xA747 }, // LATIN CAPITAL LETTER BROKEN L { 0xA748, 0xA749 }, // LATIN CAPITAL LETTER L WITH HIGH STROKE { 0xA74A, 0xA74B }, // LATIN CAPITAL LETTER O WITH LONG STROKE OVERLAY { 0xA74C, 0xA74D }, // LATIN CAPITAL LETTER O WITH LOOP { 0xA74E, 0xA74F }, // LATIN CAPITAL LETTER OO { 0xA750, 0xA751 }, // LATIN CAPITAL LETTER P WITH STROKE THROUGH DESCENDER { 0xA752, 0xA753 }, // LATIN CAPITAL LETTER P WITH FLOURISH { 0xA754, 0xA755 }, // LATIN CAPITAL LETTER P WITH SQUIRREL TAIL { 0xA756, 0xA757 }, // LATIN CAPITAL LETTER Q WITH STROKE THROUGH DESCENDER { 0xA758, 0xA759 }, // LATIN CAPITAL LETTER Q WITH DIAGONAL STROKE { 0xA75A, 0xA75B }, // LATIN CAPITAL LETTER R ROTUNDA { 0xA75C, 0xA75D }, // LATIN CAPITAL LETTER RUM ROTUNDA { 0xA75E, 0xA75F }, // LATIN CAPITAL LETTER V WITH DIAGONAL STROKE { 0xA760, 0xA761 }, // LATIN CAPITAL LETTER VY { 0xA762, 0xA763 }, // LATIN CAPITAL LETTER VISIGOTHIC Z { 0xA764, 0xA765 }, // LATIN CAPITAL LETTER THORN WITH STROKE { 0xA766, 0xA767 }, // LATIN CAPITAL LETTER THORN WITH STROKE THROUGH DESCENDER { 0xA768, 0xA769 }, // LATIN CAPITAL LETTER VEND { 0xA76A, 0xA76B }, // LATIN CAPITAL LETTER ET { 0xA76C, 0xA76D }, // LATIN CAPITAL LETTER IS { 0xA76E, 0xA76F }, // LATIN CAPITAL LETTER CON { 0xA779, 0xA77A }, // LATIN CAPITAL LETTER INSULAR D { 0xA77B, 0xA77C }, // LATIN CAPITAL LETTER INSULAR F { 0xA77D, 0x1D79 }, // LATIN CAPITAL LETTER INSULAR G { 0xA77E, 0xA77F }, // LATIN CAPITAL LETTER TURNED INSULAR G { 0xA780, 0xA781 }, // LATIN CAPITAL LETTER TURNED L { 0xA782, 0xA783 }, // LATIN CAPITAL LETTER INSULAR R { 0xA784, 0xA785 }, // LATIN CAPITAL LETTER INSULAR S { 0xA786, 0xA787 }, // LATIN CAPITAL LETTER INSULAR T { 0xA78B, 0xA78C }, // LATIN CAPITAL LETTER SALTILLO { 0xFF21, 0xFF41 }, // FULLWIDTH LATIN CAPITAL LETTER A { 0xFF22, 0xFF42 }, // FULLWIDTH LATIN CAPITAL LETTER B { 0xFF23, 0xFF43 }, // FULLWIDTH LATIN CAPITAL LETTER C { 0xFF24, 0xFF44 }, // FULLWIDTH LATIN CAPITAL LETTER D { 0xFF25, 0xFF45 }, // FULLWIDTH LATIN CAPITAL LETTER E { 0xFF26, 0xFF46 }, // FULLWIDTH LATIN CAPITAL LETTER F { 0xFF27, 0xFF47 }, // FULLWIDTH LATIN CAPITAL LETTER G { 0xFF28, 0xFF48 }, // FULLWIDTH LATIN CAPITAL LETTER H { 0xFF29, 0xFF49 }, // FULLWIDTH LATIN CAPITAL LETTER I { 0xFF2A, 0xFF4A }, // FULLWIDTH LATIN CAPITAL LETTER J { 0xFF2B, 0xFF4B }, // FULLWIDTH LATIN CAPITAL LETTER K { 0xFF2C, 0xFF4C }, // FULLWIDTH LATIN CAPITAL LETTER L { 0xFF2D, 0xFF4D }, // FULLWIDTH LATIN CAPITAL LETTER M { 0xFF2E, 0xFF4E }, // FULLWIDTH LATIN CAPITAL LETTER N { 0xFF2F, 0xFF4F }, // FULLWIDTH LATIN CAPITAL LETTER O { 0xFF30, 0xFF50 }, // FULLWIDTH LATIN CAPITAL LETTER P { 0xFF31, 0xFF51 }, // FULLWIDTH LATIN CAPITAL LETTER Q { 0xFF32, 0xFF52 }, // FULLWIDTH LATIN CAPITAL LETTER R { 0xFF33, 0xFF53 }, // FULLWIDTH LATIN CAPITAL LETTER S { 0xFF34, 0xFF54 }, // FULLWIDTH LATIN CAPITAL LETTER T { 0xFF35, 0xFF55 }, // FULLWIDTH LATIN CAPITAL LETTER U { 0xFF36, 0xFF56 }, // FULLWIDTH LATIN CAPITAL LETTER V { 0xFF37, 0xFF57 }, // FULLWIDTH LATIN CAPITAL LETTER W { 0xFF38, 0xFF58 }, // FULLWIDTH LATIN CAPITAL LETTER X { 0xFF39, 0xFF59 }, // FULLWIDTH LATIN CAPITAL LETTER Y { 0xFF3A, 0xFF5A } // FULLWIDTH LATIN CAPITAL LETTER Z }; static int compare_pair_capital(const void *a, const void *b) { return (int)(*(unsigned short *)a) - (int)((struct LatinCapitalSmallPair*)b)->capital; } unsigned short latin_tolower(unsigned short c) { struct LatinCapitalSmallPair *p = (struct LatinCapitalSmallPair *)bsearch(&c, SORTED_CHAR_MAP, sizeof(SORTED_CHAR_MAP) / sizeof(SORTED_CHAR_MAP[0]), sizeof(SORTED_CHAR_MAP[0]), compare_pair_capital); return p ? p->small : c; } } // namespace latinime
C++
/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef LATINIME_CHAR_UTILS_H #define LATINIME_CHAR_UTILS_H namespace latinime { unsigned short latin_tolower(unsigned short c); }; // namespace latinime #endif // LATINIME_CHAR_UTILS_H
C++
/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef LATINIME_DICTIONARY_H #define LATINIME_DICTIONARY_H namespace latinime { // 22-bit address = ~4MB dictionary size limit, which on average would be about 200k-300k words #define ADDRESS_MASK 0x3FFFFF // The bit that decides if an address follows in the next 22 bits #define FLAG_ADDRESS_MASK 0x40 // The bit that decides if this is a terminal node for a word. The node could still have children, // if the word has other endings. #define FLAG_TERMINAL_MASK 0x80 #define FLAG_BIGRAM_READ 0x80 #define FLAG_BIGRAM_CHILDEXIST 0x40 #define FLAG_BIGRAM_CONTINUED 0x80 #define FLAG_BIGRAM_FREQ 0x7F class Dictionary { public: Dictionary(void *dict, int typedLetterMultipler, int fullWordMultiplier, int dictSize); int getSuggestions(int *codes, int codesSize, unsigned short *outWords, int *frequencies, int maxWordLength, int maxWords, int maxAlternatives, int skipPos, int *nextLetters, int nextLettersSize); int getBigrams(unsigned short *word, int length, int *codes, int codesSize, unsigned short *outWords, int *frequencies, int maxWordLength, int maxBigrams, int maxAlternatives); bool isValidWord(unsigned short *word, int length); void setAsset(void *asset) { mAsset = asset; } void *getAsset() { return mAsset; } ~Dictionary(); private: void getVersionNumber(); bool checkIfDictVersionIsLatest(); int getAddress(int *pos); int getBigramAddress(int *pos, bool advance); int getFreq(int *pos); int getBigramFreq(int *pos); void searchForTerminalNode(int address, int frequency); bool getFirstBitOfByte(int *pos) { return (mDict[*pos] & 0x80) > 0; } bool getSecondBitOfByte(int *pos) { return (mDict[*pos] & 0x40) > 0; } bool getTerminal(int *pos) { return (mDict[*pos] & FLAG_TERMINAL_MASK) > 0; } int getCount(int *pos) { return mDict[(*pos)++] & 0xFF; } unsigned short getChar(int *pos); int wideStrLen(unsigned short *str); bool sameAsTyped(unsigned short *word, int length); bool checkFirstCharacter(unsigned short *word); bool addWord(unsigned short *word, int length, int frequency); bool addWordBigram(unsigned short *word, int length, int frequency); unsigned short toLowerCase(unsigned short c); void getWordsRec(int pos, int depth, int maxDepth, bool completion, int frequency, int inputIndex, int diffs); int isValidWordRec(int pos, unsigned short *word, int offset, int length); void registerNextLetter(unsigned short c); unsigned char *mDict; void *mAsset; int *mFrequencies; int *mBigramFreq; int mMaxWords; int mMaxBigrams; int mMaxWordLength; unsigned short *mOutputChars; unsigned short *mBigramChars; int *mInputCodes; int mInputLength; int mMaxAlternatives; unsigned short mWord[128]; int mSkipPos; int mMaxEditDistance; int mFullWordMultiplier; int mTypedLetterMultiplier; int mDictSize; int *mNextLettersFrequencies; int mNextLettersSize; int mVersion; int mBigram; }; // ---------------------------------------------------------------------------- }; // namespace latinime #endif // LATINIME_DICTIONARY_H
C++
/* ** ** Copyright 2009, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #include <stdio.h> #include <fcntl.h> #include <sys/mman.h> #include <string.h> //#define LOG_TAG "dictionary.cpp" //#include <cutils/log.h> #define LOGI #include "dictionary.h" #include "basechars.h" #include "char_utils.h" #define DEBUG_DICT 0 #define DICTIONARY_VERSION_MIN 200 #define DICTIONARY_HEADER_SIZE 2 #define NOT_VALID_WORD -99 namespace latinime { Dictionary::Dictionary(void *dict, int typedLetterMultiplier, int fullWordMultiplier, int size) { mDict = (unsigned char*) dict; mTypedLetterMultiplier = typedLetterMultiplier; mFullWordMultiplier = fullWordMultiplier; mDictSize = size; getVersionNumber(); } Dictionary::~Dictionary() { } int Dictionary::getSuggestions(int *codes, int codesSize, unsigned short *outWords, int *frequencies, int maxWordLength, int maxWords, int maxAlternatives, int skipPos, int *nextLetters, int nextLettersSize) { int suggWords; mFrequencies = frequencies; mOutputChars = outWords; mInputCodes = codes; mInputLength = codesSize; mMaxAlternatives = maxAlternatives; mMaxWordLength = maxWordLength; mMaxWords = maxWords; mSkipPos = skipPos; mMaxEditDistance = mInputLength < 5 ? 2 : mInputLength / 2; mNextLettersFrequencies = nextLetters; mNextLettersSize = nextLettersSize; if (checkIfDictVersionIsLatest()) { getWordsRec(DICTIONARY_HEADER_SIZE, 0, mInputLength * 3, false, 1, 0, 0); } else { getWordsRec(0, 0, mInputLength * 3, false, 1, 0, 0); } // Get the word count suggWords = 0; while (suggWords < mMaxWords && mFrequencies[suggWords] > 0) suggWords++; if (DEBUG_DICT) LOGI("Returning %d words", suggWords); if (DEBUG_DICT) { LOGI("Next letters: "); for (int k = 0; k < nextLettersSize; k++) { if (mNextLettersFrequencies[k] > 0) { LOGI("%c = %d,", k, mNextLettersFrequencies[k]); } } LOGI("\n"); } return suggWords; } void Dictionary::registerNextLetter(unsigned short c) { if (c < mNextLettersSize) { mNextLettersFrequencies[c]++; } } void Dictionary::getVersionNumber() { mVersion = (mDict[0] & 0xFF); mBigram = (mDict[1] & 0xFF); LOGI("IN NATIVE SUGGEST Version: %d Bigram : %d \n", mVersion, mBigram); } // Checks whether it has the latest dictionary or the old dictionary bool Dictionary::checkIfDictVersionIsLatest() { return (mVersion >= DICTIONARY_VERSION_MIN) && (mBigram == 1 || mBigram == 0); } unsigned short Dictionary::getChar(int *pos) { if (*pos < 0 || *pos >= mDictSize) return 0; unsigned short ch = (unsigned short) (mDict[(*pos)++] & 0xFF); // If the code is 255, then actual 16 bit code follows (in big endian) if (ch == 0xFF) { ch = ((mDict[*pos] & 0xFF) << 8) | (mDict[*pos + 1] & 0xFF); (*pos) += 2; } return ch; } int Dictionary::getAddress(int *pos) { if (*pos < 0 || *pos >= mDictSize) return 0; int address = 0; if ((mDict[*pos] & FLAG_ADDRESS_MASK) == 0) { *pos += 1; } else { address += (mDict[*pos] & (ADDRESS_MASK >> 16)) << 16; address += (mDict[*pos + 1] & 0xFF) << 8; address += (mDict[*pos + 2] & 0xFF); *pos += 3; } if (address < 0 || address >= mDictSize) return 0; return address; } int Dictionary::getFreq(int *pos) { if (*pos < 0 || *pos >= mDictSize) return 0; int freq = mDict[(*pos)++] & 0xFF; if (checkIfDictVersionIsLatest()) { // skipping bigram int bigramExist = (mDict[*pos] & FLAG_BIGRAM_READ); if (bigramExist > 0) { int nextBigramExist = 1; while (nextBigramExist > 0) { (*pos) += 3; nextBigramExist = (mDict[(*pos)++] & FLAG_BIGRAM_CONTINUED); } } else { (*pos)++; } } return freq; } int Dictionary::wideStrLen(unsigned short *str) { if (!str) return 0; unsigned short *end = str; while (*end) end++; return end - str; } bool Dictionary::addWord(unsigned short *word, int length, int frequency) { word[length] = 0; if (DEBUG_DICT) { char s[length + 1]; for (int i = 0; i <= length; i++) s[i] = word[i]; LOGI("Found word = %s, freq = %d : \n", s, frequency); } // Find the right insertion point int insertAt = 0; while (insertAt < mMaxWords) { if (frequency > mFrequencies[insertAt] || (mFrequencies[insertAt] == frequency && length < wideStrLen(mOutputChars + insertAt * mMaxWordLength))) { break; } insertAt++; } if (insertAt < mMaxWords) { memmove((char*) mFrequencies + (insertAt + 1) * sizeof(mFrequencies[0]), (char*) mFrequencies + insertAt * sizeof(mFrequencies[0]), (mMaxWords - insertAt - 1) * sizeof(mFrequencies[0])); mFrequencies[insertAt] = frequency; memmove((char*) mOutputChars + (insertAt + 1) * mMaxWordLength * sizeof(short), (char*) mOutputChars + (insertAt ) * mMaxWordLength * sizeof(short), (mMaxWords - insertAt - 1) * sizeof(short) * mMaxWordLength); unsigned short *dest = mOutputChars + (insertAt ) * mMaxWordLength; while (length--) { *dest++ = *word++; } *dest = 0; // NULL terminate if (DEBUG_DICT) LOGI("Added word at %d\n", insertAt); return true; } return false; } bool Dictionary::addWordBigram(unsigned short *word, int length, int frequency) { word[length] = 0; if (DEBUG_DICT) { char s[length + 1]; for (int i = 0; i <= length; i++) s[i] = word[i]; LOGI("Bigram: Found word = %s, freq = %d : \n", s, frequency); } // Find the right insertion point int insertAt = 0; while (insertAt < mMaxBigrams) { if (frequency > mBigramFreq[insertAt] || (mBigramFreq[insertAt] == frequency && length < wideStrLen(mBigramChars + insertAt * mMaxWordLength))) { break; } insertAt++; } LOGI("Bigram: InsertAt -> %d maxBigrams: %d\n", insertAt, mMaxBigrams); if (insertAt < mMaxBigrams) { memmove((char*) mBigramFreq + (insertAt + 1) * sizeof(mBigramFreq[0]), (char*) mBigramFreq + insertAt * sizeof(mBigramFreq[0]), (mMaxBigrams - insertAt - 1) * sizeof(mBigramFreq[0])); mBigramFreq[insertAt] = frequency; memmove((char*) mBigramChars + (insertAt + 1) * mMaxWordLength * sizeof(short), (char*) mBigramChars + (insertAt ) * mMaxWordLength * sizeof(short), (mMaxBigrams - insertAt - 1) * sizeof(short) * mMaxWordLength); unsigned short *dest = mBigramChars + (insertAt ) * mMaxWordLength; while (length--) { *dest++ = *word++; } *dest = 0; // NULL terminate if (DEBUG_DICT) LOGI("Bigram: Added word at %d\n", insertAt); return true; } return false; } unsigned short Dictionary::toLowerCase(unsigned short c) { if (c < sizeof(BASE_CHARS) / sizeof(BASE_CHARS[0])) { c = BASE_CHARS[c]; } if (c >='A' && c <= 'Z') { c |= 32; } else if (c > 127) { c = latin_tolower(c); } return c; } bool Dictionary::sameAsTyped(unsigned short *word, int length) { if (length != mInputLength) { return false; } int *inputCodes = mInputCodes; while (length--) { if ((unsigned int) *inputCodes != (unsigned int) *word) { return false; } inputCodes += mMaxAlternatives; word++; } return true; } static char QUOTE = '\''; void Dictionary::getWordsRec(int pos, int depth, int maxDepth, bool completion, int snr, int inputIndex, int diffs) { // Optimization: Prune out words that are too long compared to how much was typed. if (depth > maxDepth) { return; } if (diffs > mMaxEditDistance) { return; } int count = getCount(&pos); int *currentChars = NULL; if (mInputLength <= inputIndex) { completion = true; } else { currentChars = mInputCodes + (inputIndex * mMaxAlternatives); } for (int i = 0; i < count; i++) { // -- at char unsigned short c = getChar(&pos); // -- at flag/add unsigned short lowerC = toLowerCase(c); bool terminal = getTerminal(&pos); int childrenAddress = getAddress(&pos); // -- after address or flag int freq = 1; if (terminal) freq = getFreq(&pos); // -- after add or freq // If we are only doing completions, no need to look at the typed characters. if (completion) { mWord[depth] = c; if (terminal) { addWord(mWord, depth + 1, freq * snr); if (depth >= mInputLength && mSkipPos < 0) { registerNextLetter(mWord[mInputLength]); } } if (childrenAddress != 0) { getWordsRec(childrenAddress, depth + 1, maxDepth, completion, snr, inputIndex, diffs); } } else if ((c == QUOTE && currentChars[0] != QUOTE) || mSkipPos == depth) { // Skip the ' or other letter and continue deeper mWord[depth] = c; if (childrenAddress != 0) { getWordsRec(childrenAddress, depth + 1, maxDepth, false, snr, inputIndex, diffs); } } else { int j = 0; while (currentChars[j] > 0) { if (currentChars[j] == lowerC || currentChars[j] == c) { int addedWeight = j == 0 ? mTypedLetterMultiplier : 1; mWord[depth] = c; if (mInputLength == inputIndex + 1) { if (terminal) { if (//INCLUDE_TYPED_WORD_IF_VALID || !sameAsTyped(mWord, depth + 1)) { int finalFreq = freq * snr * addedWeight; if (mSkipPos < 0) finalFreq *= mFullWordMultiplier; addWord(mWord, depth + 1, finalFreq); } } if (childrenAddress != 0) { getWordsRec(childrenAddress, depth + 1, maxDepth, true, snr * addedWeight, inputIndex + 1, diffs + (j > 0)); } } else if (childrenAddress != 0) { getWordsRec(childrenAddress, depth + 1, maxDepth, false, snr * addedWeight, inputIndex + 1, diffs + (j > 0)); } } j++; if (mSkipPos >= 0) break; } } } } int Dictionary::getBigramAddress(int *pos, bool advance) { if (*pos < 0 || *pos >= mDictSize) return 0; int address = 0; address += (mDict[*pos] & 0x3F) << 16; address += (mDict[*pos + 1] & 0xFF) << 8; address += (mDict[*pos + 2] & 0xFF); if (advance) { *pos += 3; } if (address < 0 || address >= mDictSize) return 0; return address; } int Dictionary::getBigramFreq(int *pos) { if (*pos < 0 || *pos >= mDictSize) return 0; int freq = mDict[(*pos)++] & FLAG_BIGRAM_FREQ; return freq; } int Dictionary::getBigrams(unsigned short *prevWord, int prevWordLength, int *codes, int codesSize, unsigned short *bigramChars, int *bigramFreq, int maxWordLength, int maxBigrams, int maxAlternatives) { mBigramFreq = bigramFreq; mBigramChars = bigramChars; mInputCodes = codes; mInputLength = codesSize; mMaxWordLength = maxWordLength; mMaxBigrams = maxBigrams; mMaxAlternatives = maxAlternatives; if (mBigram == 1 && checkIfDictVersionIsLatest()) { int pos = isValidWordRec(DICTIONARY_HEADER_SIZE, prevWord, 0, prevWordLength); LOGI("Pos -> %d\n", pos); if (pos < 0) { return 0; } int bigramCount = 0; int bigramExist = (mDict[pos] & FLAG_BIGRAM_READ); if (bigramExist > 0) { int nextBigramExist = 1; while (nextBigramExist > 0 && bigramCount < maxBigrams) { int bigramAddress = getBigramAddress(&pos, true); int frequency = (FLAG_BIGRAM_FREQ & mDict[pos]); // search for all bigrams and store them searchForTerminalNode(bigramAddress, frequency); nextBigramExist = (mDict[pos++] & FLAG_BIGRAM_CONTINUED); bigramCount++; } } return bigramCount; } return 0; } void Dictionary::searchForTerminalNode(int addressLookingFor, int frequency) { // track word with such address and store it in an array unsigned short word[mMaxWordLength]; int pos; int followDownBranchAddress = DICTIONARY_HEADER_SIZE; bool found = false; char followingChar = ' '; int depth = -1; while(!found) { bool followDownAddressSearchStop = false; bool firstAddress = true; bool haveToSearchAll = true; if (depth >= 0) { word[depth] = (unsigned short) followingChar; } pos = followDownBranchAddress; // pos start at count int count = mDict[pos] & 0xFF; LOGI("count - %d\n",count); pos++; for (int i = 0; i < count; i++) { // pos at data pos++; // pos now at flag if (!getFirstBitOfByte(&pos)) { // non-terminal if (!followDownAddressSearchStop) { int addr = getBigramAddress(&pos, false); if (addr > addressLookingFor) { followDownAddressSearchStop = true; if (firstAddress) { firstAddress = false; haveToSearchAll = true; } else if (!haveToSearchAll) { break; } } else { followDownBranchAddress = addr; followingChar = (char)(0xFF & mDict[pos-1]); if (firstAddress) { firstAddress = false; haveToSearchAll = false; } } } pos += 3; } else if (getFirstBitOfByte(&pos)) { // terminal if (addressLookingFor == (pos-1)) { // found !! depth++; word[depth] = (0xFF & mDict[pos-1]); found = true; break; } if (getSecondBitOfByte(&pos)) { // address + freq (4 byte) if (!followDownAddressSearchStop) { int addr = getBigramAddress(&pos, false); if (addr > addressLookingFor) { followDownAddressSearchStop = true; if (firstAddress) { firstAddress = false; haveToSearchAll = true; } else if (!haveToSearchAll) { break; } } else { followDownBranchAddress = addr; followingChar = (char)(0xFF & mDict[pos-1]); if (firstAddress) { firstAddress = false; haveToSearchAll = true; } } } pos += 4; } else { // freq only (2 byte) pos += 2; } // skipping bigram int bigramExist = (mDict[pos] & FLAG_BIGRAM_READ); if (bigramExist > 0) { int nextBigramExist = 1; while (nextBigramExist > 0) { pos += 3; nextBigramExist = (mDict[pos++] & FLAG_BIGRAM_CONTINUED); } } else { pos++; } } } depth++; if (followDownBranchAddress == 0) { LOGI("ERROR!!! Cannot find bigram!!"); break; } } if (checkFirstCharacter(word)) { addWordBigram(word, depth, frequency); } } bool Dictionary::checkFirstCharacter(unsigned short *word) { // Checks whether this word starts with same character or neighboring characters of // what user typed. int *inputCodes = mInputCodes; int maxAlt = mMaxAlternatives; while (maxAlt > 0) { if ((unsigned int) *inputCodes == (unsigned int) *word) { return true; } inputCodes++; maxAlt--; } return false; } bool Dictionary::isValidWord(unsigned short *word, int length) { if (checkIfDictVersionIsLatest()) { return (isValidWordRec(DICTIONARY_HEADER_SIZE, word, 0, length) != NOT_VALID_WORD); } else { return (isValidWordRec(0, word, 0, length) != NOT_VALID_WORD); } } int Dictionary::isValidWordRec(int pos, unsigned short *word, int offset, int length) { // returns address of bigram data of that word // return -99 if not found int count = getCount(&pos); unsigned short currentChar = (unsigned short) word[offset]; for (int j = 0; j < count; j++) { unsigned short c = getChar(&pos); int terminal = getTerminal(&pos); int childPos = getAddress(&pos); if (c == currentChar) { if (offset == length - 1) { if (terminal) { return (pos+1); } } else { if (childPos != 0) { int t = isValidWordRec(childPos, word, offset + 1, length); if (t > 0) { return t; } } } } if (terminal) { getFreq(&pos); } // There could be two instances of each alphabet - upper and lower case. So continue // looking ... } return NOT_VALID_WORD; } } // namespace latinime
C++
/* ** ** Copyright 2009, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #include <stdio.h> #include <assert.h> #include <unistd.h> #include <fcntl.h> #include <jni.h> #include "dictionary.h" // ---------------------------------------------------------------------------- using namespace latinime; // // helper function to throw an exception // static void throwException(JNIEnv *env, const char* ex, const char* fmt, int data) { if (jclass cls = env->FindClass(ex)) { char msg[1000]; sprintf(msg, fmt, data); env->ThrowNew(cls, msg); env->DeleteLocalRef(cls); } } static jint latinime_BinaryDictionary_open (JNIEnv *env, jobject object, jobject dictDirectBuffer, jint typedLetterMultiplier, jint fullWordMultiplier, jint size) { void *dict = env->GetDirectBufferAddress(dictDirectBuffer); if (dict == NULL) { fprintf(stderr, "DICT: Dictionary buffer is null\n"); return 0; } Dictionary *dictionary = new Dictionary(dict, typedLetterMultiplier, fullWordMultiplier, size); return (jint) dictionary; } static int latinime_BinaryDictionary_getSuggestions( JNIEnv *env, jobject object, jint dict, jintArray inputArray, jint arraySize, jcharArray outputArray, jintArray frequencyArray, jint maxWordLength, jint maxWords, jint maxAlternatives, jint skipPos, jintArray nextLettersArray, jint nextLettersSize) { Dictionary *dictionary = (Dictionary*) dict; if (dictionary == NULL) return 0; int *frequencies = env->GetIntArrayElements(frequencyArray, NULL); int *inputCodes = env->GetIntArrayElements(inputArray, NULL); jchar *outputChars = env->GetCharArrayElements(outputArray, NULL); int *nextLetters = nextLettersArray != NULL ? env->GetIntArrayElements(nextLettersArray, NULL) : NULL; int count = dictionary->getSuggestions(inputCodes, arraySize, (unsigned short*) outputChars, frequencies, maxWordLength, maxWords, maxAlternatives, skipPos, nextLetters, nextLettersSize); env->ReleaseIntArrayElements(frequencyArray, frequencies, 0); env->ReleaseIntArrayElements(inputArray, inputCodes, JNI_ABORT); env->ReleaseCharArrayElements(outputArray, outputChars, 0); if (nextLetters) { env->ReleaseIntArrayElements(nextLettersArray, nextLetters, 0); } return count; } static int latinime_BinaryDictionary_getBigrams (JNIEnv *env, jobject object, jint dict, jcharArray prevWordArray, jint prevWordLength, jintArray inputArray, jint inputArraySize, jcharArray outputArray, jintArray frequencyArray, jint maxWordLength, jint maxBigrams, jint maxAlternatives) { Dictionary *dictionary = (Dictionary*) dict; if (dictionary == NULL) return 0; jchar *prevWord = env->GetCharArrayElements(prevWordArray, NULL); int *inputCodes = env->GetIntArrayElements(inputArray, NULL); jchar *outputChars = env->GetCharArrayElements(outputArray, NULL); int *frequencies = env->GetIntArrayElements(frequencyArray, NULL); int count = dictionary->getBigrams((unsigned short*) prevWord, prevWordLength, inputCodes, inputArraySize, (unsigned short*) outputChars, frequencies, maxWordLength, maxBigrams, maxAlternatives); env->ReleaseCharArrayElements(prevWordArray, prevWord, JNI_ABORT); env->ReleaseIntArrayElements(inputArray, inputCodes, JNI_ABORT); env->ReleaseCharArrayElements(outputArray, outputChars, 0); env->ReleaseIntArrayElements(frequencyArray, frequencies, 0); return count; } static jboolean latinime_BinaryDictionary_isValidWord (JNIEnv *env, jobject object, jint dict, jcharArray wordArray, jint wordLength) { Dictionary *dictionary = (Dictionary*) dict; if (dictionary == NULL) return (jboolean) false; jchar *word = env->GetCharArrayElements(wordArray, NULL); jboolean result = dictionary->isValidWord((unsigned short*) word, wordLength); env->ReleaseCharArrayElements(wordArray, word, JNI_ABORT); return result; } static void latinime_BinaryDictionary_close (JNIEnv *env, jobject object, jint dict) { Dictionary *dictionary = (Dictionary*) dict; delete (Dictionary*) dict; } // ---------------------------------------------------------------------------- static JNINativeMethod gMethods[] = { {"openNative", "(Ljava/nio/ByteBuffer;III)I", (void*)latinime_BinaryDictionary_open}, {"closeNative", "(I)V", (void*)latinime_BinaryDictionary_close}, {"getSuggestionsNative", "(I[II[C[IIIII[II)I", (void*)latinime_BinaryDictionary_getSuggestions}, {"isValidWordNative", "(I[CI)Z", (void*)latinime_BinaryDictionary_isValidWord}, {"getBigramsNative", "(I[CI[II[C[IIII)I", (void*)latinime_BinaryDictionary_getBigrams} }; static int registerNativeMethods(JNIEnv* env, const char* className, JNINativeMethod* gMethods, int numMethods) { jclass clazz; clazz = env->FindClass(className); if (clazz == NULL) { fprintf(stderr, "Native registration unable to find class '%s'\n", className); return JNI_FALSE; } if (env->RegisterNatives(clazz, gMethods, numMethods) < 0) { fprintf(stderr, "RegisterNatives failed for '%s'\n", className); return JNI_FALSE; } return JNI_TRUE; } static int registerNatives(JNIEnv *env) { const char* const kClassPathName = "org/pocketworkstation/pckeyboard/BinaryDictionary"; return registerNativeMethods(env, kClassPathName, gMethods, sizeof(gMethods) / sizeof(gMethods[0])); } /* * Returns the JNI version on success, -1 on failure. */ jint JNI_OnLoad(JavaVM* vm, void* reserved) { JNIEnv* env = NULL; jint result = -1; if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) { fprintf(stderr, "ERROR: GetEnv failed\n"); goto bail; } assert(env != NULL); if (!registerNatives(env)) { fprintf(stderr, "ERROR: BinaryDictionary native registration failed\n"); goto bail; } /* success -- return valid version number */ result = JNI_VERSION_1_4; bail: return result; }
C++
#include "OK.h" #include <windows.h> #include <stdio.h> #include <fcntl.h> #include <io.h> #include <iostream> #include <fstream> #include <list> #include <ctime> using namespace std; int main(int argc, char *argv[]) { _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE ); _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDOUT ); try { char* input=(argc>1?argv[1]:"data.dat"); char* output=(argc>2?argv[2]:"result.out"); int minSup = (argc>3?atoi(argv[3]):0); bool asChars = (argc>4 && argv[4][0]=='c'); cout<<"asChars: "<<asChars<<endl; DataStructure* data = loadDataSet(input); data->printSummary(std::cout); cout<<endl; std::ofstream fc(output); OK(data,&fc,minSup,NULL,asChars); fc.close(); delete data; } catch (std::exception e) { e.what(); } _CrtDumpMemoryLeaks(); system("PAUSE"); return 0; } void OK(DataStructure *ds, std::ofstream *fc, unsigned int minSup, bool (*sort_f)(const OAPair &e1, const OAPair &e2), bool printAsChars){ long startTime = clock(); if(ds->getAllObjects()->data.size()<2){ cout<<"One object only"<<endl; return; } ObjectSet* commonObjects=NULL; FormalContext* initialContext = new FormalContext(); vector<const OAPair * const> *frequentClosedItemsets; for (std::set<Attribute>::const_iterator i = ds->getAllAtributes()->data.begin(); i != ds->getAllAtributes()->data.end(); i++){ //if the objects exist for the atrribute in a number no less than minSup ObjectSet* support = ds->getObjects(*i); if(support->data.size() >= minSup){ //////initializing context as side-effect/////////// OAPair tmpPair = std::make_pair( support , new AttributeSet()); tmpPair.second->data.insert(Attribute(*i)); initialContext->data.push_back(tmpPair); //////////////////////////////////////////////////// if(commonObjects==NULL){ //first one commonObjects=new ObjectSet(*(ds->getObjects(*i))); }else{ //remove non-matching ones for(std::set<Object>::iterator stored = commonObjects->data.begin(); stored != commonObjects->data.end();){ if(ds->getObjects(*i)->data.find(*stored)==ds->getObjects(*i)->data.end()){ std::set<Object>::iterator toRemove = stored++; commonObjects->data.erase(toRemove); //perhaps all 've been removed if(commonObjects->data.size()==0){ break; } continue; } stored++; } } }else{ if(commonObjects!=NULL){ commonObjects->data.erase(commonObjects->data.begin(), commonObjects->data.end()); } } } if(commonObjects==NULL){ cout<<endl<<"Not a single item has been found with sufficient support. Aborting"<<endl; cleanUpFormalContext(initialContext, false, true); return; }else{ frequentClosedItemsets = new vector<const OAPair* const>(); if(commonObjects->data.size()>0){ OAPair *found = new OAPair(); found->first=commonObjects; found->second=ds->getAllAtributes(); insertFrequentItemset(found, frequentClosedItemsets); minSup=commonObjects->data.size()+1; }else{ if(minSup==0){ ++minSup; } frequentClosedItemsets->push_back(new pair<ObjectSet*, AttributeSet*>(new ObjectSet(), new AttributeSet(*ds->getAllAtributes()))); } delete commonObjects; } if(ds->getAllObjects()->data.size()>=minSup){ ObjectSet *allObjectSet = new ObjectSet(*(ds->getAllObjects())); AttributeSet *initialAttributeSet = new AttributeSet(); AttributeSet *attrSet4oa = new AttributeSet(); OAPair* oa = new pair<ObjectSet*, AttributeSet*>(allObjectSet, attrSet4oa); FormalContext *localContext = OKLocalContext(*oa, initialContext); Closure(*initialAttributeSet, *oa, *localContext); insertFrequentItemset(oa, frequentClosedItemsets); OKExtend(initialAttributeSet, localContext, sort_f, minSup, frequentClosedItemsets); //printFrequentClosedItemsets(frequentClosedItemsets, printAsChars); printFrequentClosedItemsets(frequentClosedItemsets, printAsChars, *fc); cleanUpFormalContext(localContext, true, true); delete initialAttributeSet; cleanUpOAPair(oa); cleanUpFormalContext(initialContext, false, true); } cleanUpFrequentClosedItemsets(frequentClosedItemsets); float exTime=(clock()-startTime)/(float)1000; *fc<<"OK completion time: "<<exTime<<" seconds"<<endl; cout<<"OK completion time: "<<exTime<<" seconds"<<endl; } void OKExtend(AttributeSet * prefix, FormalContext *P, bool (*sort_f)(const OAPair &e1, const OAPair &e2), unsigned int minSup, vector<const OAPair* const> *frequentClosedItemsets){ Order((*P),sort_f); if(!checkOrder(P)){ cout<<"Context in wrong order"<<endl; system("PAUSE"); } for(vector<OAPair>::iterator iter = P->data.begin()+P->processedNo; iter!=P->data.end() && iter!=--(P->data.end()); ++iter){ iter->second->processed=true; if(isClosable(*iter, *P)){ FormalContext *poa = OKLocalContextMinSup(*iter, P, minSup); Closure(*prefix, *iter, *poa); insertFrequentItemset(&OAPair(*iter), frequentClosedItemsets); if(poa->data.size()>poa->processedNo){ OKExtend(iter->second, poa, sort_f, minSup, frequentClosedItemsets); } cleanUpFormalContext(poa, true, true); } } if(P->data.size()>0 && isClosable(*(P->data.rbegin()),*P)){ OAPair *oapair = new pair<ObjectSet*, AttributeSet*>(new ObjectSet(),new AttributeSet()); oapair->first->data.insert(P->data.rbegin()->first->data.begin(), P->data.rbegin()->first->data.end()); oapair->second->data.insert(P->data.rbegin()->second->data.begin(), P->data.rbegin()->second->data.end()); oapair->second->data.insert(prefix->data.begin(), prefix->data.end()); insertFrequentItemset(oapair, frequentClosedItemsets); cleanUpOAPair(oapair); } } bool isClosable(const OAPair & const oa_pair, FormalContext &local_fc){ if(!checkOrder(&local_fc)){ cout<<"Context elements order violated"<<endl; system("PAUSE"); } list<const OAPair* const> deltaClosureProcessed; int offset = local_fc.data.size()-local_fc.processedNo; for(vector<OAPair>::const_reverse_iterator iter = local_fc.data.rbegin()+offset; iter != local_fc.data.rend(); ++iter){ printOAPair(&*iter); if(iter->first->data.size()>oa_pair.first->data.size()){ deltaClosureProcessed.push_back(&*iter); } } if(deltaClosureProcessed.size()==0){ return true; } for(set<Object>::const_iterator itero = oa_pair.first->data.begin(); itero!=oa_pair.first->data.end(); ++itero){ for(list<const OAPair* const>::iterator iteryb = deltaClosureProcessed.begin(); iteryb!=deltaClosureProcessed.end(); ){ bool deltaClosureUnchanged=true; for(set<Object>::const_iterator itery = (*iteryb)->first->data.begin(); itery!=(*iteryb)->first->data.end(); ++itery){ if(*itery<*itero){ continue; } if((*iteryb)->first->data.find(*itero)==(*iteryb)->first->data.end()){ deltaClosureProcessed.erase(iteryb++); deltaClosureUnchanged=false; break; }else{ //nothing = skip o in Y } } if(deltaClosureUnchanged){ ++iteryb; } } } return(deltaClosureProcessed.size()==0); } void printFrequentClosedItemsets(const vector<const OAPair* const> * const fci, bool asChars, ostream &sink){ sink<<endl; sink<<"FREQUENT CLOSED ITEMSETS:"<<endl; for(vector<const OAPair* const>::const_iterator iter = fci->begin(); iter!=fci->end(); ++iter){ printOAPair(*iter, asChars, sink); } } void printOAPair(const OAPair * const oa, bool asChars, ostream &sink){ ObjectSet *O = oa->first; AttributeSet *A = oa->second; sink<< "O:{ "; for (std::set<Object>::const_iterator i = O->data.begin(); i != O->data.end(); i++){ sink<< *i << " "; } sink << "}, A:{ "; for (std::set<Attribute>::const_iterator i = A->data.begin(); i != A->data.end(); i++){ if(asChars){ sink<< (char)('a'-1+*i) << " "; }else{ sink<<(*i) << " "; } } sink<< "}" <<endl; } void printFormalContext(const FormalContext * const fc, ostream &sink){ sink<<"**FORMAL CONTEXT DUMP ***proc: " <<fc->processedNo<<" ******" << endl; for(vector<OAPair>::const_iterator iter = fc->data.begin(); iter!=fc->data.end(); ++iter){ printOAPair(&*iter); } sink<<""<<endl; } void cleanUpFormalContext(FormalContext* fc, bool removeObjects, bool removeAttributes){ for(vector<OAPair>::iterator iter = fc->data.begin(); iter!=fc->data.end(); ++iter){ if(removeObjects){ delete iter->first; }if(removeAttributes){ delete iter->second; } } delete fc; } void cleanUpOAPair(OAPair* oa){ delete oa->first; delete oa->second; delete oa; } void insertFrequentItemset(const OAPair* const oa, vector<const OAPair* const> * const fci){ for(vector<const OAPair* const>::const_iterator iter = fci->begin(); iter!=fci->end(); ++iter){ if(*((*iter)->second)==*(oa->second)){ return; } } fci->push_back(new pair<ObjectSet*, AttributeSet*>(new ObjectSet(*(oa->first)), new AttributeSet(*(oa->second)))); } void cleanUpFrequentClosedItemsets(vector<const OAPair* const>* fci){ for(vector<const OAPair* const>::iterator iter = fci->begin(); iter!=fci->end(); ){ vector<const OAPair* const>::iterator eraser = iter++; OAPair* tmp = const_cast<OAPair*>(*eraser); cleanUpOAPair(tmp); } delete fci; } bool checkOrder(const FormalContext * const fc){ //bool onFresh=false; bool onProcessed=true; for(vector<OAPair>::const_iterator iter = fc->data.begin(); iter!=fc->data.end(); ++iter ){ if(iter->second->processed){ if(onProcessed){ continue; }else{ return false; } }else{ if(onProcessed){ onProcessed=false; } } } return true; }
C++
/** * Implementation of Closure function * * author: Marcin Wachulski * */ #include "OK.h" #include <set> #include <algorithm> #include <iterator> void Closure(const AttributeSet &prefix, OAPair &oa_pair, FormalContext &local_fc) { oa_pair.second->data.insert(prefix.data.begin(), prefix.data.end()); if (local_fc.data.size() > local_fc.processedNo) { OAPair &fc_last_p = local_fc.data.back(); if (fc_last_p.first->data.size() == oa_pair.first->data.size()) { oa_pair.second->data.insert(fc_last_p.second->data.begin(), fc_last_p.second->data.end()); local_fc.data.pop_back(); delete fc_last_p.first; delete fc_last_p.second; } } }
C++
/** * Functions responsible for determining the local context for the OK algorithm. * * author: Maciej Rubikowski */ #include "ok.h" typedef std::pair<ObjectSet, FormalContext*> ObjectContextPair; typedef std::vector<ObjectContextPair> LocalContextGrouping; FormalContext* OKLocalContext(const OAPair &oa, const FormalContext * const P) { FormalContext *FC = new FormalContext; LocalContextGrouping G; ObjectSet *O = oa.first; AttributeSet *A = oa.second; ObjectContextPair ocp = std::pair<ObjectSet, FormalContext*>(ObjectSet(), new FormalContext(*P)); G.push_back(ocp); for (std::set<Object>::const_iterator o = O->data.begin(); o != O->data.end(); ++o) { LocalContextGrouping set_S; ObjectSet *Z = NULL; FormalContext *E = NULL; for (std::vector<ObjectContextPair>::iterator j = G.begin(); j != G.end();) { Z = &j->first; E = j->second; ObjectSet os = *Z; os.data.insert(*o); ObjectContextPair S = std::pair<ObjectSet, FormalContext*>(os, new FormalContext); for (std::vector<OAPair>::iterator YB = E->data.begin(); YB != E->data.end(); ) { // remove all y from Y such that y precedes o // and BTW check if o belongs to Y ObjectSet *Y = YB->first; AttributeSet *B = YB->second; bool oInY = false; for (std::set<Object>::iterator y = Y->data.begin(); y != Y->data.end(); ) { if (*y < *o) y = Y->data.erase(y); else if (*y == *o) { oInY = true; break; } else { ++y; } } // if object o belongs to Y... if (oInY) { Y->data.erase(*o); // remove o from Y S.second->data.push_back(*YB); YB = E->data.erase(YB); // remove (Y, B) from E } else ++YB; } // if the second element of S is different from null_set then if (!S.second->data.empty()) { set_S.push_back(S); if (E->data.empty()) { j = G.erase(j); delete E; } else { ++j; } } else { delete S.second; ++j; } } G.insert(G.end(), set_S.begin(), set_S.end()); } // prepare P<O, A> for (LocalContextGrouping::iterator it = G.begin(); it != G.end();) { if (it->second->data.empty()) { ++it; continue; } ObjectSet *Z = new ObjectSet(it->first); AttributeSet *D = new AttributeSet; for (std::vector<OAPair>::iterator it2 = it->second->data.begin(); it2 != it->second->data.end(); ++it2) D->data.insert(it2->second->data.begin(), it2->second->data.end()); D->processed = false; FC->data.push_back(OAPair(Z, D)); ++it; } // clean up for(LocalContextGrouping::iterator it = G.begin(); it != G.end(); ++it) { for(std::vector<OAPair>::iterator it2 = it->second->data.begin(); it2 != it->second->data.end(); ++it2) { delete it2->first; delete it2->second; } delete it->second; } return FC; } FormalContext *OKLocalContextMinSup(const OAPair &oa, const FormalContext * const P, unsigned int minSup) { LocalContextGrouping G; FormalContext *FC = new FormalContext; ObjectSet *O = oa.first; AttributeSet *A = oa.second; // prepare the initial grouping FormalContext *FC2 = new FormalContext; for (std::vector<OAPair>::const_iterator it = P->data.begin(); it != P->data.end(); ++it) { if (*(oa.second) != *(it->second)) { OAPair oap = OAPair(new ObjectSet(*it->first), new AttributeSet(*it->second)); FC2->data.push_back(oap); } } ObjectContextPair ocp = std::pair<ObjectSet, FormalContext*>(ObjectSet(), FC2); G.push_back(ocp); for (std::set<Object>::const_iterator o = O->data.begin(); o != O->data.end(); ++o) { LocalContextGrouping set_S; ObjectSet *Z = NULL; FormalContext *E = NULL; for (std::vector<ObjectContextPair>::iterator j = G.begin(); j != G.end();) { Z = &j->first; E = j->second; ObjectSet os = *Z; os.data.insert(*o); ObjectContextPair S = std::make_pair<ObjectSet, FormalContext*>(os, new FormalContext); for (std::vector<OAPair>::iterator YB = E->data.begin(); YB != E->data.end();) { // remove all y from Y such that y precedes o // and BTW check if o belongs to Y ObjectSet *Y = YB->first; AttributeSet *B = YB->second; bool oInY = false; for (std::set<Object>::iterator y = YB->first->data.begin(); y != YB->first->data.end();) { if (*y < *o) y = Y->data.erase(y); else if (*y == *o) { oInY = true; break; } else { ++y; } } // if object o belongs to Y... if (oInY) { Y->data.erase(*o); // remove o from Y S.second->data.push_back(*YB); YB = E->data.erase(YB); // remove (Y, B) from E } else ++YB; } // if the second element of S is different from null_set then if (!S.second->data.empty()) { set_S.push_back(S); if (E->data.empty()) { j = G.erase(j); delete E; } else { ++j; } } else { delete S.second; ++j; } } G.insert(G.end(), set_S.begin(), set_S.end()); } // prepare P<O, A> for (LocalContextGrouping::iterator it = G.begin(); it != G.end();) { bool isProcessed = false; if (it->second->data.empty() || it->first.data.size() < minSup) { ++it; continue; } ObjectSet *Z = new ObjectSet(it->first); AttributeSet *D = new AttributeSet; for (std::vector<OAPair>::iterator it2 = it->second->data.begin(); it2 != it->second->data.end(); ++it2) { D->data.insert(it2->second->data.begin(), it2->second->data.end()); isProcessed = it2->second->processed; } D->processed = isProcessed; if (isProcessed) { ++(FC->processedNo); //FC->data.push_back(OAPair(Z, D)); std::vector<OAPair>::iterator iter=FC->data.begin(); for(; iter!=FC->data.end(); ++iter){ if(!iter->second->processed){ break; } } FC->data.insert(iter,OAPair(Z,D)); }else{ FC->data.push_back(OAPair(Z, D)); } ++it; } // clean up for(LocalContextGrouping::iterator it = G.begin(); it != G.end(); ++it) { for(std::vector<OAPair>::iterator it2 = it->second->data.begin(); it2 != it->second->data.end(); ++it2) { delete it2->first; delete it2->second; } delete it->second; } return FC; }
C++
/** * Implementation of Order function * * author: Marcin Wachulski * */ #include "OK.h" #include <algorithm> void Order(FormalContext &local_fc, bool (*sort_f)(const OAPair &e1, const OAPair &e2)) { if (local_fc.data.size() < 2) return; // processed group std::sort(local_fc.data.begin(), local_fc.data.begin() + local_fc.processedNo, OAPairCompare); // non-processed group std::sort(local_fc.data.begin() + local_fc.processedNo, local_fc.data.end(), OAPairCompare); }
C++
#ifndef _OK_H_ #define _OK_H_ // declaration of structures used in OK algorithm implementation #include "Attribute.h" #include "AttributeSet.h" #include "Object.h" #include "ObjectSet.h" #include "OAPair.h" #include "FormalContext.h" #include "DataStructure.h" #include "DataSetLoader.h" #include <iostream> // central data structure maintaining data loaded from external data source and // reference pointers to speed up search operations extern DataStructure data; // closure computes a closure of OAPair element in local formal context // represented by local_fc object void Closure(const AttributeSet &prefix, OAPair &oa_pair, FormalContext &local_fc); // sort_f is a sort function that compares two OAPair elements and returns true // iff e1 is less or equal than e2, false conversely void Order(FormalContext &local_fc, bool (*sort_f)(const OAPair &e1, const OAPair &e2) = NULL); // determine local context for the first iteration of OK algorithm, i.e. // w/o considering the minimal support FormalContext *OKLocalContext(const OAPair &oa, const FormalContext * const P); // determine local context for the next iterations of OK algorithm (OK-Extend), i.e. // considering the minimal support FormalContext *OKLocalContextMinSup(const OAPair &oa, const FormalContext * const P, unsigned int minSup); void printFrequentClosedItemsets(const std::vector<const OAPair* const> *const fci, bool asChars=true, std::ostream &sink=std::cout); void printOAPair(const OAPair * const oa, bool asChars=true, std::ostream &sink=std::cout); void OK(DataStructure *ds, std::ofstream *fc, unsigned int minSup, bool (*sort_f)(const OAPair &e1, const OAPair &e2)=NULL, bool printAsChars=true); bool isClosable(const OAPair & const oa_pair, FormalContext &local_fc); void OKExtend(AttributeSet * prefix, FormalContext *P, bool (*sort_f)(const OAPair &e1, const OAPair &e2), unsigned int minSup, std::vector<const OAPair * const> *frequentClosedItemsets); void printFormalContext(const FormalContext * const fc, std::ostream &sink=std::cout); //cleans up the unwanted stuff related to formal contexts without messing with existing destructors void cleanUpFormalContext(FormalContext* fc, bool removeObjects, bool removeAttributes); //similar, yet for OAPair* void cleanUpOAPair(OAPair* oa); //and once more - for the closed itemsets collection void cleanUpFrequentClosedItemsets(std::vector<const OAPair* const>* frequentClosedItemsets); //a tool to perform safe insert (without overlaps) void insertFrequentItemset(const OAPair* const oa, std::vector<const OAPair* const> * const fci); bool checkOrder(const FormalContext * const fc); #endif
C++
/** * Test collector and executor * * author: Marcin Wachulski * */ #include "gtest\gtest.h" int main(int argc, char *argv[]) { testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); }
C++
/** * Local context function testing * * author: Maciej Rubikowski */ #include "OK.h" #include <iostream> int main(int argc, char *argv[]) { FormalContext *FC = new FormalContext; OAPair oa1; OAPair oa2; OAPair oa3; OAPair oa4; OAPair oa5; OAPair oa6; OAPair oa7; OAPair oa; /* oa.first = new ObjectSet; oa.first->data.insert(2); oa.first->data.insert(3); oa.first->data.insert(6); oa.second = new AttributeSet; oa.second->data.insert(Attribute(4)); oa1.first = new ObjectSet; oa1.first->data.insert(Object(2)); oa1.first->data.insert(Object(4)); oa1.first->data.insert(Object(5)); oa1.first->data.insert(Object(6)); oa1.second = new AttributeSet; oa1.second->data.insert(Attribute(1)); oa1.second->data.insert(Attribute(6)); oa2.first = new ObjectSet; oa2.first->data.insert(Object(1)); oa2.first->data.insert(Object(2)); oa2.first->data.insert(Object(4)); oa2.first->data.insert(Object(6)); oa2.second = new AttributeSet; oa2.second->data.insert(Attribute(3)); oa3.first = new ObjectSet; oa3.first->data.insert(Object(1)); oa3.first->data.insert(Object(3)); oa3.first->data.insert(Object(4)); oa3.first->data.insert(Object(5)); oa3.second = new AttributeSet; oa3.second->data.insert(Attribute(5)); oa4.first = new ObjectSet; oa4.first->data.insert(Object(2)); oa4.first->data.insert(Object(3)); oa4.first->data.insert(Object(4)); oa4.first->data.insert(Object(6)); oa4.second = new AttributeSet; oa4.second->data.insert(Attribute(8)); FC->data.push_back(oa1); FC->data.push_back(oa2); FC->data.push_back(oa3); FC->data.push_back(oa4); //commence local context w/o minSup and deltaClosure test FormalContext *FC2 = OKLocalContext(oa, FC);*/ oa.first = new ObjectSet; oa.first->data.insert(1); oa.first->data.insert(4); oa.first->data.insert(5); oa.second = new AttributeSet; oa.second->data.insert(Attribute(2)); oa1.first = new ObjectSet; oa1.first->data.insert(Object(4)); oa1.second = new AttributeSet; oa1.second->data.insert(Attribute(7)); oa2.first = new ObjectSet; oa2.first->data.insert(Object(1)); oa2.first->data.insert(Object(4)); oa2.first->data.insert(Object(5)); oa2.second = new AttributeSet; oa2.second->data.insert(Attribute(2)); oa3.first = new ObjectSet; oa3.first->data.insert(Object(2)); oa3.first->data.insert(Object(3)); oa3.first->data.insert(Object(6)); oa3.second = new AttributeSet; oa3.second->data.insert(Attribute(4)); oa4.first = new ObjectSet; oa4.first->data.insert(Object(2)); oa4.first->data.insert(Object(4)); oa4.first->data.insert(Object(5)); oa4.first->data.insert(Object(6)); oa4.second = new AttributeSet; oa4.second->data.insert(Attribute(1)); oa4.second->data.insert(Attribute(6)); oa5.first = new ObjectSet; oa5.first->data.insert(Object(1)); oa5.first->data.insert(Object(2)); oa5.first->data.insert(Object(4)); oa5.first->data.insert(Object(6)); oa5.second = new AttributeSet; oa5.second->data.insert(Attribute(3)); oa6.first = new ObjectSet; oa6.first->data.insert(Object(1)); oa6.first->data.insert(Object(3)); oa6.first->data.insert(Object(4)); oa6.first->data.insert(Object(5)); oa6.second = new AttributeSet; oa6.second->data.insert(Attribute(5)); oa7.first = new ObjectSet; oa7.first->data.insert(Object(2)); oa7.first->data.insert(Object(3)); oa7.first->data.insert(Object(4)); oa7.first->data.insert(Object(6)); oa7.second = new AttributeSet; oa7.second->data.insert(Attribute(8)); FC->data.push_back(oa1); FC->data.push_back(oa2); FC->data.push_back(oa3); FC->data.push_back(oa4); FC->data.push_back(oa5); FC->data.push_back(oa6); FC->data.push_back(oa7); //AttributeSet as1; //AttributeSet as2; //as1.data.insert(2); //as2.data.insert(5); //DeltaClosure dc; //dc.push_back(as1); //dc.push_back(as2); unsigned int minSup = 2; FormalContext *FC2 = OKLocalContextMinSup(oa, FC, minSup); for (int i = 0; i < FC2->data.size(); ++i) { for(std::set<Object>::iterator j = FC2->data[i].first->data.begin(); j != FC2->data[i].first->data.end(); ++j) std::cout << *j; std::cout << " : "; for(std::set<Attribute>::iterator j = FC2->data[i].second->data.begin(); j != FC2->data[i].second->data.end(); ++j) std::cout << *j; std::cout << std::endl; } for (std::vector<OAPair>::iterator it = FC2->data.begin(); it != FC2->data.end(); ++it) { delete it->first; delete it->second; } delete FC2; for (std::vector<OAPair>::iterator it = FC->data.begin(); it != FC->data.end(); ++it) { delete it->first; delete it->second; } delete FC; delete oa.first; delete oa.second; _CrtDumpMemoryLeaks(); system("PAUSE"); return 0; }
C++
/** * Test of Order function * * author: Marcin Wachulski * */ #include "OKTest.h" class OrderTest : public testing::Test { }; TEST_F(OrderTest, order_empty_seq) { FormalContext fc; Order(fc); EXPECT_EQ(0, fc.data.size()); EXPECT_EQ(0, fc.processedNo); EXPECT_TRUE(is_sorted(fc)); } TEST_F(OrderTest, order_one_unproc_elem) { FormalContext fc; AttributeSet *attrSet; ObjectSet *objSet; attrSet = new AttributeSet(); attrSet->data.insert(101); objSet = new ObjectSet(); objSet->data.insert(1); fc.data.push_back(OAPair(objSet, attrSet)); Order(fc); EXPECT_EQ(1, fc.data.size()); EXPECT_EQ(0, fc.processedNo); EXPECT_TRUE(is_sorted(fc)); } TEST_F(OrderTest, order_one_proc_elem) { FormalContext fc; AttributeSet *attrSet; ObjectSet *objSet; attrSet = new AttributeSet(); attrSet->data.insert(101); objSet = new ObjectSet(); objSet->data.insert(1); fc.data.push_back(OAPair(objSet, attrSet)); fc.processedNo = 1; Order(fc); EXPECT_EQ(1, fc.data.size()); EXPECT_EQ(1, fc.processedNo); EXPECT_TRUE(is_sorted(fc)); } TEST_F(OrderTest, order_two_elems_swap) { FormalContext fc; AttributeSet *attrSet; ObjectSet *objSet; attrSet = new AttributeSet(); attrSet->data.insert(101); objSet = new ObjectSet(); objSet->data.insert(1); objSet->data.insert(2); fc.data.push_back(OAPair(objSet, attrSet)); fc.processedNo = 0; attrSet = new AttributeSet(); attrSet->data.insert(102); objSet = new ObjectSet(); objSet->data.insert(3); fc.data.push_back(OAPair(objSet, attrSet)); Order(fc); EXPECT_EQ(2, fc.data.size()); EXPECT_EQ(0, fc.processedNo); EXPECT_TRUE(is_sorted(fc)); } TEST_F(OrderTest, order_two_elems_noswap) { FormalContext fc; AttributeSet *attrSet; ObjectSet *objSet; attrSet = new AttributeSet(); attrSet->data.insert(101); objSet = new ObjectSet(); objSet->data.insert(1); fc.data.push_back(OAPair(objSet, attrSet)); fc.processedNo = 1; attrSet = new AttributeSet(); attrSet->data.insert(102); objSet = new ObjectSet(); objSet->data.insert(2); fc.data.push_back(OAPair(objSet, attrSet)); Order(fc); EXPECT_EQ(2, fc.data.size()); EXPECT_EQ(1, fc.processedNo); EXPECT_TRUE(is_sorted(fc)); } TEST_F(OrderTest, big_order) { FormalContext fc; AttributeSet *attrSet; ObjectSet *objSet; attrSet = new AttributeSet(); attrSet->data.insert(101); objSet = new ObjectSet(); objSet->data.insert(1); objSet->data.insert(2); objSet->data.insert(3); objSet->data.insert(4); fc.data.push_back(OAPair(objSet, attrSet)); attrSet = new AttributeSet(); attrSet->data.insert(102); objSet = new ObjectSet(); objSet->data.insert(1); objSet->data.insert(2); objSet->data.insert(3); fc.data.push_back(OAPair(objSet, attrSet)); attrSet = new AttributeSet(); attrSet->data.insert(103); objSet = new ObjectSet(); objSet->data.insert(1); objSet->data.insert(2); fc.data.push_back(OAPair(objSet, attrSet)); attrSet = new AttributeSet(); attrSet->data.insert(104); objSet = new ObjectSet(); objSet->data.insert(1); fc.data.push_back(OAPair(objSet, attrSet)); fc.processedNo = 4; attrSet = new AttributeSet(); attrSet->data.insert(105); objSet = new ObjectSet(); objSet->data.insert(1); objSet->data.insert(2); fc.data.push_back(OAPair(objSet, attrSet)); attrSet = new AttributeSet(); attrSet->data.insert(106); objSet = new ObjectSet(); objSet->data.insert(1); objSet->data.insert(2); objSet->data.insert(3); objSet->data.insert(4); fc.data.push_back(OAPair(objSet, attrSet)); attrSet = new AttributeSet(); attrSet->data.insert(107); objSet = new ObjectSet(); objSet->data.insert(1); fc.data.push_back(OAPair(objSet, attrSet)); attrSet = new AttributeSet(); attrSet->data.insert(108); objSet = new ObjectSet(); objSet->data.insert(1); objSet->data.insert(2); objSet->data.insert(3); fc.data.push_back(OAPair(objSet, attrSet)); Order(fc); EXPECT_EQ(8, fc.data.size()); EXPECT_EQ(4, fc.processedNo); EXPECT_TRUE(is_sorted(fc)); }
C++
/** * Test function to check whether Formal Context is sorted properly * * author: Marcin Wachulski * */ #include "OK.h" bool is_sorted(const FormalContext &fc) { if (fc.processedNo > 1) for (std::vector<OAPair>::const_iterator i = fc.data.begin(); (i+1) != fc.data.begin() + fc.processedNo; i++) if (i->first->data.size() > (i+1)->first->data.size()) return false; if (fc.data.size() - fc.processedNo > 1) for (std::vector<OAPair>::const_iterator i = fc.data.begin() + fc.processedNo; (i+1) != fc.data.end(); i++) if (i->first->data.size() > (i+1)->first->data.size()) return false; return true; }
C++
/** * Test of Closure function * * author: Marcin Wachulski * */ #include "OKTest.h" // checks whether all elements in sub set are included within super set bool subsumes(AttributeSet *sub, AttributeSet *super) { for (std::set<Attribute>::iterator i = sub->data.begin(); i != sub->data.end(); i++) if (super->data.find(*i) == super->data.end()) return false; return true; } class ClosureTest : public testing::Test { protected: virtual void SetUp() { AttributeSet *attrSet; ObjectSet *objSet; attrSet = new AttributeSet(); attrSet->data.insert(104); objSet = new ObjectSet(); objSet->data.insert(1); fc.data.push_back(OAPair(objSet, attrSet)); attrSet = new AttributeSet(); attrSet->data.insert(103); objSet = new ObjectSet(); objSet->data.insert(1); objSet->data.insert(2); fc.data.push_back(OAPair(objSet, attrSet)); attrSet = new AttributeSet(); attrSet->data.insert(102); objSet = new ObjectSet(); objSet->data.insert(1); objSet->data.insert(2); objSet->data.insert(3); fc.data.push_back(OAPair(objSet, attrSet)); attrSet = new AttributeSet(); attrSet->data.insert(101); objSet = new ObjectSet(); objSet->data.insert(1); objSet->data.insert(2); objSet->data.insert(3); objSet->data.insert(4); fc.data.push_back(OAPair(objSet, attrSet)); fc.processedNo = 4; attrSet = new AttributeSet(); attrSet->data.insert(107); objSet = new ObjectSet(); objSet->data.insert(1); fc.data.push_back(OAPair(objSet, attrSet)); attrSet = new AttributeSet(); attrSet->data.insert(105); objSet = new ObjectSet(); objSet->data.insert(1); objSet->data.insert(2); fc.data.push_back(OAPair(objSet, attrSet)); attrSet = new AttributeSet(); attrSet->data.insert(108); objSet = new ObjectSet(); objSet->data.insert(1); objSet->data.insert(2); objSet->data.insert(3); fc.data.push_back(OAPair(objSet, attrSet)); attrSet = new AttributeSet(); attrSet->data.insert(106); attrSet->data.insert(116); attrSet->data.insert(126); objSet = new ObjectSet(); objSet->data.insert(1); objSet->data.insert(2); objSet->data.insert(3); objSet->data.insert(4); fc.data.push_back(OAPair(objSet, attrSet)); prefix.data.insert(0); prefix.data.insert(2); prefix.data.insert(4); prefix.data.insert(6); prefix.data.insert(8); } FormalContext fc; AttributeSet prefix; }; TEST_F(ClosureTest, no_processing) { AttributeSet attrSet; unsigned int attrs_num = attrSet.data.size(); ObjectSet objSet; Closure(prefix, OAPair(&objSet, &attrSet), fc); EXPECT_EQ(prefix.data.size() + attrs_num, attrSet.data.size()); subsumes(&prefix, &attrSet); EXPECT_EQ(8, fc.data.size()); EXPECT_EQ(4, fc.processedNo); EXPECT_TRUE(is_sorted(fc)); } TEST_F(ClosureTest, nonequal_support) { AttributeSet attrSet; attrSet.data.insert(1); attrSet.data.insert(2); attrSet.data.insert(3); unsigned int attrs_num = attrSet.data.size(); ObjectSet objSet; Closure(prefix, OAPair(&objSet, &attrSet), fc); EXPECT_EQ(7, attrSet.data.size()); subsumes(&prefix, &attrSet); EXPECT_EQ(8, fc.data.size()); EXPECT_EQ(4, fc.processedNo); EXPECT_TRUE(is_sorted(fc)); } TEST_F(ClosureTest, full_processing) { AttributeSet attrSet; attrSet.data.insert(1); attrSet.data.insert(2); attrSet.data.insert(3); attrSet.data.insert(4); attrSet.data.insert(5); attrSet.data.insert(1001); unsigned int attrs_num = attrSet.data.size(); ObjectSet objSet; objSet.data.insert(3); objSet.data.insert(4); objSet.data.insert(5); objSet.data.insert(6); AttributeSet last_attrSet_inFC = *(fc.data.back().second); Closure(prefix, OAPair(&objSet, &attrSet), fc); EXPECT_EQ(12, attrSet.data.size()); subsumes(&prefix, &attrSet); subsumes(&last_attrSet_inFC, &attrSet); EXPECT_EQ(7, fc.data.size()); EXPECT_EQ(4, fc.processedNo); EXPECT_TRUE(is_sorted(fc)); }
C++
/** * Local context function testing * * author: Maciej Rubikowski */ #include "KOV.h" #include <iostream> int main(int argc, char *argv[]) { _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE ); _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDOUT ); { FormalContext *FC = new FormalContext; OAPair oa1; OAPair oa2; OAPair oa3; OAPair oa4; OAPair oa5; OAPair oa6; OAPair oa7; OAPair oa; /* oa.first = new ObjectSet; oa.first->data.insert(2); oa.first->data.insert(3); oa.first->data.insert(6); oa.second = new AttributeSet; oa.second->data.insert(Attribute(4)); oa1.first = new ObjectSet; oa1.first->data.insert(Object(2)); oa1.first->data.insert(Object(4)); oa1.first->data.insert(Object(5)); oa1.first->data.insert(Object(6)); oa1.second = new AttributeSet; oa1.second->data.insert(Attribute(1)); oa1.second->data.insert(Attribute(6)); oa2.first = new ObjectSet; oa2.first->data.insert(Object(1)); oa2.first->data.insert(Object(2)); oa2.first->data.insert(Object(4)); oa2.first->data.insert(Object(6)); oa2.second = new AttributeSet; oa2.second->data.insert(Attribute(3)); oa3.first = new ObjectSet; oa3.first->data.insert(Object(1)); oa3.first->data.insert(Object(3)); oa3.first->data.insert(Object(4)); oa3.first->data.insert(Object(5)); oa3.second = new AttributeSet; oa3.second->data.insert(Attribute(5)); oa4.first = new ObjectSet; oa4.first->data.insert(Object(2)); oa4.first->data.insert(Object(3)); oa4.first->data.insert(Object(4)); oa4.first->data.insert(Object(6)); oa4.second = new AttributeSet; oa4.second->data.insert(Attribute(8)); FC->data.push_back(oa1); FC->data.push_back(oa2); FC->data.push_back(oa3); FC->data.push_back(oa4); //commence local context w/o minSup and deltaClosure test FormalContext *FC2 = LocalContext(oa, FC);//new FormalContext(); */ oa.first = new ObjectSet; oa.first->data.insert(1); oa.first->data.insert(4); oa.first->data.insert(5); oa.second = new AttributeSet; oa.second->data.insert(Attribute(2)); oa1.first = new ObjectSet; oa1.first->data.insert(Object(4)); oa1.second = new AttributeSet; oa1.second->data.insert(Attribute(7)); oa2.first = new ObjectSet; oa2.first->data.insert(Object(1)); oa2.first->data.insert(Object(4)); oa2.first->data.insert(Object(5)); oa2.second = new AttributeSet; oa2.second->data.insert(Attribute(2)); oa3.first = new ObjectSet; oa3.first->data.insert(Object(2)); oa3.first->data.insert(Object(3)); oa3.first->data.insert(Object(6)); oa3.second = new AttributeSet; oa3.second->data.insert(Attribute(4)); oa4.first = new ObjectSet; oa4.first->data.insert(Object(2)); oa4.first->data.insert(Object(4)); oa4.first->data.insert(Object(5)); oa4.first->data.insert(Object(6)); oa4.second = new AttributeSet; oa4.second->data.insert(Attribute(1)); oa4.second->data.insert(Attribute(6)); oa5.first = new ObjectSet; oa5.first->data.insert(Object(1)); oa5.first->data.insert(Object(2)); oa5.first->data.insert(Object(4)); oa5.first->data.insert(Object(6)); oa5.second = new AttributeSet; oa5.second->data.insert(Attribute(3)); oa6.first = new ObjectSet; oa6.first->data.insert(Object(1)); oa6.first->data.insert(Object(3)); oa6.first->data.insert(Object(4)); oa6.first->data.insert(Object(5)); oa6.second = new AttributeSet; oa6.second->data.insert(Attribute(5)); oa7.first = new ObjectSet; oa7.first->data.insert(Object(2)); oa7.first->data.insert(Object(3)); oa7.first->data.insert(Object(4)); oa7.first->data.insert(Object(6)); oa7.second = new AttributeSet; oa7.second->data.insert(Attribute(8)); FC->data.push_back(oa1); FC->data.push_back(oa2); FC->data.push_back(oa3); FC->data.push_back(oa4); FC->data.push_back(oa5); FC->data.push_back(oa6); FC->data.push_back(oa7); AttributeSet as1; AttributeSet as2; as1.data.insert(2); as2.data.insert(5); DeltaClosure dc; dc.push_back(as1); dc.push_back(as2); unsigned int minSup = 2; FormalContext *FC2 = LocalContextMinSup(oa, dc, FC, minSup); for (int i = 0; i < FC2->data.size(); ++i) { for(std::set<Object>::iterator j = FC2->data[i].first->data.begin(); j != FC2->data[i].first->data.end(); ++j) std::cout << *j; std::cout << " : "; for(std::set<Attribute>::iterator j = FC2->data[i].second->data.begin(); j != FC2->data[i].second->data.end(); ++j) std::cout << *j; std::cout << std::endl; } for (std::vector<OAPair>::iterator it = FC2->data.begin(); it != FC2->data.end(); ++it) { delete it->first; delete it->second; } delete FC2; for (std::vector<OAPair>::iterator it = FC->data.begin(); it != FC->data.end(); ++it) { delete it->first; delete it->second; } delete FC; delete oa.first; delete oa.second; } _CrtDumpMemoryLeaks(); system("PAUSE"); return 0; }
C++
/** * Test of Order function * * author: Marcin Wachulski * */ #include "KOVTest.h" class OrderTest : public testing::Test { }; TEST_F(OrderTest, order_empty_seq) { FormalContext fc; Order(fc); EXPECT_EQ(0, fc.data.size()); EXPECT_EQ(0, fc.processedNo); EXPECT_TRUE(is_sorted(fc)); } TEST_F(OrderTest, order_one_unproc_elem) { FormalContext fc; AttributeSet *attrSet; ObjectSet *objSet; attrSet = new AttributeSet(); attrSet->data.insert(101); objSet = new ObjectSet(); objSet->data.insert(1); fc.data.push_back(OAPair(objSet, attrSet)); Order(fc); EXPECT_EQ(1, fc.data.size()); EXPECT_EQ(0, fc.processedNo); EXPECT_TRUE(is_sorted(fc)); } TEST_F(OrderTest, order_one_proc_elem) { FormalContext fc; AttributeSet *attrSet; ObjectSet *objSet; attrSet = new AttributeSet(); attrSet->data.insert(101); objSet = new ObjectSet(); objSet->data.insert(1); fc.data.push_back(OAPair(objSet, attrSet)); fc.processedNo = 1; Order(fc); EXPECT_EQ(1, fc.data.size()); EXPECT_EQ(1, fc.processedNo); EXPECT_TRUE(is_sorted(fc)); } TEST_F(OrderTest, order_two_elems_swap) { FormalContext fc; AttributeSet *attrSet; ObjectSet *objSet; attrSet = new AttributeSet(); attrSet->data.insert(101); objSet = new ObjectSet(); objSet->data.insert(1); objSet->data.insert(2); fc.data.push_back(OAPair(objSet, attrSet)); fc.processedNo = 0; attrSet = new AttributeSet(); attrSet->data.insert(102); objSet = new ObjectSet(); objSet->data.insert(3); fc.data.push_back(OAPair(objSet, attrSet)); Order(fc); EXPECT_EQ(2, fc.data.size()); EXPECT_EQ(0, fc.processedNo); EXPECT_TRUE(is_sorted(fc)); } TEST_F(OrderTest, order_two_elems_noswap) { FormalContext fc; AttributeSet *attrSet; ObjectSet *objSet; attrSet = new AttributeSet(); attrSet->data.insert(101); objSet = new ObjectSet(); objSet->data.insert(1); fc.data.push_back(OAPair(objSet, attrSet)); fc.processedNo = 1; attrSet = new AttributeSet(); attrSet->data.insert(102); objSet = new ObjectSet(); objSet->data.insert(2); fc.data.push_back(OAPair(objSet, attrSet)); Order(fc); EXPECT_EQ(2, fc.data.size()); EXPECT_EQ(1, fc.processedNo); EXPECT_TRUE(is_sorted(fc)); } TEST_F(OrderTest, big_order) { FormalContext fc; AttributeSet *attrSet; ObjectSet *objSet; attrSet = new AttributeSet(); attrSet->data.insert(101); objSet = new ObjectSet(); objSet->data.insert(1); objSet->data.insert(2); objSet->data.insert(3); objSet->data.insert(4); fc.data.push_back(OAPair(objSet, attrSet)); attrSet = new AttributeSet(); attrSet->data.insert(102); objSet = new ObjectSet(); objSet->data.insert(1); objSet->data.insert(2); objSet->data.insert(3); fc.data.push_back(OAPair(objSet, attrSet)); attrSet = new AttributeSet(); attrSet->data.insert(103); objSet = new ObjectSet(); objSet->data.insert(1); objSet->data.insert(2); fc.data.push_back(OAPair(objSet, attrSet)); attrSet = new AttributeSet(); attrSet->data.insert(104); objSet = new ObjectSet(); objSet->data.insert(1); fc.data.push_back(OAPair(objSet, attrSet)); fc.processedNo = 4; attrSet = new AttributeSet(); attrSet->data.insert(105); objSet = new ObjectSet(); objSet->data.insert(1); objSet->data.insert(2); fc.data.push_back(OAPair(objSet, attrSet)); attrSet = new AttributeSet(); attrSet->data.insert(106); objSet = new ObjectSet(); objSet->data.insert(1); objSet->data.insert(2); objSet->data.insert(3); objSet->data.insert(4); fc.data.push_back(OAPair(objSet, attrSet)); attrSet = new AttributeSet(); attrSet->data.insert(107); objSet = new ObjectSet(); objSet->data.insert(1); fc.data.push_back(OAPair(objSet, attrSet)); attrSet = new AttributeSet(); attrSet->data.insert(108); objSet = new ObjectSet(); objSet->data.insert(1); objSet->data.insert(2); objSet->data.insert(3); fc.data.push_back(OAPair(objSet, attrSet)); Order(fc); EXPECT_EQ(8, fc.data.size()); EXPECT_EQ(4, fc.processedNo); EXPECT_TRUE(is_sorted(fc)); }
C++
/** * Test function to check whether Formal Context is sorted properly * * author: Marcin Wachulski * */ #include "KOV.h" bool is_sorted(const FormalContext &fc) { if (fc.data.size() < 2) return true; for (std::vector<OAPair>::const_iterator i = fc.data.begin(); (i+1) != fc.data.end(); i++) if (i->first->data.size() > (i+1)->first->data.size()) return false; return true; }
C++
/** * Test of Closure function * * author: Marcin Wachulski * */ #include "KOVTest.h" // checks whether all elements in sub set are included within super set bool subsumes(AttributeSet *sub, AttributeSet *super) { for (std::set<Attribute>::iterator i = sub->data.begin(); i != sub->data.end(); i++) if (super->data.find(*i) == super->data.end()) return false; return true; } class ClosureTest : public testing::Test { protected: virtual void SetUp() { AttributeSet *attrSet; ObjectSet *objSet; attrSet = new AttributeSet(); attrSet->data.insert(1); objSet = new ObjectSet(); for (int i = 1; i <= 1; i++) objSet->data.insert(i); fc.data.push_back(OAPair(objSet, attrSet)); attrSet = new AttributeSet(); attrSet->data.insert(2); objSet = new ObjectSet(); for (int i = 1; i <= 2; i++) objSet->data.insert(i); fc.data.push_back(OAPair(objSet, attrSet)); attrSet = new AttributeSet(); attrSet->data.insert(3); objSet = new ObjectSet(); for (int i = 1; i <= 3; i++) objSet->data.insert(i); fc.data.push_back(OAPair(objSet, attrSet)); attrSet = new AttributeSet(); attrSet->data.insert(4); objSet = new ObjectSet(); for (int i = 1; i <= 4; i++) objSet->data.insert(i); fc.data.push_back(OAPair(objSet, attrSet)); fc.processedNo = 4; attrSet = new AttributeSet(); attrSet->data.insert(5); objSet = new ObjectSet(); for (int i = 1; i <= 5; i++) objSet->data.insert(i); fc.data.push_back(OAPair(objSet, attrSet)); attrSet = new AttributeSet(); attrSet->data.insert(6); objSet = new ObjectSet(); for (int i = 1; i <= 6; i++) objSet->data.insert(i); fc.data.push_back(OAPair(objSet, attrSet)); attrSet = new AttributeSet(); attrSet->data.insert(7); objSet = new ObjectSet(); for (int i = 1; i <= 7; i++) objSet->data.insert(i); fc.data.push_back(OAPair(objSet, attrSet)); attrSet = new AttributeSet(); attrSet->data.insert(6); attrSet->data.insert(7); attrSet->data.insert(9); objSet = new ObjectSet(); for (int i = 1; i <= 8; i++) objSet->data.insert(i); fc.data.push_back(OAPair(objSet, attrSet)); for (int i = 1; i <= 15; i++) all_attributes.data.insert(i); } FormalContext fc; AttributeSet all_attributes; }; TEST_F(ClosureTest, empty_FC) { FormalContext empty_fc; AttributeSet *attrSet = new AttributeSet(); ObjectSet *objSet = new ObjectSet(); ClosureForEmptySet(all_attributes, OAPair(objSet, attrSet), empty_fc); EXPECT_EQ(15, attrSet->data.size()); subsumes(&all_attributes, attrSet); EXPECT_EQ(8, fc.data.size()); EXPECT_EQ(4, fc.processedNo); EXPECT_TRUE(is_sorted(fc)); delete attrSet; delete objSet; } TEST_F(ClosureTest, nonequal_support) { AttributeSet *attrSet = new AttributeSet(); attrSet->data.insert(1); attrSet->data.insert(2); attrSet->data.insert(3); ObjectSet *objSet = new ObjectSet(); ClosureForEmptySet(all_attributes, OAPair(objSet, attrSet), fc); EXPECT_EQ(7, attrSet->data.size()); AttributeSet diff_attributes; diff_attributes.data.insert(8); for (int i = 10; i <= 15; i++) diff_attributes.data.insert(i); subsumes(&diff_attributes, attrSet); EXPECT_EQ(8, fc.data.size()); EXPECT_EQ(4, fc.processedNo); EXPECT_TRUE(is_sorted(fc)); delete attrSet; delete objSet; } TEST_F(ClosureTest, full_processing) { AttributeSet *attrSet = new AttributeSet(); attrSet->data.insert(1); attrSet->data.insert(2); attrSet->data.insert(3); attrSet->data.insert(4); attrSet->data.insert(5); attrSet->data.insert(1001); ObjectSet *objSet = new ObjectSet(); objSet->data.insert(3); objSet->data.insert(4); objSet->data.insert(5); objSet->data.insert(6); objSet->data.insert(7); objSet->data.insert(8); objSet->data.insert(9); objSet->data.insert(10); AttributeSet last_attrSet_inFC = *(fc.data.back().second); OAPair oa(objSet, attrSet); ClosureForEmptySet(all_attributes, oa, fc); EXPECT_EQ(8, oa.second->data.size()); AttributeSet diff_attributes; diff_attributes.data.insert(8); for (int i = 8; i <= 15; i++) diff_attributes.data.insert(i); subsumes(&diff_attributes, oa.second); subsumes(&last_attrSet_inFC, oa.second); EXPECT_EQ(7, fc.data.size()); EXPECT_EQ(4, fc.processedNo); EXPECT_TRUE(is_sorted(fc)); delete oa.first; delete oa.second; }
C++
/** * Test collector and executor * * author: Marcin Wachulski * */ #include "gtest\gtest.h" int main(int argc, char *argv[]) { testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); }
C++
/** * Test of DataSetLoader class * * author: Marcin Wachulski * */ #include "DataStructure.h" #include "DataSetLoader.h" #include "gtest\gtest.h" #include <iostream> class DataSetLoader : public testing::Test { public: }; TEST_F(DataSetLoader, a) { DataStructure *data = loadDataSet("../datasets/a.dat"); EXPECT_EQ(8, data->getAllAtributes()->data.size()); EXPECT_EQ(6, data->getAllObjects()->data.size()); data->printSummary(std::cout); delete data; } TEST_F(DataSetLoader, chess) { DataStructure *data = loadDataSet("../datasets/chess.dat"); EXPECT_EQ(75, data->getAllAtributes()->data.size()); EXPECT_EQ(3196, data->getAllObjects()->data.size()); data->printSummary(std::cout); delete data; } TEST_F(DataSetLoader, mushroom) { DataStructure *data = loadDataSet("../datasets/mushroom.dat"); EXPECT_EQ(119, data->getAllAtributes()->data.size()); EXPECT_EQ(8124, data->getAllObjects()->data.size()); data->printSummary(std::cout); delete data; } TEST_F(DataSetLoader, T10I4D100K) { DataStructure *data = loadDataSet("../datasets/T10I4D100K.dat"); EXPECT_EQ(870, data->getAllAtributes()->data.size()); EXPECT_EQ(100000, data->getAllObjects()->data.size()); data->printSummary(std::cout); delete data; } TEST_F(DataSetLoader, connect) { DataStructure *data = loadDataSet("../datasets/connect.dat"); EXPECT_EQ(129, data->getAllAtributes()->data.size()); EXPECT_EQ(67557, data->getAllObjects()->data.size()); data->printSummary(std::cout); delete data; } TEST_F(DataSetLoader, pumsb_star) { DataStructure *data = loadDataSet("../datasets/pumsb_star.dat"); EXPECT_EQ(2088, data->getAllAtributes()->data.size()); EXPECT_EQ(49046, data->getAllObjects()->data.size()); data->printSummary(std::cout); delete data; } TEST_F(DataSetLoader, T40I10D100K) { DataStructure *data = loadDataSet("../datasets/T40I10D100K.dat"); EXPECT_EQ(942, data->getAllAtributes()->data.size()); EXPECT_EQ(100000, data->getAllObjects()->data.size()); data->printSummary(std::cout); delete data; } TEST_F(DataSetLoader, pubsb) { DataStructure *data = loadDataSet("../datasets/pumsb.dat"); EXPECT_EQ(2113, data->getAllAtributes()->data.size()); EXPECT_EQ(49046, data->getAllObjects()->data.size()); data->printSummary(std::cout); delete data; }
C++
/** * Test collector and executor * * author: Marcin Wachulski * */ #include "gtest\gtest.h" int main(int argc, char *argv[]) { testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); }
C++
#ifndef _OBJECT_SET_H_ #define _OBJECT_SET_H_ #include "Object.h" #include <set> // set of objects class ObjectSet { public: ~ObjectSet() {}; std::set<Object> data; }; #endif
C++
/** * Implementation of file data loader * * author: Marcin Wachulski * */ #include "DataSetLoader.h" DataStructure* loadDataSet(const char* filepath) { if (filepath == NULL || filepath == "") throw std::exception("Unspecified file path"); std::ifstream input; input.open(filepath, std::ifstream::in); if (!input.good()) throw std::exception("Input file corrupted"); DataStructure *result = new DataStructure(); char nextChar = input.peek(); int currAttr = 0, currObj = 1; AttributeSet *currAttrSet = new AttributeSet(); while (input.good()) { input >> currAttr; currAttrSet->data.insert(currAttr); result->updateAttribute(currAttr, currObj); // new Object (Transaction or Line) recognized nextChar = input.peek(); while (nextChar == ' ' || nextChar == '\t') { input.get(); nextChar = input.peek(); } if (nextChar == '\n' || input.eof()) { result->addObject(currObj, currAttrSet); currObj++; currAttrSet = new AttributeSet(); nextChar = input.peek(); while (input.good() && nextChar == ' ' || nextChar == '\t' || nextChar == '\n') { input.get(); nextChar = input.peek(); } } } delete currAttrSet; return result; }
C++
/** * Implementation of main data structure * * author: Marcin Wachulski * */ #include "DataStructure.h" DataStructure::DataStructure() { this->_allAttrs = new AttributeSet(); this->_allObjs = new ObjectSet(); } DataStructure::~DataStructure() { // cleaning attributes with object references for (std::map<Attribute, ObjectSet*>::iterator i = this->_attrs.begin(); i != this->_attrs.end(); i++) delete i->second; // cleaning objects with attribute references for (std::vector<AttributeSet*>::iterator i = this->_objs.begin(); i != this->_objs.end(); i++) delete *i; // cleaning the full sets delete this->_allAttrs; delete this->_allObjs; } void DataStructure::updateAttribute(const Attribute &attr, const Object &obj) { ObjectSet * &objSet = this->_attrs[attr]; if (objSet == NULL) objSet = new ObjectSet(); objSet->data.insert(obj); // update complete AllAttributes set this->_allAttrs->data.insert(attr); } // object is not used since object vector is assumend to be a completed list of // objects (a sequence of integers) ordered asc - performance optimization void DataStructure::addObject(const Object &obj, AttributeSet *aSet) { this->_objs.push_back(aSet); this->_allObjs->data.insert(obj); } // summarize the structure void DataStructure::printSummary(std::ostream &out) { // basic properties out << "Total attributes: " << this->getAllAtributes()->data.size() << std::endl; out << "Total objects: " << this->getAllObjects()->data.size() << std::endl; // counting relation elements int r_elem = 0; for (std::vector<AttributeSet*>::const_iterator i = this->_objs.begin(); i != this->_objs.end(); i++) r_elem += (*i)->data.size(); out << "Total relation elements: " << r_elem; }
C++
/** * Implementation of OAPair universal comparator function * * author: Marcin Wachulski * */ #include "OAPair.h" // universal comparator w.r.t |O| that is the support of an attribute bool OAPairCompare(const OAPair& e1, const OAPair& e2) { return e1.first->data.size() < e2.first->data.size(); }
C++