1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-25 20:22:30 +01:00

Make buildable with GCC in Linux

* replace GetThreadID with std::this_thread.getId()
* name all anonymous structs and unions that contain non-trivially constructable objects
* made default constructor for big endian type noexcept to make it work with std::atomic
* move instantiated specialized template function members ouside of the class definition to comply with the standard
* added default instantiation for template parameter "=nullptr"
* used the C++11 standardized thread_local instead of the __declspec(thread)
* added transitional definitions to bridge the microsoft specific calls (compare and exchange and aligned alloc)
* removed cyclic dependency between Emulator->CPUThreadManager->CPUThread->SMutex->Emulator->...
* fixed some instances of indentation by space instead of tabs
* surrounded some unused code with an #if 0 block to make sure it doesn't compile
This commit is contained in:
Bigpet 2014-02-23 17:52:52 +01:00
parent 07135570f4
commit 9a30ce5f18
48 changed files with 190 additions and 154 deletions

View File

@ -52,9 +52,7 @@ class be_t
T m_data;
public:
be_t()
{
}
be_t() noexcept = default;
be_t(const T& value)
{

View File

@ -1,8 +1,8 @@
#pragma once
#if defined(__GNUG__)
#include <math.h>
#define _fpclass(x) fpclassify(x)
#include <cmath>
#define _fpclass(x) std::fpclassify(x)
#define __forceinline __attribute__((always_inline))
#define _byteswap_ushort(x) __builtin_bswap16(x)
#define _byteswap_ulong(x) __builtin_bswap32(x)
@ -11,4 +11,9 @@
#define mkdir(x) mkdir(x, 0777)
#define INFINITE 0xFFFFFFFF
#define _CRT_ALIGN(x) __attribute__((aligned(x)))
#define InterlockedCompareExchange(ptr,new_val,old_val) __sync_val_compare_and_swap(ptr,old_val,new_val)
#define InterlockedCompareExchange64(ptr,new_val,old_val) __sync_val_compare_and_swap(ptr,old_val,new_val)
#define _aligned_malloc(size,alignment) aligned_alloc(alignment,size)
#define _aligned_free(pointer) free(pointer)
#define DWORD int64_t
#endif

View File

@ -96,7 +96,7 @@ public:
m_cur_id = s_first_id;
}
template<typename T>
template<typename T = char>
ID_TYPE GetNewID(const std::string& name = "", T* data = nullptr, const u8 attr = 0)
{
std::lock_guard<std::mutex> lock(m_mtx_main);

View File

@ -6,9 +6,9 @@ __forceinline void SM_Sleep()
Sleep(1);
}
__forceinline DWORD SM_GetCurrentThreadId()
__forceinline std::thread::id SM_GetCurrentThreadId()
{
return GetCurrentThreadId();
return std::this_thread::get_id();
}
__forceinline u32 SM_GetCurrentCPUThreadId()

View File

@ -1,7 +1,7 @@
#pragma once
extern void SM_Sleep();
extern DWORD SM_GetCurrentThreadId();
extern std::thread::id SM_GetCurrentThreadId();
extern u32 SM_GetCurrentCPUThreadId();
extern be_t<u32> SM_GetCurrentCPUThreadIdBE();
@ -22,7 +22,7 @@ template
typename T,
u32 free_value = 0,
u32 dead_value = ~0,
void (wait)() = SM_Sleep
void (*wait)() = SM_Sleep
>
class SMutexBase
{
@ -149,7 +149,7 @@ typedef SMutexBase<u32>
typedef SMutexBase<be_t<u32>>
SMutexBE;
typedef SMutexLockerBase<DWORD, SM_GetCurrentThreadId>
typedef SMutexLockerBase<std::thread::id, SM_GetCurrentThreadId>
SMutexGeneralLocker;
typedef SMutexLockerBase<u32, SM_GetCurrentCPUThreadId>
SMutexLocker;

View File

@ -1,7 +1,7 @@
#include "stdafx.h"
#include "Thread.h"
__declspec(thread) NamedThreadBase* g_tls_this_thread = nullptr;
/*__declspec(thread)*/ thread_local NamedThreadBase* g_tls_this_thread = nullptr;
NamedThreadBase* GetCurrentNamedThread()
{
@ -124,7 +124,7 @@ void thread::start(std::function<void()> func)
catch(...)
{
ConLog.Error("Crash :(");
terminate();
std::terminate();
}
});
}

View File

