//Reset Sysmem/Regs -- Pvr is not changed , bios/flash are not zero'd out void mem_Reset(bool Manual) { //mem is reseted on hard restart(power on) , not manual... if (!Manual) { //fill mem w/ 0's mem_b.Zero(); char* temp_path=GetEmuPath("data/"); u32 pl=(u32)strlen(temp_path); #ifdef BUILD_DREAMCAST strcat(temp_path,"syscalls.bin"); LoadFileToSh4Mem(0x00000, temp_path); temp_path[pl]=0; strcat(temp_path,"IP.bin"); LoadFileToSh4Mem(0x08000, temp_path); temp_path[pl]=0; #endif free(temp_path); LoadSyscallHooks(); } //Reset registers sh4_area0_Reset(Manual); sh4_internal_reg_Reset(Manual); MMU_Reset(Manual); }
bool VramLockedWrite(u8* address) { size_t offset=address-vram.data; if (offset<VRAM_SIZE) { size_t addr_hash = offset/PAGE_SIZE; vector<vram_block*>* list=&VramLocks[addr_hash]; { vramlist_lock.Lock(); for (size_t i=0;i<list->size();i++) { if ((*list)[i]) { libPvr_LockedBlockWrite((*list)[i],(u32)offset); if ((*list)[i]) { msgboxf("Error : pvr is supposed to remove lock",MBX_OK); dbgbreak; } } } list->clear(); vram.UnLockRegion((u32)offset&(~(PAGE_SIZE-1)),PAGE_SIZE); //TODO: Fix this for 32M wrap as well if (_nvmem_enabled() && VRAM_SIZE == 0x800000) { vram.UnLockRegion((u32)offset&(~(PAGE_SIZE-1)) + VRAM_SIZE,PAGE_SIZE); } vramlist_lock.Unlock(); } return true; } else return false; }
vram_block* libCore_vramlock_Lock(u32 start_offset64,u32 end_offset64,void* userdata) { vram_block* block=(vram_block* )malloc(sizeof(vram_block)); if (end_offset64>(VRAM_SIZE-1)) { msgboxf("vramlock_Lock_64: end_offset64>(VRAM_SIZE-1) \n Tried to lock area out of vram , possibly bug on the pvr plugin",MBX_OK); end_offset64=(VRAM_SIZE-1); } if (start_offset64>end_offset64) { msgboxf("vramlock_Lock_64: start_offset64>end_offset64 \n Tried to lock negative block , possibly bug on the pvr plugin",MBX_OK); start_offset64=0; } block->end=end_offset64; block->start=start_offset64; block->len=end_offset64-start_offset64+1; block->userdata=userdata; block->type=64; { vramlist_lock.Lock(); vram.LockRegion(block->start,block->len); //TODO: Fix this for 32M wrap as well if (_nvmem_enabled() && VRAM_SIZE == 0x800000) { vram.LockRegion(block->start + VRAM_SIZE, block->len); } vramlock_list_add(block); vramlist_lock.Unlock(); } return block; }
//Reset Sysmem/Regs -- Pvr is not changed , bios/flash are not zeroed out void mem_Reset(bool Manual) { //mem is reseted on hard restart(power on) , not manual... if (!Manual) { //fill mem w/ 0's mem_b.Zero(); } //Reset registers sh4_area0_Reset(Manual); sh4_mmr_reset(); MMU_reset(); }