Skip to content

Commit

Permalink
Merge branch 'rickgaiser:master' into cue_final
Browse files Browse the repository at this point in the history
  • Loading branch information
AKuHAK authored Oct 8, 2023
2 parents 1c524a9 + c9da431 commit 6ba8de8
Show file tree
Hide file tree
Showing 17 changed files with 246 additions and 112 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,10 @@ Options:
- 5: IOP: Emulate DVD-DL
Multiple options possible, for example -gc=23
-eC Enable debug colors
-eL Enable logo (adds rom0:PS2LOGO to arguments)
-cfg=<file> Load extra user/game specific config file (without .toml extension)
-dbc Enable debug colors
-logo Enable logo (adds rom0:PS2LOGO to arguments)
--b Break, all following parameters are passed to the ELF
Expand Down
43 changes: 38 additions & 5 deletions ee/ee_core/src/iopmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,35 @@
extern int _iop_reboot_count;
extern void *ModStorageStart;

#ifdef __EESIO_DEBUG
static void print_iop_args(int arg_len, const char *args)
{
// Multiple null terminated strings together
int args_idx = 0;
int was_null = 1;

if (arg_len == 0)
return;

DPRINTF("IOP reboot arguments (arg_len=%d):\n", arg_len);

// Search strings
while(args_idx < arg_len) {
if (args[args_idx] == 0) {
if (was_null == 1) {
DPRINTF("- args[%d]=0\n", args_idx);
}
was_null = 1;
}
else if (was_null == 1) {
DPRINTF("- args[%d]='%s'\n", args_idx, &args[args_idx]);
was_null = 0;
}
args_idx++;
}
}
#endif

/*----------------------------------------------------------------*/
/* Reset IOP to include our modules. */
/*----------------------------------------------------------------*/
Expand All @@ -33,7 +62,11 @@ int New_Reset_Iop(const char *arg, int arglen)
irxtab_t *irxtable = (irxtab_t *)ModStorageStart;
static int imgdrv_offset = 0;

DPRINTF("New_Reset_Iop start!\n");
DPRINTF("%s()\n", __FUNCTION__);
#ifdef __EESIO_DEBUG
print_iop_args(arglen, arg);
#endif

if (EnableDebug)
GS_BGCOLOUR = 0xFF00FF; // Purple

Expand All @@ -45,20 +78,20 @@ int New_Reset_Iop(const char *arg, int arglen)
sbv_patch_enable_lmb();

udnl_cmdlen = 0;
if (arglen > 0) {
if (arglen >= 10) {
// Copy: rom0:UDNL or rom1:UDNL
// - Are these the only update modules? Always 9 chars long?
strncpy(udnl_mod, &arg[0], 10);
// Make sure it's 0 terminated
udnl_mod[9] = '\0';
udnl_mod[10-1] = '\0';

if (arglen > 10) {
// Copy: arguments
udnl_cmdlen = arglen-10; // length, including terminating 0
strncpy(udnl_cmd, &arg[10], udnl_cmdlen);

// Fix if 0 is not included
if (udnl_cmd[udnl_cmdlen-1] != 0) {
// Fix if 0 is not included in length
if (udnl_cmd[udnl_cmdlen-1] != '\0') {
udnl_cmd[udnl_cmdlen] = '\0';
udnl_cmdlen++;
}
Expand Down
19 changes: 12 additions & 7 deletions ee/ee_core/src/loadfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,14 +370,19 @@ int SifExecModuleBuffer(void *ptr, u32 size, u32 arg_len, const char *args, int
/* Round the size up to the nearest 16 bytes. */
size = (size + 15) & -16;

// Estimate free IOP RAM
// Estimate largest free IOP RAM block up to 256 byte accuracy
// 12 iterations are needed
void *ptemp = NULL;
u32 freemem = 1800*1024;
do {
freemem -= 4*1024;
ptemp = SifAllocIopHeap(freemem);
} while (ptemp == NULL);
SifFreeIopHeap(ptemp);
u32 freemem = 0;
u32 freecheck = 1024*1024;
while (freecheck > 256) {
ptemp = SifAllocIopHeap(freemem+freecheck);
if (ptemp != NULL) {
freemem += freecheck;
SifFreeIopHeap(ptemp);
}
freecheck /= 2;
}

// Allocate large buffer, forcing the module buffer to be allocated in 'middle' memory
ptemp = SifAllocIopHeap((freemem - size) / 2);
Expand Down
21 changes: 21 additions & 0 deletions ee/loader/config/system.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
# Name of loaded config, to show to user
name = "System settings and drivers"

# Default argument values
# Overwrite these from the command line
default_bsd = "no"
default_dvd = "no"
#default_ata0 = "mass:mydrive0.bin"
#default_ata0id = "mass:mydrive0_id.bin"
#default_ata1 = "mass:mydrive1.bin"
#default_mc0 = "mass:mymc0.bin"
#default_mc1 = "mass:mymc1.bin"
default_elf = "auto"
#default_mt = "dvd"
#default_gc = "12"
default_dbc = false
default_logo = false

# Select the number of sectors for the FS buffer
# A small value can increase game compatibility
# A large value can increase performce
# Min=2, Max=128, Default=8
cdvdman_fs_sectors = 8

# Override the 8-byte string returned by:
# - sceCdRI
# This string is also used by:
Expand Down
Loading

0 comments on commit 6ba8de8

Please sign in to comment.