@ -141,7 +141,7 @@ class StepThread : public ThreadBase
volatile bool m_exit;
protected:
StepThread(const wxString& name = "Unknown StepThread")
StepThread(const std::string& name = "Unknown StepThread")
: ThreadBase(true, name)
, m_exit(false)
{

View File

@ -3,14 +3,15 @@ cmake_minimum_required(VERSION 2.8)
project(rpcs3)
if (CMAKE_COMPILER_IS_GNUCXX)
add_definitions(-std=gnu++11)
add_definitions(-D__WXGTK__)
#add_definitions(-Wfatal-errors)
add_definitions(-w) # TODO: remove me
add_definitions(-DwxUSE_UNICODE=0)
add_definitions(-fpermissive) # TODO: remove me
add_definitions(-std=gnu++11)
#add_definitions(-D__WXGTK__)
#add_definitions(-Wfatal-errors)
add_definitions(-w) # TODO: remove me
add_definitions(-fpermissive) # TODO: remove me
endif()
SET(EXECUTABLE_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/../bin")
add_definitions(-DGL_GLEXT_PROTOTYPES)
add_definitions(-DGLX_GLXEXT_PROTOTYPES)

View File

@ -21,7 +21,7 @@ struct reservation_struct
extern reservation_struct reservation;
enum CPUThreadType
enum CPUThreadType :unsigned char
{
CPU_THREAD_PPU,
CPU_THREAD_SPU,

View File

@ -1,5 +1,6 @@
#pragma once
#include "CPUThread.h"
class CPUThread;
enum CPUThreadType : unsigned char;
class CPUThreadManager
{

View File

@ -1,3 +1,4 @@
#if 0
#include "stdafx.h"
#include "PPCThreadManager.h"
#include "PPUThread.h"
@ -33,7 +34,7 @@ PPCThread& PPCThreadManager::AddThread(PPCThreadType type)
default: assert(0);
}
new_thread->SetId(Emu.GetIdManager().GetNewID(wxString::Format("%s Thread", name), new_thread));
new_thread->SetId(Emu.GetIdManager().GetNewID(wxString::Format("%s Thread", name).ToStdString(), new_thread));
m_threads.Add(new_thread);
wxGetApp().SendDbgCommand(DID_CREATE_THREAD, new_thread);
@ -106,3 +107,4 @@ void PPCThreadManager::Exec()
m_threads[i].Exec();
}
}
#endif

View File

@ -3,9 +3,9 @@
enum PPCThreadType
{
PPC_THREAD_PPU,
PPC_THREAD_SPU,
PPC_THREAD_RAW_SPU
PPC_THREAD_PPU,
PPC_THREAD_SPU,
PPC_THREAD_RAW_SPU
};
class PPCThreadManager
@ -17,7 +17,7 @@ class PPCThreadManager
std::mutex m_mtx_thread;
wxSemaphore m_sem_task;
Stack<u32> m_delete_threads;
u32 m_raw_spu_num;
u32 m_raw_spu_num;
public:
PPCThreadManager();

View File

@ -97,7 +97,7 @@ private:
const int fpc = _fpclass(v);
#ifdef __GNUG__
if(fpc == FP_SUBNORMAL)
return signbit(v) ? -0.0f : 0.0f;
return std::signbit(v) ? -0.0f : 0.0f;
#else
if(fpc & _FPCLASS_ND) return -0.0f;
if(fpc & _FPCLASS_PD) return 0.0f;
@ -3361,7 +3361,7 @@ private:
#ifdef _MSC_VER
if(_fpclass(CPU.FPR[frb]) >= _FPCLASS_NZ)
#else
if(_fpclass(CPU.FPR[frb]) == FP_ZERO || signbit(CPU.FPR[frb]) == 0)
if(_fpclass(CPU.FPR[frb]) == FP_ZERO || std::signbit(CPU.FPR[frb]) == 0)
#endif
{
res = static_cast<float>(1.0 / CPU.FPR[frb]);

View File

@ -2,6 +2,7 @@
#include "Emu/Cell/PPCThread.h"
#include "Emu/SysCalls/SysCalls.h"
#include "rpcs3.h"
#include <cmath>
enum
{
@ -373,10 +374,10 @@ struct PPCdouble
switch (fpc)
{
case FP_NAN: return FPR_QNAN;
case FP_INFINITE: return signbit(_double) ? FPR_NINF : FPR_PINF;
case FP_SUBNORMAL: return signbit(_double) ? FPR_ND : FPR_PD;
case FP_ZERO: return signbit(_double) ? FPR_NZ : FPR_PZ;
default: return signbit(_double) ? FPR_NN : FPR_PN;
case FP_INFINITE: return std::signbit(_double) ? FPR_NINF : FPR_PINF;
case FP_SUBNORMAL: return std::signbit(_double) ? FPR_ND : FPR_PD;
case FP_ZERO: return std::signbit(_double) ? FPR_NZ : FPR_PZ;
default: return std::signbit(_double) ? FPR_NN : FPR_PN;
}
#endif

View File

@ -1,6 +1,5 @@
#include "stdafx.h"
#include "vfsLocalDir.h"
#include <direct.h>
vfsLocalDir::vfsLocalDir(vfsDevice* device) : vfsDirBase(device)
{

View File

@ -2,6 +2,7 @@
#include "GLGSRender.h"
#include "Emu/Cell/PPCInstrTable.h"
#include "Gui/RSXDebugger.h"
#include "OpenGL.h"
#define CMD_DEBUG 0
#define DUMP_VERTEX_DATA 0
@ -649,12 +650,10 @@ void GLGSRender::OnInitThread()
#ifdef _WIN32
glSwapInterval(Ini.GSVSyncEnable.GetValue() ? 1 : 0);
glGenTextures(1, &g_depth_tex);
glGenTextures(1, &g_flip_tex);
#else
if (GLXDrawable drawable = glXGetCurrentDrawable())
glXSwapIntervalEXT(glXGetCurrentDisplay(), drawable, Ini.GSVSyncEnable.GetValue() ? 1 : 0);
if (GLXDrawable drawable = glXGetCurrentDrawable()){
//glXSwapIntervalEXT(glXGetCurrentDisplay(), drawable, Ini.GSVSyncEnable.GetValue() ? 1 : 0);
}
#endif
}

View File

@ -4,7 +4,7 @@
#include "GL/GLGSRender.h"
BEGIN_EVENT_TABLE(GSFrame, wxFrame)
EVT_PAINT(GSFrame::OnPaint)
EVT_PAINT(GSFrame::OnPaint)
EVT_SIZE(GSFrame::OnSize)
END_EVENT_TABLE()

View File

@ -75,7 +75,7 @@ enum CellVideoOutPortType
enum CellVideoOutDisplayAspect
{
CELL_VIDEO_OUT_ASPECT_AUTO,
CELL_VIDEO_OUT_ASPECT_AUTO,
CELL_VIDEO_OUT_ASPECT_4_3,
CELL_VIDEO_OUT_ASPECT_16_9,
};

View File

@ -482,7 +482,7 @@ public:
int OpenDir(const wxString& name)
{
ConLog.Warning("OpenDir(%s)", name.mb_str());
ConLog.Warning("OpenDir(%s)", name.wx_str());
u64 entry_block;
if(!SearchEntry(name, entry_block))
return -1;
@ -769,7 +769,7 @@ public:
if(entry.type == vfsHDD_Entry_Dir && name != "." && name != "..")
{
ConLog.Warning("removing sub folder '%s'", name.mb_str());
ConLog.Warning("removing sub folder '%s'", name.wx_str());
RemoveBlocksDir(entry.data_block);
}
else if(entry.type == vfsHDD_Entry_File)

View File

@ -1,5 +1,6 @@
#pragma once
#include "MemoryBlock.h"
#include <vector>
enum MemoryType
{
@ -912,10 +913,10 @@ public:
return m_ptr;
}
T operator [](int index)
{
return *(m_ptr + index);
}
T operator [](int index)
{
return *(m_ptr + index);
}
template<typename T1>
operator const mem_t<T1>() const

View File

@ -96,20 +96,20 @@ struct CellDmuxResource2
be_t<u32> memSize;
be_t<u32> ppuThreadPriority;
be_t<u32> ppuThreadStackSize;
union
union cell_info
{
struct
struct spu_info
{
be_t<u32> noex_spuThreadPriority;
be_t<u32> noex_numOfSpus;
};
struct
}spu_inf;
struct spurs_info
{
be_t<u32> ex_spurs_addr;
u8 ex_priority[8];
be_t<u32> ex_maxContention;
};
};
}spurs_inf;
}cell_inf;
};
struct CellDmuxCb
@ -140,8 +140,8 @@ struct CellDmuxEsAttr
struct CellDmuxEsResource
{
be_t<u32> memAddr;
be_t<u32> memSize;
be_t<u32> memAddr;
be_t<u32> memSize;
};
struct CellDmuxAuInfo
@ -149,7 +149,7 @@ struct CellDmuxAuInfo
be_t<u32> auAddr;
be_t<u32> auSize;
be_t<u32> auMaxSize;
be_t<u64> userData;
be_t<u64> userData;
be_t<u32> ptsUpper;
be_t<u32> ptsLower;
be_t<u32> dtsUpper;

