From d8bd34b57ede9d47565be25704e4b1985a543452 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Bla=C5=BEevi=C4=87?= Date: Tue, 19 Nov 2013 11:30:58 +0100 Subject: [PATCH] Start porting to GNU compiler --- Utilities/Array.h | 12 +- Utilities/BEType.h | 12 +- Utilities/GNU.h | 13 ++ Utilities/IdManager.h | 2 +- Utilities/Thread.h | 2 +- Utilities/Timer.h | 33 ++-- rpcs3/CMakeLists.txt | 37 +++++ rpcs3/Emu/ARMv7/ARMv7DisAsm.h | 6 +- rpcs3/Emu/CPU/CPUDecoder.h | 160 +++++++++---------- rpcs3/Emu/CPU/CPUDisAsm.h | 6 +- rpcs3/Emu/CPU/CPUThread.cpp | 4 +- rpcs3/Emu/CPU/CPUThread.h | 6 +- rpcs3/Emu/CPU/CPUThreadManager.cpp | 12 +- rpcs3/Emu/Cell/PPCDisAsm.h | 82 +++++----- rpcs3/Emu/Cell/PPCInstrTable.h | 28 ++-- rpcs3/Emu/Cell/PPCThreadManager.cpp | 7 +- rpcs3/Emu/Cell/PPCThreadManager.h | 10 +- rpcs3/Emu/Cell/PPUDisAsm.h | 82 +++++----- rpcs3/Emu/Cell/PPUInterpreter.h | 20 ++- rpcs3/Emu/Cell/PPUProgramCompiler.cpp | 32 ++-- rpcs3/Emu/Cell/PPUThread.h | 15 +- rpcs3/Emu/Cell/RawSPUThread.cpp | 6 +- rpcs3/Emu/Cell/SPUDecoder.h | 2 +- rpcs3/Emu/Cell/SPUDisAsm.h | 20 +-- rpcs3/Emu/Cell/SPUInterpreter.h | 2 +- rpcs3/Emu/Cell/SPUThread.h | 4 +- rpcs3/Emu/FS/VFS.cpp | 4 +- rpcs3/Emu/FS/vfsDirBase.cpp | 2 +- rpcs3/Emu/GS/GL/GLBuffers.cpp | 2 +- rpcs3/Emu/GS/GL/GLFragmentProgram.cpp | 10 +- rpcs3/Emu/GS/GL/GLGSRender.cpp | 48 +++--- rpcs3/Emu/GS/GL/GLGSRender.h | 4 +- rpcs3/Emu/GS/GL/GLProcTable.tbl | 16 +- rpcs3/Emu/GS/GL/GLProgram.cpp | 4 +- rpcs3/Emu/GS/GL/GLProgramBuffer.cpp | 6 +- rpcs3/Emu/GS/GL/GLVertexProgram.cpp | 6 +- rpcs3/Emu/GS/GL/OpenGL.cpp | 6 +- rpcs3/Emu/GS/GL/OpenGL.h | 8 +- rpcs3/Emu/GS/Null/NullGSRender.h | 16 +- rpcs3/Emu/GS/sysutil_video.h | 4 +- rpcs3/Emu/HDD/HDD.h | 6 +- rpcs3/Emu/Memory/DynamicMemoryBlockBase.inl | 8 +- rpcs3/Emu/Memory/Memory.cpp | 5 + rpcs3/Emu/Memory/Memory.h | 91 +++++------ rpcs3/Emu/SysCalls/Modules.cpp | 6 + rpcs3/Emu/SysCalls/Modules.h | 6 +- rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp | 4 +- rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp | 4 +- rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp | 4 +- rpcs3/Emu/SysCalls/Modules/cellRtc.cpp | 6 +- rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp | 14 +- rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp | 2 +- rpcs3/Emu/SysCalls/Modules/sys_fs.cpp | 6 +- rpcs3/Emu/SysCalls/SC_FUNC.h | 2 +- rpcs3/Emu/SysCalls/SysCalls.h | 2 +- rpcs3/Emu/SysCalls/lv2/SC_FileSystem.cpp | 40 ++--- rpcs3/Emu/SysCalls/lv2/SC_FileSystem.h | 8 +- rpcs3/Emu/SysCalls/lv2/SC_PPU_Thread.cpp | 2 +- rpcs3/Emu/SysCalls/lv2/SC_Process.cpp | 2 +- rpcs3/Emu/SysCalls/lv2/SC_SPU_Thread.cpp | 12 +- rpcs3/Emu/SysCalls/lv2/SC_Time.cpp | 19 ++- rpcs3/Emu/System.cpp | 8 +- rpcs3/Gui/AboutDialog.cpp | 4 +- rpcs3/Gui/CompilerELF.h | 2 +- rpcs3/Gui/ConLog.cpp | 4 +- rpcs3/Gui/Debugger.h | 4 +- rpcs3/Gui/DisAsmFrame.cpp | 8 +- rpcs3/Gui/GameViewer.cpp | 4 +- rpcs3/Gui/InstructionEditor.cpp | 5 +- rpcs3/Gui/InterpreterDisAsm.cpp | 6 +- rpcs3/Gui/MainFrame.cpp | 5 +- rpcs3/Gui/MainFrame.h | 4 +- rpcs3/Gui/MemoryViewer.cpp | 11 +- rpcs3/Gui/RegisterEditor.cpp | 5 +- rpcs3/Gui/VFSManager.cpp | 8 +- rpcs3/Gui/VHDDManager.cpp | 12 +- rpcs3/Ini.h | 2 +- rpcs3/Loader/ELF64.cpp | 8 +- rpcs3/Loader/Loader.cpp | 10 +- rpcs3/Loader/PSF.cpp | 18 +-- rpcs3/stdafx.h | 22 +-- scetool/scetool.cpp | 2 + scetool/types.h | 4 +- unpkg/unpkg.h | 4 + 84 files changed, 654 insertions(+), 506 deletions(-) create mode 100644 Utilities/GNU.h create mode 100644 rpcs3/CMakeLists.txt diff --git a/Utilities/Array.h b/Utilities/Array.h index 11439694e9..b7226cf2cd 100644 --- a/Utilities/Array.h +++ b/Utilities/Array.h @@ -297,17 +297,17 @@ template struct Stack : public Array ~Stack() { - Clear(); + Array::Clear(); } - void Push(const T data) { AddCpy(data); } + void Push(const T data) { Array::AddCpy(data); } T Pop() { - const u32 pos = GetCount() - 1; + const u32 pos = Array::GetCount() - 1; - const T ret = Get(pos); - RemoveAt(pos); + const T ret = Array::Get(pos); + Array::RemoveAt(pos); return ret; } @@ -498,4 +498,4 @@ public: delete m_ptr; m_ptr = ptr; } -}; \ No newline at end of file +}; diff --git a/Utilities/BEType.h b/Utilities/BEType.h index ac622de3bd..7f6745b949 100644 --- a/Utilities/BEType.h +++ b/Utilities/BEType.h @@ -1,23 +1,25 @@ #pragma once +#include "Utilities/GNU.h" + template struct se_t; template struct se_t { static __forceinline void func(T& dst, const T src) { (u8&)dst = (u8&)src; } }; template struct se_t { static __forceinline void func(T& dst, const T src) { (u16&)dst = _byteswap_ushort((u16&)src); } }; template struct se_t { static __forceinline void func(T& dst, const T src) { (u32&)dst = _byteswap_ulong((u32&)src); } }; template struct se_t { static __forceinline void func(T& dst, const T src) { (u64&)dst = _byteswap_uint64((u64&)src); } }; -template struct const_se_t;; -template struct const_se_t +template struct const_se_t;; +template struct const_se_t { static const T value = (T)_value; }; -template struct const_se_t +template struct const_se_t { static const T value = ((_value >> 8) & 0xff) | ((_value << 8) & 0xff00); }; -template struct const_se_t +template struct const_se_t { static const T value = ((_value >> 24) & 0x000000ff) | @@ -26,7 +28,7 @@ template struct const_se_t ((_value << 24) & 0xff000000); }; -template struct const_se_t +template struct const_se_t { static const T value = ((_value >> 56) & 0x00000000000000ff) | diff --git a/Utilities/GNU.h b/Utilities/GNU.h new file mode 100644 index 0000000000..4995297187 --- /dev/null +++ b/Utilities/GNU.h @@ -0,0 +1,13 @@ +#pragma once + +#if defined(__GNUG__) +#include +#define _fpclass(x) fpclassify(x) +#define __forceinline __attribute__((always_inline)) +#define _byteswap_ushort(x) __builtin_bswap16(x) +#define _byteswap_ulong(x) __builtin_bswap32(x) +#define _byteswap_uint64(x) __builtin_bswap64(x) +#define Sleep(x) usleep(x * 1000) +#define mkdir(x) mkdir(x, 0777) +#define INFINITE 0xFFFFFFFF +#endif diff --git a/Utilities/IdManager.h b/Utilities/IdManager.h index 11a25f51b0..112788b19f 100644 --- a/Utilities/IdManager.h +++ b/Utilities/IdManager.h @@ -133,4 +133,4 @@ public: if(IDToNum(_id) == IDs.GetCount()-1) Cleanup(); return true; } -}; \ No newline at end of file +}; diff --git a/Utilities/Thread.h b/Utilities/Thread.h index f98c22107b..253d17d5f1 100644 --- a/Utilities/Thread.h +++ b/Utilities/Thread.h @@ -218,4 +218,4 @@ public: if(wait) WaitForExit(); } }; -*/ \ No newline at end of file +*/ diff --git a/Utilities/Timer.h b/Utilities/Timer.h index 6c83ba75c2..ce4dc6a12d 100644 --- a/Utilities/Timer.h +++ b/Utilities/Timer.h @@ -1,47 +1,38 @@ #pragma once +#include +using namespace std::chrono; + class Timer { private: bool stopped; - double startTimeInMicroSec; - double endTimeInMicroSec; - LARGE_INTEGER frequency; - LARGE_INTEGER startCycle; - LARGE_INTEGER endCycle; + high_resolution_clock::time_point start; + high_resolution_clock::time_point end; public: - Timer() + Timer() : stopped(false) { - QueryPerformanceFrequency(&frequency); - startCycle.QuadPart = 0; - endCycle.QuadPart = 0; - stopped = false; - startTimeInMicroSec = 0; - endTimeInMicroSec = 0; } void Start() { stopped = false; - QueryPerformanceCounter(&startCycle); + start = high_resolution_clock::now(); } void Stop() { stopped = true; - QueryPerformanceCounter(&endCycle); + end = high_resolution_clock::now(); } double GetElapsedTimeInSec(){return GetElapsedTimeInMicroSec() / 1000000.0;} double GetElapsedTimeInMilliSec(){return GetElapsedTimeInMicroSec() / 1000.0;} double GetElapsedTimeInMicroSec() { - if(!stopped) QueryPerformanceCounter(&endCycle); - - startTimeInMicroSec = startCycle.QuadPart * (1000000.0 / frequency.QuadPart); - endTimeInMicroSec = endCycle.QuadPart * (1000000.0 / frequency.QuadPart); - - return endTimeInMicroSec - startTimeInMicroSec; + if (!stopped) + end = high_resolution_clock::now(); + return duration_cast(end - start).count(); } -}; \ No newline at end of file +}; diff --git a/rpcs3/CMakeLists.txt b/rpcs3/CMakeLists.txt new file mode 100644 index 0000000000..8412a2d5a9 --- /dev/null +++ b/rpcs3/CMakeLists.txt @@ -0,0 +1,37 @@ +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 +endif() + +find_package(wxWidgets) + +include("${wxWidgets_USE_FILE}") + +include_directories( +${wxWidgets_INCLUDE_DIRS} +${CMAKE_SOURCE_DIR} +${CMAKE_SOURCE_DIR}/Emu +${CMAKE_SOURCE_DIR}/Gui +${CMAKE_SOURCE_DIR}/Loader +${CMAKE_SOURCE_DIR}/.. +) + +file( +GLOB_RECURSE +RPCS3_SRC +${CMAKE_SOURCE_DIR}/Emu/* +${CMAKE_SOURCE_DIR}/Gui/* +${CMAKE_SOURCE_DIR}/Loader/* +${CMAKE_SOURCE_DIR}/../Utilities/* +) + +add_executable(rpcs3 ${RPCS3_SRC}) +target_link_libraries(rpcs3 ${wxWidgets_LIBRARIES}) diff --git a/rpcs3/Emu/ARMv7/ARMv7DisAsm.h b/rpcs3/Emu/ARMv7/ARMv7DisAsm.h index 3217907018..1998a40d46 100644 --- a/rpcs3/Emu/ARMv7/ARMv7DisAsm.h +++ b/rpcs3/Emu/ARMv7/ARMv7DisAsm.h @@ -54,12 +54,12 @@ protected: void PUSH(u16 regs_list) { - Write(wxString::Format("push {%s}", GetRegsListString(regs_list))); + Write(wxString::Format("push {%s}", GetRegsListString(regs_list).mb_str())); } void POP(u16 regs_list) { - Write(wxString::Format("pop {%s}", GetRegsListString(regs_list))); + Write(wxString::Format("pop {%s}", GetRegsListString(regs_list).mb_str())); } void NOP() @@ -93,4 +93,4 @@ protected: { Write(wxString::Format("Unknown/Illegal opcode! (0x%04x : 0x%04x)", code0, code1)); } -}; \ No newline at end of file +}; diff --git a/rpcs3/Emu/CPU/CPUDecoder.h b/rpcs3/Emu/CPU/CPUDecoder.h index 430fc82b5c..f1c1d3501a 100644 --- a/rpcs3/Emu/CPU/CPUDecoder.h +++ b/rpcs3/Emu/CPU/CPUDecoder.h @@ -12,7 +12,7 @@ template class InstrCaller { public: - virtual ~InstrCaller() + virtual ~InstrCaller() { } @@ -32,7 +32,7 @@ class InstrBinder_0 : public InstrCaller public: InstrBinder_0(func_t func) - : InstrCaller() + : InstrCaller() , m_func(func) { } @@ -52,7 +52,7 @@ class InstrBinder_1 : public InstrCaller public: InstrBinder_1(func_t func, const CodeFieldBase& arg_func_1) - : InstrCaller() + : InstrCaller() , m_func(func) , m_arg_func_1(arg_func_1) { @@ -74,7 +74,7 @@ class InstrBinder_2 : public InstrCaller public: InstrBinder_2(func_t func, const CodeFieldBase& arg_func_1, const CodeFieldBase& arg_func_2) - : InstrCaller() + : InstrCaller() , m_func(func) , m_arg_func_1(arg_func_1) , m_arg_func_2(arg_func_2) @@ -104,7 +104,7 @@ public: const CodeFieldBase& arg_func_1, const CodeFieldBase& arg_func_2, const CodeFieldBase& arg_func_3) - : InstrCaller() + : InstrCaller() , m_func(func) , m_arg_func_1(arg_func_1) , m_arg_func_2(arg_func_2) @@ -138,7 +138,7 @@ public: const CodeFieldBase& arg_func_2, const CodeFieldBase& arg_func_3, const CodeFieldBase& arg_func_4) - : InstrCaller() + : InstrCaller() , m_func(func) , m_arg_func_1(arg_func_1) , m_arg_func_2(arg_func_2) @@ -176,7 +176,7 @@ public: const CodeFieldBase& arg_func_3, const CodeFieldBase& arg_func_4, const CodeFieldBase& arg_func_5) - : InstrCaller() + : InstrCaller() , m_func(func) , m_arg_func_1(arg_func_1) , m_arg_func_2(arg_func_2) @@ -218,7 +218,7 @@ public: const CodeFieldBase& arg_func_4, const CodeFieldBase& arg_func_5, const CodeFieldBase& arg_func_6) - : InstrCaller() + : InstrCaller() , m_func(func) , m_arg_func_1(arg_func_1) , m_arg_func_2(arg_func_2) @@ -487,7 +487,7 @@ class Instr0 : public InstrBase public: Instr0(InstrList* list, const wxString& name, void (TO::*func)()) - : InstrBase(name, opcode, 0) + : InstrBase(name, opcode, 0) , m_list(*list) { m_list.set_instr(opcode, instr_bind(func), this); @@ -500,7 +500,7 @@ public: virtual u32 encode(const Array& args) const { - assert(args.GetCount() == m_args_count); + assert(args.GetCount() == InstrBase::m_args_count); return m_list.encode(opcode); } @@ -524,10 +524,10 @@ public: Instr1(InstrList* list, const wxString& name, void (TO::*func)(T1), CodeFieldBase& arg_1) - : InstrBase(name, opcode, 1) + : InstrBase(name, opcode, 1) , m_list(*list) { - m_args[0] = &arg_1; + InstrBase::m_args[0] = &arg_1; m_list.set_instr(opcode, instr_bind(func, arg_1), this); } @@ -539,13 +539,13 @@ public: virtual u32 encode(const Array& args) const { - assert(args.GetCount() == m_args_count); - return m_list.encode(opcode) | (*m_args[0])[args[0]]; + assert(args.GetCount() == InstrBase::m_args_count); + return m_list.encode(opcode) | (*InstrBase::m_args[0])[args[0]]; } u32 encode(T1 a1) const { - return m_list.encode(opcode) | (*m_args[0])[a1]; + return m_list.encode(opcode) | (*InstrBase::m_args[0])[a1]; } u32 operator()(T1 a1) const @@ -564,11 +564,11 @@ public: void (TO::*func)(T1, T2), CodeFieldBase& arg_1, CodeFieldBase& arg_2) - : InstrBase(name, opcode, 2) + : InstrBase(name, opcode, 2) , m_list(*list) { - m_args[0] = &arg_1; - m_args[1] = &arg_2; + InstrBase::m_args[0] = &arg_1; + InstrBase::m_args[1] = &arg_2; m_list.set_instr(opcode, instr_bind(func, arg_1, arg_2), this); } @@ -580,13 +580,13 @@ public: virtual u32 encode(const Array& args) const { - assert(args.GetCount() == m_args_count); - return m_list.encode(opcode) | (*m_args[0])[args[0]] | (*m_args[1])[args[1]]; + assert(args.GetCount() == InstrBase::m_args_count); + return m_list.encode(opcode) | (*InstrBase::m_args[0])[args[0]] | (*InstrBase::m_args[1])[args[1]]; } u32 encode(T1 a1, T2 a2) const { - return m_list.encode(opcode) | (*m_args[0])[a1] | (*m_args[1])[a2]; + return m_list.encode(opcode) | (*InstrBase::m_args[0])[a1] | (*InstrBase::m_args[1])[a2]; } u32 operator()(T1 a1, T2 a2) const @@ -606,12 +606,12 @@ public: CodeFieldBase& arg_1, CodeFieldBase& arg_2, CodeFieldBase& arg_3) - : InstrBase(name, opcode, 3) + : InstrBase(name, opcode, 3) , m_list(*list) { - m_args[0] = &arg_1; - m_args[1] = &arg_2; - m_args[2] = &arg_3; + InstrBase::m_args[0] = &arg_1; + InstrBase::m_args[1] = &arg_2; + InstrBase::m_args[2] = &arg_3; m_list.set_instr(opcode, instr_bind(func, arg_1, arg_2, arg_3), this); } @@ -623,13 +623,13 @@ public: virtual u32 encode(const Array& args) const { - assert(args.GetCount() == m_args_count); - return m_list.encode(opcode) | (*m_args[0])[args[0]] | (*m_args[1])[args[1]] | (*m_args[2])[args[2]]; + assert(args.GetCount() == InstrBase::m_args_count); + return m_list.encode(opcode) | (*InstrBase::m_args[0])[args[0]] | (*InstrBase::m_args[1])[args[1]] | (*InstrBase::m_args[2])[args[2]]; } u32 encode(T1 a1, T2 a2, T3 a3) const { - return m_list.encode(opcode) | (*m_args[0])[a1] | (*m_args[1])[a2] | (*m_args[2])[a3]; + return m_list.encode(opcode) | (*InstrBase::m_args[0])[a1] | (*InstrBase::m_args[1])[a2] | (*InstrBase::m_args[2])[a3]; } u32 operator()(T1 a1, T2 a2, T3 a3) const @@ -650,13 +650,13 @@ public: CodeFieldBase& arg_2, CodeFieldBase& arg_3, CodeFieldBase& arg_4) - : InstrBase(name, opcode, 4) + : InstrBase(name, opcode, 4) , m_list(*list) { - m_args[0] = &arg_1; - m_args[1] = &arg_2; - m_args[2] = &arg_3; - m_args[3] = &arg_4; + InstrBase::m_args[0] = &arg_1; + InstrBase::m_args[1] = &arg_2; + InstrBase::m_args[2] = &arg_3; + InstrBase::m_args[3] = &arg_4; m_list.set_instr(opcode, instr_bind(func, arg_1, arg_2, arg_3, arg_4), this); } @@ -668,21 +668,21 @@ public: virtual u32 encode(const Array& args) const { - assert(args.GetCount() == m_args_count); + assert(args.GetCount() == InstrBase::m_args_count); return m_list.encode(opcode) | - (*m_args[0])[args[0]] | - (*m_args[1])[args[1]] | - (*m_args[2])[args[2]] | - (*m_args[3])[args[3]]; + (*InstrBase::m_args[0])[args[0]] | + (*InstrBase::m_args[1])[args[1]] | + (*InstrBase::m_args[2])[args[2]] | + (*InstrBase::m_args[3])[args[3]]; } u32 encode(T1 a1, T2 a2, T3 a3, T4 a4) const { return m_list.encode(opcode) | - (*m_args[0])[a1] | - (*m_args[1])[a2] | - (*m_args[2])[a3] | - (*m_args[3])[a4]; + (*InstrBase::m_args[0])[a1] | + (*InstrBase::m_args[1])[a2] | + (*InstrBase::m_args[2])[a3] | + (*InstrBase::m_args[3])[a4]; } u32 operator()(T1 a1, T2 a2, T3 a3, T4 a4) const @@ -704,14 +704,14 @@ public: CodeFieldBase& arg_3, CodeFieldBase& arg_4, CodeFieldBase& arg_5) - : InstrBase(name, opcode, 5) + : InstrBase(name, opcode, 5) , m_list(*list) { - m_args[0] = &arg_1; - m_args[1] = &arg_2; - m_args[2] = &arg_3; - m_args[3] = &arg_4; - m_args[4] = &arg_5; + InstrBase::m_args[0] = &arg_1; + InstrBase::m_args[1] = &arg_2; + InstrBase::m_args[2] = &arg_3; + InstrBase::m_args[3] = &arg_4; + InstrBase::m_args[4] = &arg_5; m_list.set_instr(opcode, instr_bind(func, arg_1, arg_2, arg_3, arg_4, arg_5), this); } @@ -723,23 +723,23 @@ public: virtual u32 encode(const Array& args) const { - assert(args.GetCount() == m_args_count); + assert(args.GetCount() == InstrBase::m_args_count); return m_list.encode(opcode) | - (*m_args[0])[args[0]] | - (*m_args[1])[args[1]] | - (*m_args[2])[args[2]] | - (*m_args[3])[args[3]] | - (*m_args[4])[args[4]]; + (*InstrBase::m_args[0])[args[0]] | + (*InstrBase::m_args[1])[args[1]] | + (*InstrBase::m_args[2])[args[2]] | + (*InstrBase::m_args[3])[args[3]] | + (*InstrBase::m_args[4])[args[4]]; } u32 encode(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) const { return m_list.encode(opcode) | - (*m_args[0])[a1] | - (*m_args[1])[a2] | - (*m_args[2])[a3] | - (*m_args[3])[a4] | - (*m_args[4])[a5]; + (*InstrBase::m_args[0])[a1] | + (*InstrBase::m_args[1])[a2] | + (*InstrBase::m_args[2])[a3] | + (*InstrBase::m_args[3])[a4] | + (*InstrBase::m_args[4])[a5]; } u32 operator()(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) const @@ -762,15 +762,15 @@ public: CodeFieldBase& arg_4, CodeFieldBase& arg_5, CodeFieldBase& arg_6) - : InstrBase(name, opcode, 6) + : InstrBase(name, opcode, 6) , m_list(*list) { - m_args[0] = &arg_1; - m_args[1] = &arg_2; - m_args[2] = &arg_3; - m_args[3] = &arg_4; - m_args[4] = &arg_5; - m_args[5] = &arg_6; + InstrBase::m_args[0] = &arg_1; + InstrBase::m_args[1] = &arg_2; + InstrBase::m_args[2] = &arg_3; + InstrBase::m_args[3] = &arg_4; + InstrBase::m_args[4] = &arg_5; + InstrBase::m_args[5] = &arg_6; m_list.set_instr(opcode, instr_bind(func, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6), this); } @@ -782,25 +782,25 @@ public: virtual u32 encode(const Array& args) const { - assert(args.GetCount() == m_args_count); + assert(args.GetCount() == InstrBase::m_args_count); return m_list.encode(opcode) | - (*m_args[0])[args[0]] | - (*m_args[1])[args[1]] | - (*m_args[2])[args[2]] | - (*m_args[3])[args[3]] | - (*m_args[4])[args[4]] | - (*m_args[5])[args[5]]; + (*InstrBase::m_args[0])[args[0]] | + (*InstrBase::m_args[1])[args[1]] | + (*InstrBase::m_args[2])[args[2]] | + (*InstrBase::m_args[3])[args[3]] | + (*InstrBase::m_args[4])[args[4]] | + (*InstrBase::m_args[5])[args[5]]; } u32 encode(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T5 a6) const { return m_list.encode(opcode) | - (*m_args[0])[a1] | - (*m_args[1])[a2] | - (*m_args[2])[a3] | - (*m_args[3])[a4] | - (*m_args[4])[a5] | - (*m_args[5])[a6]; + (*InstrBase::m_args[0])[a1] | + (*InstrBase::m_args[1])[a2] | + (*InstrBase::m_args[2])[a3] | + (*InstrBase::m_args[3])[a4] | + (*InstrBase::m_args[4])[a5] | + (*InstrBase::m_args[5])[a6]; } u32 operator()(T1 a1, T2 a2, T3 a3, T4 a4, T4 a5, T4 a6) const @@ -876,4 +876,4 @@ static Instr6& make_instr(InstrList(list, name, func, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6); -} \ No newline at end of file +} diff --git a/rpcs3/Emu/CPU/CPUDisAsm.h b/rpcs3/Emu/CPU/CPUDisAsm.h index 139dd3f1d0..fb5dd50b86 100644 --- a/rpcs3/Emu/CPU/CPUDisAsm.h +++ b/rpcs3/Emu/CPU/CPUDisAsm.h @@ -24,7 +24,7 @@ protected: Memory.Read8(offset + dump_pc), Memory.Read8(offset + dump_pc + 1), Memory.Read8(offset + dump_pc + 2), - Memory.Read8(offset + dump_pc + 3), value); + Memory.Read8(offset + dump_pc + 3), value.mb_str()); break; case CPUDisAsm_InterpreterMode: @@ -32,7 +32,7 @@ protected: Memory.Read8(offset + dump_pc), Memory.Read8(offset + dump_pc + 1), Memory.Read8(offset + dump_pc + 2), - Memory.Read8(offset + dump_pc + 3), value); + Memory.Read8(offset + dump_pc + 3), value.mb_str()); break; case CPUDisAsm_CompilerElfMode: @@ -60,4 +60,4 @@ protected: op.Append(' ', max(8 - op.Len(), 0)); return op; } -}; \ No newline at end of file +}; diff --git a/rpcs3/Emu/CPU/CPUThread.cpp b/rpcs3/Emu/CPU/CPUThread.cpp index bb952393aa..8135c1b5b8 100644 --- a/rpcs3/Emu/CPU/CPUThread.cpp +++ b/rpcs3/Emu/CPU/CPUThread.cpp @@ -149,7 +149,7 @@ void CPUThread::SetBranch(const u64 pc, bool record_branch) { if(!Memory.IsGoodAddr(m_offset + pc)) { - ConLog.Error("%s branch error: bad address 0x%llx #pc: 0x%llx", GetFName(), m_offset + pc, m_offset + PC); + ConLog.Error("%s branch error: bad address 0x%llx #pc: 0x%llx", GetFName().mb_str(), m_offset + pc, m_offset + PC); Emu.Pause(); } @@ -324,7 +324,7 @@ void CPUThread::Task() } catch(const wxString& e) { - ConLog.Error("Exception: %s", e); + ConLog.Error("Exception: %s", e.mb_str()); } catch(const char* e) { diff --git a/rpcs3/Emu/CPU/CPUThread.h b/rpcs3/Emu/CPU/CPUThread.h index 9568e80dbd..3ac354e7f5 100644 --- a/rpcs3/Emu/CPU/CPUThread.h +++ b/rpcs3/Emu/CPU/CPUThread.h @@ -73,9 +73,9 @@ public: { return wxString::Format("%s[%d] Thread%s", - GetTypeString(), + GetTypeString().mb_str(), m_id, - (GetName().IsEmpty() ? "" : " (" + GetName() + ")") + (GetName().IsEmpty() ? "" : (" (" + GetName() + ")").mb_str()) ); } @@ -227,4 +227,4 @@ protected: virtual void Task(); }; -CPUThread* GetCurrentCPUThread(); \ No newline at end of file +CPUThread* GetCurrentCPUThread(); diff --git a/rpcs3/Emu/CPU/CPUThreadManager.cpp b/rpcs3/Emu/CPU/CPUThreadManager.cpp index d4588f4930..f960e570c8 100644 --- a/rpcs3/Emu/CPU/CPUThreadManager.cpp +++ b/rpcs3/Emu/CPU/CPUThreadManager.cpp @@ -1,9 +1,9 @@ #include "stdafx.h" #include "CPUThreadManager.h" -#include "Emu\Cell\PPUThread.h" -#include "Emu\Cell\SPUThread.h" -#include "Emu\Cell\RawSPUThread.h" -#include "Emu\ARMv7\ARMv7Thread.h" +#include "Emu/Cell/PPUThread.h" +#include "Emu/Cell/SPUThread.h" +#include "Emu/Cell/RawSPUThread.h" +#include "Emu/ARMv7/ARMv7Thread.h" CPUThreadManager::CPUThreadManager() : m_raw_spu_num(0) @@ -36,7 +36,7 @@ CPUThread& CPUThreadManager::AddThread(CPUThreadType type) default: assert(0); } - new_thread->SetId(Emu.GetIdManager().GetNewID(wxString::Format("%s Thread", new_thread->GetTypeString()), new_thread)); + new_thread->SetId(Emu.GetIdManager().GetNewID(wxString::Format("%s Thread", new_thread->GetTypeString().mb_str()), new_thread)); m_threads.Add(new_thread); wxGetApp().SendDbgCommand(DID_CREATE_THREAD, new_thread); @@ -108,4 +108,4 @@ void CPUThreadManager::Exec() { m_threads[i].Exec(); } -} \ No newline at end of file +} diff --git a/rpcs3/Emu/Cell/PPCDisAsm.h b/rpcs3/Emu/Cell/PPCDisAsm.h index 40c56dda39..e2610d6d07 100644 --- a/rpcs3/Emu/Cell/PPCDisAsm.h +++ b/rpcs3/Emu/Cell/PPCDisAsm.h @@ -15,39 +15,39 @@ protected: void DisAsm_V4(const wxString& op, u32 v0, u32 v1, u32 v2, u32 v3) { - Write(wxString::Format("%s v%d,v%d,v%d,v%d", FixOp(op), v0, v1, v2, v3)); + Write(wxString::Format("%s v%d,v%d,v%d,v%d", FixOp(op).mb_str(), v0, v1, v2, v3)); } void DisAsm_V3_UIMM(const wxString& op, u32 v0, u32 v1, u32 v2, u32 uimm) { - Write(wxString::Format("%s v%d,v%d,v%d,%u #%x", FixOp(op), v0, v1, v2, uimm, uimm)); + Write(wxString::Format("%s v%d,v%d,v%d,%u #%x", FixOp(op).mb_str(), v0, v1, v2, uimm, uimm)); } void DisAsm_V3(const wxString& op, u32 v0, u32 v1, u32 v2) { - Write(wxString::Format("%s v%d,v%d,v%d", FixOp(op), v0, v1, v2)); + Write(wxString::Format("%s v%d,v%d,v%d", FixOp(op).mb_str(), v0, v1, v2)); } void DisAsm_V2_UIMM(const wxString& op, u32 v0, u32 v1, u32 uimm) { - Write(wxString::Format("%s v%d,v%d,%u #%x", FixOp(op), v0, v1, uimm, uimm)); + Write(wxString::Format("%s v%d,v%d,%u #%x", FixOp(op).mb_str(), v0, v1, uimm, uimm)); } void DisAsm_V2(const wxString& op, u32 v0, u32 v1) { - Write(wxString::Format("%s v%d,v%d", FixOp(op), v0, v1)); + Write(wxString::Format("%s v%d,v%d", FixOp(op).mb_str(), v0, v1)); } void DisAsm_V1_SIMM(const wxString& op, u32 v0, s32 simm) { - Write(wxString::Format("%s v%d,%d #%x", FixOp(op), v0, simm, simm)); + Write(wxString::Format("%s v%d,%d #%x", FixOp(op).mb_str(), v0, simm, simm)); } void DisAsm_V1(const wxString& op, u32 v0) { - Write(wxString::Format("%s v%d", FixOp(op), v0)); + Write(wxString::Format("%s v%d", FixOp(op).mb_str(), v0)); } void DisAsm_V1_R2(const wxString& op, u32 v0, u32 r1, u32 r2) { - Write(wxString::Format("%s v%d,r%d,r%d", FixOp(op), v0, r1, r2)); + Write(wxString::Format("%s v%d,r%d,r%d", FixOp(op).mb_str(), v0, r1, r2)); } void DisAsm_CR1_F2_RC(const wxString& op, u32 cr0, u32 f0, u32 f1, bool rc) { - Write(wxString::Format("%s%s cr%d,f%d,f%d", FixOp(op), rc ? "." : "", cr0, f0, f1)); + Write(wxString::Format("%s%s cr%d,f%d,f%d", FixOp(op).mb_str(), rc ? "." : "", cr0, f0, f1)); } void DisAsm_CR1_F2(const wxString& op, u32 cr0, u32 f0, u32 f1) { @@ -55,15 +55,15 @@ protected: } void DisAsm_INT1_R2(const wxString& op, u32 i0, u32 r0, u32 r1) { - Write(wxString::Format("%s %d,r%d,r%d", FixOp(op), i0, r0, r1)); + Write(wxString::Format("%s %d,r%d,r%d", FixOp(op).mb_str(), i0, r0, r1)); } void DisAsm_INT1_R1_IMM(const wxString& op, u32 i0, u32 r0, s32 imm0) { - Write(wxString::Format("%s %d,r%d,%d #%x", FixOp(op), i0, r0, imm0, imm0)); + Write(wxString::Format("%s %d,r%d,%d #%x", FixOp(op).mb_str(), i0, r0, imm0, imm0)); } void DisAsm_INT1_R1_RC(const wxString& op, u32 i0, u32 r0, bool rc) { - Write(wxString::Format("%s%s %d,r%d", FixOp(op), rc ? "." : "", i0, r0)); + Write(wxString::Format("%s%s %d,r%d", FixOp(op).mb_str(), rc ? "." : "", i0, r0)); } void DisAsm_INT1_R1(const wxString& op, u32 i0, u32 r0) { @@ -71,11 +71,11 @@ protected: } void DisAsm_F4_RC(const wxString& op, u32 f0, u32 f1, u32 f2, u32 f3, bool rc) { - Write(wxString::Format("%s%s f%d,f%d,f%d,f%d", FixOp(op), rc ? "." : "", f0, f1, f2, f3)); + Write(wxString::Format("%s%s f%d,f%d,f%d,f%d", FixOp(op).mb_str(), rc ? "." : "", f0, f1, f2, f3)); } void DisAsm_F3_RC(const wxString& op, u32 f0, u32 f1, u32 f2, bool rc) { - Write(wxString::Format("%s%s f%d,f%d,f%d", FixOp(op), rc ? "." : "", f0, f1, f2)); + Write(wxString::Format("%s%s f%d,f%d,f%d", FixOp(op).mb_str(), rc ? "." : "", f0, f1, f2)); } void DisAsm_F3(const wxString& op, u32 f0, u32 f1, u32 f2) { @@ -83,7 +83,7 @@ protected: } void DisAsm_F2_RC(const wxString& op, u32 f0, u32 f1, bool rc) { - Write(wxString::Format("%s%s f%d,f%d", FixOp(op), rc ? "." : "", f0, f1)); + Write(wxString::Format("%s%s f%d,f%d", FixOp(op).mb_str(), rc ? "." : "", f0, f1)); } void DisAsm_F2(const wxString& op, u32 f0, u32 f1) { @@ -93,21 +93,21 @@ protected: { if(m_mode == CPUDisAsm_CompilerElfMode) { - Write(wxString::Format("%s f%d,r%d,r%d", FixOp(op), f0, r0, r1)); + Write(wxString::Format("%s f%d,r%d,r%d", FixOp(op).mb_str(), f0, r0, r1)); return; } - Write(wxString::Format("%s f%d,r%d(r%d)", FixOp(op), f0, r0, r1)); + Write(wxString::Format("%s f%d,r%d(r%d)", FixOp(op).mb_str(), f0, r0, r1)); } void DisAsm_F1_IMM_R1_RC(const wxString& op, u32 f0, s32 imm0, u32 r0, bool rc) { if(m_mode == CPUDisAsm_CompilerElfMode) { - Write(wxString::Format("%s%s f%d,r%d,%d #%x", FixOp(op), rc ? "." : "", f0, r0, imm0, imm0)); + Write(wxString::Format("%s%s f%d,r%d,%d #%x", FixOp(op).mb_str(), rc ? "." : "", f0, r0, imm0, imm0)); return; } - Write(wxString::Format("%s%s f%d,%d(r%d) #%x", FixOp(op), rc ? "." : "", f0, imm0, r0, imm0)); + Write(wxString::Format("%s%s f%d,%d(r%d) #%x", FixOp(op).mb_str(), rc ? "." : "", f0, imm0, r0, imm0)); } void DisAsm_F1_IMM_R1(const wxString& op, u32 f0, s32 imm0, u32 r0) { @@ -115,11 +115,11 @@ protected: } void DisAsm_F1_RC(const wxString& op, u32 f0, bool rc) { - Write(wxString::Format("%s%s f%d", FixOp(op), rc ? "." : "", f0)); + Write(wxString::Format("%s%s f%d", FixOp(op).mb_str(), rc ? "." : "", f0)); } void DisAsm_R1_RC(const wxString& op, u32 r0, bool rc) { - Write(wxString::Format("%s%s r%d", FixOp(op), rc ? "." : "", r0)); + Write(wxString::Format("%s%s r%d", FixOp(op).mb_str(), rc ? "." : "", r0)); } void DisAsm_R1(const wxString& op, u32 r0) { @@ -127,7 +127,7 @@ protected: } void DisAsm_R2_OE_RC(const wxString& op, u32 r0, u32 r1, u32 oe, bool rc) { - Write(wxString::Format("%s%s%s r%d,r%d", FixOp(op), oe ? "o" : "", rc ? "." : "", r0, r1)); + Write(wxString::Format("%s%s%s r%d,r%d", FixOp(op).mb_str(), oe ? "o" : "", rc ? "." : "", r0, r1)); } void DisAsm_R2_RC(const wxString& op, u32 r0, u32 r1, bool rc) { @@ -139,11 +139,11 @@ protected: } void DisAsm_R3_OE_RC(const wxString& op, u32 r0, u32 r1, u32 r2, u32 oe, bool rc) { - Write(wxString::Format("%s%s%s r%d,r%d,r%d", FixOp(op), oe ? "o" : "", rc ? "." : "", r0, r1, r2)); + Write(wxString::Format("%s%s%s r%d,r%d,r%d", FixOp(op).mb_str(), oe ? "o" : "", rc ? "." : "", r0, r1, r2)); } void DisAsm_R3_INT2_RC(const wxString& op, u32 r0, u32 r1, u32 r2, s32 i0, s32 i1, bool rc) { - Write(wxString::Format("%s%s r%d,r%d,r%d,%d,%d", FixOp(op), rc ? "." : "", r0, r1, r2, i0, i1)); + Write(wxString::Format("%s%s r%d,r%d,r%d,%d,%d", FixOp(op).mb_str(), rc ? "." : "", r0, r1, r2, i0, i1)); } void DisAsm_R3_RC(const wxString& op, u32 r0, u32 r1, u32 r2, bool rc) { @@ -155,7 +155,7 @@ protected: } void DisAsm_R2_INT3_RC(const wxString& op, u32 r0, u32 r1, s32 i0, s32 i1, s32 i2, bool rc) { - Write(wxString::Format("%s%s r%d,r%d,%d,%d,%d", FixOp(op), rc ? "." : "", r0, r1, i0, i1, i2)); + Write(wxString::Format("%s%s r%d,r%d,%d,%d,%d", FixOp(op).mb_str(), rc ? "." : "", r0, r1, i0, i1, i2)); } void DisAsm_R2_INT3(const wxString& op, u32 r0, u32 r1, s32 i0, s32 i1, s32 i2) { @@ -163,7 +163,7 @@ protected: } void DisAsm_R2_INT2_RC(const wxString& op, u32 r0, u32 r1, s32 i0, s32 i1, bool rc) { - Write(wxString::Format("%s%s r%d,r%d,%d,%d", FixOp(op), rc ? "." : "", r0, r1, i0, i1)); + Write(wxString::Format("%s%s r%d,r%d,%d,%d", FixOp(op).mb_str(), rc ? "." : "", r0, r1, i0, i1)); } void DisAsm_R2_INT2(const wxString& op, u32 r0, u32 r1, s32 i0, s32 i1) { @@ -171,7 +171,7 @@ protected: } void DisAsm_R2_INT1_RC(const wxString& op, u32 r0, u32 r1, s32 i0, bool rc) { - Write(wxString::Format("%s%s r%d,r%d,%d", FixOp(op), rc ? "." : "", r0, r1, i0)); + Write(wxString::Format("%s%s r%d,r%d,%d", FixOp(op).mb_str(), rc ? "." : "", r0, r1, i0)); } void DisAsm_R2_INT1(const wxString& op, u32 r0, u32 r1, s32 i0) { @@ -181,27 +181,27 @@ protected: { if(m_mode == CPUDisAsm_CompilerElfMode) { - Write(wxString::Format("%s r%d,r%d,%d #%x", FixOp(op), r0, r1, imm0, imm0)); + Write(wxString::Format("%s r%d,r%d,%d #%x", FixOp(op).mb_str(), r0, r1, imm0, imm0)); return; } - Write(wxString::Format("%s r%d,%d(r%d) #%x", FixOp(op), r0, imm0, r1, imm0)); + Write(wxString::Format("%s r%d,%d(r%d) #%x", FixOp(op).mb_str(), r0, imm0, r1, imm0)); } void DisAsm_R1_IMM(const wxString& op, u32 r0, s32 imm0) { - Write(wxString::Format("%s r%d,%d #%x", FixOp(op), r0, imm0, imm0)); + Write(wxString::Format("%s r%d,%d #%x", FixOp(op).mb_str(), r0, imm0, imm0)); } void DisAsm_IMM_R1(const wxString& op, s32 imm0, u32 r0) { - Write(wxString::Format("%s %d,r%d #%x", FixOp(op), imm0, r0, imm0)); + Write(wxString::Format("%s %d,r%d #%x", FixOp(op).mb_str(), imm0, r0, imm0)); } void DisAsm_CR1_R1_IMM(const wxString& op, u32 cr0, u32 r0, s32 imm0) { - Write(wxString::Format("%s cr%d,r%d,%d #%x", FixOp(op), cr0, r0, imm0, imm0)); + Write(wxString::Format("%s cr%d,r%d,%d #%x", FixOp(op).mb_str(), cr0, r0, imm0, imm0)); } void DisAsm_CR1_R2_RC(const wxString& op, u32 cr0, u32 r0, u32 r1, bool rc) { - Write(wxString::Format("%s%s cr%d,r%d,r%d", FixOp(op), rc ? "." : "", cr0, r0, r1)); + Write(wxString::Format("%s%s cr%d,r%d,r%d", FixOp(op).mb_str(), rc ? "." : "", cr0, r0, r1)); } void DisAsm_CR1_R2(const wxString& op, u32 cr0, u32 r0, u32 r1) { @@ -209,30 +209,30 @@ protected: } void DisAsm_CR2(const wxString& op, u32 cr0, u32 cr1) { - Write(wxString::Format("%s cr%d,cr%d", FixOp(op), cr0, cr1)); + Write(wxString::Format("%s cr%d,cr%d", FixOp(op).mb_str(), cr0, cr1)); } void DisAsm_INT3(const wxString& op, const int i0, const int i1, const int i2) { - Write(wxString::Format("%s %d,%d,%d", FixOp(op), i0, i1, i2)); + Write(wxString::Format("%s %d,%d,%d", FixOp(op).mb_str(), i0, i1, i2)); } void DisAsm_INT1(const wxString& op, const int i0) { - Write(wxString::Format("%s %d", FixOp(op), i0)); + Write(wxString::Format("%s %d", FixOp(op).mb_str(), i0)); } void DisAsm_BRANCH(const wxString& op, const int pc) { - Write(wxString::Format("%s 0x%x", FixOp(op), DisAsmBranchTarget(pc))); + Write(wxString::Format("%s 0x%x", FixOp(op).mb_str(), DisAsmBranchTarget(pc))); } void DisAsm_BRANCH_A(const wxString& op, const int pc) { - Write(wxString::Format("%s 0x%x", FixOp(op), pc)); + Write(wxString::Format("%s 0x%x", FixOp(op).mb_str(), pc)); } void DisAsm_B2_BRANCH(const wxString& op, u32 b0, u32 b1, const int pc) { - Write(wxString::Format("%s %d,%d,0x%x ", FixOp(op), b0, b1, DisAsmBranchTarget(pc))); + Write(wxString::Format("%s %d,%d,0x%x ", FixOp(op).mb_str(), b0, b1, DisAsmBranchTarget(pc))); } void DisAsm_CR_BRANCH(const wxString& op, u32 cr, const int pc) { - Write(wxString::Format("%s cr%d,0x%x ", FixOp(op), cr, DisAsmBranchTarget(pc))); + Write(wxString::Format("%s cr%d,0x%x ", FixOp(op).mb_str(), cr, DisAsmBranchTarget(pc))); } -}; \ No newline at end of file +}; diff --git a/rpcs3/Emu/Cell/PPCInstrTable.h b/rpcs3/Emu/Cell/PPCInstrTable.h index 79942b9305..b0f23521ba 100644 --- a/rpcs3/Emu/Cell/PPCInstrTable.h +++ b/rpcs3/Emu/Cell/PPCInstrTable.h @@ -57,7 +57,7 @@ class DoubleCodeField : public CodeField static_assert(to2 <= 31, "too big to2 value"); public: - DoubleCodeField(CodeFieldType type = FIELD_IMM) : CodeField(type) + DoubleCodeField(CodeFieldType type = FIELD_IMM) : CodeField(type) { } @@ -66,13 +66,13 @@ public: static __forceinline void encode(u32& data, u32 value) { - data &= ~(mask | mask2); - data |= ((value << shift) & mask) | (((value >> offset) << shift2) & mask2); + data &= ~(CodeField::mask | mask2); + data |= ((value << CodeField::shift) & CodeField::mask) | (((value >> offset) << shift2) & mask2); } static __forceinline u32 decode(u32 data) { - return ((data & mask) >> shift) | (((data & mask2) >> shift2) << offset); + return ((data & CodeField::mask) >> CodeField::shift) | (((data & mask2) >> shift2) << offset); } virtual u32 operator ()(u32 data) const @@ -90,7 +90,7 @@ template class CodeFieldSigned : public CodeField { public: - CodeFieldSigned(CodeFieldType type = FIELD_IMM) : CodeField(type) + CodeFieldSigned(CodeFieldType type = FIELD_IMM) : CodeField(type) { } @@ -98,7 +98,7 @@ public: static __forceinline u32 decode(u32 data) { - return sign((data & mask) >> shift); + return sign((data & CodeField::mask) >> CodeField::shift); } virtual u32 operator ()(u32 data) const @@ -113,19 +113,19 @@ class CodeFieldOffset : public CodeField static const int offset = _offset; public: - CodeFieldOffset(CodeFieldType type = FIELD_IMM) : CodeField(type) + CodeFieldOffset(CodeFieldType type = FIELD_IMM) : CodeField(type) { } static __forceinline u32 decode(u32 data) { - return ((data & mask) >> shift) << offset; + return ((data & CodeField::mask) >> CodeField::shift) << offset; } static __forceinline void encode(u32& data, u32 value) { - data &= ~mask; - data |= ((value >> offset) << shift) & mask; + data &= ~CodeField::mask; + data |= ((value >> offset) << CodeField::shift) & CodeField::mask; } virtual u32 operator ()(u32 data) const @@ -145,19 +145,19 @@ class CodeFieldSignedOffset : public CodeFieldSigned static const int offset = _offset; public: - CodeFieldSignedOffset(CodeFieldType type = FIELD_IMM) : CodeFieldSigned(type) + CodeFieldSignedOffset(CodeFieldType type = FIELD_IMM) : CodeFieldSigned(type) { } static __forceinline u32 decode(u32 data) { - return sign((data & mask) >> shift) << offset; + return sign((data & CodeField::mask) >> CodeField::shift) << offset; } static __forceinline void encode(u32& data, u32 value) { - data &= ~mask; - data |= ((value >> offset) << shift) & mask; + data &= ~CodeField::mask; + data |= ((value >> offset) << CodeField::shift) & CodeField::mask; } virtual u32 operator ()(u32 data) const diff --git a/rpcs3/Emu/Cell/PPCThreadManager.cpp b/rpcs3/Emu/Cell/PPCThreadManager.cpp index 37580c518e..2be6a26806 100644 --- a/rpcs3/Emu/Cell/PPCThreadManager.cpp +++ b/rpcs3/Emu/Cell/PPCThreadManager.cpp @@ -4,7 +4,8 @@ #include "SPUThread.h" #include "RawSPUThread.h" -PPCThreadManager::PPCThreadManager() +PPCThreadManager::PPCThreadManager() : +m_raw_spu_num(0) { } @@ -28,7 +29,7 @@ PPCThread& PPCThreadManager::AddThread(PPCThreadType type) { case PPC_THREAD_PPU: new_thread = new PPUThread(); name = "PPU"; break; case PPC_THREAD_SPU: new_thread = new SPUThread(); name = "SPU"; break; - case PPC_THREAD_RAW_SPU: new_thread = new RawSPUThread(); name = "RawSPU"; break; + case PPC_THREAD_RAW_SPU: new_thread = new RawSPUThread(m_raw_spu_num++); name = "RawSPU"; break; default: assert(0); } @@ -104,4 +105,4 @@ void PPCThreadManager::Exec() { m_threads[i].Exec(); } -} \ No newline at end of file +} diff --git a/rpcs3/Emu/Cell/PPCThreadManager.h b/rpcs3/Emu/Cell/PPCThreadManager.h index 593e1fdba8..3d2754302b 100644 --- a/rpcs3/Emu/Cell/PPCThreadManager.h +++ b/rpcs3/Emu/Cell/PPCThreadManager.h @@ -1,6 +1,13 @@ #pragma once #include "PPCThread.h" +enum PPCThreadType +{ + PPC_THREAD_PPU, + PPC_THREAD_SPU, + PPC_THREAD_RAW_SPU +}; + class PPCThreadManager { //IdManager m_threads_id; @@ -10,6 +17,7 @@ class PPCThreadManager std::mutex m_mtx_thread; wxSemaphore m_sem_task; Stack m_delete_threads; + u32 m_raw_spu_num; public: PPCThreadManager(); @@ -27,4 +35,4 @@ public: void Exec(); void Task(); -}; \ No newline at end of file +}; diff --git a/rpcs3/Emu/Cell/PPUDisAsm.h b/rpcs3/Emu/Cell/PPUDisAsm.h index 458a578b3c..7aea473b42 100644 --- a/rpcs3/Emu/Cell/PPUDisAsm.h +++ b/rpcs3/Emu/Cell/PPUDisAsm.h @@ -24,39 +24,39 @@ private: private: void DisAsm_V4(const wxString& op, u32 v0, u32 v1, u32 v2, u32 v3) { - Write(wxString::Format("%s v%d,v%d,v%d,v%d", FixOp(op), v0, v1, v2, v3)); + Write(wxString::Format("%s v%d,v%d,v%d,v%d", FixOp(op).mb_str(), v0, v1, v2, v3)); } void DisAsm_V3_UIMM(const wxString& op, u32 v0, u32 v1, u32 v2, u32 uimm) { - Write(wxString::Format("%s v%d,v%d,v%d,%u #%x", FixOp(op), v0, v1, v2, uimm, uimm)); + Write(wxString::Format("%s v%d,v%d,v%d,%u #%x", FixOp(op).mb_str(), v0, v1, v2, uimm, uimm)); } void DisAsm_V3(const wxString& op, u32 v0, u32 v1, u32 v2) { - Write(wxString::Format("%s v%d,v%d,v%d", FixOp(op), v0, v1, v2)); + Write(wxString::Format("%s v%d,v%d,v%d", FixOp(op).mb_str(), v0, v1, v2)); } void DisAsm_V2_UIMM(const wxString& op, u32 v0, u32 v1, u32 uimm) { - Write(wxString::Format("%s v%d,v%d,%u #%x", FixOp(op), v0, v1, uimm, uimm)); + Write(wxString::Format("%s v%d,v%d,%u #%x", FixOp(op).mb_str(), v0, v1, uimm, uimm)); } void DisAsm_V2(const wxString& op, u32 v0, u32 v1) { - Write(wxString::Format("%s v%d,v%d", FixOp(op), v0, v1)); + Write(wxString::Format("%s v%d,v%d", FixOp(op).mb_str(), v0, v1)); } void DisAsm_V1_SIMM(const wxString& op, u32 v0, s32 simm) { - Write(wxString::Format("%s v%d,%d #%x", FixOp(op), v0, simm, simm)); + Write(wxString::Format("%s v%d,%d #%x", FixOp(op).mb_str(), v0, simm, simm)); } void DisAsm_V1(const wxString& op, u32 v0) { - Write(wxString::Format("%s v%d", FixOp(op), v0)); + Write(wxString::Format("%s v%d", FixOp(op).mb_str(), v0)); } void DisAsm_V1_R2(const wxString& op, u32 v0, u32 r1, u32 r2) { - Write(wxString::Format("%s v%d,r%d,r%d", FixOp(op), v0, r1, r2)); + Write(wxString::Format("%s v%d,r%d,r%d", FixOp(op).mb_str(), v0, r1, r2)); } void DisAsm_CR1_F2_RC(const wxString& op, u32 cr0, u32 f0, u32 f1, bool rc) { - Write(wxString::Format("%s%s cr%d,f%d,f%d", FixOp(op), rc ? "." : "", cr0, f0, f1)); + Write(wxString::Format("%s%s cr%d,f%d,f%d", FixOp(op).mb_str(), rc ? "." : "", cr0, f0, f1)); } void DisAsm_CR1_F2(const wxString& op, u32 cr0, u32 f0, u32 f1) { @@ -64,15 +64,15 @@ private: } void DisAsm_INT1_R2(const wxString& op, u32 i0, u32 r0, u32 r1) { - Write(wxString::Format("%s %d,r%d,r%d", FixOp(op), i0, r0, r1)); + Write(wxString::Format("%s %d,r%d,r%d", FixOp(op).mb_str(), i0, r0, r1)); } void DisAsm_INT1_R1_IMM(const wxString& op, u32 i0, u32 r0, s32 imm0) { - Write(wxString::Format("%s %d,r%d,%d #%x", FixOp(op), i0, r0, imm0, imm0)); + Write(wxString::Format("%s %d,r%d,%d #%x", FixOp(op).mb_str(), i0, r0, imm0, imm0)); } void DisAsm_INT1_R1_RC(const wxString& op, u32 i0, u32 r0, bool rc) { - Write(wxString::Format("%s%s %d,r%d", FixOp(op), rc ? "." : "", i0, r0)); + Write(wxString::Format("%s%s %d,r%d", FixOp(op).mb_str(), rc ? "." : "", i0, r0)); } void DisAsm_INT1_R1(const wxString& op, u32 i0, u32 r0) { @@ -80,11 +80,11 @@ private: } void DisAsm_F4_RC(const wxString& op, u32 f0, u32 f1, u32 f2, u32 f3, bool rc) { - Write(wxString::Format("%s%s f%d,f%d,f%d,f%d", FixOp(op), rc ? "." : "", f0, f1, f2, f3)); + Write(wxString::Format("%s%s f%d,f%d,f%d,f%d", FixOp(op).mb_str(), rc ? "." : "", f0, f1, f2, f3)); } void DisAsm_F3_RC(const wxString& op, u32 f0, u32 f1, u32 f2, bool rc) { - Write(wxString::Format("%s%s f%d,f%d,f%d", FixOp(op), rc ? "." : "", f0, f1, f2)); + Write(wxString::Format("%s%s f%d,f%d,f%d", FixOp(op).mb_str(), rc ? "." : "", f0, f1, f2)); } void DisAsm_F3(const wxString& op, u32 f0, u32 f1, u32 f2) { @@ -92,7 +92,7 @@ private: } void DisAsm_F2_RC(const wxString& op, u32 f0, u32 f1, bool rc) { - Write(wxString::Format("%s%s f%d,f%d", FixOp(op), rc ? "." : "", f0, f1)); + Write(wxString::Format("%s%s f%d,f%d", FixOp(op).mb_str(), rc ? "." : "", f0, f1)); } void DisAsm_F2(const wxString& op, u32 f0, u32 f1) { @@ -102,21 +102,21 @@ private: { if(m_mode == CPUDisAsm_CompilerElfMode) { - Write(wxString::Format("%s f%d,r%d,r%d", FixOp(op), f0, r0, r1)); + Write(wxString::Format("%s f%d,r%d,r%d", FixOp(op).mb_str(), f0, r0, r1)); return; } - Write(wxString::Format("%s f%d,r%d(r%d)", FixOp(op), f0, r0, r1)); + Write(wxString::Format("%s f%d,r%d(r%d)", FixOp(op).mb_str(), f0, r0, r1)); } void DisAsm_F1_IMM_R1_RC(const wxString& op, u32 f0, s32 imm0, u32 r0, bool rc) { if(m_mode == CPUDisAsm_CompilerElfMode) { - Write(wxString::Format("%s%s f%d,r%d,%d #%x", FixOp(op), rc ? "." : "", f0, r0, imm0, imm0)); + Write(wxString::Format("%s%s f%d,r%d,%d #%x", FixOp(op).mb_str(), rc ? "." : "", f0, r0, imm0, imm0)); return; } - Write(wxString::Format("%s%s f%d,%d(r%d) #%x", FixOp(op), rc ? "." : "", f0, imm0, r0, imm0)); + Write(wxString::Format("%s%s f%d,%d(r%d) #%x", FixOp(op).mb_str(), rc ? "." : "", f0, imm0, r0, imm0)); } void DisAsm_F1_IMM_R1(const wxString& op, u32 f0, s32 imm0, u32 r0) { @@ -124,11 +124,11 @@ private: } void DisAsm_F1_RC(const wxString& op, u32 f0, bool rc) { - Write(wxString::Format("%s%s f%d", FixOp(op), rc ? "." : "", f0)); + Write(wxString::Format("%s%s f%d", FixOp(op).mb_str(), rc ? "." : "", f0)); } void DisAsm_R1_RC(const wxString& op, u32 r0, bool rc) { - Write(wxString::Format("%s%s r%d", FixOp(op), rc ? "." : "", r0)); + Write(wxString::Format("%s%s r%d", FixOp(op).mb_str(), rc ? "." : "", r0)); } void DisAsm_R1(const wxString& op, u32 r0) { @@ -136,7 +136,7 @@ private: } void DisAsm_R2_OE_RC(const wxString& op, u32 r0, u32 r1, u32 oe, bool rc) { - Write(wxString::Format("%s%s%s r%d,r%d", FixOp(op), oe ? "o" : "", rc ? "." : "", r0, r1)); + Write(wxString::Format("%s%s%s r%d,r%d", FixOp(op).mb_str(), oe ? "o" : "", rc ? "." : "", r0, r1)); } void DisAsm_R2_RC(const wxString& op, u32 r0, u32 r1, bool rc) { @@ -148,11 +148,11 @@ private: } void DisAsm_R3_OE_RC(const wxString& op, u32 r0, u32 r1, u32 r2, u32 oe, bool rc) { - Write(wxString::Format("%s%s%s r%d,r%d,r%d", FixOp(op), oe ? "o" : "", rc ? "." : "", r0, r1, r2)); + Write(wxString::Format("%s%s%s r%d,r%d,r%d", FixOp(op).mb_str(), oe ? "o" : "", rc ? "." : "", r0, r1, r2)); } void DisAsm_R3_INT2_RC(const wxString& op, u32 r0, u32 r1, u32 r2, s32 i0, s32 i1, bool rc) { - Write(wxString::Format("%s%s r%d,r%d,r%d,%d,%d", FixOp(op), rc ? "." : "", r0, r1, r2, i0, i1)); + Write(wxString::Format("%s%s r%d,r%d,r%d,%d,%d", FixOp(op).mb_str(), rc ? "." : "", r0, r1, r2, i0, i1)); } void DisAsm_R3_RC(const wxString& op, u32 r0, u32 r1, u32 r2, bool rc) { @@ -164,7 +164,7 @@ private: } void DisAsm_R2_INT3_RC(const wxString& op, u32 r0, u32 r1, s32 i0, s32 i1, s32 i2, bool rc) { - Write(wxString::Format("%s%s r%d,r%d,%d,%d,%d", FixOp(op), rc ? "." : "", r0, r1, i0, i1, i2)); + Write(wxString::Format("%s%s r%d,r%d,%d,%d,%d", FixOp(op).mb_str(), rc ? "." : "", r0, r1, i0, i1, i2)); } void DisAsm_R2_INT3(const wxString& op, u32 r0, u32 r1, s32 i0, s32 i1, s32 i2) { @@ -172,7 +172,7 @@ private: } void DisAsm_R2_INT2_RC(const wxString& op, u32 r0, u32 r1, s32 i0, s32 i1, bool rc) { - Write(wxString::Format("%s%s r%d,r%d,%d,%d", FixOp(op), rc ? "." : "", r0, r1, i0, i1)); + Write(wxString::Format("%s%s r%d,r%d,%d,%d", FixOp(op).mb_str(), rc ? "." : "", r0, r1, i0, i1)); } void DisAsm_R2_INT2(const wxString& op, u32 r0, u32 r1, s32 i0, s32 i1) { @@ -180,7 +180,7 @@ private: } void DisAsm_R2_INT1_RC(const wxString& op, u32 r0, u32 r1, s32 i0, bool rc) { - Write(wxString::Format("%s%s r%d,r%d,%d", FixOp(op), rc ? "." : "", r0, r1, i0)); + Write(wxString::Format("%s%s r%d,r%d,%d", FixOp(op).mb_str(), rc ? "." : "", r0, r1, i0)); } void DisAsm_R2_INT1(const wxString& op, u32 r0, u32 r1, s32 i0) { @@ -190,27 +190,27 @@ private: { if(m_mode == CPUDisAsm_CompilerElfMode) { - Write(wxString::Format("%s r%d,r%d,%d #%x", FixOp(op), r0, r1, imm0, imm0)); + Write(wxString::Format("%s r%d,r%d,%d #%x", FixOp(op).mb_str(), r0, r1, imm0, imm0)); return; } - Write(wxString::Format("%s r%d,%d(r%d) #%x", FixOp(op), r0, imm0, r1, imm0)); + Write(wxString::Format("%s r%d,%d(r%d) #%x", FixOp(op).mb_str(), r0, imm0, r1, imm0)); } void DisAsm_R1_IMM(const wxString& op, u32 r0, s32 imm0) { - Write(wxString::Format("%s r%d,%d #%x", FixOp(op), r0, imm0, imm0)); + Write(wxString::Format("%s r%d,%d #%x", FixOp(op).mb_str(), r0, imm0, imm0)); } void DisAsm_IMM_R1(const wxString& op, s32 imm0, u32 r0) { - Write(wxString::Format("%s %d,r%d #%x", FixOp(op), imm0, r0, imm0)); + Write(wxString::Format("%s %d,r%d #%x", FixOp(op).mb_str(), imm0, r0, imm0)); } void DisAsm_CR1_R1_IMM(const wxString& op, u32 cr0, u32 r0, s32 imm0) { - Write(wxString::Format("%s cr%d,r%d,%d #%x", FixOp(op), cr0, r0, imm0, imm0)); + Write(wxString::Format("%s cr%d,r%d,%d #%x", FixOp(op).mb_str(), cr0, r0, imm0, imm0)); } void DisAsm_CR1_R2_RC(const wxString& op, u32 cr0, u32 r0, u32 r1, bool rc) { - Write(wxString::Format("%s%s cr%d,r%d,r%d", FixOp(op), rc ? "." : "", cr0, r0, r1)); + Write(wxString::Format("%s%s cr%d,r%d,r%d", FixOp(op).mb_str(), rc ? "." : "", cr0, r0, r1)); } void DisAsm_CR1_R2(const wxString& op, u32 cr0, u32 r0, u32 r1) { @@ -218,31 +218,31 @@ private: } void DisAsm_CR2(const wxString& op, u32 cr0, u32 cr1) { - Write(wxString::Format("%s cr%d,cr%d", FixOp(op), cr0, cr1)); + Write(wxString::Format("%s cr%d,cr%d", FixOp(op).mb_str(), cr0, cr1)); } void DisAsm_INT3(const wxString& op, const int i0, const int i1, const int i2) { - Write(wxString::Format("%s %d,%d,%d", FixOp(op), i0, i1, i2)); + Write(wxString::Format("%s %d,%d,%d", FixOp(op).mb_str(), i0, i1, i2)); } void DisAsm_INT1(const wxString& op, const int i0) { - Write(wxString::Format("%s %d", FixOp(op), i0)); + Write(wxString::Format("%s %d", FixOp(op).mb_str(), i0)); } void DisAsm_BRANCH(const wxString& op, const int pc) { - Write(wxString::Format("%s 0x%x", FixOp(op), DisAsmBranchTarget(pc))); + Write(wxString::Format("%s 0x%x", FixOp(op).mb_str(), DisAsmBranchTarget(pc))); } void DisAsm_BRANCH_A(const wxString& op, const int pc) { - Write(wxString::Format("%s 0x%x", FixOp(op), pc)); + Write(wxString::Format("%s 0x%x", FixOp(op).mb_str(), pc)); } void DisAsm_B2_BRANCH(const wxString& op, u32 b0, u32 b1, const int pc) { - Write(wxString::Format("%s %d,%d,0x%x ", FixOp(op), b0, b1, DisAsmBranchTarget(pc))); + Write(wxString::Format("%s %d,%d,0x%x ", FixOp(op).mb_str(), b0, b1, DisAsmBranchTarget(pc))); } void DisAsm_CR_BRANCH(const wxString& op, u32 cr, const int pc) { - Write(wxString::Format("%s cr%d,0x%x ", FixOp(op), cr, DisAsmBranchTarget(pc))); + Write(wxString::Format("%s cr%d,0x%x ", FixOp(op).mb_str(), cr, DisAsmBranchTarget(pc))); } private: @@ -1978,4 +1978,4 @@ private: }; #undef START_OPCODES_GROUP -#undef END_OPCODES_GROUP \ No newline at end of file +#undef END_OPCODES_GROUP diff --git a/rpcs3/Emu/Cell/PPUInterpreter.h b/rpcs3/Emu/Cell/PPUInterpreter.h index 44c5eb67fd..8afde576c9 100644 --- a/rpcs3/Emu/Cell/PPUInterpreter.h +++ b/rpcs3/Emu/Cell/PPUInterpreter.h @@ -6,7 +6,12 @@ #include "Emu/SysCalls/SysCalls.h" #include "rpcs3.h" #include +#ifdef _MSC_VER #include +#else +#include +#define _rotl64(x,r) (((u64)x << r) | ((u64)x >> (64 - r))) +#endif #define UNIMPLEMENTED() UNK(__FUNCTION__) @@ -85,9 +90,14 @@ private: { if(!CPU.VSCR.NJ) return v; - int fpc = _fpclass(v); + const int fpc = _fpclass(v); +#ifdef __GNUG__ + if(fpc == FP_SUBNORMAL) + return signbit(v) ? -0.0f : 0.0f; +#else if(fpc & _FPCLASS_ND) return -0.0f; if(fpc & _FPCLASS_PD) return 0.0f; +#endif return v; } @@ -1459,7 +1469,7 @@ private: for (uint w = 0; w < 4; w++) { float f; - modf(CPU.VPR[vb]._f[w], &f); + modff(CPU.VPR[vb]._f[w], &f); CPU.VPR[vd]._f[w] = f; } } @@ -3259,7 +3269,11 @@ private: { double res; +#ifdef _MSVC_VER if(_fpclass(CPU.FPR[frb]) >= _FPCLASS_NZ) +#else + if(_fpclass(CPU.FPR[frb]) == FP_ZERO || signbit(CPU.FPR[frb]) == 0) +#endif { res = static_cast(1.0 / CPU.FPR[frb]); if(FPRdouble::IsINF(res) && CPU.FPR[frb] != 0.0) @@ -3835,7 +3849,7 @@ private: for(uint i=0; i<32; ++i) ConLog.Write("r%d = 0x%llx", i, CPU.GPR[i]); for(uint i=0; i<32; ++i) ConLog.Write("f%d = %llf", i, CPU.FPR[i]); - for(uint i=0; i<32; ++i) ConLog.Write("v%d = 0x%s [%s]", i, CPU.VPR[i].ToString(true), CPU.VPR[i].ToString()); + for(uint i=0; i<32; ++i) ConLog.Write("v%d = 0x%s [%s]", i, CPU.VPR[i].ToString(true).mb_str(), CPU.VPR[i].ToString().mb_str()); ConLog.Write("CR = 0x%08x", CPU.CR); ConLog.Write("LR = 0x%llx", CPU.LR); ConLog.Write("CTR = 0x%llx", CPU.CTR); diff --git a/rpcs3/Emu/Cell/PPUProgramCompiler.cpp b/rpcs3/Emu/Cell/PPUProgramCompiler.cpp index 60c5d860c5..14713c9b9b 100644 --- a/rpcs3/Emu/Cell/PPUProgramCompiler.cpp +++ b/rpcs3/Emu/Cell/PPUProgramCompiler.cpp @@ -148,7 +148,7 @@ void CompilePPUProgram::WriteError(const wxString& error) { if(m_err_list) { - m_err_list->WriteText(wxString::Format("line %lld: %s\n", m_line, error)); + m_err_list->WriteText(wxString::Format("line %lld: %s\n", m_line, error.mb_str())); } } @@ -566,7 +566,7 @@ bool CompilePPUProgram::SetNextArgType(u32 types, bool show_err) if(show_err) { - WriteError(wxString::Format("Bad arg '%s'", arg.string)); + WriteError(wxString::Format("Bad arg '%s'", &arg.string[0])); m_error = true; } @@ -697,7 +697,7 @@ void CompilePPUProgram::LoadSp(const wxString& op, Elf64_Shdr& s_opd) if(!GetArg(test) || test[0] != '[') { if(m_analyze) WriteHex("error\n"); - WriteError(wxString::Format("data not found. style: %s", GetSpStyle(sp))); + WriteError(wxString::Format("data not found. style: %s", GetSpStyle(sp).mb_str())); m_error = true; NextLn(); return; @@ -710,7 +710,7 @@ void CompilePPUProgram::LoadSp(const wxString& op, Elf64_Shdr& s_opd) if(!GetArg(dst)) { if(m_analyze) WriteHex("error\n"); - WriteError(wxString::Format("dst not found. style: %s", GetSpStyle(sp))); + WriteError(wxString::Format("dst not found. style: %s", GetSpStyle(sp).mb_str())); m_error = true; NextLn(); return; @@ -741,7 +741,7 @@ void CompilePPUProgram::LoadSp(const wxString& op, Elf64_Shdr& s_opd) if(!dst_branch) { if(m_analyze) WriteHex("error\n"); - WriteError(wxString::Format("bad dst type. style: %s", GetSpStyle(sp))); + WriteError(wxString::Format("bad dst type. style: %s", GetSpStyle(sp).mb_str())); m_error = true; NextLn(); return; @@ -759,7 +759,7 @@ void CompilePPUProgram::LoadSp(const wxString& op, Elf64_Shdr& s_opd) if(!GetArg(src1, true)) { if(m_analyze) WriteHex("error\n"); - WriteError(wxString::Format("src not found. style: %s", GetSpStyle(sp))); + WriteError(wxString::Format("src not found. style: %s", GetSpStyle(sp).mb_str())); m_error = true; NextLn(); return; @@ -775,7 +775,7 @@ void CompilePPUProgram::LoadSp(const wxString& op, Elf64_Shdr& s_opd) : ~(ARG_IMM | ARG_BRANCH) & a_src1.type) { if(m_analyze) WriteHex("error\n"); - WriteError(wxString::Format("bad src type. style: %s", GetSpStyle(sp))); + WriteError(wxString::Format("bad src type. style: %s", GetSpStyle(sp).mb_str())); m_error = true; NextLn(); return; @@ -784,7 +784,7 @@ void CompilePPUProgram::LoadSp(const wxString& op, Elf64_Shdr& s_opd) if(m_asm[p - 1] != ']') { if(m_analyze) WriteHex("error\n"); - WriteError(wxString::Format("']' not found. style: %s", GetSpStyle(sp))); + WriteError(wxString::Format("']' not found. style: %s", GetSpStyle(sp).mb_str())); m_error = true; NextLn(); return; @@ -865,7 +865,7 @@ void CompilePPUProgram::LoadSp(const wxString& op, Elf64_Shdr& s_opd) if(!GetArg(src1)) { if(m_analyze) WriteHex("error\n"); - WriteError(wxString::Format("src1 not found. style: %s", GetSpStyle(sp))); + WriteError(wxString::Format("src1 not found. style: %s", GetSpStyle(sp).mb_str())); m_error = true; NextLn(); return; @@ -877,7 +877,7 @@ void CompilePPUProgram::LoadSp(const wxString& op, Elf64_Shdr& s_opd) if(~(ARG_IMM | ARG_BRANCH) & a_src1.type) { if(m_analyze) WriteHex("error\n"); - WriteError(wxString::Format("bad src1 type. style: %s", GetSpStyle(sp))); + WriteError(wxString::Format("bad src1 type. style: %s", GetSpStyle(sp).mb_str())); m_error = true; NextLn(); return; @@ -887,7 +887,7 @@ void CompilePPUProgram::LoadSp(const wxString& op, Elf64_Shdr& s_opd) if(!GetArg(src2, true)) { if(m_analyze) WriteHex("error\n"); - WriteError(wxString::Format("src2 not found. style: %s", GetSpStyle(sp))); + WriteError(wxString::Format("src2 not found. style: %s", GetSpStyle(sp).mb_str())); m_error = true; return; } @@ -898,7 +898,7 @@ void CompilePPUProgram::LoadSp(const wxString& op, Elf64_Shdr& s_opd) if(~(ARG_IMM | ARG_BRANCH) & a_src2.type) { if(m_analyze) WriteHex("error\n"); - WriteError(wxString::Format("bad src2 type. style: %s", GetSpStyle(sp))); + WriteError(wxString::Format("bad src2 type. style: %s", GetSpStyle(sp).mb_str())); m_error = true; NextLn(); return; @@ -907,7 +907,7 @@ void CompilePPUProgram::LoadSp(const wxString& op, Elf64_Shdr& s_opd) if(m_asm[p - 1] != ']') { if(m_analyze) WriteHex("error\n"); - WriteError(wxString::Format("']' not found. style: %s", GetSpStyle(sp))); + WriteError(wxString::Format("']' not found. style: %s", GetSpStyle(sp).mb_str())); m_error = true; NextLn(); return; @@ -1336,7 +1336,7 @@ void CompilePPUProgram::Compile() for(u32 i=0; i unknown fpclass (0x%04x).", fpc); } @@ -729,7 +740,7 @@ public: for(uint i=0; i<32; ++i) ret += wxString::Format("GPR[%d] = 0x%llx\n", i, GPR[i]); for(uint i=0; i<32; ++i) ret += wxString::Format("FPR[%d] = %.6G\n", i, FPR[i]); - for(uint i=0; i<32; ++i) ret += wxString::Format("VPR[%d] = 0x%s [%s]\n", i, VPR[i].ToString(true), VPR[i].ToString()); + for(uint i=0; i<32; ++i) ret += wxString::Format("VPR[%d] = 0x%s [%s]\n", i, VPR[i].ToString(true).mb_str(), VPR[i].ToString().mb_str()); ret += wxString::Format("CR = 0x%08x\n", CR); ret += wxString::Format("LR = 0x%llx\n", LR); ret += wxString::Format("CTR = 0x%llx\n", CTR); @@ -839,4 +850,4 @@ protected: } }; -PPUThread& GetCurrentPPUThread(); \ No newline at end of file +PPUThread& GetCurrentPPUThread(); diff --git a/rpcs3/Emu/Cell/RawSPUThread.cpp b/rpcs3/Emu/Cell/RawSPUThread.cpp index 86d8addf0c..db6350b81a 100644 --- a/rpcs3/Emu/Cell/RawSPUThread.cpp +++ b/rpcs3/Emu/Cell/RawSPUThread.cpp @@ -269,7 +269,7 @@ u32 RawSPUThread::GetIndex() const void RawSPUThread::Task() { - ConLog.Write("%s enter", PPCThread::GetFName()); + ConLog.Write("%s enter", PPCThread::GetFName().mb_str()); const Array& bp = Emu.GetBreakPoints(); @@ -339,12 +339,12 @@ void RawSPUThread::Task() } catch(const wxString& e) { - ConLog.Error("Exception: %s", e); + ConLog.Error("Exception: %s", e.mb_str()); } catch(const char* e) { ConLog.Error("Exception: %s", e); } - ConLog.Write("%s leave", PPCThread::GetFName()); + ConLog.Write("%s leave", PPCThread::GetFName().mb_str()); } diff --git a/rpcs3/Emu/Cell/SPUDecoder.h b/rpcs3/Emu/Cell/SPUDecoder.h index 9c179a5d8e..ec2dc3daa2 100644 --- a/rpcs3/Emu/Cell/SPUDecoder.h +++ b/rpcs3/Emu/Cell/SPUDecoder.h @@ -2,7 +2,7 @@ #include "Emu/Cell/SPUOpcodes.h" #include "Emu/Cell/PPCDecoder.h" -#include "Emu/Cell/SPUInstrtable.h" +#include "Emu/Cell/SPUInstrTable.h" class SPUDecoder : public PPCDecoder { diff --git a/rpcs3/Emu/Cell/SPUDisAsm.h b/rpcs3/Emu/Cell/SPUDisAsm.h index c0eee0044a..e89b93c098 100644 --- a/rpcs3/Emu/Cell/SPUDisAsm.h +++ b/rpcs3/Emu/Cell/SPUDisAsm.h @@ -37,43 +37,43 @@ private: } void DisAsm(wxString op, u32 a1) { - Write(wxString::Format("%s 0x%x", FixOp(op), a1)); + Write(wxString::Format("%s 0x%x", FixOp(op).mb_str(), a1)); } void DisAsm(wxString op, const char* a1) { - Write(wxString::Format("%s %s", FixOp(op), a1)); + Write(wxString::Format("%s %s", FixOp(op).mb_str(), a1)); } void DisAsm(wxString op, const char* a1, const char* a2) { - Write(wxString::Format("%s %s,%s", FixOp(op), a1, a2)); + Write(wxString::Format("%s %s,%s", FixOp(op).mb_str(), a1, a2)); } void DisAsm(wxString op, int a1, const char* a2) { - Write(wxString::Format("%s 0x%x,%s", FixOp(op), a1, a2)); + Write(wxString::Format("%s 0x%x,%s", FixOp(op).mb_str(), a1, a2)); } void DisAsm(wxString op, const char* a1, int a2) { - Write(wxString::Format("%s %s,0x%x", FixOp(op), a1, a2)); + Write(wxString::Format("%s %s,0x%x", FixOp(op).mb_str(), a1, a2)); } void DisAsm(wxString op, int a1, int a2) { - Write(wxString::Format("%s 0x%x,0x%x", FixOp(op), a1, a2)); + Write(wxString::Format("%s 0x%x,0x%x", FixOp(op).mb_str(), a1, a2)); } void DisAsm(wxString op, const char* a1, const char* a2, const char* a3) { - Write(wxString::Format("%s %s,%s,%s", FixOp(op), a1, a2, a3)); + Write(wxString::Format("%s %s,%s,%s", FixOp(op).mb_str(), a1, a2, a3)); } void DisAsm(wxString op, const char* a1, int a2, const char* a3) { - Write(wxString::Format("%s %s,0x%x(%s)", FixOp(op), a1, a2, a3)); + Write(wxString::Format("%s %s,0x%x(%s)", FixOp(op).mb_str(), a1, a2, a3)); } void DisAsm(wxString op, const char* a1, const char* a2, int a3) { - Write(wxString::Format("%s %s,%s,0x%x", FixOp(op), a1, a2, a3)); + Write(wxString::Format("%s %s,%s,0x%x", FixOp(op).mb_str(), a1, a2, a3)); } void DisAsm(wxString op, const char* a1, const char* a2, const char* a3, const char* a4) { - Write(wxString::Format("%s %s,%s,%s,%s", FixOp(op), a1, a2, a3, a4)); + Write(wxString::Format("%s %s,%s,%s,%s", FixOp(op).mb_str(), a1, a2, a3, a4)); } //0 - 10 void STOP(u32 code) diff --git a/rpcs3/Emu/Cell/SPUInterpreter.h b/rpcs3/Emu/Cell/SPUInterpreter.h index f225baa5a5..1483f0b546 100644 --- a/rpcs3/Emu/Cell/SPUInterpreter.h +++ b/rpcs3/Emu/Cell/SPUInterpreter.h @@ -1333,6 +1333,6 @@ private: { ConLog.Error(err + wxString::Format(" #pc: 0x%x", CPU.PC)); Emu.Pause(); - for(uint i=0; i<128; ++i) ConLog.Write("r%d = 0x%s", i, CPU.GPR[i].ToString()); + for(uint i=0; i<128; ++i) ConLog.Write("r%d = 0x%s", i, CPU.GPR[i].ToString().mb_str()); } }; diff --git a/rpcs3/Emu/Cell/SPUThread.h b/rpcs3/Emu/Cell/SPUThread.h index 2a016e27c4..4cda6c586b 100644 --- a/rpcs3/Emu/Cell/SPUThread.h +++ b/rpcs3/Emu/Cell/SPUThread.h @@ -441,7 +441,7 @@ public: { wxString ret = "Registers:\n=========\n"; - for(uint i=0; i<128; ++i) ret += wxString::Format("GPR[%d] = 0x%s\n", i, GPR[i].ToString()); + for(uint i=0; i<128; ++i) ret += wxString::Format("GPR[%d] = 0x%s\n", i, GPR[i].ToString().mb_str()); return ret; } @@ -490,4 +490,4 @@ protected: virtual void DoStop(); }; -SPUThread& GetCurrentSPUThread(); \ No newline at end of file +SPUThread& GetCurrentSPUThread(); diff --git a/rpcs3/Emu/FS/VFS.cpp b/rpcs3/Emu/FS/VFS.cpp index fb1874f5bc..c6dd8e1ed8 100644 --- a/rpcs3/Emu/FS/VFS.cpp +++ b/rpcs3/Emu/FS/VFS.cpp @@ -1,6 +1,6 @@ #include "stdafx.h" #include "VFS.h" -#include "Emu\HDD\HDD.h" +#include "Emu/HDD/HDD.h" int sort_devices(const void* _a, const void* _b) { @@ -230,4 +230,4 @@ void VFS::SaveLoadDevices(Array& res, bool is_load) entry_device.SaveValue(res[i].device); } } -} \ No newline at end of file +} diff --git a/rpcs3/Emu/FS/vfsDirBase.cpp b/rpcs3/Emu/FS/vfsDirBase.cpp index 875605fe79..0d29a26585 100644 --- a/rpcs3/Emu/FS/vfsDirBase.cpp +++ b/rpcs3/Emu/FS/vfsDirBase.cpp @@ -1,3 +1,3 @@ #include "stdafx.h" -#include "vfsDirBase.cpp" +#include "vfsDirBase.h" diff --git a/rpcs3/Emu/GS/GL/GLBuffers.cpp b/rpcs3/Emu/GS/GL/GLBuffers.cpp index 9b14845c0d..b7ea6001c7 100644 --- a/rpcs3/Emu/GS/GL/GLBuffers.cpp +++ b/rpcs3/Emu/GS/GL/GLBuffers.cpp @@ -265,4 +265,4 @@ void GLfbo::Delete() bool GLfbo::IsCreated() const { return m_id != 0; -} \ No newline at end of file +} diff --git a/rpcs3/Emu/GS/GL/GLFragmentProgram.cpp b/rpcs3/Emu/GS/GL/GLFragmentProgram.cpp index bdfca11ab7..ff4c0672f1 100644 --- a/rpcs3/Emu/GS/GL/GLFragmentProgram.cpp +++ b/rpcs3/Emu/GS/GL/GLFragmentProgram.cpp @@ -43,7 +43,7 @@ void GLFragmentDecompilerThread::AddCode(wxString code, bool append_mask) cond = "equal"; } - cond = wxString::Format("if(all(%s(%s.%s, vec4(0, 0, 0, 0)))) ", cond, AddCond(dst.no_dest), swizzle); + cond = wxString::Format("if(all(%s(%s.%s, vec4(0, 0, 0, 0)))) ", cond.mb_str(), AddCond(dst.no_dest).mb_str(), swizzle.mb_str()); //ConLog.Error("cond! [eq: %d gr: %d lt: %d] (%s)", src0.exec_if_eq, src0.exec_if_gr, src0.exec_if_lt, cond); //Emu.Pause(); //return; @@ -74,7 +74,7 @@ void GLFragmentDecompilerThread::AddCode(wxString code, bool append_mask) code = cond + (dst.set_cond ? m_parr.AddParam(PARAM_NONE , "vec4", wxString::Format(dst.fp16 ? "hc%d" : "rc%d", src0.cond_reg_index)) : AddReg(dst.dest_reg, dst.fp16)) + mask - + " = " + code + (append_mask ? mask : wxEmptyString); + + " = " + code + (append_mask ? mask : wxString(wxEmptyString)); main += "\t" + code + ";\n"; } @@ -93,7 +93,7 @@ wxString GLFragmentDecompilerThread::GetMask() if(dst.mask_z) ret += dst_mask[2]; if(dst.mask_w) ret += dst_mask[3]; - return ret.IsEmpty() || strncmp(ret, dst_mask, 4) == 0 ? wxEmptyString : ("." + ret); + return ret.IsEmpty() || strncmp(ret, dst_mask, 4) == 0 ? wxString(wxEmptyString) : ("." + ret); } wxString GLFragmentDecompilerThread::AddReg(u32 index, int fp16) @@ -220,7 +220,7 @@ wxString GLFragmentDecompilerThread::BuildCode() "%s\n" "void main()\n{\n%s}\n"; - return wxString::Format(prot, p, main); + return wxString::Format(prot, p.mb_str(), main.mb_str()); } void GLFragmentDecompilerThread::Task() @@ -420,4 +420,4 @@ void GLShaderProgram::Delete() glDeleteShader(id); id = 0; } -} \ No newline at end of file +} diff --git a/rpcs3/Emu/GS/GL/GLGSRender.cpp b/rpcs3/Emu/GS/GL/GLGSRender.cpp index 4f4253ef6f..278c073f83 100644 --- a/rpcs3/Emu/GS/GL/GLGSRender.cpp +++ b/rpcs3/Emu/GS/GL/GLGSRender.cpp @@ -449,13 +449,13 @@ void GLGSRender::WriteDepthBuffer() return; } - glReadPixels(0, 0, m_width, m_height, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, &Memory[address]); + glReadPixels(0, 0, RSXThread::m_width, RSXThread::m_height, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, &Memory[address]); checkForGlError("glReadPixels"); GLuint depth_tex; glGenTextures(1, &depth_tex); glBindTexture(GL_TEXTURE_2D, depth_tex); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_width, m_height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, &Memory[address]); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, RSXThread::m_width, RSXThread::m_height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, &Memory[address]); checkForGlError("glTexImage2D"); glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, &Memory[address]); checkForGlError("glGetTexImage"); @@ -478,7 +478,7 @@ void GLGSRender::WriteColourBufferA() glReadBuffer(GL_COLOR_ATTACHMENT0); checkForGlError("glReadBuffer(GL_COLOR_ATTACHMENT0)"); - glReadPixels(0, 0, m_width, m_height, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, &Memory[address]); + glReadPixels(0, 0, RSXThread::m_width, RSXThread::m_height, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, &Memory[address]); checkForGlError("glReadPixels(GL_RGBA, GL_UNSIGNED_INT_8_8_8_8)"); } @@ -498,7 +498,7 @@ void GLGSRender::WriteColourBufferB() glReadBuffer(GL_COLOR_ATTACHMENT1); checkForGlError("glReadBuffer(GL_COLOR_ATTACHMENT1)"); - glReadPixels(0, 0, m_width, m_height, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, &Memory[address]); + glReadPixels(0, 0, RSXThread::m_width, RSXThread::m_height, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, &Memory[address]); checkForGlError("glReadPixels(GL_RGBA, GL_UNSIGNED_INT_8_8_8_8)"); } @@ -518,7 +518,7 @@ void GLGSRender::WriteColourBufferC() glReadBuffer(GL_COLOR_ATTACHMENT2); checkForGlError("glReadBuffer(GL_COLOR_ATTACHMENT2)"); - glReadPixels(0, 0, m_width, m_height, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, &Memory[address]); + glReadPixels(0, 0, RSXThread::m_width, RSXThread::m_height, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, &Memory[address]); checkForGlError("glReadPixels(GL_RGBA, GL_UNSIGNED_INT_8_8_8_8)"); } @@ -538,7 +538,7 @@ void GLGSRender::WriteColourBufferD() glReadBuffer(GL_COLOR_ATTACHMENT3); checkForGlError("glReadBuffer(GL_COLOR_ATTACHMENT3)"); - glReadPixels(0, 0, m_width, m_height, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, &Memory[address]); + glReadPixels(0, 0, RSXThread::m_width, RSXThread::m_height, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, &Memory[address]); checkForGlError("glReadPixels(GL_RGBA, GL_UNSIGNED_INT_8_8_8_8)"); } @@ -584,8 +584,8 @@ void GLGSRender::OnInit() { m_draw_frames = 1; m_skip_frames = 0; - m_width = 720; - m_height = 576; + RSXThread::m_width = 720; + RSXThread::m_height = 576; last_width = 0; last_height = 0; @@ -603,7 +603,15 @@ void GLGSRender::OnInitThread() glEnable(GL_TEXTURE_2D); glEnable(GL_SCISSOR_TEST); + +#if defined(__GNUG__) // Hack. Should detect xorg instead +#if 0 + if (GLXDrawable drawable = glXGetCurrentDrawable()) + glXSwapIntervalEXT(glXGetCurrentDisplay(), drawable, Ini.GSVSyncEnable.GetValue() ? 1 : 0); +#endif +#else glSwapInterval(Ini.GSVSyncEnable.GetValue() ? 1 : 0); +#endif } void GLGSRender::OnExitThread() @@ -641,11 +649,11 @@ void GLGSRender::ExecCMD() return; } - if(!m_fbo.IsCreated() || m_width != last_width || m_height != last_height || last_depth_format != m_surface_depth_format) + if(!m_fbo.IsCreated() || RSXThread::m_width != last_width || RSXThread::m_height != last_height || last_depth_format != m_surface_depth_format) { - ConLog.Warning("New FBO (%dx%d)", m_width, m_height); - last_width = m_width; - last_height = m_height; + ConLog.Warning("New FBO (%dx%d)", RSXThread::m_width, RSXThread::m_height); + last_width = RSXThread::m_width; + last_height = RSXThread::m_height; last_depth_format = m_surface_depth_format; m_fbo.Create(); @@ -658,7 +666,7 @@ void GLGSRender::ExecCMD() for(int i=0; i<4; ++i) { m_rbo.Bind(i); - m_rbo.Storage(GL_RGBA, m_width, m_height); + m_rbo.Storage(GL_RGBA, RSXThread::m_width, RSXThread::m_height); checkForGlError("m_rbo.Storage(GL_RGBA)"); } @@ -667,12 +675,12 @@ void GLGSRender::ExecCMD() switch(m_surface_depth_format) { case 1: - m_rbo.Storage(GL_DEPTH_COMPONENT16, m_width, m_height); + m_rbo.Storage(GL_DEPTH_COMPONENT16, RSXThread::m_width, RSXThread::m_height); checkForGlError("m_rbo.Storage(GL_DEPTH_COMPONENT16)"); break; case 2: - m_rbo.Storage(GL_DEPTH24_STENCIL8, m_width, m_height); + m_rbo.Storage(GL_DEPTH24_STENCIL8, RSXThread::m_width, RSXThread::m_height); checkForGlError("m_rbo.Storage(GL_DEPTH24_STENCIL8)"); break; @@ -701,13 +709,13 @@ void GLGSRender::ExecCMD() if(!m_set_surface_clip_horizontal) { m_surface_clip_x = 0; - m_surface_clip_w = m_width; + m_surface_clip_w = RSXThread::m_width; } if(!m_set_surface_clip_vertical) { m_surface_clip_y = 0; - m_surface_clip_h = m_height; + m_surface_clip_h = RSXThread::m_height; } m_fbo.Bind(); @@ -753,13 +761,13 @@ void GLGSRender::ExecCMD() if(m_set_viewport_horizontal && m_set_viewport_vertical) { - glViewport(m_viewport_x, m_height-m_viewport_y-m_viewport_h, m_viewport_w, m_viewport_h); + glViewport(m_viewport_x, RSXThread::m_height-m_viewport_y-m_viewport_h, m_viewport_w, m_viewport_h); checkForGlError("glViewport"); } if(m_set_scissor_horizontal && m_set_scissor_vertical) { - glScissor(m_scissor_x, m_height-m_scissor_y-m_scissor_h, m_scissor_w, m_scissor_h); + glScissor(m_scissor_x, RSXThread::m_height-m_scissor_y-m_scissor_h, m_scissor_w, m_scissor_h); checkForGlError("glScissor"); } @@ -1038,4 +1046,4 @@ void GLGSRender::Flip() } m_frame->Flip(); -} \ No newline at end of file +} diff --git a/rpcs3/Emu/GS/GL/GLGSRender.h b/rpcs3/Emu/GS/GL/GLGSRender.h index 9fa7c9a125..17573c677b 100644 --- a/rpcs3/Emu/GS/GL/GLGSRender.h +++ b/rpcs3/Emu/GS/GL/GLGSRender.h @@ -1,7 +1,7 @@ #pragma once #include "Emu/GS/GSRender.h" #include "Emu/GS/RSXThread.h" -#include "wx/glcanvas.h" +#include #include "GLBuffers.h" #include "GLProgram.h" #include "OpenGL.h" @@ -462,4 +462,4 @@ protected: virtual void OnReset(); virtual void ExecCMD(); virtual void Flip(); -}; \ No newline at end of file +}; diff --git a/rpcs3/Emu/GS/GL/GLProcTable.tbl b/rpcs3/Emu/GS/GL/GLProcTable.tbl index ca6f1ca1f2..ebeb72cff0 100644 --- a/rpcs3/Emu/GS/GL/GLProcTable.tbl +++ b/rpcs3/Emu/GS/GL/GLProcTable.tbl @@ -11,15 +11,12 @@ OPENGL_PROC(PFNGLGETBUFFERPARAMETERIVPROC, GetBufferParameteriv); OPENGL_PROC(PFNGLGETBUFFERPOINTERVPROC, GetBufferPointerv); OPENGL_PROC(PFNGLBLENDFUNCSEPARATEPROC, BlendFuncSeparate); OPENGL_PROC(PFNGLBLENDEQUATIONSEPARATEPROC, BlendEquationSeparate); -OPENGL_PROC(PFNGLBLENDCOLORPROC, BlendColor); -OPENGL_PROC(PFNGLBLENDEQUATIONPROC, BlendEquation); OPENGL_PROC(PFNGLCREATESHADERPROC, CreateShader); OPENGL_PROC(PFNGLDELETESHADERPROC, DeleteShader); OPENGL_PROC(PFNGLCOMPILESHADERPROC, CompileShader); OPENGL_PROC(PFNGLSHADERSOURCEPROC, ShaderSource); OPENGL_PROC(PFNGLGETSHADERIVPROC, GetShaderiv); OPENGL_PROC(PFNGLGETSHADERINFOLOGPROC, GetShaderInfoLog); -OPENGL_PROC(PFNGLACTIVETEXTUREPROC, ActiveTexture); OPENGL_PROC(PFNGLCREATEPROGRAMPROC, CreateProgram); OPENGL_PROC(PFNGLDELETEPROGRAMPROC, DeleteProgram); OPENGL_PROC(PFNGLATTACHSHADERPROC, AttachShader); @@ -80,12 +77,10 @@ OPENGL_PROC(PFNGLPROGRAMUNIFORM1FPROC, ProgramUniform1f); OPENGL_PROC(PFNGLPROGRAMUNIFORM4FPROC, ProgramUniform4f); OPENGL_PROC(PFNGLUNIFORMMATRIX4FVPROC, UniformMatrix4fv); OPENGL_PROC(PFNGLUSEPROGRAMPROC, UseProgram); -OPENGL_PROC2(PFNWGLSWAPINTERVALEXTPROC, SwapInterval, wglSwapIntervalEXT); OPENGL_PROC2(PFNGLDEPTHBOUNDSEXTPROC, DepthBounds, glDepthBoundsEXT); OPENGL_PROC(PFNGLSTENCILOPSEPARATEPROC, StencilOpSeparate); OPENGL_PROC(PFNGLSTENCILFUNCSEPARATEPROC, StencilFuncSeparate); OPENGL_PROC(PFNGLSTENCILMASKSEPARATEPROC, StencilMaskSeparate); -OPENGL_PROC(PFNGLCOMPRESSEDTEXIMAGE2DPROC, CompressedTexImage2D); OPENGL_PROC(PFNGLGENERATEMIPMAPPROC, GenerateMipmap); OPENGL_PROC(PFNGLBINDRENDERBUFFERPROC, BindRenderbuffer); OPENGL_PROC(PFNGLDELETERENDERBUFFERSPROC, DeleteRenderbuffers); @@ -99,4 +94,13 @@ OPENGL_PROC(PFNGLFRAMEBUFFERTEXTURE2DPROC, FramebufferTexture2D); OPENGL_PROC(PFNGLFRAMEBUFFERTEXTURE3DPROC, FramebufferTexture3D); OPENGL_PROC(PFNGLFRAMEBUFFERRENDERBUFFERPROC, FramebufferRenderbuffer); OPENGL_PROC(PFNGLBLITFRAMEBUFFERPROC, BlitFramebuffer); -OPENGL_PROC(PFNGLDRAWBUFFERSPROC, DrawBuffers); \ No newline at end of file +OPENGL_PROC(PFNGLDRAWBUFFERSPROC, DrawBuffers); + +#ifndef __GNUG__ +OPENGL_PROC(PFNGLBLENDCOLORPROC, BlendColor); +OPENGL_PROC(PFNGLBLENDEQUATIONPROC, BlendEquation); +OPENGL_PROC(PFNGLCOMPRESSEDTEXIMAGE2DPROC, CompressedTexImage2D); +OPENGL_PROC(PFNGLACTIVETEXTUREPROC, ActiveTexture); + +OPENGL_PROC2(PFNWGLSWAPINTERVALEXTPROC, SwapInterval, wglSwapIntervalEXT); +#endif diff --git a/rpcs3/Emu/GS/GL/GLProgram.cpp b/rpcs3/Emu/GS/GL/GLProgram.cpp index 1f0c21539b..49b00de64b 100644 --- a/rpcs3/Emu/GS/GL/GLProgram.cpp +++ b/rpcs3/Emu/GS/GL/GLProgram.cpp @@ -20,7 +20,7 @@ int GLProgram::GetLocation(const wxString& name) m_locations[pos].name = name; m_locations[pos].loc = glGetUniformLocation(id, name); - checkForGlError(wxString::Format("glGetUniformLocation(0x%x, %s)", id, name)); + checkForGlError(wxString::Format("glGetUniformLocation(0x%x, %s)", id, name.mb_str())); return m_locations[pos].loc; } @@ -100,4 +100,4 @@ void GLProgram::Delete() glDeleteProgram(id); id = 0; m_locations.Clear(); -} \ No newline at end of file +} diff --git a/rpcs3/Emu/GS/GL/GLProgramBuffer.cpp b/rpcs3/Emu/GS/GL/GLProgramBuffer.cpp index 76b6e0f602..0212c7e488 100644 --- a/rpcs3/Emu/GS/GL/GLProgramBuffer.cpp +++ b/rpcs3/Emu/GS/GL/GLProgramBuffer.cpp @@ -93,8 +93,8 @@ void GLProgramBuffer::Add(GLProgram& prog, GLShaderProgram& gl_fp, RSXShaderProg ConLog.Write("*** vp data size = %d", rsx_vp.data.GetCount() * 4); ConLog.Write("*** fp data size = %d", rsx_fp.size); - ConLog.Write("*** vp shader = \n%s", gl_vp.shader); - ConLog.Write("*** fp shader = \n%s", gl_fp.shader); + ConLog.Write("*** vp shader = \n%s", gl_vp.shader.mb_str()); + ConLog.Write("*** fp shader = \n%s", gl_fp.shader.mb_str()); new_buf.prog_id = prog.id; new_buf.vp_id = gl_vp.id; @@ -125,4 +125,4 @@ void GLProgramBuffer::Clear() } m_buf.Clear(); -} \ No newline at end of file +} diff --git a/rpcs3/Emu/GS/GL/GLVertexProgram.cpp b/rpcs3/Emu/GS/GL/GLVertexProgram.cpp index 50b9fc30b7..591482ff3d 100644 --- a/rpcs3/Emu/GS/GL/GLVertexProgram.cpp +++ b/rpcs3/Emu/GS/GL/GLVertexProgram.cpp @@ -20,7 +20,7 @@ wxString GLVertexDecompilerThread::GetMask(bool is_sca) if(d3.vec_writemask_w) ret += "w"; } - return ret.IsEmpty() || ret == "xyzw" ? wxEmptyString : ("." + ret); + return ret.IsEmpty() || ret == "xyzw" ? wxString(wxEmptyString) : ("." + ret); } wxString GLVertexDecompilerThread::GetVecMask() @@ -179,7 +179,7 @@ void GLVertexDecompilerThread::AddCode(bool is_sca, wxString code, bool src_mask } //ConLog.Error("cond! %d (%d %s %d %d)", d0.cond, d0.dst_tmp, cond, d1.input_src, d1.const_src); - cond = wxString::Format("if(tmp%d.x %s 0) ", d0.dst_tmp, cond); + cond = wxString::Format("if(tmp%d.x %s 0) ", d0.dst_tmp, cond.mb_str()); } wxString value = src_mask ? code + GetMask(is_sca) : code; @@ -240,7 +240,7 @@ wxString GLVertexDecompilerThread::BuildCode() "%s\n" "void main()\n{\n\tgl_Position = vec4(0.0f, 0.0f, 0.0f, 1.0f);\n%s}\n"; - return wxString::Format(prot, p, main); + return wxString::Format(prot, p.mb_str(), main.mb_str()); } void GLVertexDecompilerThread::Task() diff --git a/rpcs3/Emu/GS/GL/OpenGL.cpp b/rpcs3/Emu/GS/GL/OpenGL.cpp index 4ac3fb3951..e1a797c216 100644 --- a/rpcs3/Emu/GS/GL/OpenGL.cpp +++ b/rpcs3/Emu/GS/GL/OpenGL.cpp @@ -3,11 +3,13 @@ void InitProcTable() { +#if 0 #define OPENGL_PROC(p, n) OPENGL_PROC2(p, n, gl##n) #define OPENGL_PROC2(p, n, tn) /*if(!gl##n)*/ if(!(gl##n = (p)wglGetProcAddress(#tn))) ConLog.Error("OpenGL: initialization of " #tn " failed.") #include "GLProcTable.tbl" #undef OPENGL_PROC #undef OPENGL_PROC2 +#endif } #define OPENGL_PROC(p, n) p gl##n = nullptr @@ -29,11 +31,13 @@ OpenGL::~OpenGL() void OpenGL::Init() { +#if 0 #define OPENGL_PROC(p, n) OPENGL_PROC2(p, n, gl##n) #define OPENGL_PROC2(p, n, tn) if(!(n = (p)wglGetProcAddress(#tn))) ConLog.Error("OpenGL: initialization of " #tn " failed.") #include "GLProcTable.tbl" #undef OPENGL_PROC #undef OPENGL_PROC2 +#endif } void OpenGL::Close() @@ -43,4 +47,4 @@ void OpenGL::Close() #include "GLProcTable.tbl" #undef OPENGL_PROC #undef OPENGL_PROC2 -} \ No newline at end of file +} diff --git a/rpcs3/Emu/GS/GL/OpenGL.h b/rpcs3/Emu/GS/GL/OpenGL.h index 2614038244..83859fd75b 100644 --- a/rpcs3/Emu/GS/GL/OpenGL.h +++ b/rpcs3/Emu/GS/GL/OpenGL.h @@ -2,7 +2,13 @@ #include #include "GL/glext.h" +#ifdef __GNUG__ // HACK: detect xorg +#define GLX_GLXEXT_PROTOTYPES +//#include +//#include +#else typedef BOOL (WINAPI* PFNWGLSWAPINTERVALEXTPROC) (int interval); +#endif #define OPENGL_PROC(p, n) extern p gl##n #define OPENGL_PROC2(p, n, tn) OPENGL_PROC(p, n) @@ -25,4 +31,4 @@ struct OpenGL void Init(); void Close(); -}; \ No newline at end of file +}; diff --git a/rpcs3/Emu/GS/Null/NullGSRender.h b/rpcs3/Emu/GS/Null/NullGSRender.h index 032d34fc5c..f2f2be04fb 100644 --- a/rpcs3/Emu/GS/Null/NullGSRender.h +++ b/rpcs3/Emu/GS/Null/NullGSRender.h @@ -8,19 +8,27 @@ struct NullGSFrame : public GSFrame Connect(wxEVT_LEFT_DCLICK, wxMouseEventHandler(GSFrame::OnLeftDclick)); } - void Draw() { Draw(wxClientDC(this)); } + void Draw() + { + wxClientDC dc(this); + Draw(&dc); + } private: - virtual void OnPaint(wxPaintEvent& event) { Draw(wxPaintDC(this)); } + virtual void OnPaint(wxPaintEvent& event) + { + wxPaintDC dc(this); + Draw(&dc); + } virtual void OnSize(wxSizeEvent& event) { GSFrame::OnSize(event); Draw(); } - void Draw(wxDC& dc) + void Draw(wxDC* dc) { - dc.DrawText("Null GS output", 0, 0); + dc->DrawText("Null GS output", 0, 0); } }; diff --git a/rpcs3/Emu/GS/sysutil_video.h b/rpcs3/Emu/GS/sysutil_video.h index a1a0d4c920..6ec3f0de63 100644 --- a/rpcs3/Emu/GS/sysutil_video.h +++ b/rpcs3/Emu/GS/sysutil_video.h @@ -223,7 +223,7 @@ enum CellVideoOutRGBOutputRange static const CellVideoOutResolution ResolutionTable[] = { - {-1, -1}, //0 - 0 + {(u16)-1, (u16)-1}, //0 - 0 {1920, 1080}, //1 - 1 {1280, 720}, //2 - 2 {720, 480}, //4 - 3 @@ -273,4 +273,4 @@ inline static u32 ResolutionNumToId(u32 num) }; return num <= 8 ? res[num] : 0; -} \ No newline at end of file +} diff --git a/rpcs3/Emu/HDD/HDD.h b/rpcs3/Emu/HDD/HDD.h index 58438a6a4e..baa03fdfe0 100644 --- a/rpcs3/Emu/HDD/HDD.h +++ b/rpcs3/Emu/HDD/HDD.h @@ -474,7 +474,7 @@ public: int OpenDir(const wxString& name) { - ConLog.Warning("OpenDir(%s)", name); + ConLog.Warning("OpenDir(%s)", name.mb_str()); u64 entry_block; if(!SearchEntry(name, entry_block)) return -1; @@ -761,7 +761,7 @@ public: if(entry.type == vfsHDD_Entry_Dir && name != "." && name != "..") { - ConLog.Warning("removing sub folder '%s'", name); + ConLog.Warning("removing sub folder '%s'", name.mb_str()); RemoveBlocksDir(entry.data_block); } else if(entry.type == vfsHDD_Entry_File) @@ -861,4 +861,4 @@ public: { return m_file.GetSize(); } -}; \ No newline at end of file +}; diff --git a/rpcs3/Emu/Memory/DynamicMemoryBlockBase.inl b/rpcs3/Emu/Memory/DynamicMemoryBlockBase.inl index d4f28d2feb..61550a8e3a 100644 --- a/rpcs3/Emu/Memory/DynamicMemoryBlockBase.inl +++ b/rpcs3/Emu/Memory/DynamicMemoryBlockBase.inl @@ -21,7 +21,7 @@ const u32 DynamicMemoryBlockBase::GetUsedSize() const template bool DynamicMemoryBlockBase::IsInMyRange(const u64 addr) { - return addr >= GetStartAddr() && addr < GetStartAddr() + GetSize(); + return addr >= MemoryBlock::GetStartAddr() && addr < MemoryBlock::GetStartAddr() + GetSize(); } template @@ -95,7 +95,7 @@ void DynamicMemoryBlockBase::AppendUsedMem(u64 addr, u32 size) template u64 DynamicMemoryBlockBase::Alloc(u32 size) { - for(u64 addr=GetStartAddr(); addr <= GetEndAddr() - size;) + for(u64 addr = MemoryBlock::GetStartAddr(); addr <= MemoryBlock::GetEndAddr() - size;) { bool is_good_addr = true; @@ -146,7 +146,7 @@ u8* DynamicMemoryBlockBase::GetMem(u64 addr) const { for(u32 i=0; i= _addr && addr < _addr + m_used_mem[i].size) { @@ -157,4 +157,4 @@ u8* DynamicMemoryBlockBase::GetMem(u64 addr) const ConLog.Error("GetMem(%llx) from not allocated address.", addr); assert(0); return nullptr; -} \ No newline at end of file +} diff --git a/rpcs3/Emu/Memory/Memory.cpp b/rpcs3/Emu/Memory/Memory.cpp index 994dc01af1..0c5f547c33 100644 --- a/rpcs3/Emu/Memory/Memory.cpp +++ b/rpcs3/Emu/Memory/Memory.cpp @@ -494,3 +494,8 @@ u128 MemoryBase::Read128(u64 addr) GetMemByAddr(addr).Read128(addr, &res); return res; } + +template<> __forceinline u64 MemoryBase::ReverseData<1>(u64 val) { return val; } +template<> __forceinline u64 MemoryBase::ReverseData<2>(u64 val) { return Reverse16(val); } +template<> __forceinline u64 MemoryBase::ReverseData<4>(u64 val) { return Reverse32(val); } +template<> __forceinline u64 MemoryBase::ReverseData<8>(u64 val) { return Reverse64(val); } diff --git a/rpcs3/Emu/Memory/Memory.h b/rpcs3/Emu/Memory/Memory.h index 507073f337..66123e36ca 100644 --- a/rpcs3/Emu/Memory/Memory.h +++ b/rpcs3/Emu/Memory/Memory.h @@ -87,10 +87,6 @@ public: } template static __forceinline u64 ReverseData(u64 val); - template<> static __forceinline u64 ReverseData<1>(u64 val) { return val; } - template<> static __forceinline u64 ReverseData<2>(u64 val) { return Reverse16(val); } - template<> static __forceinline u64 ReverseData<4>(u64 val) { return Reverse32(val); } - template<> static __forceinline u64 ReverseData<8>(u64 val) { return Reverse64(val); } template static __forceinline T Reverse(T val) { @@ -125,11 +121,11 @@ public: u64 RealToVirtualAddr(const void* addr) { - const u32 raddr = (u32)addr; + const u64 raddr = (u64)addr; for(u32 i=0; i= baddr && raddr < baddr + b.GetSize()) { @@ -430,97 +426,97 @@ public: T* operator -> () { - return (T*)&Memory[m_addr]; + return (T*)&Memory[this->m_addr]; } const T* operator -> () const { - return (const T*)&Memory[m_addr]; + return (const T*)&Memory[this->m_addr]; } mem_ptr_t operator++ (int) { - mem_struct_ptr_t res(m_addr); - m_addr += sizeof(T); + mem_ptr_t ret(this->m_addr); + this->m_addr += sizeof(T); return ret; } mem_ptr_t& operator++ () { - m_addr += sizeof(T); + this->m_addr += sizeof(T); return *this; } mem_ptr_t operator-- (int) { - mem_struct_ptr_t res(m_addr); - m_addr -= sizeof(T); + mem_ptr_t ret(this->m_addr); + this->m_addr -= sizeof(T); return ret; } mem_ptr_t& operator-- () { - m_addr -= sizeof(T); + this->m_addr -= sizeof(T); return *this; } mem_ptr_t& operator += (uint count) { - m_addr += count * sizeof(T); + this->m_addr += count * sizeof(T); return *this; } mem_ptr_t& operator -= (uint count) { - m_addr -= count * sizeof(T); + this->m_addr -= count * sizeof(T); return *this; } mem_ptr_t operator + (uint count) const { - return m_addr + count * sizeof(T); + return this->m_addr + count * sizeof(T); } mem_ptr_t operator - (uint count) const { - return m_addr - count * sizeof(T); + return this->m_addr - count * sizeof(T); } T& operator *() { - return (T&)Memory[m_addr]; + return (T&)Memory[this->m_addr]; } const T& operator *() const { - return (T&)Memory[m_addr]; + return (T&)Memory[this->m_addr]; } T& operator [](uint index) { - return (T&)Memory[m_addr + sizeof(T) * index]; + return (T&)Memory[this->m_addr + sizeof(T) * index]; } const T& operator [](uint index) const { - return (const T&)Memory[m_addr + sizeof(T) * index]; + return (const T&)Memory[this->m_addr + sizeof(T) * index]; } - operator bool() const { return m_addr == 0; } + operator bool() const { return this->m_addr == 0; } - bool operator == (mem_ptr_t right) const { return m_addr == right.m_addr; } - bool operator != (mem_ptr_t right) const { return m_addr != right.m_addr; } - bool operator > (mem_ptr_t right) const { return m_addr > right.m_addr; } - bool operator < (mem_ptr_t right) const { return m_addr < right.m_addr; } - bool operator >= (mem_ptr_t right) const { return m_addr >= right.m_addr; } - bool operator <= (mem_ptr_t right) const { return m_addr <= right.m_addr; } + bool operator == (mem_ptr_t right) const { return this->m_addr == right.m_addr; } + bool operator != (mem_ptr_t right) const { return this->m_addr != right.m_addr; } + bool operator > (mem_ptr_t right) const { return this->m_addr > right.m_addr; } + bool operator < (mem_ptr_t right) const { return this->m_addr < right.m_addr; } + bool operator >= (mem_ptr_t right) const { return this->m_addr >= right.m_addr; } + bool operator <= (mem_ptr_t right) const { return this->m_addr <= right.m_addr; } - bool operator == (T* right) const { return (T*)&Memory[m_addr] == right; } - bool operator != (T* right) const { return (T*)&Memory[m_addr] != right; } - bool operator > (T* right) const { return (T*)&Memory[m_addr] > right; } - bool operator < (T* right) const { return (T*)&Memory[m_addr] < right; } - bool operator >= (T* right) const { return (T*)&Memory[m_addr] >= right; } - bool operator <= (T* right) const { return (T*)&Memory[m_addr] <= right; } + bool operator == (T* right) const { return (T*)&Memory[this->m_addr] == right; } + bool operator != (T* right) const { return (T*)&Memory[this->m_addr] != right; } + bool operator > (T* right) const { return (T*)&Memory[this->m_addr] > right; } + bool operator < (T* right) const { return (T*)&Memory[this->m_addr] < right; } + bool operator >= (T* right) const { return (T*)&Memory[this->m_addr] >= right; } + bool operator <= (T* right) const { return (T*)&Memory[this->m_addr] <= right; } }; template static bool operator == (T* left, mem_ptr_t right) { return left == (T*)&Memory[right.GetAddr()]; } @@ -539,14 +535,14 @@ public: mem_t& operator = (T right) { - (be_t&)Memory[m_addr] = right; + (be_t&)Memory[this->m_addr] = right; return *this; } operator const T() const { - return (be_t&)Memory[m_addr]; + return (be_t&)Memory[this->m_addr]; } mem_t& operator += (T right) { return *this = (*this) + right; } @@ -570,17 +566,17 @@ public: void operator = (T right) { - (be_t&)Memory[m_addr] = right; + (be_t&)Memory[this->m_addr] = right; } u32 operator += (T right) { *this = right; - m_addr += sizeof(T); - return m_addr; + this->m_addr += sizeof(T); + return this->m_addr; } - u32 Skip(const u32 offset) { return m_addr += offset; } + u32 Skip(const u32 offset) { return this->m_addr += offset; } operator be_t*() { return GetPtr(); } operator void*() { return GetPtr(); } @@ -589,17 +585,17 @@ public: const char* GetString() const { - return (const char*)&Memory[m_addr]; + return (const char*)&Memory[this->m_addr]; } be_t* GetPtr() { - return (be_t*)&Memory[m_addr]; + return (be_t*)&Memory[this->m_addr]; } const be_t* GetPtr() const { - return (const be_t*)&Memory[m_addr]; + return (const be_t*)&Memory[this->m_addr]; } }; @@ -719,6 +715,11 @@ public: return m_ptr; } + T operator [](int index) + { + return *(m_ptr + index); + } + template operator const mem_t() const { @@ -757,4 +758,4 @@ typedef mem_list_ptr_t mem64_lptr_t; typedef mem_list_ptr_t mem8_ptr_t; typedef mem_list_ptr_t mem16_ptr_t; typedef mem_list_ptr_t mem32_ptr_t; -typedef mem_list_ptr_t mem64_ptr_t; \ No newline at end of file +typedef mem_list_ptr_t mem64_ptr_t; diff --git a/rpcs3/Emu/SysCalls/Modules.cpp b/rpcs3/Emu/SysCalls/Modules.cpp index f50beceadf..ccc0cf1f31 100644 --- a/rpcs3/Emu/SysCalls/Modules.cpp +++ b/rpcs3/Emu/SysCalls/Modules.cpp @@ -470,3 +470,9 @@ u32 Module::GetNewId(void* data, u8 flags) { return Emu.GetIdManager().GetNewID(GetName(), data, flags); } + +template +__forceinline void Module::AddFunc(u32 id, T func) +{ + m_funcs_list.Move(new ModuleFunc(id, bind_func(func))); +} diff --git a/rpcs3/Emu/SysCalls/Modules.h b/rpcs3/Emu/SysCalls/Modules.h index ae8a4ea791..eb7384bc36 100644 --- a/rpcs3/Emu/SysCalls/Modules.h +++ b/rpcs3/Emu/SysCalls/Modules.h @@ -67,11 +67,7 @@ public: u32 GetNewId(void* data = nullptr, u8 flags = 0); - template - __forceinline void AddFunc(u32 id, T func) - { - m_funcs_list.Move(new ModuleFunc(id, bind_func(func))); - } + template __forceinline void AddFunc(u32 id, T func); }; bool IsLoadedFunc(u32 id); diff --git a/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp b/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp index 09fab89512..d54629e80a 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp @@ -172,7 +172,7 @@ int cellGifDecOpen(u32 mainHandle, mem32_t subHandle, const mem_ptr_t sb; // Alloc a CellFsStat struct - ret = cellFsFstat(current_subHandle->fd, sb); + ret = cellFsFstat(current_subHandle->fd, sb.GetAddr()); if(ret != CELL_OK) return ret; current_subHandle->fileSize = sb->st_size; // Get CellFsStat.st_size @@ -339,4 +339,4 @@ void cellGifDec_init() cellGifDec.AddFunc(0xe53f91f2, cellGifDecExtReadHeader); cellGifDec.AddFunc(0x95cae771, cellGifDecExtSetParameter); cellGifDec.AddFunc(0x02e7e03e, cellGifDecExtDecodeData);*/ -} \ No newline at end of file +} diff --git a/rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp b/rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp index 58dd6ec7f6..4db668ce17 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp @@ -146,7 +146,7 @@ int cellJpgDecOpen(u32 mainHandle, mem32_t subHandle, u32 src_addr, mem_ptr_t sb; // Alloc a CellFsStat struct - ret = cellFsFstat(current_subHandle->fd, sb); + ret = cellFsFstat(current_subHandle->fd, sb.GetAddr()); if(ret != CELL_OK) return ret; current_subHandle->fileSize = sb->st_size; // Get CellFsStat.st_size @@ -353,4 +353,4 @@ void cellJpgDec_init() cellJpgDec.AddFunc(0xb91eb3d2, cellJpgDecExtReadHeader); cellJpgDec.AddFunc(0x65cbbb16, cellJpgDecExtSetParameter); cellJpgDec.AddFunc(0x716f8792, cellJpgDecExtDecodeData);*/ -} \ No newline at end of file +} diff --git a/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp b/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp index 8bc72699e0..dc2b9123ea 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp @@ -136,7 +136,7 @@ int cellPngDecOpen(u32 mainHandle, mem32_t subHandle, u32 src_addr, u32 openInfo // Get size of file MemoryAllocator sb; // Alloc a CellFsStat struct - ret = cellFsFstat(current_subHandle->fd, sb); + ret = cellFsFstat(current_subHandle->fd, sb.GetAddr()); if(ret != CELL_OK) return ret; current_subHandle->fileSize = sb->st_size; // Get CellFsStat.st_size @@ -342,4 +342,4 @@ void cellPngDec_init() cellPngDec.AddFunc(0xe163977f, cellPngDecGetPLTE); cellPngDec.AddFunc(0x609ec7d5, cellPngDecUnknownChunks); cellPngDec.AddFunc(0xb40ca175, cellPngDecGetTextChunk);*/ -} \ No newline at end of file +} diff --git a/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp b/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp index 967b0dedf3..32c6c9f094 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp @@ -48,8 +48,8 @@ long convertToUNIXTime(u16 seconds, u16 minutes, u16 hours, u16 days, int years) u64 convertToWin32FILETIME(u16 seconds, u16 minutes, u16 hours, u16 days, int years) { long unixtime = convertToUNIXTime(seconds, minutes, hours, days, years); - LONGLONG win32time = Int32x32To64(unixtime, 10000000) + 116444736000000000; - u64 win32filetime = (u64) win32time | win32time >> 32; + u64 win32time = u64(unixtime) * u64(10000000) + u64(116444736000000000); + u64 win32filetime = win32time | win32time >> 32; return win32filetime; } @@ -606,4 +606,4 @@ void cellRtc_init() cellRtc.AddFunc(0x7f1086e6, cellRtcCheckValid); cellRtc.AddFunc(0xfb51fc61, cellRtcCompareTick); -} \ No newline at end of file +} diff --git a/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp b/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp index 53abf38020..82518ff22a 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp @@ -94,9 +94,9 @@ struct CellSaveDataSystemFileParam struct CellSaveDataDirStat { - s64 st_atime; - s64 st_mtime; - s64 st_ctime; + s64 st_atime_; + s64 st_mtime_; + s64 st_ctime_; char dirName; //[CELL_SAVEDATA_DIRNAME_SIZE]; }; @@ -105,9 +105,9 @@ struct CellSaveDataFileStat unsigned int fileType; char reserved1[4]; u64 st_size; - s64 st_atime; - s64 st_mtime; - s64 st_ctime; + s64 st_atime_; + s64 st_mtime_; + s64 st_ctime_; char fileName; //[CELL_SAVEDATA_FILENAME_SIZE]; char reserved2[3]; }; @@ -410,4 +410,4 @@ void cellSaveData_init() cellSaveData.AddFunc(0xcdc6aefd, cellSaveDataUserAutoLoad); cellSaveData.AddFunc(0x0e091c36, cellSaveDataUserListAutoSave); //cellSaveData.AddFunc(0xe7fa820b, cellSaveDataEnableOverlay); -} \ No newline at end of file +} diff --git a/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp b/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp index ab26b6d773..dd53ba1d89 100644 --- a/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp @@ -43,7 +43,7 @@ s64 sys_prx_exitspawn_with_level() s64 sys_strlen(u32 addr) { const wxString& str = Memory.ReadString(addr); - sysPrxForUser.Log("sys_strlen(0x%x - \"%s\")", addr, str); + sysPrxForUser.Log("sys_strlen(0x%x - \"%s\")", addr, str.mb_str()); return str.Len(); } diff --git a/rpcs3/Emu/SysCalls/Modules/sys_fs.cpp b/rpcs3/Emu/SysCalls/Modules/sys_fs.cpp index 38bb598860..45242c6bb1 100644 --- a/rpcs3/Emu/SysCalls/Modules/sys_fs.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sys_fs.cpp @@ -38,14 +38,14 @@ int sdata_unpack(wxString packed_file, wxString unpacked_file) if(!packed_stream || !packed_stream->IsOpened()) { - sys_fs.Error("'%s' not found! flags: 0x%08x", packed_file, vfsRead); + sys_fs.Error("'%s' not found! flags: 0x%08x", packed_file.mb_str(), vfsRead); delete packed_stream; return CELL_ENOENT; } if(!unpacked_stream || !unpacked_stream->IsOpened()) { - sys_fs.Error("'%s' couldn't be created! flags: 0x%08x", unpacked_file, vfsWrite); + sys_fs.Error("'%s' couldn't be created! flags: 0x%08x", unpacked_file.mb_str(), vfsWrite); delete unpacked_stream; return CELL_ENOENT; } @@ -114,7 +114,7 @@ int cellFsSdataOpen(u32 path_addr, int flags, mem32_t fd, mem32_t arg, u64 size) { const wxString& path = Memory.ReadString(path_addr); sys_fs.Warning("cellFsSdataOpen(path: %s, flags: 0x%x, fd_addr: 0x%x, arg_addr: 0x%x, size: 0x%llx)", - path, flags, fd.GetAddr(), arg.GetAddr(), size); + path.mb_str(), flags, fd.GetAddr(), arg.GetAddr(), size); if (!fd.IsGood() || (!arg.IsGood() && size)) return CELL_EFAULT; diff --git a/rpcs3/Emu/SysCalls/SC_FUNC.h b/rpcs3/Emu/SysCalls/SC_FUNC.h index 3c8f6aa362..0965ae90f1 100644 --- a/rpcs3/Emu/SysCalls/SC_FUNC.h +++ b/rpcs3/Emu/SysCalls/SC_FUNC.h @@ -380,4 +380,4 @@ func_caller* bind_func(TR (*call)(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, return new binder_func_12(call); } -#undef ARG(n) \ No newline at end of file +#undef ARG(n) diff --git a/rpcs3/Emu/SysCalls/SysCalls.h b/rpcs3/Emu/SysCalls/SysCalls.h index ea828897e3..03a2b6a815 100644 --- a/rpcs3/Emu/SysCalls/SysCalls.h +++ b/rpcs3/Emu/SysCalls/SysCalls.h @@ -361,4 +361,4 @@ public: static s64 DoFunc(const u32 id); }; -//extern SysCalls SysCallsManager; \ No newline at end of file +//extern SysCalls SysCallsManager; diff --git a/rpcs3/Emu/SysCalls/lv2/SC_FileSystem.cpp b/rpcs3/Emu/SysCalls/lv2/SC_FileSystem.cpp index dd2a6f6da8..fe473bb86f 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_FileSystem.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_FileSystem.cpp @@ -8,7 +8,7 @@ int cellFsOpen(u32 path_addr, int flags, mem32_t fd, mem32_t arg, u64 size) { const wxString& path = Memory.ReadString(path_addr); sys_fs.Log("cellFsOpen(path: %s, flags: 0x%x, fd_addr: 0x%x, arg_addr: 0x%x, size: 0x%llx)", - path, flags, fd.GetAddr(), arg.GetAddr(), size); + path.mb_str(), flags, fd.GetAddr(), arg.GetAddr(), size); const wxString& ppath = path; //ConLog.Warning("path: %s [%s]", ppath, path); @@ -80,7 +80,7 @@ int cellFsOpen(u32 path_addr, int flags, mem32_t fd, mem32_t arg, u64 size) if(_oflags != 0) { - sys_fs.Error("'%s' has unknown flags! flags: 0x%08x", ppath, flags); + sys_fs.Error("'%s' has unknown flags! flags: 0x%08x", ppath.mb_str(), flags); return CELL_EINVAL; } @@ -88,7 +88,7 @@ int cellFsOpen(u32 path_addr, int flags, mem32_t fd, mem32_t arg, u64 size) if(!stream || !stream->IsOpened()) { - sys_fs.Error("'%s' not found! flags: 0x%08x", ppath, flags); + sys_fs.Error("'%s' not found! flags: 0x%08x", ppath.mb_str(), flags); delete stream; return CELL_ENOENT; @@ -156,7 +156,7 @@ int cellFsClose(u32 fd) int cellFsOpendir(u32 path_addr, mem32_t fd) { const wxString& path = Memory.ReadString(path_addr); - sys_fs.Error("cellFsOpendir(path_addr: 0x%x(%s), fd_addr: 0x%x)", path_addr, path, fd.GetAddr()); + sys_fs.Error("cellFsOpendir(path_addr: 0x%x(%s), fd_addr: 0x%x)", path_addr, path.mb_str(), fd.GetAddr()); if(!Memory.IsGoodAddr(path_addr) || !fd.IsGood()) return CELL_EFAULT; return CELL_OK; @@ -177,7 +177,7 @@ int cellFsClosedir(u32 fd) int cellFsStat(const u32 path_addr, mem_ptr_t sb) { const wxString& path = Memory.ReadString(path_addr); - sys_fs.Log("cellFsFstat(path: %s, sb_addr: 0x%x)", path, sb.GetAddr()); + sys_fs.Log("cellFsFstat(path: %s, sb_addr: 0x%x)", path.mb_str(), sb.GetAddr()); sb->st_mode = CELL_FS_S_IRUSR | CELL_FS_S_IWUSR | CELL_FS_S_IXUSR | @@ -186,9 +186,9 @@ int cellFsStat(const u32 path_addr, mem_ptr_t sb) sb->st_uid = 0; sb->st_gid = 0; - sb->st_atime = 0; //TODO - sb->st_mtime = 0; //TODO - sb->st_ctime = 0; //TODO + sb->st_atime_ = 0; //TODO + sb->st_mtime_ = 0; //TODO + sb->st_ctime_ = 0; //TODO sb->st_blksize = 4096; // Check if path is a mount point. (TODO: Add information in sb_addr) @@ -196,7 +196,7 @@ int cellFsStat(const u32 path_addr, mem_ptr_t sb) { if(path.CmpNoCase(Emu.GetVFS().m_devices[i].GetPs3Path().RemoveLast(1)) == 0) { - sys_fs.Log("cellFsFstat: '%s' is a mount point.", path); + sys_fs.Log("cellFsFstat: '%s' is a mount point.", path.mb_str()); sb->st_mode |= CELL_FS_S_IFDIR; return CELL_OK; } @@ -206,7 +206,7 @@ int cellFsStat(const u32 path_addr, mem_ptr_t sb) if(!f.IsOpened()) { - sys_fs.Warning("cellFsFstat: '%s' not found.", path); + sys_fs.Warning("cellFsFstat: '%s' not found.", path.mb_str()); return CELL_ENOENT; } @@ -231,9 +231,9 @@ int cellFsFstat(u32 fd, mem_ptr_t sb) sb->st_mode |= CELL_FS_S_IFREG; //TODO: dir CELL_FS_S_IFDIR sb->st_uid = 0; sb->st_gid = 0; - sb->st_atime = 0; //TODO - sb->st_mtime = 0; //TODO - sb->st_ctime = 0; //TODO + sb->st_atime_ = 0; //TODO + sb->st_mtime_ = 0; //TODO + sb->st_ctime_ = 0; //TODO sb->st_size = file.GetSize(); sb->st_blksize = 4096; @@ -245,7 +245,7 @@ int cellFsMkdir(u32 path_addr, u32 mode) const wxString& ps3_path = Memory.ReadString(path_addr); wxString path; Emu.GetVFS().GetDevice(ps3_path, path); - sys_fs.Log("cellFsMkdir(path: %s, mode: 0x%x)", path, mode); + sys_fs.Log("cellFsMkdir(path: %s, mode: 0x%x)", path.mb_str(), mode); if(wxDirExists(path)) return CELL_EEXIST; if(!wxMkdir(path)) return CELL_EBUSY; return CELL_OK; @@ -260,7 +260,7 @@ int cellFsRename(u32 from_addr, u32 to_addr) Emu.GetVFS().GetDevice(ps3_from, from); Emu.GetVFS().GetDevice(ps3_to, to); - sys_fs.Log("cellFsRename(from: %s, to: %s)", from, to); + sys_fs.Log("cellFsRename(from: %s, to: %s)", from.mb_str(), to.mb_str()); if(!wxFileExists(from)) return CELL_ENOENT; if(wxFileExists(to)) return CELL_EEXIST; if(!wxRenameFile(from, to)) return CELL_EBUSY; // (TODO: RenameFile(a,b) = CopyFile(a,b) + RemoveFile(a), therefore file "a" will not be removed if it is opened) @@ -272,7 +272,7 @@ int cellFsRmdir(u32 path_addr) const wxString& ps3_path = Memory.ReadString(path_addr); wxString path; Emu.GetVFS().GetDevice(ps3_path, path); - sys_fs.Log("cellFsRmdir(path: %s)", path); + sys_fs.Log("cellFsRmdir(path: %s)", path.mb_str()); if(!wxDirExists(path)) return CELL_ENOENT; if(!wxRmdir(path)) return CELL_EBUSY; // (TODO: Under certain conditions it is not able to delete the folder) return CELL_OK; @@ -283,7 +283,7 @@ int cellFsUnlink(u32 path_addr) const wxString& ps3_path = Memory.ReadString(path_addr); wxString path; Emu.GetVFS().GetDevice(ps3_path, path); - sys_fs.Error("cellFsUnlink(path: %s)", path); + sys_fs.Error("cellFsUnlink(path: %s)", path.mb_str()); return CELL_OK; } @@ -336,12 +336,12 @@ int cellFsFtruncate(u32 fd, u64 size) int cellFsTruncate(u32 path_addr, u64 size) { const wxString& path = Memory.ReadString(path_addr); - sys_fs.Log("cellFsTruncate(path: %s, size: %lld)", path, size); + sys_fs.Log("cellFsTruncate(path: %s, size: %lld)", path.mb_str(), size); vfsFile f(path, vfsReadWrite); if(!f.IsOpened()) { - sys_fs.Warning("cellFsTruncate: '%s' not found.", path); + sys_fs.Warning("cellFsTruncate: '%s' not found.", path.mb_str()); return CELL_ENOENT; } u64 initialSize = f.GetSize(); @@ -372,4 +372,4 @@ int cellFsFGetBlockSize(u32 fd, mem64_t sector_size, mem64_t block_size) block_size = 4096; // ? return CELL_OK; -} \ No newline at end of file +} diff --git a/rpcs3/Emu/SysCalls/lv2/SC_FileSystem.h b/rpcs3/Emu/SysCalls/lv2/SC_FileSystem.h index b2e515b83f..1ed8d84a01 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_FileSystem.h +++ b/rpcs3/Emu/SysCalls/lv2/SC_FileSystem.h @@ -63,9 +63,9 @@ struct CellFsStat be_t st_mode; be_t st_uid; be_t st_gid; - be_t st_atime; - be_t st_mtime; - be_t st_ctime; + be_t st_atime_; + be_t st_mtime_; + be_t st_ctime_; be_t st_size; be_t st_blksize; }; @@ -83,4 +83,4 @@ struct CellFsDirent char d_name[CELL_MAX_FS_FILE_NAME_LENGTH + 1]; }; -#pragma pack() \ No newline at end of file +#pragma pack() diff --git a/rpcs3/Emu/SysCalls/lv2/SC_PPU_Thread.cpp b/rpcs3/Emu/SysCalls/lv2/SC_PPU_Thread.cpp index a9c712c608..078d78fefa 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_PPU_Thread.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_PPU_Thread.cpp @@ -132,7 +132,7 @@ int sys_ppu_thread_restart(u32 thread_id) int sys_ppu_thread_create(u32 thread_id_addr, u32 entry, u32 arg, int prio, u32 stacksize, u64 flags, u32 threadname_addr) { sysPrxForUser.Log("sys_ppu_thread_create(thread_id_addr=0x%x, entry=0x%x, arg=0x%x, prio=%d, stacksize=0x%x, flags=0x%llx, threadname_addr=0x%x('%s'))", - thread_id_addr, entry, arg, prio, stacksize, flags, threadname_addr, Memory.ReadString(threadname_addr)); + thread_id_addr, entry, arg, prio, stacksize, flags, threadname_addr, Memory.ReadString(threadname_addr).mb_str()); if(!Memory.IsGoodAddr(entry) || !Memory.IsGoodAddr(thread_id_addr) || !Memory.IsGoodAddr(threadname_addr)) { diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Process.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Process.cpp index daea57358c..d65f554032 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Process.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_Process.cpp @@ -52,7 +52,7 @@ int sys_game_process_exitspawn( u32 path_addr, u32 argv_addr, u32 envp_addr, u32 data, u32 data_size, int prio, u64 flags ) { sc_p.Log("sys_game_process_exitspawn: "); - sc_p.Log("path: %s", Memory.ReadString(path_addr)); + sc_p.Log("path: %s", Memory.ReadString(path_addr).mb_str()); sc_p.Log("argv: 0x%x", Memory.Read32(argv_addr)); sc_p.Log("envp: 0x%x", Memory.Read32(envp_addr)); sc_p.Log("data: 0x%x", data); diff --git a/rpcs3/Emu/SysCalls/lv2/SC_SPU_Thread.cpp b/rpcs3/Emu/SysCalls/lv2/SC_SPU_Thread.cpp index 320588ad42..94c41b5742 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_SPU_Thread.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_SPU_Thread.cpp @@ -36,7 +36,7 @@ u32 LoadSpuImage(vfsStream& stream) int sys_spu_image_open(mem_ptr_t img, u32 path_addr) { const wxString& path = Memory.ReadString(path_addr); - sc_spu.Warning("sys_spu_image_open(img_addr=0x%x, path_addr=0x%x [%s])", img.GetAddr(), path_addr, path); + sc_spu.Warning("sys_spu_image_open(img_addr=0x%x, path_addr=0x%x [%s])", img.GetAddr(), path_addr, path.mb_str()); if(!img.IsGood() || !Memory.IsGoodAddr(path_addr)) { @@ -46,7 +46,7 @@ int sys_spu_image_open(mem_ptr_t img, u32 path_addr) vfsFile f(path); if(!f.IsOpened()) { - sc_spu.Error("sys_spu_image_open error: '%s' not found!", path); + sc_spu.Error("sys_spu_image_open error: '%s' not found!", path.mb_str()); return CELL_ENOENT; } @@ -102,7 +102,7 @@ int sys_spu_thread_initialize(mem32_t thread, u32 group, u32 spu_num, mem_ptr_t< ConLog.Write("New SPU Thread:"); ConLog.Write("entry = 0x%x", entry); - ConLog.Write("name = %s", name); + ConLog.Write("name = %s", name.mb_str()); ConLog.Write("a1 = 0x%x", a1); ConLog.Write("a2 = 0x%x", a2); ConLog.Write("a3 = 0x%x", a3); @@ -191,9 +191,9 @@ int sys_spu_thread_group_create(mem32_t id, u32 num, int prio, mem_ptr_toption.ct.ToLE()); const wxString& name = Memory.ReadString(attr->name_addr, attr->name_len); - ConLog.Write("*** name='%s'", name); + ConLog.Write("*** name='%s'", name.mb_str()); - id = Emu.GetIdManager().GetNewID(wxString::Format("sys_spu_thread_group '%s'", name), new SpuGroupInfo(*attr)); + id = Emu.GetIdManager().GetNewID(wxString::Format("sys_spu_thread_group '%s'", name.mb_str()), new SpuGroupInfo(*attr)); return CELL_OK; } @@ -374,4 +374,4 @@ int sys_spu_thread_group_connect_event_all_threads(u32 id, u32 eq, u64 req, u32 } } return CELL_OK; -} \ No newline at end of file +} diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Time.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Time.cpp index 42c384ac59..f6b7c7912a 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Time.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_Time.cpp @@ -1,3 +1,10 @@ +/* +* This file contains Nt monotonic counter code, taken from wine which is: +* Copyright 2002 Rex Jolliff (rex@lvcablemodem.com) +* Copyright 1999 Juergen Schmied +* Copyright 2007 Dmitry Timoshkov +* GNU LGPL 2.1 license +* */ #include "stdafx.h" #include "Emu/SysCalls/SysCalls.h" #include @@ -31,18 +38,28 @@ int sys_time_get_current_time(u32 sec_addr, u32 nsec_addr) s64 sys_time_get_system_time() { sys_time.Log("sys_time_get_system_time()"); +#ifdef _WIN32 LARGE_INTEGER cycle; QueryPerformanceCounter(&cycle); return cycle.QuadPart; +#else + struct timespec ts; + if (!clock_gettime(CLOCK_MONOTONIC, &ts)) + return ts.tv_sec * (s64)10000000 + (s64)ts.tv_nsec / (s64)100; +#endif } u64 sys_time_get_timebase_frequency() { sys_time.Log("sys_time_get_timebase_frequency()"); +#ifdef _WIN32 static LARGE_INTEGER frequency = {0ULL}; if(!frequency.QuadPart) QueryPerformanceFrequency(&frequency); return frequency.QuadPart; -} \ No newline at end of file +#else + return 10000000; +#endif +} diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index 525eb81b36..9408842dc0 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -81,7 +81,7 @@ void Emulator::CheckStatus() void Emulator::Load() { if(!wxFileExists(m_path)) return; - ConLog.Write("Loading '%s'...", m_path); + ConLog.Write("Loading '%s'...", m_path.mb_str()); GetInfo().Reset(); m_vfs.Init(m_path); //m_vfs.Mount("/", vfsDevice::GetRoot(m_path), new vfsLocalFile()); @@ -93,7 +93,7 @@ void Emulator::Load() ConLog.Write("Mount info:"); for(uint i=0; i %s", m_vfs.m_devices[i].GetPs3Path(), m_vfs.m_devices[i].GetLocalPath()); + ConLog.Write("%s -> %s", m_vfs.m_devices[i].GetPs3Path().mb_str(), m_vfs.m_devices[i].GetLocalPath().mb_str()); } ConLog.SkipLn(); @@ -106,7 +106,7 @@ void Emulator::Load() if(!f.IsOpened()) { - ConLog.Error("Elf not found! (%s - %s)", m_path, m_elf_path); + ConLog.Error("Elf not found! (%s - %s)", m_path.mb_str(), m_elf_path.mb_str()); return; } @@ -366,7 +366,7 @@ void Emulator::LoadPoints(const wxString& path) if(version != bpdb_version || (sizeof(u16) + break_count * sizeof(u64) + sizeof(u32) + marked_count * sizeof(u64) + sizeof(u32)) != f.Length()) { - ConLog.Error("'%s' is broken", path); + ConLog.Error("'%s' is broken", path.mb_str()); return; } diff --git a/rpcs3/Gui/AboutDialog.cpp b/rpcs3/Gui/AboutDialog.cpp index 7f0202d486..5a167d9bf7 100644 --- a/rpcs3/Gui/AboutDialog.cpp +++ b/rpcs3/Gui/AboutDialog.cpp @@ -1,3 +1,5 @@ +#include "stdafx.h" + class AboutDialog : public wxDialog { @@ -90,4 +92,4 @@ void AboutDialog::OpenWebsite(wxCommandEvent& WXUNUSED(event)) void AboutDialog::OpenForum(wxCommandEvent& WXUNUSED(event)) { wxLaunchDefaultBrowser("http://www.emunewz.net/forum/forumdisplay.php?fid=162"); -} \ No newline at end of file +} diff --git a/rpcs3/Gui/CompilerELF.h b/rpcs3/Gui/CompilerELF.h index 55fac74790..a0b4fc1965 100644 --- a/rpcs3/Gui/CompilerELF.h +++ b/rpcs3/Gui/CompilerELF.h @@ -1,7 +1,7 @@ #pragma once #include "Emu/Cell/PPUOpcodes.h" -#include "wx/aui/aui.h" +#include #include "Loader/ELF64.h" #include diff --git a/rpcs3/Gui/ConLog.cpp b/rpcs3/Gui/ConLog.cpp index 32d19b573f..b36fd383d8 100644 --- a/rpcs3/Gui/ConLog.cpp +++ b/rpcs3/Gui/ConLog.cpp @@ -115,7 +115,7 @@ void LogWriter::WriteToLog(wxString prefix, wxString value, wxString colour/*, w } if(m_logfile.IsOpened()) - m_logfile.Write((prefix.IsEmpty() ? wxEmptyString : "[" + prefix + "]: ") + value + "\n"); + m_logfile.Write((prefix.IsEmpty() ? wxString(wxEmptyString) : "[" + prefix + "]: ") + value + "\n"); if(!ConLogFrame) return; @@ -267,4 +267,4 @@ void LogFrame::OnQuit(wxCloseEvent& event) Stop(); ConLogFrame = NULL; event.Skip(); -} \ No newline at end of file +} diff --git a/rpcs3/Gui/Debugger.h b/rpcs3/Gui/Debugger.h index 7f48f0c623..33b527710b 100644 --- a/rpcs3/Gui/Debugger.h +++ b/rpcs3/Gui/Debugger.h @@ -1,6 +1,6 @@ #pragma once #include -#include "wx/aui/aui.h" +#include class DebuggerPanel : public wxPanel { @@ -11,4 +11,4 @@ public: ~DebuggerPanel(); void UpdateUI(); -}; \ No newline at end of file +}; diff --git a/rpcs3/Gui/DisAsmFrame.cpp b/rpcs3/Gui/DisAsmFrame.cpp index 9932953eed..6a3ba288ec 100644 --- a/rpcs3/Gui/DisAsmFrame.cpp +++ b/rpcs3/Gui/DisAsmFrame.cpp @@ -295,7 +295,7 @@ void DisAsmFrame::Dump(wxCommandEvent& WXUNUSED(event)) if(ctrl.ShowModal() == wxID_CANCEL) return; vfsStream& f_elf = *new vfsLocalFile(Emu.m_path); - ConLog.Write("path: %s", Emu.m_path); + ConLog.Write("path: %s", Emu.m_path.mb_str()); Elf_Ehdr ehdr; ehdr.Load(f_elf); @@ -384,8 +384,8 @@ void DisAsmFrame::Dump(wxCommandEvent& WXUNUSED(event)) const wxString name = sh < name_arr.GetCount() ? name_arr[sh] : "Unknown"; - fd.Write(wxString::Format("Start of section header %s[%d] (instructions count: %d)\n", name, sh, sh_size)); - prog_dial.Update(0, vsize, wxString::Format("Disasm %s section", name)); + fd.Write(wxString::Format("Start of section header %s[%d] (instructions count: %d)\n", name.mb_str(), sh, sh_size)); + prog_dial.Update(0, vsize, wxString::Format("Disasm %s section", name.mb_str())); if(Memory.IsGoodAddr(sh_addr)) { @@ -397,7 +397,7 @@ void DisAsmFrame::Dump(wxCommandEvent& WXUNUSED(event)) fd.Write(disasm->last_opcode); } } - fd.Write(wxString::Format("End of section header %s[%d]\n\n", name, sh)); + fd.Write(wxString::Format("End of section header %s[%d]\n\n", name.mb_str(), sh)); } prog_dial.Close(); diff --git a/rpcs3/Gui/GameViewer.cpp b/rpcs3/Gui/GameViewer.cpp index 8ed62a0964..14dc7ad303 100644 --- a/rpcs3/Gui/GameViewer.cpp +++ b/rpcs3/Gui/GameViewer.cpp @@ -94,11 +94,11 @@ void GameViewer::DClick(wxListEvent& event) const wxString& path = m_path + "\\" + m_game_data[i].root + "\\" + "USRDIR" + "\\" + "BOOT.BIN"; if(!wxFileExists(path)) { - ConLog.Error("Boot error: elf not found! [%s]", path); + ConLog.Error("Boot error: elf not found! [%s]", path.mb_str()); return; } Emu.Stop(); Emu.SetPath(path); Emu.Run(); -} \ No newline at end of file +} diff --git a/rpcs3/Gui/InstructionEditor.cpp b/rpcs3/Gui/InstructionEditor.cpp index cc5fd53bec..bb0a1b65f1 100644 --- a/rpcs3/Gui/InstructionEditor.cpp +++ b/rpcs3/Gui/InstructionEditor.cpp @@ -1,3 +1,6 @@ +#include "stdafx.h" +#include "Emu/CPU/CPUDisAsm.h" + class InstructionEditorDialog : public wxDialog { @@ -107,4 +110,4 @@ void InstructionEditorDialog::updatePreview(wxCommandEvent& event) { t3_preview->SetLabel("Could not parse instruction."); } -} \ No newline at end of file +} diff --git a/rpcs3/Gui/InterpreterDisAsm.cpp b/rpcs3/Gui/InterpreterDisAsm.cpp index cad576da6f..f268879ee1 100644 --- a/rpcs3/Gui/InterpreterDisAsm.cpp +++ b/rpcs3/Gui/InterpreterDisAsm.cpp @@ -168,7 +168,8 @@ void InterpreterDisAsmFrame::OnKeyDown(wxKeyEvent& event) { if(event.GetKeyCode() == WXK_SPACE) { - DoStep(wxCommandEvent()); + wxCommandEvent ce; + DoStep(ce); return; } } @@ -222,7 +223,8 @@ void InterpreterDisAsmFrame::OnResize(wxSizeEvent& event) void InterpreterDisAsmFrame::DoUpdate() { - Show_PC(wxCommandEvent()); + wxCommandEvent ce; + Show_PC(ce); WriteRegs(); WriteCallStack(); } diff --git a/rpcs3/Gui/MainFrame.cpp b/rpcs3/Gui/MainFrame.cpp index 87e1d217e5..abffdb0557 100644 --- a/rpcs3/Gui/MainFrame.cpp +++ b/rpcs3/Gui/MainFrame.cpp @@ -200,7 +200,7 @@ void MainFrame::BootGame(wxCommandEvent& WXUNUSED(event)) } } - ConLog.Error("Ps3 executable not found in selected folder (%s)", ctrl.GetPath()); + ConLog.Error("Ps3 executable not found in selected folder (%s)", ctrl.GetPath().mb_str()); return; } @@ -336,7 +336,8 @@ void MainFrame::SendOpenCloseSysMenu(wxCommandEvent& event) { Emu.GetCallbackManager().m_exit_callback.Handle(m_sys_menu_opened ? 0x0132 : 0x0131, 0); m_sys_menu_opened = !m_sys_menu_opened; - UpdateUI(wxCommandEvent()); + wxCommandEvent ce; + UpdateUI(ce); } void MainFrame::Config(wxCommandEvent& WXUNUSED(event)) diff --git a/rpcs3/Gui/MainFrame.h b/rpcs3/Gui/MainFrame.h index acb82de459..27da011f28 100644 --- a/rpcs3/Gui/MainFrame.h +++ b/rpcs3/Gui/MainFrame.h @@ -1,6 +1,6 @@ #pragma once #include "GameViewer.h" -#include "wx/aui/aui.h" +#include class MainFrame : public FrameBase { @@ -38,4 +38,4 @@ private: private: DECLARE_EVENT_TABLE() -}; \ No newline at end of file +}; diff --git a/rpcs3/Gui/MemoryViewer.cpp b/rpcs3/Gui/MemoryViewer.cpp index afd1d76e81..6006ec1e2a 100644 --- a/rpcs3/Gui/MemoryViewer.cpp +++ b/rpcs3/Gui/MemoryViewer.cpp @@ -26,8 +26,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->SetMax(16); - sc_bytes->SetMin(1); + sc_bytes->SetRange(1, 16); s_tools_mem_bytes.Add(sc_bytes); wxStaticBoxSizer& s_tools_mem_buttons = *new wxStaticBoxSizer(wxHORIZONTAL, this, "Control"); @@ -54,10 +53,8 @@ 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->SetMax(8192); - sc_img_size_y->SetMax(8192); - sc_img_size_x->SetMin(1); - sc_img_size_y->SetMin(1); + sc_img_size_x->SetRange(1, 8192); + sc_img_size_y->SetRange(1, 8192); wxStaticBoxSizer& s_tools_img_mode = *new wxStaticBoxSizer(wxHORIZONTAL, this, "Mode"); cbox_img_mode = new wxComboBox(this, wxID_ANY); @@ -271,4 +268,4 @@ void MemoryViewerPanel::ShowImage(wxCommandEvent& WXUNUSED(event)) void MemoryViewerPanel::Next (wxCommandEvent& WXUNUSED(event)) { m_addr += m_colcount; ShowMemory(); } void MemoryViewerPanel::Prev (wxCommandEvent& WXUNUSED(event)) { m_addr -= m_colcount; ShowMemory(); } void MemoryViewerPanel::fNext(wxCommandEvent& WXUNUSED(event)) { m_addr += m_rowcount * m_colcount; ShowMemory(); } -void MemoryViewerPanel::fPrev(wxCommandEvent& WXUNUSED(event)) { m_addr -= m_rowcount * m_colcount; ShowMemory(); } \ No newline at end of file +void MemoryViewerPanel::fPrev(wxCommandEvent& WXUNUSED(event)) { m_addr -= m_rowcount * m_colcount; ShowMemory(); } diff --git a/rpcs3/Gui/RegisterEditor.cpp b/rpcs3/Gui/RegisterEditor.cpp index 08d12378e4..50374a2087 100644 --- a/rpcs3/Gui/RegisterEditor.cpp +++ b/rpcs3/Gui/RegisterEditor.cpp @@ -1,3 +1,6 @@ +#include "stdafx.h" +#include "Emu/CPU/CPUDisAsm.h" + class RegisterEditorDialog : public wxDialog { u64 pc; @@ -103,4 +106,4 @@ void RegisterEditorDialog::updateRegister(wxCommandEvent& event) { wxString reg = t1_register->GetStringSelection(); t2_value->SetValue(CPU->ReadRegString(reg)); -} \ No newline at end of file +} diff --git a/rpcs3/Gui/VFSManager.cpp b/rpcs3/Gui/VFSManager.cpp index cfd82c446d..7060821bed 100644 --- a/rpcs3/Gui/VFSManager.cpp +++ b/rpcs3/Gui/VFSManager.cpp @@ -58,7 +58,8 @@ VFSEntrySettingsDialog::VFSEntrySettingsDialog(wxWindow* parent, VFSManagerEntry m_tctrl_mount->SetValue(m_entry.mount.GetPtr()); m_ch_type->SetSelection(m_entry.device); - OnSelectType(wxCommandEvent()); + wxCommandEvent ce; + OnSelectType(ce); } void VFSEntrySettingsDialog::OnSelectType(wxCommandEvent& event) @@ -187,7 +188,8 @@ void VFSManagerDialog::OnAdd(wxCommandEvent& event) m_list->SetItemState(i, i == idx ? wxLIST_STATE_SELECTED : ~wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED); } - OnEntryConfig(wxCommandEvent()); + wxCommandEvent ce; + OnEntryConfig(ce); } void VFSManagerDialog::OnRemove(wxCommandEvent& event) @@ -216,4 +218,4 @@ void VFSManagerDialog::LoadEntries() void VFSManagerDialog::SaveEntries() { Emu.GetVFS().SaveLoadDevices(m_entries, false); -} \ No newline at end of file +} diff --git a/rpcs3/Gui/VHDDManager.cpp b/rpcs3/Gui/VHDDManager.cpp index 367b144c6f..9f538a816c 100644 --- a/rpcs3/Gui/VHDDManager.cpp +++ b/rpcs3/Gui/VHDDManager.cpp @@ -141,7 +141,7 @@ void VHDDExplorer::Export(const wxString& path, const wxString& to) { if(!m_hdd->Open(path)) { - wxMessageBox(wxString::Format("EXPORT ERROR: file open error. (%s)", path)); + wxMessageBox(wxString::Format("EXPORT ERROR: file open error. (%s)", path.mb_str())); return; } @@ -188,7 +188,7 @@ void VHDDExplorer::OnDropFiles(wxDropFilesEvent& event) for(int i=0; iAppend("MB"); m_ch_type->Append("GB"); - m_spin_size->SetMin(1); - m_spin_size->SetMax(0x7fffffff); + m_spin_size->SetRange(1, 0x7fffffff); m_spin_size->SetValue(64); m_ch_type->SetSelection(3); - m_spin_block_size->SetMin(64); - m_spin_block_size->SetMax(0x7fffffff); + m_spin_block_size->SetRange(64, 0x7fffffff); m_spin_block_size->SetValue(2048); Connect(wxID_OK, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(VHDDSetInfoDialog::OnOk)); } @@ -548,4 +546,4 @@ void VHDDManagerDialog::SavePathes() path_entry.Init(wxString::Format("path[%d]", i), "HDDManager"); path_entry.SaveValue(m_pathes[i]); } -} \ No newline at end of file +} diff --git a/rpcs3/Ini.h b/rpcs3/Ini.h index 8ee138328e..26d8290c46 100644 --- a/rpcs3/Ini.h +++ b/rpcs3/Ini.h @@ -154,4 +154,4 @@ public: } }; -extern Inis Ini; \ No newline at end of file +extern Inis Ini; diff --git a/rpcs3/Loader/ELF64.cpp b/rpcs3/Loader/ELF64.cpp index ccb462d15e..e03ac6cadd 100644 --- a/rpcs3/Loader/ELF64.cpp +++ b/rpcs3/Loader/ELF64.cpp @@ -343,7 +343,7 @@ bool ELF64Loader::LoadPhdrData(u64 offset) } else { - ConLog.Warning("Unknown module '%s'", module_name); + ConLog.Warning("Unknown module '%s'", module_name.mb_str()); } #ifdef LOADER_DEBUG @@ -353,7 +353,7 @@ bool ELF64Loader::LoadPhdrData(u64 offset) ConLog.Write("*** unk0: 0x%x", stub.s_unk0); ConLog.Write("*** unk1: 0x%x", stub.s_unk1); ConLog.Write("*** imports: %d", stub.s_imports); - ConLog.Write("*** module name: %s [0x%x]", module_name, stub.s_modulename); + ConLog.Write("*** module name: %s [0x%x]", module_name.mb_str(), stub.s_modulename); ConLog.Write("*** nid: 0x%x", stub.s_nid); ConLog.Write("*** text: 0x%x", stub.s_text); #endif @@ -370,7 +370,7 @@ bool ELF64Loader::LoadPhdrData(u64 offset) { if(!module->Load(nid)) { - ConLog.Warning("Unknown function 0x%08x in '%s' module", nid, module_name); + ConLog.Warning("Unknown function 0x%08x in '%s' module", nid, module_name.mb_str()); } } #ifdef LOADER_DEBUG @@ -471,4 +471,4 @@ bool ELF64Loader::LoadShdrData(u64 offset) } return true; -} \ No newline at end of file +} diff --git a/rpcs3/Loader/Loader.cpp b/rpcs3/Loader/Loader.cpp index ea863afeb8..86f8ebd326 100644 --- a/rpcs3/Loader/Loader.cpp +++ b/rpcs3/Loader/Loader.cpp @@ -57,9 +57,9 @@ const wxString Phdr_FlagsToString(u32 flags) enum {rsx_R = 0x1, rsx_W = 0x2, rsx_E = 0x4}; #define FLAGS_TO_STRING(f) \ - wxString(f & ##f##_R ? "R" : "-") + \ - wxString(f & ##f##_W ? "W" : "-") + \ - wxString(f & ##f##_E ? "E" : "-") + wxString(f & f##_R ? "R" : "-") + \ + wxString(f & f##_W ? "W" : "-") + \ + wxString(f & f##_E ? "E" : "-") const u8 ppu = flags & 0xf; const u8 spu = (flags >> 0x14) & 0xf; @@ -72,7 +72,7 @@ const wxString Phdr_FlagsToString(u32 flags) flags &= ~spu << 0x14; flags &= ~rsx << 0x18; - if(flags != 0) return wxString::Format("Unknown %s PPU[%x] SPU[%x] RSX[%x]", ret, ppu, spu, rsx); + if(flags != 0) return wxString::Format("Unknown %s PPU[%x] SPU[%x] RSX[%x]", ret.mb_str(), ppu, spu, rsx); ret += "PPU[" + FLAGS_TO_STRING(ppu) + "] "; ret += "SPU[" + FLAGS_TO_STRING(spu) + "] "; @@ -177,4 +177,4 @@ bool Loader::Load() } return true; -} \ No newline at end of file +} diff --git a/rpcs3/Loader/PSF.cpp b/rpcs3/Loader/PSF.cpp index 7e7c1a2ac9..adb1b29c5f 100644 --- a/rpcs3/Loader/PSF.cpp +++ b/rpcs3/Loader/PSF.cpp @@ -20,7 +20,7 @@ bool PSFLoader::Load(bool show) ConLog.SkipLn(); for(uint i=0; i +#include + typedef unsigned int uint; -typedef unsigned __int8 u8; -typedef unsigned __int16 u16; -typedef unsigned __int32 u32; -typedef unsigned __int64 u64; +typedef uint8_t u8; +typedef uint16_t u16; +typedef uint32_t u32; +typedef uint64_t u64; -typedef signed __int8 s8; -typedef signed __int16 s16; -typedef signed __int32 s32; -typedef signed __int64 s64; +typedef int8_t s8; +typedef int16_t s16; +typedef int32_t s32; +typedef int64_t s64; union u128 { @@ -97,13 +99,13 @@ union s128 operator bool() const { return _i64[0] != 0 || _i64[1] != 0; } - static s128 From64( u64 src ) + static s128 From64( s64 src ) { s128 ret = {src, 0}; return ret; } - static s128 From32( u32 src ) + static s128 From32( s32 src ) { s128 ret; ret._i32[0] = src; diff --git a/scetool/scetool.cpp b/scetool/scetool.cpp index 0ded2a40d4..57dbf40946 100644 --- a/scetool/scetool.cpp +++ b/scetool/scetool.cpp @@ -15,6 +15,8 @@ #else #include #include +#define _access access +#define _strdup strdup #endif #include "types.h" diff --git a/scetool/types.h b/scetool/types.h index 566a612725..70d2a86aff 100644 --- a/scetool/types.h +++ b/scetool/types.h @@ -20,8 +20,8 @@ namespace scetool{ typedef __int64 s64; typedef unsigned __int64 u64; #else - typedef long long int scetool::s64; - typedef unsigned long long int scetool::u64; + typedef long long int s64; + typedef unsigned long long int u64; #endif } diff --git a/unpkg/unpkg.h b/unpkg/unpkg.h index 0eb214f1b4..2f06d4241c 100644 --- a/unpkg/unpkg.h +++ b/unpkg/unpkg.h @@ -21,6 +21,10 @@ #include "scetool/aes.h" #include "scetool/sha1.h" +#ifdef __GNUG__ +#include +#endif + #define ntohll(x) (((u64) ntohl (x) << 32) | (u64) ntohl (x >> 32) ) #define htonll(x) (((u64) htonl (x) << 32) | (u64) htonl (x >> 32) ) #define conv_ntohl(x) { x = ntohl(x); }