Skip to content
Permalink
Browse files

v2.80 with NTSF/EXTx support for PSX games

  • Loading branch information...
Estwald committed Jan 27, 2014
1 parent ea4ba7b commit 3dbce2cf7bfb7471507136a2cc6f20df3bd44bae
Showing with 1,354 additions and 535 deletions.
  1. +1 −1 Makefile
  2. +3 −1 include/modules.h
  3. +1 −0 include/utils.h
  4. +17 −17 source/archive_manager.c
  5. +20 −0 source/cobre.c
  6. +16 −4 source/iso.c
  7. +92 −15 source/main.c
  8. +693 −453 source/modules.c
  9. +3 −0 source/payload446/payload_446.c
  10. +248 −39 source/psx.c
  11. +121 −1 source/updates.c
  12. +139 −4 source/utils.c
@@ -18,7 +18,7 @@ SFOXML := sfo.xml

# usage: make BUILD_STEALTH=yes
ifndef BUILD_STEALTH
TITLE := IrisManager - v2.74
TITLE := IrisManager - v2.80
APPID := IMANAGER4
else
TITLE := LEMMINGS™ Trial Version
@@ -1,7 +1,9 @@
#ifndef _MODULES_H
#define _MODULES_H

#define SIZE_SPRX_ISO 9848
#define SIZE_SPRX_ISO 13688
extern unsigned char sprx_iso[SIZE_SPRX_ISO];

#define PLUGIN_ISO "%s/sprx_iso" // note: it is also defined as sprx_iso from main.c

#endif
@@ -107,6 +107,7 @@ void sort_entries2(t_directories *list, int *max, u32 mode);
int delete_entries(t_directories *list, int *max, u32 flag);
void fill_entries_from_device(char *path, t_directories *list, int *max, u32 flag, int sel);
void fill_iso_entries_from_device(char *path, u32 flag, t_directories *list, int *max);
void fill_psx_iso_entries_from_device(char *path, u32 flag, t_directories *list, int *max);

void copy_from_selection(int game_sel);
void copy_from_bluray();
@@ -24,7 +24,6 @@
#include <unistd.h>
#include <math.h>


#include <sysutil/osk.h>
#include "sysutil/sysutil.h"
#include <sys/memory.h>
@@ -47,6 +46,7 @@
#include "cobre.h"
#include "iso.h"
#include "ftp/ftp.h"
#include "modules.h"

#define MAX_SECTIONS ((0x10000-sizeof(rawseciso_args))/8)

@@ -222,7 +222,7 @@ int NTFS_Event_Mount(int id)
ports_cnt &= ~(1<<id);
if(PS3_NTFS_IsInserted(id)) ports_cnt |= 1<<id;

if( ((ports_cnt>>id) & 1) && !((old_ports_cnt>>id) & 1)) automountCount[id] = 300; // enable delay event
if( ((ports_cnt>>id) & 1) && !((old_ports_cnt>>id) & 1)) automountCount[id] = 420; // enable delay event (420 = 7 seconds)

if(automountCount[id]>0) { // if delay counter ticks...
automountCount[id]--; if(automountCount[id]==0) r = 1; // mount device
@@ -3174,7 +3174,7 @@ int launch_iso_game(char *path)

struct stat s;

sprintf((char *) plugin_args, "%s/sprx_iso", self_path);
sprintf((char *) plugin_args, PLUGIN_ISO, self_path);

if(stat((char *) plugin_args, &s)!=0) {free(plugin_args); return -1;}

@@ -3198,8 +3198,8 @@ int launch_iso_game(char *path)
else if(!memcmp((void *) &plugin_args[1], "BEA01", 5)) type = EMU_BD;
else if(!memcmp((void *) &plugin_args[0x28], "PS3VOLUME", 9)) type = EMU_PS3;
else if(!memcmp((void *) &plugin_args[8], "PLAYSTATION", 11) || !memcmp((void *) &plugin_args[256], "PLAYSTATION", 11) ) {
//if(s.st_size>= 900 * 1024 * 1024)
type = EMU_PS2_DVD; is_ps2_game = 1;
if(!strncmp(path, "/ntfs", 5) || !strncmp(path, "/ext", 4)) type = EMU_PSX;
else {type = EMU_PS2_DVD; is_ps2_game = 1;}
}

}
@@ -3214,7 +3214,7 @@ int launch_iso_game(char *path)
uint32_t *sections = malloc(MAX_SECTIONS * sizeof(uint32_t));
uint32_t *sections_size = malloc(MAX_SECTIONS * sizeof(uint32_t));

