static void tecmo_adpcm_int() { #if 0 static int adpcm_data = -1; if (adpcm_pos >= adpcm_end || adpcm_pos >= get_region_size(REGION_SOUND1)) MSM5205_reset_w(0,1); else if (adpcm_data != -1) { MSM5205_data_w(0,adpcm_data & 0x0f); adpcm_data = -1; } else { unsigned char *ROM = load_region[REGION_SOUND1]; adpcm_data = ROM[adpcm_pos++]; MSM5205_data_w(0,adpcm_data >> 4); } #else if (adpcm_end > adpcm_pos) { live_msm_decode(adpcm_pos,adpcm_end-adpcm_pos-1); adpcm_pos++; } #endif }
static void load_callback() { int i,temp; for (i=0; i<num_voices; i++) { adpcm[i].base = adpcm[i].region_base + voices_offs[i]; } for (i=0; i<num_voices / MAX_OKIM6295_VOICES; i++) { if (load_region[REGION_SMP1 + i] && old_bank[i] >= 0 && get_region_size(REGION_SMP1 + i) > 0x40000) { /* I am not really sure doing this is a good idea : it is quite dangerous since the oki does not always use bankswitch. I try to detect if it needs bankswitch, and then restore the old state */ temp = old_bank[i]++; OKIM6295_bankswitch(i,temp); } } }
void list_mem(void) { struct mem_block *mem; int cnt[100],size[100],n,tcnt=0,tsize=0,rsize=0; extern int mmem_usage; extern int get_region_maxsize(int nr); bzero(cnt,sizeof(cnt)); bzero(size,sizeof(size)); #ifdef DEBUG xlog("mem-DEBUG version"); #endif pthread_mutex_lock(&alloc_mutex); for (mem=mb; mem; mem=mem->next) { //xlog("%p: size=%d, ID=%s",mem,mem->size,memname[mem->ID]); if (mem->ID>99 || mem->ID<1) { elog("list_mem found illegal mem ID: %d at %p, giving up.",mem->ID,mem); pthread_mutex_unlock(&alloc_mutex); return; } #ifdef DEBUG if (memcmp(mem->magic,"ABCDEFGHIJKLMNOPQRSTUVWXYZ012345",32)) { elog("memory fail: top, type=%d, size=%d, p=%p",mem->ID,mem->size,mem); elog("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d", mem->content[0], mem->content[1], mem->content[2], mem->content[3], mem->content[4], mem->content[5], mem->content[6], mem->content[7], mem->content[8], mem->content[9], mem->content[10], mem->content[11], mem->content[12], mem->content[13], mem->content[14], mem->content[15]); } if (memcmp(mem->content+mem->size,"abcdefghijklmnopqrstuvwxyz678901",32)) { elog("memory fail: bottom, type=%d, size=%d, p=%p",mem->ID,mem->size,mem); elog("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d", mem->content[0], mem->content[1], mem->content[2], mem->content[3], mem->content[4], mem->content[5], mem->content[6], mem->content[7], mem->content[8], mem->content[9], mem->content[10], mem->content[11], mem->content[12], mem->content[13], mem->content[14], mem->content[15]); } #endif cnt[mem->ID]++; size[mem->ID]+=mem->size; tcnt++; tsize+=mem->size; } for (n=0; n<100; n++) { if (get_region_size(n)) { xlog("%-10.10s: %4d blks, %8.2fK (size %7.3fM/%3.0fM %5.1f%%, free: %8.2fK, %4d blks)", memname[n], cnt[n],size[n]/(1024.0), get_region_size(n)/1024.0/1024.0, get_region_maxsize(n)/1024.0/1024.0, 100.0/get_region_maxsize(n)*get_region_size(n), get_region_freesize(n)/1024.0, get_region_free(n)); rsize+=get_region_size(n); //_list_free(n); } } xlog("total: %d blocks, total size: %.2fM (%.2fM, r=%.2fM/%.2fM)",tcnt,tsize/(1024.0*1024.0),msize/(1024.0*1024.0),rsize/1024.0/1024.0,mmem_usage/1024.0/1024.0); pthread_mutex_unlock(&alloc_mutex); }