View File

@ -292,7 +292,7 @@ int cellGameContentErrorDialog(s32 type, s32 errNeedSizeKB, u32 dirName_addr)
}
std::string errorMsg = wxString::Format("%s\nSpace needed: %d KB\nDirectory name: %s",
wxString(errorName).wx_str(), errNeedSizeKB, wxString(dirName).wx_str());
wxString(errorName).wx_str(), errNeedSizeKB, wxString(dirName).wx_str()).ToStdString();
wxMessageBox(errorMsg, wxGetApp().GetAppName(), wxICON_ERROR | wxOK);
return CELL_OK;
}

View File

@ -728,9 +728,9 @@ int cellRescSetBufferAddress(mem32_t colorBuffers, mem32_t vertexArray, mem32_t
if(!colorBuffers.IsGood() || !vertexArray.IsGood() || !fragmentShader.IsGood())
return CELL_RESC_ERROR_BAD_ARGUMENT;
if(colorBuffers.GetAddr() % COLOR_BUFFER_ALIGNMENT ||
vertexArray.GetAddr() % VERTEX_BUFFER_ALIGNMENT ||
fragmentShader.GetAddr() % FRAGMENT_SHADER_ALIGNMENT)
return CELL_RESC_ERROR_BAD_ALIGNMENT;
vertexArray.GetAddr() % VERTEX_BUFFER_ALIGNMENT ||
fragmentShader.GetAddr() % FRAGMENT_SHADER_ALIGNMENT)
return CELL_RESC_ERROR_BAD_ALIGNMENT;
s_rescInternalInstance->m_colorBuffersEA_addr = colorBuffers.GetAddr();
s_rescInternalInstance->m_vertexArrayEA_addr = vertexArray.GetAddr();

