diff options
Diffstat (limited to 'backends/platform/ps2/irxboot.cpp')
-rw-r--r-- | backends/platform/ps2/irxboot.cpp | 85 |
1 files changed, 60 insertions, 25 deletions
diff --git a/backends/platform/ps2/irxboot.cpp b/backends/platform/ps2/irxboot.cpp index d3049fcf4b..0e05047c6e 100644 --- a/backends/platform/ps2/irxboot.cpp +++ b/backends/platform/ps2/irxboot.cpp @@ -34,37 +34,65 @@ static const char hddArg[] = "-o" "\0" "8" "\0" "-n" "\0" "20"; static const char pfsArg[] = "-m" "\0" "2" "\0" "-o" "\0" "32" "\0" "-n" "\0" "72"; // "\0" "-debug"; -static const char netArg[] = "192.168.0.10" "\0" "255.255.255.0" "\0" "192.168.0.1"; - -IrxFile irxFiles[] = { - { "SIO2MAN", BIOS, NOTHING, NULL, 0 }, - { "MCMAN", BIOS, NOTHING, NULL, 0 }, - { "MCSERV", BIOS, NOTHING, NULL, 0 }, - { "PADMAN", BIOS, NOTHING, NULL, 0 }, - { "LIBSD", BIOS, NOTHING, NULL, 0 }, - - { "IOMANX.IRX", SYSTEM, NOTHING, NULL, 0 }, - { "FILEXIO.IRX", SYSTEM, NOTHING, NULL, 0 }, - { "CODYVDFS.IRX", SYSTEM, NOTHING, NULL, 0 }, +static const char netArg[] = "192.168.1.20" "\0" "255.255.255.0" "\0" "192.168.1.1"; // TODO: set in ScummVM.ini + +IrxFile irxCore[] = { // core modules + // Memory Card + { "SIO2MAN", BIOS, NOTHING, NULL, 0 }, + { "MCMAN", BIOS, NOTHING, NULL, 0 }, + { "MCSERV", BIOS, NOTHING, NULL, 0 }, + // Joypad + { "PADMAN", BIOS, NOTHING, NULL, 0 }, + // Sound + { "LIBSD", BIOS, NOTHING, NULL, 0 }, { "SJPCM.IRX", SYSTEM, NOTHING, NULL, 0 }, + // Files I/O + { "IOMANX.IRX", SYSTEM, NOTHING, NULL, 0 }, + { "FILEXIO.IRX", SYSTEM, NOTHING, NULL, 0 } +}; + +IrxFile irxCdrom[] = { // cdrom modules + // CD-Rom FS + { "CODYVDFS.IRX", SYSTEM, CD_DRIVER, NULL, 0 } +}; +IrxFile irxUSB[] = { // USB mass + // USB drv & key { "USBD.IRX", USB | OPTIONAL | DEPENDANCY, USB_DRIVER, NULL, 0 }, - { "USB_MASS.IRX", USB | OPTIONAL, MASS_DRIVER, NULL, 0 }, + { "USB_MASS.IRX", USB | OPTIONAL, MASS_DRIVER, NULL, 0 } +}; + +IrxFile irxInput[] = { // USB input + // USB mouse & kbd { "PS2MOUSE.IRX", USB | OPTIONAL, MOUSE_DRIVER, NULL, 0 }, - { "RPCKBD.IRX", USB | OPTIONAL, KBD_DRIVER, NULL, 0 }, -#ifndef NO_ADAPTOR + { "RPCKBD.IRX", USB | OPTIONAL, KBD_DRIVER, NULL, 0 } +}; + +IrxFile irxHDD[] = { // modules to support HDD + // hdd modules { "POWEROFF.IRX", HDD | OPTIONAL | NOT_HOST | DEPENDANCY, HDD_DRIVER, NULL, 0 }, { "PS2DEV9.IRX", HDD | OPTIONAL | NOT_HOST | DEPENDANCY, HDD_DRIVER, NULL, 0 }, { "PS2ATAD.IRX", HDD | OPTIONAL | DEPENDANCY, HDD_DRIVER, NULL, 0 }, { "PS2HDD.IRX", HDD | OPTIONAL | DEPENDANCY, HDD_DRIVER, hddArg, sizeof(hddArg) }, - { "PS2FS.IRX", HDD | OPTIONAL | DEPENDANCY, HDD_DRIVER, pfsArg, sizeof(pfsArg) }, + { "PS2FS.IRX", HDD | OPTIONAL | DEPENDANCY, HDD_DRIVER, pfsArg, sizeof(pfsArg) } +}; + +IrxFile irxNet[] = { // modules to support NET + // net modules { "PS2IP.IRX", NET | OPTIONAL | NOT_HOST | DEPENDANCY, NET_DRIVER, NULL, 0 }, { "PS2SMAP.IRX", NET | OPTIONAL | NOT_HOST | DEPENDANCY, NET_DRIVER, netArg, sizeof(netArg) }, { "PS2HOST.IRX", NET | OPTIONAL | NOT_HOST | DEPENDANCY, NET_DRIVER, NULL, 0 } -#endif }; -static const int numIrxFiles = sizeof(irxFiles) / sizeof(irxFiles[0]); +IrxFile *irxType[IRX_MAX] = { irxCore, irxCdrom, irxUSB, irxInput, irxHDD, irxNet }; + +static const int numIrx[IRX_MAX] = { sizeof(irxCore) / sizeof(IrxFile), + sizeof(irxCdrom) / sizeof(IrxFile), + sizeof(irxUSB) / sizeof(IrxFile), + sizeof(irxInput) / sizeof(IrxFile), + sizeof(irxHDD) / sizeof(IrxFile), + sizeof(irxNet) / sizeof(IrxFile) +}; PS2Device detectBootPath(const char *elfPath, char *bootPath) { @@ -113,19 +141,26 @@ PS2Device detectBootPath(const char *elfPath, char *bootPath) { return device; } -int loadIrxModules(int device, const char *irxPath, IrxReference **modules) { +int loadIrxModules(int device, const char *irxPath, IrxReference **modules, IrxType type) { + + IrxReference *resModules; + IrxReference *curModule; + IrxFile *irxFiles; + int numFiles; - IrxReference *resModules = (IrxReference *)malloc(numIrxFiles * sizeof(IrxReference)); - IrxReference *curModule = resModules; + irxFiles = irxType[type]; + numFiles = numIrx[type]; + resModules = (IrxReference *)memalign(64, numFiles * sizeof(IrxReference)); + curModule = resModules; - for (int i = 0; i < numIrxFiles; i++) { + for (int i = 0; i < numFiles; i++) { curModule->fileRef = irxFiles + i; if ((device == HOST_DEV) && (irxFiles[i].flags & NOT_HOST)) continue; if ((irxFiles[i].flags & TYPEMASK) == BIOS) { curModule->loc = IRX_FILE; - curModule->path = (char *)malloc(32); + curModule->path = (char *)memalign(64, 32); sprintf(curModule->path, "rom0:%s", irxFiles[i].name); curModule->buffer = NULL; curModule->size = 0; @@ -134,7 +169,7 @@ int loadIrxModules(int device, const char *irxPath, IrxReference **modules) { curModule->errorCode = 0; } else { curModule->loc = IRX_BUFFER; - curModule->path = (char *)malloc(256); + curModule->path = (char *)memalign(64, 256); sprintf(curModule->path, "%s%s%s", irxPath, irxFiles[i].name, (device == CD_DEV) ? ";1" : ""); int fd = fioOpen(curModule->path, O_RDONLY); @@ -191,7 +226,7 @@ int loadIrxModules(int device, const char *irxPath, IrxReference **modules) { pos++; } // and skip any remaining modules that depend on the missing one, too. - while ((i < numIrxFiles - 1) && ((irxFiles[i + 1].flags & TYPEMASK) == (curModule->fileRef->flags & TYPEMASK))) + while ((i < numFiles - 1) && ((irxFiles[i + 1].flags & TYPEMASK) == (curModule->fileRef->flags & TYPEMASK))) i++; // the module that actually failed (curModule) is kept in the array for displaying an error message } |