if(plugin_args && sections && sections_size && (type == EMU_PS3 || type == EMU_DVD || type == EMU_BD)) {
if(plugin_args && sections && sections_size && (type == EMU_PS3 || type == EMU_DVD || type == EMU_BD || type == EMU_PSX)) {

rawseciso_args *p_args;

@@ -3262,7 +3262,7 @@ int launch_iso_game(char *path)

cobra_unload_vsh_plugin(0);

sprintf(temp_buffer + 2048, "%s/sprx_iso", self_path);
sprintf(temp_buffer + 2048, PLUGIN_ISO, self_path);

if (cobra_load_vsh_plugin(0, temp_buffer + 2048, plugin_args, 0x10000) == 0)
{use_cobra = 2; exit(0);}
@@ -3391,7 +3391,7 @@ int launch_iso_game(char *path)

cobra_unload_vsh_plugin(0);

sprintf(temp_buffer + 2048, "%s/sprx_iso", self_path);
sprintf(temp_buffer + 2048, PLUGIN_ISO, self_path);

int r= 0;
if ((r= cobra_load_vsh_plugin(0, temp_buffer + 2048, plugin_args, 0x10000)) == 0)
@@ -3431,7 +3431,7 @@ int launch_iso_build(char *path, char *path2, int sel)

struct stat s;

sprintf((char *) plugin_args, "%s/sprx_iso", self_path);
sprintf((char *) plugin_args, PLUGIN_ISO, self_path);

if(stat((char *) plugin_args, &s)!=0) {free(plugin_args); return -1;}

@@ -3485,7 +3485,7 @@ int launch_iso_build(char *path, char *path2, int sel)

cobra_unload_vsh_plugin(0);

sprintf(temp_buffer + 2048, "%s/sprx_iso", self_path);
sprintf(temp_buffer + 2048, PLUGIN_ISO, self_path);

if (cobra_load_vsh_plugin(0, temp_buffer + 2048, plugin_args, 0x1000) == 0) {

@@ -3552,7 +3552,7 @@ int launch_iso_build(char *path, char *path2, int sel)

cobra_unload_vsh_plugin(0);

sprintf(temp_buffer + 2048, "%s/sprx_iso", self_path);
sprintf(temp_buffer + 2048, PLUGIN_ISO, self_path);

if (cobra_load_vsh_plugin(0, temp_buffer + 2048, plugin_args, 0x10000) == 0) {

@@ -4152,7 +4152,7 @@ void archive_manager(char *pathw1, char *pathw2)
if(!strcmp(ext, ".self") || !strcmp(ext, ".SELF")) type = 3; else
if(!strcmp(ext, ".png") || !strcmp(ext, ".PNG") || !strcmp(ext, ".jpg") || !strcmp(ext, ".JPG")) type = 4; else
if(!strcmp(ext, ".iso") || !strcmp(ext, ".ISO") || !strcmpext(entries1[pos1 + n].d_name, ".iso.0") || !strcmpext(entries1[pos1 + n].d_name, ".ISO.0")) type = 5; else
if(noBDVD && use_cobra /*&& !strncmp(path1, "/ntfs", 5)*/ &&
if(noBDVD == 2 && use_cobra /*&& !strncmp(path1, "/ntfs", 5)*/ &&
(!strcmp(ext, ".avi") || !strcmp(ext, ".AVI")
|| !strcmp(ext, ".mp4") || !strcmp(ext, ".MP4")
|| !strcmp(ext, ".ogm") || !strcmp(ext, ".OGM")
@@ -4244,7 +4244,7 @@ void archive_manager(char *pathw1, char *pathw2)
if(!strcmp(ext, ".self") || !strcmp(ext, ".SELF")) type = 3;else
if(!strcmp(ext, ".png") || !strcmp(ext, ".PNG") || !strcmp(ext, ".jpg") || !strcmp(ext, ".JPG")) type = 4; else
if(!strcmp(ext, ".iso") || !strcmp(ext, ".ISO") || !strcmpext(entries2[pos2 + n].d_name, ".iso.0") || !strcmpext(entries2[pos2 + n].d_name, ".ISO.0")) type = 5; else
if(noBDVD && use_cobra /*&& !strncmp(path2, "/ntfs", 5)*/ &&
if(noBDVD == 2 && use_cobra /*&& !strncmp(path2, "/ntfs", 5)*/ &&
(!strcmp(ext, ".avi") || !strcmp(ext, ".AVI")
|| !strcmp(ext, ".mp4") || !strcmp(ext, ".MP4")
|| !strcmp(ext, ".ogm") || !strcmp(ext, ".OGM")
@@ -5028,7 +5028,7 @@ void archive_manager(char *pathw1, char *pathw2)
} else {
char *ext =get_extension(entries1[sel1].d_name);

if(noBDVD && use_cobra /*&& !strncmp(path1, "/ntfs", 5)*/ && !(entries1[sel1].d_type & 2)
if(noBDVD == 2 && use_cobra /*&& !strncmp(path1, "/ntfs", 5)*/ && !(entries1[sel1].d_type & 2)
&& (!strcmp(ext, ".avi") || !strcmp(ext, ".AVI")
|| !strcmp(ext, ".mp4") || !strcmp(ext, ".MP4")
|| !strcmp(ext, ".ogm") || !strcmp(ext, ".OGM")
@@ -5040,7 +5040,7 @@ void archive_manager(char *pathw1, char *pathw2)
launch_iso_build(temp_buffer + 2048, temp_buffer, 1);


} else if(noBDVD && use_cobra && !(entries1[sel1].d_type & 2)
} else if(noBDVD == 2 && use_cobra && !(entries1[sel1].d_type & 2)
&& (!strcmp(ext, ".iso") || !strcmp(ext, ".ISO")
|| !strcmpext(entries1[sel1].d_name, ".iso.0") || !strcmpext(entries1[sel1].d_name, ".ISO.0"))) {

@@ -5207,7 +5207,7 @@ void archive_manager(char *pathw1, char *pathw2)
} else {
char *ext =get_extension(entries2[sel2].d_name);

if(noBDVD && use_cobra /*&& !strncmp(path2, "/ntfs", 5)*/ && !(entries2[sel2].d_type & 2)
if(noBDVD == 2 && use_cobra /*&& !strncmp(path2, "/ntfs", 5)*/ && !(entries2[sel2].d_type & 2)
&& (!strcmp(ext, ".avi") || !strcmp(ext, ".AVI")
|| !strcmp(ext, ".mp4") || !strcmp(ext, ".MP4")
|| !strcmp(ext, ".ogm") || !strcmp(ext, ".OGM")
@@ -5218,7 +5218,7 @@ void archive_manager(char *pathw1, char *pathw2)

launch_iso_build(temp_buffer + 2048, temp_buffer, 1);

} else if(noBDVD && use_cobra && !(entries2[sel2].d_type & 2)
} else if(noBDVD == 2 && use_cobra && !(entries2[sel2].d_type & 2)
&& (!strcmp(ext, ".iso") || !strcmp(ext, ".ISO")
|| !strcmpext(entries2[sel2].d_name, ".iso.0")|| !strcmpext(entries2[sel2].d_name, ".ISO.0"))) {

@@ -512,5 +512,25 @@ int cobra_unload_vsh_plugin(unsigned int slot)
return_to_user_prog(s32);
}

int cobra_mount_psx_disc_image(char *file, TrackDef *tracks, unsigned int num_tracks)
{
ScsiTrackDescriptor scsi_tracks[100];

if (!file || num_tracks >= 100)
return EINVAL;

memset(scsi_tracks, 0, sizeof(scsi_tracks));

for (int i = 0; i < num_tracks; i++)
{
scsi_tracks[i].adr_control = (!tracks[i].is_audio) ? 0x14 : 0x10;
scsi_tracks[i].track_number = i+1;
scsi_tracks[i].track_start_addr = tracks[i].lba;
}

return sys_storage_ext_mount_psx_discfile(file, num_tracks, scsi_tracks);
}




@@ -405,7 +405,7 @@ int get_iso_file_pos(FILE *fp, char *path, u32 *flba, u64 *size)
if(fread((void *) &sect_descriptor, 1, sizeof(struct iso_primary_descriptor), fp) != sizeof(struct iso_primary_descriptor)) goto err;
#endif

if(strncmp((void *) sect_descriptor.id, "CD001", 5)) goto err;
if(sect_descriptor.type[0]!=1 || strncmp((void *) sect_descriptor.id, "CD001", 5)) goto err;

u32 lba0 = isonum_731(&sect_descriptor.type_l_path_table[0]); // lba
u32 size0 = isonum_733(&sect_descriptor.path_table_size[0]); // tamaño
@@ -478,9 +478,21 @@ int get_iso_file_pos(FILE *fp, char *path, u32 *flba, u64 *size)
#endif

p = 0;

int size_directory = -1;
int p2 = 0;
while(1) {
if(nsplit >= nfolder_split) break;
idr = (struct iso_directory_record *) &sectors[p];

if(size_directory == -1) {

if((int) idr->name_len[0] == 1 && idr->name[0]== 0 && lba == isonum_731((void *) idr->extent) && idr->flags[0] == 0x2) {
size_directory = isonum_733((void *) idr->size);

}
}

if(idr->length[0] == 0 && sizeof(struct iso_directory_record) + p > 2048) {
lba_folder++;

@@ -491,10 +503,10 @@ int get_iso_file_pos(FILE *fp, char *path, u32 *flba, u64 *size)
if(fseek(fp, lba_folder * 2048, SEEK_SET)!=0) goto err;
if(fread((void *) sectors, 1, 2048, fp) != 2048) goto err;
#endif
p = 0; continue;
p = 0; p2= (p2 & ~2047) + 2048; continue;
}

if(idr->length[0] == 0) break;
if((size_directory == -1 && idr->length[0] == 0) || (size_directory != -1 && p2 >= size_directory)) break;

if((int) idr->name_len[0] == folder_split[nsplit][2]
&& !strncmp((char *) idr->name, &path[folder_split[nsplit][1]], (int) idr->name_len[0])) {
@@ -504,7 +516,7 @@ int get_iso_file_pos(FILE *fp, char *path, u32 *flba, u64 *size)

} else if(file_lba != 0xffffffff) break;

p+= idr->length[0];
p+= idr->length[0]; p2+= idr->length[0];
}

*flba = file_lba;

0 comments on commit 3dbce2c

Please sign in to comment.
You can’t perform that action at this time.