View File

@ -24,14 +24,12 @@ enum
};
#pragma pack(push, 1)
struct CellSyncMutex {
union {
struct {
be_t<u16> m_freed;
be_t<u16> m_order;
};
volatile u32 m_data;
};
union CellSyncMutex {
struct cell_sync_mutex_info{
be_t<u16> m_freed;
be_t<u16> m_order;
}parts;
volatile u32 m_data;
/*
(???) Initialize: set zeros
(???) Lock: increase m_order and wait until m_freed == old m_order
@ -87,9 +85,9 @@ int cellSyncMutexLock(mem_ptr_t<CellSyncMutex> mutex)
{
reservation.clear();
}
old_order = mutex->m_order;
mutex->m_order = mutex->m_order + 1;
if (old_order == mutex->m_freed)
old_order = mutex->parts.m_order;
mutex->parts.m_order = mutex->parts.m_order + 1;
if (old_order == mutex->parts.m_freed)
{
return CELL_OK;
}
@ -127,11 +125,11 @@ int cellSyncMutexTryLock(mem_ptr_t<CellSyncMutex> mutex)
{
reservation.clear();
}
if (mutex->m_order != mutex->m_freed)
if (mutex->parts.m_order != mutex->parts.m_freed)
{
return CELL_SYNC_ERROR_BUSY;
}
mutex->m_order = mutex->m_order + 1;
mutex->parts.m_order = mutex->parts.m_order + 1;
return CELL_OK;
}
}
@ -156,7 +154,7 @@ int cellSyncMutexUnlock(mem_ptr_t<CellSyncMutex> mutex)
{
reservation.clear();
}
mutex->m_freed = mutex->m_freed + 1;
mutex->parts.m_freed = mutex->parts.m_freed + 1;
return CELL_OK;
}
}

View File

@ -1,12 +1,16 @@
#if 0
#include "stdafx.h"
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h"
#include "sceNp.h"
void sceNp_init();
void sceNpTrophy_init();
Module sceNp(0x0016, sceNpTrophy_init);
void sceNpTrophy_init()
{
}
#endif

View File

@ -129,8 +129,8 @@ int cellFsSdataOpen(u32 path_addr, int flags, mem32_t fd, mem32_t arg, u64 size)
return CELL_OK;
}
std::atomic<u32> g_FsAioReadID = 0;
std::atomic<u32> g_FsAioReadCur = 0;
std::atomic<u32> g_FsAioReadID( 0 );
std::atomic<u32> g_FsAioReadCur( 0 );
bool aio_init;
void fsAioRead(u32 fd, mem_ptr_t<CellFsAio> aio, int xid, mem_func_ptr_t<void (*)(mem_ptr_t<CellFsAio> xaio, u32 error, int xid, u64 size)> func)

View File

@ -1,4 +1,5 @@
#pragma once
#include "Modules.h"
#define RESULT(x) SC_ARGS_1 = (x)

View File

@ -3,6 +3,13 @@
#include "Modules.h"
#include "SC_FUNC.h"
namespace detail{
template<> bool CheckId(u32 id, ID*& _id,const std::string &name)
{
return Emu.GetIdManager().CheckID(id) && (_id = &Emu.GetIdManager().GetID(id))->m_name == name;
}
}
void default_syscall();
static func_caller *null_func = bind_func(default_syscall);

View File

@ -14,6 +14,20 @@
#define declCPU PPUThread& CPU = GetCurrentPPUThread
class SysCallBase;
namespace detail{
template<typename T> bool CheckId(u32 id, T*& data,const std::string &name)
{
ID* id_data;
if(!CheckId(id, id_data,name)) return false;
data = id_data->m_data->get<T>();
return true;
}
template<> bool CheckId<ID>(u32 id, ID*& _id,const std::string &name);
}
class SysCallBase //Module
{
private:
@ -94,18 +108,7 @@ public:
template<typename T> bool CheckId(u32 id, T*& data)
{
ID* id_data;
if(!CheckId(id, id_data)) return false;
data = id_data->m_data->get<T>();
return true;
}
template<> bool CheckId(u32 id, ID*& _id)
{
return Emu.GetIdManager().CheckID(id) && (_id = &Emu.GetIdManager().GetID(id))->m_name == GetName();
return detail::CheckId(id,data,GetName());
}
template<typename T>

View File

@ -86,11 +86,11 @@ int sys_lwcond_signal(mem_ptr_t<sys_lwcond_t> lwcond)
if (be_t<u32> target = mutex->attribute.ToBE() == se32(SYS_SYNC_PRIORITY) ? sq->pop_prio() : sq->pop())
{
if (mutex->owner.trylock(target) != SMR_OK)
if (mutex->vars.parts.owner.trylock(target) != SMR_OK)
{
mutex->owner.lock(tid);
mutex->vars.parts.owner.lock(tid);
mutex->recursive_count = 1;
mutex->owner.unlock(tid, target);
mutex->vars.parts.owner.unlock(tid, target);
}
}
@ -122,11 +122,11 @@ int sys_lwcond_signal_all(mem_ptr_t<sys_lwcond_t> lwcond)
while (be_t<u32> target = mutex->attribute.ToBE() == se32(SYS_SYNC_PRIORITY) ? sq->pop_prio() : sq->pop())
{
if (mutex->owner.trylock(target) != SMR_OK)
if (mutex->vars.parts.owner.trylock(target) != SMR_OK)
{
mutex->owner.lock(tid);
mutex->vars.parts.owner.lock(tid);
mutex->recursive_count = 1;
mutex->owner.unlock(tid, target);
mutex->vars.parts.owner.unlock(tid, target);
}
}
@ -163,11 +163,11 @@ int sys_lwcond_signal_to(mem_ptr_t<sys_lwcond_t> lwcond, u32 ppu_thread_id)
be_t<u32> target = ppu_thread_id;
if (mutex->owner.trylock(target) != SMR_OK)
if (mutex->vars.parts.owner.trylock(target) != SMR_OK)
{
mutex->owner.lock(tid);
mutex->vars.parts.owner.lock(tid);
mutex->recursive_count = 1;
mutex->owner.unlock(tid, target);
mutex->vars.parts.owner.unlock(tid, target);
}
if (Emu.IsStopped())
@ -197,7 +197,7 @@ int sys_lwcond_wait(mem_ptr_t<sys_lwcond_t> lwcond, u64 timeout)
u32 tid_le = GetCurrentPPUThread().GetId();
be_t<u32> tid = tid_le;
if (mutex->owner.GetOwner() != tid)
if (mutex->vars.parts.owner.GetOwner() != tid)
{
return CELL_EPERM; // caller must own this lwmutex
}
@ -205,7 +205,7 @@ int sys_lwcond_wait(mem_ptr_t<sys_lwcond_t> lwcond, u64 timeout)
sq->push(tid_le);
mutex->recursive_count = 0;
mutex->owner.unlock(tid);
mutex->vars.parts.owner.unlock(tid);
u32 counter = 0;
const u32 max_counter = timeout ? (timeout / 1000) : ~0;
@ -216,7 +216,7 @@ int sys_lwcond_wait(mem_ptr_t<sys_lwcond_t> lwcond, u64 timeout)
case SMR_OK: mutex->unlock(tid); break;
case SMR_SIGNAL: return CELL_OK;
} */
if (mutex->owner.GetOwner() == tid)
if (mutex->vars.parts.owner.GetOwner() == tid)
{
_mm_mfence();
mutex->recursive_count = 1;

View File

@ -28,7 +28,7 @@ int sys_lwmutex_create(mem_ptr_t<sys_lwmutex_t> lwmutex, mem_ptr_t<sys_lwmutex_a
}
lwmutex->attribute = attr->attr_protocol | attr->attr_recursive;
lwmutex->all_info = 0;
lwmutex->vars.all_info = 0;
lwmutex->pad = 0;
lwmutex->recursive_count = 0;
@ -68,7 +68,7 @@ int sys_lwmutex_lock(mem_ptr_t<sys_lwmutex_t> lwmutex, u64 timeout)
if (!lwmutex.IsGood()) return CELL_EFAULT;
//ConLog.Write("*** lock mutex (addr=0x%x, attr=0x%x, Nrec=%d, owner=%d, waiter=%d)",
//lwmutex.GetAddr(), (u32)lwmutex->attribute, (u32)lwmutex->recursive_count, lwmutex->owner.GetOwner(), (u32)lwmutex->waiter);
//lwmutex.GetAddr(), (u32)lwmutex->attribute, (u32)lwmutex->recursive_count, lwmutex->vars.parts.owner.GetOwner(), (u32)lwmutex->waiter);
return lwmutex->lock(GetCurrentPPUThread().GetId(), timeout ? ((timeout < 1000) ? 1 : (timeout / 1000)) : 0);
}
@ -89,7 +89,7 @@ int sys_lwmutex_unlock(mem_ptr_t<sys_lwmutex_t> lwmutex)
if (!lwmutex.IsGood()) return CELL_EFAULT;
//ConLog.Write("*** unlocking mutex (addr=0x%x, attr=0x%x, Nrec=%d, owner=%d, waiter=%d)",
//lwmutex.GetAddr(), (u32)lwmutex->attribute, (u32)lwmutex->recursive_count, (u32)lwmutex->owner.GetOwner(), (u32)lwmutex->waiter);
//lwmutex.GetAddr(), (u32)lwmutex->attribute, (u32)lwmutex->recursive_count, (u32)lwmutex->vars.parts.owner.GetOwner(), (u32)lwmutex->waiter);
return lwmutex->unlock(GetCurrentPPUThread().GetId());
}
@ -204,7 +204,7 @@ int sys_lwmutex_t::trylock(be_t<u32> tid)
{
if (!attribute.ToBE()) return CELL_EINVAL;
if (tid == owner.GetOwner())
if (tid == vars.parts.owner.GetOwner())
{
if (attribute.ToBE() & se32(SYS_SYNC_RECURSIVE))
{
@ -218,7 +218,7 @@ int sys_lwmutex_t::trylock(be_t<u32> tid)
}
}
switch (owner.trylock(tid))
switch (vars.parts.owner.trylock(tid))
{
case SMR_OK: recursive_count = 1; return CELL_OK;
case SMR_FAILED: return CELL_EBUSY;
@ -228,7 +228,7 @@ int sys_lwmutex_t::trylock(be_t<u32> tid)
int sys_lwmutex_t::unlock(be_t<u32> tid)
{
if (tid != owner.GetOwner())
if (tid != vars.parts.owner.GetOwner())
{
return CELL_EPERM;
}
@ -245,7 +245,7 @@ int sys_lwmutex_t::unlock(be_t<u32> tid)
SleepQueue* sq;
if (!Emu.GetIdManager().GetIDData(sleep_queue, sq)) return CELL_ESRCH;
target = attribute.ToBE() & se32(SYS_SYNC_FIFO) ? sq->pop() : sq->pop_prio();
case se32(SYS_SYNC_RETRY): default: owner.unlock(tid, target); break;
case se32(SYS_SYNC_RETRY): default: vars.parts.owner.unlock(tid, target); break;
}
}
return CELL_OK;
@ -271,7 +271,7 @@ int sys_lwmutex_t::lock(be_t<u32> tid, u64 timeout)
default: break;
}
switch (owner.lock(tid, timeout))
switch (vars.parts.owner.lock(tid, timeout))
{
case SMR_OK:
sq->invalidate(tid);

View File

@ -65,18 +65,15 @@ struct SleepQueue
struct sys_lwmutex_t
{
union // sys_lwmutex_variable_t
union sys_lwmutex_variable_t
{
struct // sys_lwmutex_lock_info_t
struct sys_lwmutex_lock_info_t
{
/* volatile */ SMutexBE owner;
/* volatile */ be_t<u32> waiter; // not used
};
struct
{
}parts;
/* volatile */ be_t<u64> all_info;
};
};
}vars;
be_t<u32> attribute;
be_t<u32> recursive_count;
be_t<u32> sleep_queue;

View File

@ -1,3 +1,4 @@
#if 0
#include "stdafx.h"
#include "Emu/SysCalls/SysCalls.h"
@ -19,3 +20,4 @@ int sys_raw_spu_create(u32 id_addr, u32 attr_addr)
Memory.Write32(id_addr, Emu.GetIdManager().GetNewID("raw_spu"));
return CELL_OK;
}
#endif

