X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pico%2Fcarthw%2Fsvp%2Fsvp.c;h=a3ed89eb52e78517d9a398031fd577ff3ceed08a;hb=aecb3335547df2341014f01d74e2b088960d7d8e;hp=6248120a79838596a82c406aba554a82f8efb854;hpb=41397701210c08b9d25ca66cbe372c7ed86d6927;p=picodrive.git diff --git a/pico/carthw/svp/svp.c b/pico/carthw/svp/svp.c index 6248120..a3ed89e 100644 --- a/pico/carthw/svp/svp.c +++ b/pico/carthw/svp/svp.c @@ -7,6 +7,7 @@ #include "../../pico_int.h" +#include "../../cpu/drc/cmn.h" #include "compiler.h" svp_t *svp = NULL; @@ -97,25 +98,34 @@ static int PicoSVPDma(unsigned int source, int len, unsigned short **srcp, unsig void PicoSVPInit(void) { +#ifndef PSP + // this is to unmap tcache and make + // mem available for large ROMs, MCD, etc. + drc_cmn_cleanup(); +#endif +} + +static void PicoSVPExit(void) +{ +#ifndef PSP + ssp1601_dyn_exit(); +#endif } void PicoSVPStartup(void) { - void *tmp; + int ret; elprintf(EL_STATUS, "SVP startup"); - tmp = realloc(Pico.rom, 0x200000 + sizeof(*svp)); - if (tmp == NULL) - { + ret = PicoCartResize(Pico.romsize + sizeof(*svp)); + if (ret != 0) { elprintf(EL_STATUS|EL_SVP, "OOM for SVP data"); return; } - //PicoOpt &= ~0x20000; - Pico.rom = tmp; - svp = (void *) ((char *)tmp + 0x200000); + svp = (void *) ((char *)Pico.rom + Pico.romsize); memset(svp, 0, sizeof(*svp)); // init SVP compiler @@ -133,6 +143,7 @@ void PicoSVPStartup(void) PicoDmaHook = PicoSVPDma; PicoResetHook = PicoSVPReset; PicoLineHook = PicoSVPLine; + PicoCartUnloadHook = PicoSVPExit; // save state stuff svp_states[0].ptr = svp->iram_rom; @@ -142,4 +153,3 @@ void PicoSVPStartup(void) PicoAHW |= PAHW_SVP; } -