Merge pull request #559 from Nekotekina/master

Build fix
This commit is contained in:
Alexandro Sánchez Bach 2014-07-12 18:07:43 +02:00
commit 5835669dd9
41 changed files with 86 additions and 124 deletions

View File

@ -154,7 +154,7 @@ bool rFile::Open(const std::string &filename, rFile::OpenMode mode, int access)
bool rFile::Exists(const std::string &file)
{
#ifdef _WIN32
std::wstring wstr = ConvertUTF8ToWString(filename);
std::wstring wstr = ConvertUTF8ToWString(file);
return GetFileAttributes(wstr.c_str()) != 0xFFFFFFFF;
#else
struct stat buffer;
@ -206,8 +206,10 @@ bool rRmdir(const std::string &dir)
{
#ifdef _WIN32
if (!RemoveDirectory(ConvertUTF8ToWString(dir).c_str())) {
ELOG("Error deleting directory %s: %i", dir, GetLastError());
LOG_ERROR(GENERAL, "Error deleting directory %s: %i", dir, GetLastError());
return false;
}
return true;
#else
rmdir(dir.c_str());
#endif

View File

@ -168,7 +168,7 @@ private:
}
}
void MFVSCR(u32 vd)
void MFVSCR(u32 vd) //nf
{
CPU.VPR[vd].Clear();
CPU.VPR[vd]._u32[0] = CPU.VSCR.VSCR;

View File

@ -75,15 +75,15 @@ union FPSCRhdr
u32 RN :2; //Floating-point rounding control
u32 NI :1; //Floating-point non-IEEE mode
u32 XE :1; //Floating-point inexact exception enable
u32 ZE :1; //IEEE oating-point zero divide exception enable
u32 UE :1; //IEEE floating-point underflow exception enable
u32 OE :1; //IEEE floating-point overflow exception enable
u32 ZE :1; //IEEE floating-point zero divide exception enable
u32 UE :1; //IEEE floating-point underflow exception enable
u32 OE :1; //IEEE floating-point overflow exception enable
u32 VE :1; //Floating-point invalid operation exception enable
u32 VXCVI :1; //Floating-point invalid operation exception for invalid integer convert
u32 VXSQRT :1; //Floating-point invalid operation exception for invalid square root
u32 VXSOFT :1; //Floating-point invalid operation exception for software request
u32 :1; //Reserved
u32 FPRF :5; //Floating-point result ags
u32 FPRF :5; //Floating-point result flags
u32 FI :1; //Floating-point fraction inexact
u32 FR :1; //Floating-point fraction rounded
u32 VXVC :1; //Floating-point invalid operation exception for invalid compare
@ -94,8 +94,8 @@ union FPSCRhdr
u32 VXSNAN :1; //Floating-point invalid operation exception for SNaN
u32 XX :1; //Floating-point inexact exception
u32 ZX :1; //Floating-point zero divide exception
u32 UX :1; //Floating-point underow exception
u32 OX :1; //Floating-point overow exception
u32 UX :1; //Floating-point underflow exception
u32 OX :1; //Floating-point overflow exception
u32 VX :1; //Floating-point invalid operation exception summary
u32 FEX :1; //Floating-point enabled exception summary
u32 FX :1; //Floating-point exception summary
@ -131,7 +131,7 @@ union MSRhdr
//1 Instruction address translation is enabled.
u64 IR : 1;
//Exception prefix. The setting of this bit specifies whether an exception vector offset
//Exception prefix. The setting of this bit specifies whether an exception vector offset
//is prepended with Fs or 0s. In the following description, nnnnn is the offset of the
//exception.
//0 Exceptions are vectored to the physical address 0x0000_0000_000n_nnnn in 64-bit implementations.
@ -168,9 +168,9 @@ union MSRhdr
u64 ME : 1;
//Floating-point available
//0 The processor prevents dispatch of oating-point instructions, including
//oating-point loads, stores, and moves.
//1 The processor can execute oating-point instructions.
//0 The processor prevents dispatch of floating-point instructions, including
//floating-point loads, stores, and moves.
//1 The processor can execute floating-point instructions.
u64 FP : 1;
//Privilege level
@ -261,7 +261,7 @@ union VSCRhdr
{
/*
Saturation. A sticky status bit indicating that some field in a saturating instruction saturated since the last
time SAT was cleared. In other words when SAT = 1 it remains set to 1 until it is cleared to 0 by an
time SAT was cleared. In other words when SAT = '1' it remains set to '1' until it is cleared to '0' by an
mtvscr instruction.
1 The vector saturate instruction implicitly sets when saturation has occurred on the results one of
the vector instructions having saturate in its name:
@ -283,12 +283,12 @@ union VSCRhdr
/*
Non-Java. A mode control bit that determines whether vector floating-point operations will be performed
in a Java-IEEE-C9Xcompliant mode or a possibly faster non-Java/non-IEEE mode.
0 The Java-IEEE-C9Xcompliant mode is selected. Denormalized values are handled as specified
in a Java-IEEE-C9X-compliant mode or a possibly faster non-Java/non-IEEE mode.
0 The Java-IEEE-C9X-compliant mode is selected. Denormalized values are handled as specified
by Java, IEEE, and C9X standard.
1 The non-Java/non-IEEEcompliant mode is selected. If an element in a source vector register
contains a denormalized value, the value 0 is used instead. If an instruction causes an underflow
exception, the corresponding element in the target VR is cleared to 0. In both cases, the 0
1 The non-Java/non-IEEE-compliant mode is selected. If an element in a source vector register
contains a denormalized value, the value '0' is used instead. If an instruction causes an underflow
exception, the corresponding element in the target VR is cleared to '0'. In both cases, the '0'
has the same sign as the denormalized or underflowing value.
*/
u32 NJ : 1;

View File

@ -2,8 +2,8 @@
//DynamicMemoryBlockBase
template<typename PT>
DynamicMemoryBlockBase<PT>::DynamicMemoryBlockBase()
: PT()
, m_max_size(0)
: PT()
, m_max_size(0)
{
}
@ -37,11 +37,7 @@ bool DynamicMemoryBlockBase<PT>::IsInMyRange(const u64 addr, const u32 size)
template<typename PT>
bool DynamicMemoryBlockBase<PT>::IsMyAddress(const u64 addr)
{
if (!IsInMyRange(addr)) return false;
const u32 index = MemoryBlock::FixAddr(addr) >> 12;
return m_pages[index] != nullptr;
return IsInMyRange(addr);
}
template<typename PT>
@ -50,11 +46,11 @@ MemoryBlock* DynamicMemoryBlockBase<PT>::SetRange(const u64 start, const u32 siz
std::lock_guard<std::mutex> lock(m_lock);
m_max_size = PAGE_4K(size);
MemoryBlock::SetRange(start, 0);
const u32 page_count = m_max_size >> 12;
m_pages.resize(page_count);
memset(m_pages.data(), 0, sizeof(u8*) * page_count);
if (!MemoryBlock::SetRange(start, 0))
{
assert(0);
return nullptr;
}
return this;
}
@ -67,8 +63,6 @@ void DynamicMemoryBlockBase<PT>::Delete()
m_allocated.clear();
m_max_size = 0;
m_pages.clear();
MemoryBlock::Delete();
}
@ -107,17 +101,6 @@ template<typename PT>
void DynamicMemoryBlockBase<PT>::AppendMem(u64 addr, u32 size) /* private */
{
m_allocated.emplace_back(addr, size);
u8* pointer = (u8*) m_allocated.back().mem;
const u32 first = MemoryBlock::FixAddr(addr) >> 12;
const u32 last = first + ((size - 1) >> 12);
for (u32 i = first; i <= last; i++)
{
m_pages[i] = pointer;
pointer += 4096;
}
}
template<typename PT>
@ -186,24 +169,6 @@ bool DynamicMemoryBlockBase<PT>::Free(u64 addr)
{
if (addr == m_allocated[num].addr)
{
/* if(IsLocked(m_allocated[num].addr)) return false; */
const u32 first = MemoryBlock::FixAddr(addr) >> 12;
const u32 last = first + ((m_allocated[num].size - 1) >> 12);
// check if locked:
//for (u32 i = first; i <= last; i++)
//{
// if (!m_pages[i]) return false;
//}
// clear pointers:
for (u32 i = first; i <= last; i++)
{
m_pages[i] = nullptr;
}
//LOG_NOTICE(MEMORY, "Free(0x%llx)", addr);
m_allocated.erase(m_allocated.begin() + num);
@ -221,21 +186,9 @@ bool DynamicMemoryBlockBase<PT>::Free(u64 addr)
}
template<typename PT>
u8* DynamicMemoryBlockBase<PT>::GetMem(u64 addr) const // lock-free, addr is fixed
u8* DynamicMemoryBlockBase<PT>::GetMem(u64 addr) const
{
const u32 index = addr >> 12;
if (index < m_pages.size())
{
if (u8* res = m_pages[index])
{
return res + (addr & 4095);
}
}
LOG_ERROR(MEMORY, "GetMem(0x%llx) from not allocated address.", addr);
assert(0);
return nullptr;
return MemoryBlock::GetMem(addr);
}
template<typename PT>

View File

@ -69,16 +69,21 @@ void MemoryBlock::Init()
range_start = 0;
range_size = 0;
mem = nullptr;
mem = Memory.GetMemFromAddr(0);
}
void MemoryBlock::InitMemory()
{
if (!range_size) return;
if (!range_size)
{
mem = Memory.GetMemFromAddr(range_start);
}
else
{
Free();
mem_inf = new MemBlockInfo(range_start, range_size);
mem = (u8*)mem_inf->mem;
}
}
void MemoryBlock::Free()
@ -88,13 +93,11 @@ void MemoryBlock::Free()
delete mem_inf;
mem_inf = nullptr;
}
mem = nullptr;
}
void MemoryBlock::Delete()
{
Free();
safe_free(mem);
Init();
}
@ -135,6 +138,8 @@ u8* MemoryBlock::GetMemFromAddr(const u64 addr)
MemoryBlock* MemoryBlock::SetRange(const u64 start, const u32 size)
{
if (start + size > 0x100000000) return nullptr;
range_start = start;
range_size = size;

View File

@ -286,6 +286,8 @@ public:
block->Delete();
}
RSXIOMem.Delete();
MemoryBlocks.clear();
#ifdef _WIN32

