Skip to content

Commit

Permalink
Merge branch 'rickgaiser:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
AKuHAK authored Jul 23, 2023
2 parents 869f04c + 1e5b374 commit 41602e8
Show file tree
Hide file tree
Showing 21 changed files with 172 additions and 210 deletions.
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ all:
$(MAKE) -C iop/smap all DEBUG=$(DEBUG)
$(MAKE) -C iop/imgdrv all DEBUG=$(DEBUG)
$(MAKE) -C iop/isofs all DEBUG=$(DEBUG)
$(MAKE) -C iop/resetspu all DEBUG=$(DEBUG)
$(MAKE) -C ee/ee_core all
$(MAKE) -C ee/loader all DEBUG=$(DEBUG)

Expand All @@ -22,7 +21,6 @@ clean:
$(MAKE) -C iop/smap clean
$(MAKE) -C iop/imgdrv clean
$(MAKE) -C iop/isofs clean
$(MAKE) -C iop/resetspu clean
$(MAKE) -C ee/ee_core clean
$(MAKE) -C ee/loader clean

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Usage: neutrino.elf -drv=<driver> -iso=<path>\n");
Options:\n");
-drv=<driver> Select block device driver, supported are: ata, usb, mx4sio(sdc), udpbd(udp) and ilink(sd)
-iso=<file> Select iso file (full path!)
-elf=<file> Select elf file inside iso to boot
-mt=<type> Select media type, supported are: cd, dvd. Defaults to cd for size<=650MiB, and dvd for size>650MiB
-gc=<compat> Game compatibility modes, supperted are:
- 0: Disable builtin compat flags
Expand Down
2 changes: 1 addition & 1 deletion ee/ee_core/include/modmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ typedef struct

int LoadFileInit();
void LoadFileExit();
int LoadModule(const char *path, int arg_len, const char *args);
int LoadModule(const char *path, int mode, int arg_len, const char *args);
int LoadMemModule(int mode, void *modptr, unsigned int modsize, int arg_len, const char *args);
int GetOPLModInfo(int id, void **pointer, unsigned int *size);
int LoadOPLModule(int id, int mode, int arg_len, const char *args);
Expand Down
6 changes: 3 additions & 3 deletions ee/ee_core/src/iopmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static void ResetIopSpecial(const char *args, unsigned int arglen)
ee_kmode_exit();
EIntr();

LoadOPLModule(OPL_MODULE_ID_UDNL, SIF_RPC_M_NOWAIT, CommandLen, command);
LoadModule("rom0:UDNL", SIF_RPC_M_NOWAIT, CommandLen, command);

DIntr();
ee_kmode_enter();
Expand All @@ -100,9 +100,9 @@ static void ResetIopSpecial(const char *args, unsigned int arglen)

