// XXX: rename\r
PICO_INTERNAL void SekPackCpu(unsigned char *cpu, int is_sub)\r
{\r
- u32 pc=0;\r
-\r
#if defined(EMU_C68K)\r
struct Cyclone *context = is_sub ? &PicoCpuCS68k : &PicoCpuCM68k;\r
memcpy(cpu,context->d,0x40);\r
\r
void SekInitIdleDet(void)\r
{\r
- unsigned short **tmp;\r
- tmp = realloc(idledet_ptrs, 0x200 * sizeof(tmp[0]));\r
- if (tmp == NULL) {\r
- free(idledet_ptrs);\r
- idledet_ptrs = NULL;\r
- }\r
- else\r
- idledet_ptrs = tmp;\r
idledet_count = idledet_bads = 0;\r
idledet_start_frame = Pico.m.frame_count + 360;\r
#ifdef IDLE_STATS\r
int SekIsIdleCode(unsigned short *dst, int bytes)\r
{\r
// printf("SekIsIdleCode %04x %i\n", *dst, bytes);\r
- switch (bytes)\r
+ if (idledet_count >= 0) switch (bytes)\r
{\r
case 2:\r
if ((*dst & 0xf000) != 0x6000) // not another branch\r
return 1; // don't patch\r
}\r
\r
- if (idledet_count >= 0x200 && (idledet_count & 0x1ff) == 0) {\r
+ if (!idledet_ptrs || (idledet_count & 0x1ff) == 0) {\r
unsigned short **tmp;\r
tmp = realloc(idledet_ptrs, (idledet_count+0x200) * sizeof(tmp[0]));\r
if (tmp == NULL)\r
else\r
elprintf(EL_STATUS|EL_IDLE, "idle: don't know how to restore %04x", *op);\r
}\r
+\r
idledet_count = -1;\r
+ if (idledet_ptrs)\r
+ free(idledet_ptrs);\r
+ idledet_ptrs = NULL;\r
}\r
\r
\r