View File

@ -390,8 +390,6 @@ class DynamicMemoryBlockBase : public PT
{
mutable std::mutex m_lock;
std::vector<MemBlockInfo> m_allocated; // allocation info
std::vector<u8*> m_pages; // real addresses of every 4096 byte pages (array size should be fixed)
u32 m_max_size;
public:

View File

@ -1,5 +1,5 @@
#if 0
#include "stdafx.h"
#if 0
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h"

View File

@ -1,5 +1,5 @@
#if 0
#include "stdafx.h"
#if 0
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h"

View File

@ -1,5 +1,5 @@
#if 0
#include "stdafx.h"
#if 0
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h"

View File

@ -1,5 +1,6 @@
#if 0
#include "stdafx.h"
#if 0
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h"

View File

@ -1,5 +1,5 @@
#if 0
#include "stdafx.h"
#if 0
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h"

View File

@ -1,5 +1,5 @@
#if 0
#include "stdafx.h"
#if 0
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h"

View File

@ -1,5 +1,5 @@
#if 0
#include "stdafx.h"
#if 0
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h"

View File

@ -1,5 +1,5 @@
#if 0
#include "stdafx.h"
#if 0
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h"

View File

@ -1,5 +1,5 @@
#if 0
#include "stdafx.h"
#if 0
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h"

View File

@ -1,5 +1,5 @@
#if 0
#include "stdafx.h"
#if 0
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h"

View File

@ -1,5 +1,5 @@
#if 0
#include "stdafx.h"
#if 0
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h"

View File

@ -1,5 +1,5 @@
#if 0
#include "stdafx.h"
#if 0
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h"

View File

@ -1,5 +1,5 @@
#if 0
#include "stdafx.h"
#if 0
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h"

View File

@ -1,5 +1,5 @@
#if 0
#include "stdafx.h"
#if 0
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h"

View File

@ -1,5 +1,5 @@
#if 0
#include "stdafx.h"
#if 0
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h"

View File

@ -1,5 +1,5 @@
#if 0
#include "stdafx.h"
#if 0
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h"

View File

@ -1,5 +1,5 @@
#if 0
#include "stdafx.h"
#if 0
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h"

View File

@ -1,5 +1,5 @@
#if 0
#include "stdafx.h"
#if 0
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h"

View File

@ -1,5 +1,5 @@
#if 0
#include "stdafx.h"
#if 0
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h"

View File

@ -1,5 +1,5 @@
#if 0
#include "stdafx.h"
#if 0
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h"

View File

@ -1,5 +1,5 @@
#if 0
#include "stdafx.h"
#if 0
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h"

View File

@ -1,5 +1,5 @@
#if 0
#include "stdafx.h"
#if 0
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h"

View File

@ -1,5 +1,5 @@
#if 0
#include "stdafx.h"
#if 0
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h"

View File

@ -1,5 +1,5 @@
#if 0
#include "stdafx.h"
#if 0
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h"

View File

@ -1,5 +1,5 @@
#if 0
#include "stdafx.h"
#if 0
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h"

View File

@ -1,5 +1,5 @@
#if 0
#include "stdafx.h"
#if 0
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h"

View File

@ -1,5 +1,5 @@
#if 0
#include "stdafx.h"
#if 0
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h"

View File

@ -1,5 +1,5 @@
#if 0
#include "stdafx.h"
#if 0
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h"

View File

@ -1,5 +1,5 @@
#if 0
#include "stdafx.h"
#if 0
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h"

View File

@ -1,5 +1,5 @@
#if 0
#include "stdafx.h"
#if 0
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h"

View File

@ -1,5 +1,5 @@
#if 0
#include "stdafx.h"
#if 0
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h"

View File

@ -1,5 +1,5 @@
#if 0
#include "stdafx.h"
#if 0
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h"

View File

@ -14,11 +14,11 @@ Module *libmixer = nullptr;
CellSurMixerConfig surMixer;
#define SUR_PORT (7)
u32 surMixerCb = 0;
u32 surMixerCbArg = 0;
u32 surMixerCb;
u32 surMixerCbArg;
std::mutex mixer_mutex;
float mixdata[8*256];
u64 mixcount = 0;
u64 mixcount;
std::vector<SSPlayer> ssp;
@ -342,6 +342,9 @@ int cellSurMixerCreate(const mem_ptr_t<CellSurMixerConfig> config)
libmixer->Warning("*** surMixer created (ch1=%d, ch2=%d, ch6=%d, ch8=%d)",
(u32)surMixer.chStrips1, (u32)surMixer.chStrips2, (u32)surMixer.chStrips6, (u32)surMixer.chStrips8);
mixcount = 0;
surMixerCb = 0;
thread t("Surmixer Thread", []()
{
AudioPortConfig& port = m_config.m_ports[SUR_PORT];
@ -350,8 +353,6 @@ int cellSurMixerCreate(const mem_ptr_t<CellSurMixerConfig> config)
mixerCb->SetName("Surmixer Callback");
mixcount = 0;
while (port.m_is_audio_port_opened)
{
if (Emu.IsStopped())

View File

@ -1,6 +1,6 @@
#pragma once
class SFunc;
struct SFunc;
class StaticFuncManager
{