View File

@ -190,8 +190,8 @@ void Emulator::Load()
if(IsSelf(m_path.ToStdString()))
{
std::string self_path = m_path.mb_str();
std::string elf_path = wxFileName(m_path).GetPath().c_str();
std::string self_path = m_path.ToStdString();
std::string elf_path = wxFileName(m_path).GetPath().ToStdString();
if(wxFileName(m_path).GetFullName().CmpNoCase("EBOOT.BIN") == 0)
{
@ -216,7 +216,7 @@ void Emulator::Load()
ConLog.Write("Mount info:");
for(uint i=0; i<m_vfs.m_devices.GetCount(); ++i)
{
ConLog.Write("%s -> %s", m_vfs.m_devices[i].GetPs3Path().wx_str(), m_vfs.m_devices[i].GetLocalPath().wx_str());
ConLog.Write("%s -> %s", static_cast<const char *>(m_vfs.m_devices[i].GetPs3Path()), static_cast<const char *>(m_vfs.m_devices[i].GetLocalPath().ToAscii()));
}
ConLog.SkipLn();

View File

@ -12,8 +12,9 @@
#include "Emu/DbgConsole.h"
#include "Loader/Loader.h"
#include "SysCalls/Callback.h"
#include "SysCalls/Modules.h"
#include "event.h"
class EventManager;
extern void UnloadModules();
struct EmuInfo
{
@ -90,7 +91,7 @@ class Emulator
AudioManager m_audio_manager;
CallbackManager m_callback_manager;
CPUThread* m_ppu_callback_thr;
EventManager m_event_manager;
EventManager &m_event_manager;
VFS m_vfs;

View File

@ -167,7 +167,7 @@ void InterpreterDisAsmFrame::OnKeyDown(wxKeyEvent& event)
{
if(event.GetKeyCode() == WXK_SPACE)
{
wxCommandEvent ce;
wxCommandEvent ce;
DoStep(ce);
return;
}
@ -222,7 +222,7 @@ void InterpreterDisAsmFrame::OnResize(wxSizeEvent& event)
void InterpreterDisAsmFrame::DoUpdate()
{
wxCommandEvent ce;
wxCommandEvent ce;
Show_PC(ce);
WriteRegs();
WriteCallStack();

View File

@ -228,7 +228,7 @@ void MainFrame::InstallPkg(wxCommandEvent& WXUNUSED(event))
Emu.Stop();
// Open and install PKG file
std::string filePath = ctrl.GetPath();
std::string filePath = ctrl.GetPath().ToStdString();
wxFile pkg_f(filePath, wxFile::read); // TODO: Use VFS to install PKG files
if (pkg_f.IsOpened())

View File

@ -25,7 +25,7 @@ MemoryViewerPanel::MemoryViewerPanel(wxWindow* parent)
wxStaticBoxSizer& s_tools_mem_bytes = *new wxStaticBoxSizer(wxHORIZONTAL, this, "Bytes");
sc_bytes = new wxSpinCtrl(this, wxID_ANY, "16", wxDefaultPosition, wxSize(44,-1));
sc_bytes->SetRange(1, 16);
sc_bytes->SetRange(1, 16);
s_tools_mem_bytes.Add(sc_bytes);
wxStaticBoxSizer& s_tools_mem_buttons = *new wxStaticBoxSizer(wxHORIZONTAL, this, "Control");
@ -52,7 +52,7 @@ MemoryViewerPanel::MemoryViewerPanel(wxWindow* parent)
s_tools_img_size.Add(new wxStaticText(this, wxID_ANY, " x "));
s_tools_img_size.Add(sc_img_size_y);
sc_img_size_x->SetRange(1, 8192);
sc_img_size_x->SetRange(1, 8192);
sc_img_size_y->SetRange(1, 8192);
wxStaticBoxSizer& s_tools_img_mode = *new wxStaticBoxSizer(wxHORIZONTAL, this, "Mode");

View File

@ -58,7 +58,7 @@ VFSEntrySettingsDialog::VFSEntrySettingsDialog(wxWindow* parent, VFSManagerEntry
m_tctrl_mount->SetValue(m_entry.mount);
m_ch_type->SetSelection(m_entry.device);
wxCommandEvent ce;
wxCommandEvent ce;
OnSelectType(ce);
}

View File

@ -347,10 +347,10 @@ VHDDSetInfoDialog::VHDDSetInfoDialog(wxWindow* parent) : wxDialog(parent, wxID_A
m_ch_type->Append("MB");
m_ch_type->Append("GB");
m_spin_size->SetRange(1, 0x7fffffff);
m_spin_size->SetRange(1, 0x7fffffff);
m_spin_size->SetValue(64);
m_ch_type->SetSelection(3);
m_spin_block_size->SetRange(64, 0x7fffffff);
m_spin_block_size->SetRange(64, 0x7fffffff);
m_spin_block_size->SetValue(2048);
Connect(wxID_OK, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(VHDDSetInfoDialog::OnOk));
}

View File

@ -155,7 +155,7 @@ Ini::Ini()
wxGetCwd() + "\\rpcs3.ini",
wxEmptyString, wxCONFIG_USE_LOCAL_FILE );
#else
m_Config = new wxConfig("rpcs3");
m_Config = new wxConfig("rpcs3");
#endif
}

View File

@ -23,7 +23,7 @@ bool PKGLoader::Install(std::string dest, bool show)
return false;
std::string titleID = std::string(m_header.title_id).substr(7, 9);
std::string decryptedFile = wxGetCwd() + "/dev_hdd1/" + titleID + ".dec";
std::string decryptedFile = wxGetCwd().ToStdString() + "/dev_hdd1/" + titleID + ".dec";
if (wxDirExists(dest+titleID)) {
wxMessageDialog d_overwrite(NULL, "Another installation was found. Do you want to overwrite it?", "PKG Decrypter / Installer", wxYES_NO|wxCENTRE);

View File

@ -1,5 +1,4 @@
#pragma once
#include "Gui/MainFrame.h"
template<typename T> T min(const T a, const T b) { return a < b ? a : b; }

View File

@ -3,19 +3,33 @@
#define NOMINMAX
#ifndef QT_UI
#ifdef _WIN32
#include <wx/msw/setup.h>
#include <wx/wx.h>
#endif
#include <wx/config.h>
#include <wx/string.h>
#include <wx/propdlg.h>
#include <wx/stdpaths.h>
#include <wx/filename.h>
#include <wx/filefn.h>
#include <wx/dcclient.h>
#include <wx/wfstream.h>
#include <wx/dir.h>
#include <wx/spinctrl.h>
#include <wx/datetime.h>
#include <wx/filepicker.h>
#include <wx/menu.h>
#include <wx/menuitem.h>
#include <wx/stattext.h>
#include <wx/msgdlg.h>
#include "wx/gauge.h"
#include <wx/stattext.h>
#include "wx/scrolbar.h"
#include "wx/frame.h"
#include <wx/combobox.h>
#include <wx/checkbox.h>
#include "wx/app.h"
#include <wx/wxprec.h>
#endif
@ -199,12 +213,15 @@ enum Status
#include "AppConnector.h"
#include "Emu/SysCalls/Callback.h"
#include "Ini.h"
#include "Gui/FrameBase.h"
#include "Gui/ConLog.h"
#include "Emu/Memory/Memory.h"
#include "Emu/System.h"
#include "Emu/Cell/PPUThread.h"
#include "Emu/SysCalls/Modules.h"
#include "Emu/FS/vfsDirBase.h"
#include "Emu/FS/vfsFileBase.h"