diff --git a/src/main.c b/src/main.c index 3e0a617..c3d35d8 100644 --- a/src/main.c +++ b/src/main.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -191,6 +192,26 @@ int main(int argc, char *argv[]) unsigned char *RAM_p = NULL; char *CNFBUFF, *name, *value; +#ifndef NO_DECKARD +#define XPARAM_PARAM_ADDR *((uint32_t *)0xFFFE01A0) +#define XPARAM_VALUE_ADDR *((uint32_t *)0xFFFE01A4) + if (IOP_CPU_TYPE == IOP_TYPE_POWERPC) { // this PS2 is DECKARD. reset the XPARAMS to their default value in case we are not coming from a reset + const u32 xparam_default[0x12] = { + 0x01F4, 0x07D0, 0x0023, 0x07D0, + 0x0014, 0x0000, 0x0001, 0x0020, + 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x229C, 0x06EC, 0x06EC, + 0x0001, 0x0090 + }; + for (x = 0; x < 0x12; x++) { + XPARAM_PARAM_ADDR = 0xFFFFFFFF; + XPARAM_VALUE_ADDR = 0x0; + XPARAM_PARAM_ADDR = x; + XPARAM_VALUE_ADDR = xparam_default[x]; + } + } +#endif + ResetIOP(); SifInitIopHeap(); // Initialize SIF services for loading modules and files. SifLoadFileInit();