DPRINTF("Loading extra IOP modules...\n");
irxtab_t *irxtable = (irxtab_t *)ModStorageStart;
// Skip the first 4 modules
// Skip the first 2 modules: IOPRP.IMG and imgdrv.irx
// FIXME: magic number!
for (i = 4; i < irxtable->count; i++) {
for (i = 2; i < irxtable->count; i++) {
irxptr_t p = irxtable->modules[i];
// Modules that emulate the sceCdRead function must operate at a higher
// priority than the highest possible game priority.
Expand Down
6 changes: 3 additions & 3 deletions ee/ee_core/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ static void set_args_mod(char *arg)
ModStorageEnd = (void *)_strtoui(_strtok(NULL, " "));
}

static void set_args_file(const char *arg)
static void set_args_gameid(const char *arg)
{
strncpy(GameID, arg, sizeof(GameID) - 1);
GameID[sizeof(GameID) - 1] = '\0';
Expand Down Expand Up @@ -93,8 +93,8 @@ static int eecoreInit(int argc, char **argv)
set_args_kernel(&argv[i][8]);
if (!_strncmp(argv[i], "-mod=", 5))
set_args_mod(&argv[i][5]);
if (!_strncmp(argv[i], "-file=", 6))
set_args_file(&argv[i][6]);
if (!_strncmp(argv[i], "-gid=", 5))
set_args_gameid(&argv[i][5]);
if (!_strncmp(argv[i], "-compat=", 8))
set_args_compat(&argv[i][8]);
if (!_strncmp(argv[i], "--b", 3))
Expand Down
8 changes: 4 additions & 4 deletions ee/ee_core/src/modmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ void LoadFileExit()


/*----------------------------------------------------------------------------------------*/
/* Load an irx module from path with waiting. */
/* Load an irx module from path. */
/*----------------------------------------------------------------------------------------*/
int LoadModule(const char *path, int arg_len, const char *args)
int LoadModule(const char *path, int mode, int arg_len, const char *args)
{
struct _lf_module_load_arg arg;

Expand All @@ -68,14 +68,14 @@ int LoadModule(const char *path, int arg_len, const char *args)
} else
arg.p.arg_len = 0;

if (SifCallRpc(&_lf_cd, LF_F_MOD_LOAD, 0x0, &arg, sizeof(arg), &arg, 8, NULL, NULL) < 0)
if (SifCallRpc(&_lf_cd, LF_F_MOD_LOAD, mode, &arg, sizeof(arg), &arg, 8, NULL, NULL) < 0)
return -SCE_ECALLMISS;

return arg.p.result;
}

/*----------------------------------------------------------------------------------------*/
/* Load an irx module from path without waiting. */
/* Load an irx module from path. */
/*----------------------------------------------------------------------------------------*/
int LoadMemModule(int mode, void *modptr, unsigned int modsize, int arg_len, const char *args)
{
Expand Down
28 changes: 20 additions & 8 deletions ee/ee_core/src/patches.c
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,10 @@ static void HarvestMoonAWLPatch(int region)
void apply_patches(const char *path)
{
const patchlist_t *p;
// Some patches hack into specific ELF files
// make sure the filename and gameid match for those patches
// This prevents games with multiple ELF's from being corrupted by the patch
int file_eq_gameid = !_strncmp(&path[8], GameID, 11); // starting after 'cdrom0:\'

// if there are patches matching game name/mode then fill the patch table
for (p = patch_list; p->game; p++) {
Expand All @@ -878,22 +882,28 @@ void apply_patches(const char *path)
AC9B_generic_patches();
break;
case PATCH_GENERIC_SLOW_READS:
generic_delayed_cdRead_patches(p->patch.check, p->patch.val); // slow reads generic patch
if (file_eq_gameid)
generic_delayed_cdRead_patches(p->patch.check, p->patch.val); // slow reads generic patch
break;
case PATCH_SDF_MACROSS:
SDF_Macross_patch();
if (file_eq_gameid)
SDF_Macross_patch();
break;
case PATCH_GENERIC_CAPCOM:
generic_capcom_protection_patches(p->patch.val); // Capcom anti cdvd emulator protection patch
if (file_eq_gameid)
generic_capcom_protection_patches(p->patch.val); // Capcom anti cdvd emulator protection patch
break;
case PATCH_SRW_IMPACT:
SRWI_IMPACT_patches();
if (file_eq_gameid)
SRWI_IMPACT_patches();
break;
case PATCH_RNC_UYA:
RnC3_UYA_patches((unsigned int *)p->patch.val);
if (file_eq_gameid)
RnC3_UYA_patches((unsigned int *)p->patch.val);
break;
case PATCH_ZOMBIE_ZONE:
ZombieZone_patches(p->patch.val);
if (file_eq_gameid)
ZombieZone_patches(p->patch.val);
break;
case PATCH_DOT_HACK:
DotHack_patches(path);
Expand All @@ -904,15 +914,17 @@ void apply_patches(const char *path)
#endif
break;
case PATCH_VIRTUA_QUEST:
VirtuaQuest_patches();
if (file_eq_gameid)
VirtuaQuest_patches();
break;
case PATCH_ULT_PRO_PINBALL:
#ifdef APEMOD_PATCH
UltProPinballPatch(path);
#endif
break;
case PATCH_EUTECHNYX_WU_TID:
EutechnyxWakeupTIDPatch(p->patch.val);
if (file_eq_gameid)
EutechnyxWakeupTIDPatch(p->patch.val);
break;
case PATCH_PRO_SNOWBOARDER:
ProSnowboarderPatch();
Expand Down
24 changes: 17 additions & 7 deletions ee/loader/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ EE_IRX_FILES += \
bdm_cdvdman.irx \
imgdrv.irx \
isofs.irx \
resetspu.irx \
eesync.irx \
udnl.irx \
iomanX.irx \
fileXio.irx \
bdm.irx \
Expand Down Expand Up @@ -51,7 +49,6 @@ vpath %.irx ../../iop/cdvdman/irx/
vpath %.irx ../../iop/smap/irx/
vpath %.irx ../../iop/imgdrv/irx/
vpath %.irx ../../iop/isofs/irx/
vpath %.irx ../../iop/resetspu/irx/
vpath %.elf ../ee_core/
vpath %.irx $(PS2SDK)/iop/irx/

Expand All @@ -76,6 +73,20 @@ $(EE_BIN_PACKED): $(EE_BIN)
all: $(EE_BIN_PACKED)


# ALL : BSOD when returning back to menu
# Game uses differnt ELF files for menu and game
#GAME = 'CD/Densha de Go! 3 - Tsuukin-hen (J).iso'

# ALL : BSOD
# These CD games use sceCdGetToc and sceCdPosToInt
# Do these functions work as expected?
#GAME = 'CD/Madden NFL 2001 (U).iso'
#GAME = 'CD/Madden NFL 2002 (U).iso'
#GAME = 'CD/NASCAR Thunder 2002 (U).iso'

# UDPBD: works
#GAME = 'CD/Downforce (U).iso'

# USB : BSOD
# UDPBD: works
#GAME = 'CD/Super Bust-A-Move (U).iso'
Expand All @@ -101,7 +112,7 @@ all: $(EE_BIN_PACKED)

# Tested, working
#GAME = 'CD/ICO (U).iso'
#GAME = 'DVD/DragonBall Z Budokai Tenkaichi 3 (E).iso'
GAME = 'DVD/DragonBall Z Budokai Tenkaichi 3 (E).iso'
#GAME = 'DVD/PES 2023 (E).iso'
#GAME = 'DVD/Sonic Unleashed (E).iso'
#GAME = 'DVD/007 - Agent Under Fire (E).iso'
Expand All @@ -110,7 +121,8 @@ all: $(EE_BIN_PACKED)
#GAME = 'DVD/Ratchet Clank - Going Commando (E).iso'
#GAME = 'DVD/Ratchet Clank - Up Your Arsenal (U).iso'
#GAME = 'CD/Quake III Revolution (E).iso'
GAME = 'DVD/Super Dragon Ball Z (E).iso'
#GAME = 'DVD/Super Dragon Ball Z (E).iso'
#GAME = 'CD/Tekken Tag Tournament (E) v2.iso'


run: all copy
Expand All @@ -129,10 +141,8 @@ copy:
cp ../../iop/smap/irx/smap.irx modules
cp ../../iop/imgdrv/irx/imgdrv.irx modules
cp ../../iop/isofs/irx/isofs.irx modules
cp ../../iop/resetspu/irx/resetspu.irx modules
cp ../ee_core/ee_core.elf modules
cp $(PS2SDK)/iop/irx/eesync.irx modules
cp $(PS2SDK)/iop/irx/udnl.irx modules
cp $(PS2SDK)/iop/irx/iomanX.irx modules
cp $(PS2SDK)/iop/irx/fileXio.irx modules
cp $(PS2SDK)/iop/irx/bdm.irx modules
Expand Down
13 changes: 11 additions & 2 deletions ee/loader/src/ee_core_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ void eecc_init(struct SEECoreConfig *eecc)
eecc_setKernelConfig(eecc, 0, 0);
eecc_setModStorageConfig(eecc, 0, 0);
eecc_setCompatFlags(eecc, 0);
eecc_setGameID(eecc, "");
eecc_setFileName(eecc, "");
eecc_setExitPath(eecc, "Browser");
IP4_ADDR(&eecc->_ethAddr, 192, 168, 1, 10);
Expand Down Expand Up @@ -70,6 +71,11 @@ void eecc_setCheats(struct SEECoreConfig *eecc, bool enable)
eecc->_enableCheats = enable;
}

void eecc_setGameID(struct SEECoreConfig *eecc, const char *gameID)
{
eecc->_sGameID = gameID;
}

void eecc_setFileName(struct SEECoreConfig *eecc, const char *fileName)
{
eecc->_sFileName = fileName;
Expand Down Expand Up @@ -102,6 +108,9 @@ bool eecc_valid(struct SEECoreConfig *eecc)
if (eecc->_irxptr == 0x0)
return false;

if (eecc->_sGameID[0] == 0)
return false;

if (eecc->_sFileName[0] == 0)
return false;

Expand Down Expand Up @@ -155,8 +164,8 @@ const char **eecc_argv(struct SEECoreConfig *eecc)
maxStrLen -= strlen(psConfig) + 1;
psConfig += strlen(psConfig) + 1;

// Filename
snprintf(psConfig, maxStrLen, "-file=%s", eecc->_sFileName);
// GameID
snprintf(psConfig, maxStrLen, "-gid=%s", eecc->_sGameID);
eecc->_argv[eecc->_argc++] = psConfig;
maxStrLen -= strlen(psConfig) + 1;
psConfig += strlen(psConfig) + 1;
Expand Down
2 changes: 2 additions & 0 deletions ee/loader/src/ee_core_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ struct SEECoreConfig
ip4_addr_t _ethAddr;
ip4_addr_t _ethMask;
ip4_addr_t _ethGateway;
const char *_sGameID;
const char *_sFileName;
const char *_sExitPath;

Expand All @@ -46,6 +47,7 @@ void eecc_setGameMode(struct SEECoreConfig *eecc, u32 gameMode);
void eecc_setKernelConfig(struct SEECoreConfig *eecc, u32 eeloadCopy, u32 initUserMemory);
void eecc_setModStorageConfig(struct SEECoreConfig *eecc, u32 irxtable, u32 irxptr);
void eecc_setCompatFlags(struct SEECoreConfig *eecc, u32 compatFlags);
void eecc_setGameID(struct SEECoreConfig *eecc, const char *gameID);
void eecc_setFileName(struct SEECoreConfig *eecc, const char *fileName);
void eecc_setExitPath(struct SEECoreConfig *eecc, const char *path);
void eecc_setHDDSpindown(struct SEECoreConfig *eecc, u32 minutes);
Expand Down
Loading

0 comments on commit 41602e8

Please sign in to comment.