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

Merge pull request #24 from FGRE/master

Fix compilation with GNU compiler
This commit is contained in:
DHrpcs3 2013-11-23 14:50:13 -08:00
commit 0ff38bc8ce
84 changed files with 637 additions and 506 deletions

View File

@ -297,17 +297,17 @@ template<typename T> struct Stack : public Array<T>
~Stack()
{
Clear();
Array<T>::Clear();
}
void Push(const T data) { AddCpy(data); }
void Push(const T data) { Array<T>::AddCpy(data); }
T Pop()
{
const u32 pos = GetCount() - 1;
const u32 pos = Array<T>::GetCount() - 1;
const T ret = Get(pos);
RemoveAt(pos);
const T ret = Array<T>::Get(pos);
Array<T>::RemoveAt(pos);
return ret;
}
@ -498,4 +498,4 @@ public:
delete m_ptr;
m_ptr = ptr;
}
};
};

View File

@ -1,23 +1,25 @@
#pragma once
#include "Utilities/GNU.h"
template<typename T, int size = sizeof(T)> struct se_t;
template<typename T> struct se_t<T, 1> { static __forceinline void func(T& dst, const T src) { (u8&)dst = (u8&)src; } };
template<typename T> struct se_t<T, 2> { static __forceinline void func(T& dst, const T src) { (u16&)dst = _byteswap_ushort((u16&)src); } };
template<typename T> struct se_t<T, 4> { static __forceinline void func(T& dst, const T src) { (u32&)dst = _byteswap_ulong((u32&)src); } };
template<typename T> struct se_t<T, 8> { static __forceinline void func(T& dst, const T src) { (u64&)dst = _byteswap_uint64((u64&)src); } };
template<typename T, __int64 _value, int size = sizeof(T)> struct const_se_t;;
template<typename T, __int64 _value> struct const_se_t<T, _value, 1>
template<typename T, s64 _value, int size = sizeof(T)> struct const_se_t;;
template<typename T, s64 _value> struct const_se_t<T, _value, 1>
{
static const T value = (T)_value;
};
template<typename T, __int64 _value> struct const_se_t<T, _value, 2>
template<typename T, s64 _value> struct const_se_t<T, _value, 2>
{
static const T value = ((_value >> 8) & 0xff) | ((_value << 8) & 0xff00);
};
template<typename T, __int64 _value> struct const_se_t<T, _value, 4>
template<typename T, s64 _value> struct const_se_t<T, _value, 4>
{
static const T value =
((_value >> 24) & 0x000000ff) |
@ -26,7 +28,7 @@ template<typename T, __int64 _value> struct const_se_t<T, _value, 4>
((_value << 24) & 0xff000000);
};
template<typename T, __int64 _value> struct const_se_t<T, _value, 8>
template<typename T, s64 _value> struct const_se_t<T, _value, 8>
{
static const T value =
((_value >> 56) & 0x00000000000000ff) |

13
Utilities/GNU.h Normal file
View File

@ -0,0 +1,13 @@
#pragma once
#if defined(__GNUG__)
#include <math.h>
#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

View File

@ -133,4 +133,4 @@ public:
if(IDToNum(_id) == IDs.GetCount()-1) Cleanup();
return true;
}
};
};

View File

@ -218,4 +218,4 @@ public:
if(wait) WaitForExit();
}
};
*/
*/

View File

@ -1,47 +1,38 @@
#pragma once
#include <chrono>
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<microseconds>(end - start).count();
}
};
};

37
rpcs3/CMakeLists.txt Normal file
View File

@ -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})

View File

@ -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));
}
};
};

View File

@ -12,7 +12,7 @@ template<typename TO>
class InstrCaller
{
public:
virtual ~InstrCaller()
virtual ~InstrCaller<TO>()
{
}
@ -32,7 +32,7 @@ class InstrBinder_0 : public InstrCaller<TO>
public:
InstrBinder_0(func_t func)
: InstrCaller()
: InstrCaller<TO>()
, m_func(func)
{
}
@ -52,7 +52,7 @@ class InstrBinder_1 : public InstrCaller<TO>
public:
InstrBinder_1(func_t func, const CodeFieldBase& arg_func_1)
: InstrCaller()
: InstrCaller<TO>()
, m_func(func)
, m_arg_func_1(arg_func_1)
{
@ -74,7 +74,7 @@ class InstrBinder_2 : public InstrCaller<TO>
public:
InstrBinder_2(func_t func, const CodeFieldBase& arg_func_1, const CodeFieldBase& arg_func_2)
: InstrCaller()
: InstrCaller<TO>()
, 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<TO>()
, 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<TO>()
, 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<TO>()
, 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<TO>()
, 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<TO>
public:
Instr0(InstrList<count, TO>* list, const wxString& name,
void (TO::*func)())
: InstrBase(name, opcode, 0)
: InstrBase<TO>(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<u32>& args) const
{
assert(args.GetCount() == m_args_count);
assert(args.GetCount() == InstrBase<TO>::m_args_count);
return m_list.encode(opcode);
}
@ -524,10 +524,10 @@ public:
Instr1(InstrList<count, TO>* list, const wxString& name,
void (TO::*func)(T1),
CodeFieldBase& arg_1)
: InstrBase(name, opcode, 1)
: InstrBase<TO>(name, opcode, 1)
, m_list(*list)
{
m_args[0] = &arg_1;
InstrBase<TO>::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<u32>& args) const
{
assert(args.GetCount() == m_args_count);
return m_list.encode(opcode) | (*m_args[0])[args[0]];
assert(args.GetCount() == InstrBase<TO>::m_args_count);
return m_list.encode(opcode) | (*InstrBase<TO>::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<TO>::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<TO>(name, opcode, 2)
, m_list(*list)
{
m_args[0] = &arg_1;
m_args[1] = &arg_2;
InstrBase<TO>::m_args[0] = &arg_1;
InstrBase<TO>::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<u32>& 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<TO>::m_args_count);
return m_list.encode(opcode) | (*InstrBase<TO>::m_args[0])[args[0]] | (*InstrBase<TO>::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<TO>::m_args[0])[a1] | (*InstrBase<TO>::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<TO>(name, opcode, 3)
, m_list(*list)
{
m_args[0] = &arg_1;
m_args[1] = &arg_2;
m_args[2] = &arg_3;
InstrBase<TO>::m_args[0] = &arg_1;
InstrBase<TO>::m_args[1] = &arg_2;
InstrBase<TO>::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<u32>& 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<TO>::m_args_count);
return m_list.encode(opcode) | (*InstrBase<TO>::m_args[0])[args[0]] | (*InstrBase<TO>::m_args[1])[args[1]] | (*InstrBase<TO>::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<TO>::m_args[0])[a1] | (*InstrBase<TO>::m_args[1])[a2] | (*InstrBase<TO>::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<TO>(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<TO>::m_args[0] = &arg_1;
InstrBase<TO>::m_args[1] = &arg_2;
InstrBase<TO>::m_args[2] = &arg_3;
InstrBase<TO>::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<u32>& args) const
{
assert(args.GetCount() == m_args_count);
assert(args.GetCount() == InstrBase<TO>::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<TO>::m_args[0])[args[0]] |
(*InstrBase<TO>::m_args[1])[args[1]] |
(*InstrBase<TO>::m_args[2])[args[2]] |
(*InstrBase<TO>::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<TO>::m_args[0])[a1] |
(*InstrBase<TO>::m_args[1])[a2] |
(*InstrBase<TO>::m_args[2])[a3] |
(*InstrBase<TO>::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<TO>(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<TO>::m_args[0] = &arg_1;
InstrBase<TO>::m_args[1] = &arg_2;
InstrBase<TO>::m_args[2] = &arg_3;
InstrBase<TO>::m_args[3] = &arg_4;
InstrBase<TO>::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<u32>& args) const
{
assert(args.GetCount() == m_args_count);
assert(args.GetCount() == InstrBase<TO>::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<TO>::m_args[0])[args[0]] |
(*InstrBase<TO>::m_args[1])[args[1]] |
(*InstrBase<TO>::m_args[2])[args[2]] |
(*InstrBase<TO>::m_args[3])[args[3]] |
(*InstrBase<TO>::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<TO>::m_args[0])[a1] |
(*InstrBase<TO>::m_args[1])[a2] |
(*InstrBase<TO>::m_args[2])[a3] |
(*InstrBase<TO>::m_args[3])[a4] |
(*InstrBase<TO>::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<TO>(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<TO>::m_args[0] = &arg_1;
InstrBase<TO>::m_args[1] = &arg_2;
InstrBase<TO>::m_args[2] = &arg_3;
InstrBase<TO>::m_args[3] = &arg_4;
InstrBase<TO>::m_args[4] = &arg_5;
InstrBase<TO>::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<u32>& args) const
{
assert(args.GetCount() == m_args_count);
assert(args.GetCount() == InstrBase<TO>::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<TO>::m_args[0])[args[0]] |
(*InstrBase<TO>::m_args[1])[args[1]] |
(*InstrBase<TO>::m_args[2])[args[2]] |
(*InstrBase<TO>::m_args[3])[args[3]] |
(*InstrBase<TO>::m_args[4])[args[4]] |
(*InstrBase<TO>::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<TO>::m_args[0])[a1] |
(*InstrBase<TO>::m_args[1])[a2] |
(*InstrBase<TO>::m_args[2])[a3] |
(*InstrBase<TO>::m_args[3])[a4] |
(*InstrBase<TO>::m_args[4])[a5] |
(*InstrBase<TO>::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<TO, opcode, count, T1, T2, T3, T4, T5, T6>& make_instr(InstrList<c
CodeFieldBase& arg_6)
{
return *new Instr6<TO, opcode, count, T1, T2, T3, T4, T5, T6>(list, name, func, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6);
}
}

View File

@ -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<int>(8 - op.Len(), 0));
return op;
}
};
};

View File

@ -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)
{

View File

@ -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();
CPUThread* GetCurrentCPUThread();

View File

@ -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();
}
}
}

View File

@ -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)));
}
};
};

View File

@ -57,7 +57,7 @@ class DoubleCodeField : public CodeField<from1, to1>
static_assert(to2 <= 31, "too big to2 value");
public:
DoubleCodeField(CodeFieldType type = FIELD_IMM) : CodeField(type)
DoubleCodeField(CodeFieldType type = FIELD_IMM) : CodeField<from1, to1>(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<from1, to1>::mask | mask2);
data |= ((value << CodeField<from1, to1>::shift) & CodeField<from1, to1>::mask) | (((value >> offset) << shift2) & mask2);
}
static __forceinline u32 decode(u32 data)
{
return ((data & mask) >> shift) | (((data & mask2) >> shift2) << offset);
return ((data & CodeField<from1, to1>::mask) >> CodeField<from1, to1>::shift) | (((data & mask2) >> shift2) << offset);
}
virtual u32 operator ()(u32 data) const
@ -90,7 +90,7 @@ template<uint from, uint to = from, uint _size = to - from + 1>
class CodeFieldSigned : public CodeField<from, to>
{
public:
CodeFieldSigned(CodeFieldType type = FIELD_IMM) : CodeField(type)
CodeFieldSigned(CodeFieldType type = FIELD_IMM) : CodeField<from, to>(type)
{
}
@ -98,7 +98,7 @@ public:
static __forceinline u32 decode(u32 data)
{
return sign<size>((data & mask) >> shift);
return sign<size>((data & CodeField<from, to>::mask) >> CodeField<from, to>::shift);
}
virtual u32 operator ()(u32 data) const
@ -113,19 +113,19 @@ class CodeFieldOffset : public CodeField<from, to>
static const int offset = _offset;
public:
CodeFieldOffset(CodeFieldType type = FIELD_IMM) : CodeField(type)
CodeFieldOffset(CodeFieldType type = FIELD_IMM) : CodeField<from, to>(type)
{
}
static __forceinline u32 decode(u32 data)
{
return ((data & mask) >> shift) << offset;
return ((data & CodeField<from, to>::mask) >> CodeField<from, to>::shift) << offset;
}
static __forceinline void encode(u32& data, u32 value)
{
data &= ~mask;
data |= ((value >> offset) << shift) & mask;
data &= ~CodeField<from, to>::mask;
data |= ((value >> offset) << CodeField<from, to>::shift) & CodeField<from, to>::mask;
}
virtual u32 operator ()(u32 data) const
@ -145,19 +145,19 @@ class CodeFieldSignedOffset : public CodeFieldSigned<from, to, size>
static const int offset = _offset;
public:
CodeFieldSignedOffset(CodeFieldType type = FIELD_IMM) : CodeFieldSigned(type)
CodeFieldSignedOffset(CodeFieldType type = FIELD_IMM) : CodeFieldSigned<from, to, size>(type)
{
}
static __forceinline u32 decode(u32 data)
{
return sign<size>((data & mask) >> shift) << offset;
return sign<size>((data & CodeField<from, to>::mask) >> CodeField<from, to>::shift) << offset;
}
static __forceinline void encode(u32& data, u32 value)
{
data &= ~mask;
data |= ((value >> offset) << shift) & mask;
data &= ~CodeField<from, to>::mask;
data |= ((value >> offset) << CodeField<from, to>::shift) & CodeField<from, to>::mask;
}
virtual u32 operator ()(u32 data) const

View File

@ -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();
}
}
}

View File

@ -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<u32> m_delete_threads;
u32 m_raw_spu_num;
public:
PPCThreadManager();
@ -27,4 +35,4 @@ public:
void Exec();
void Task();
};
};

View File

@ -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
#undef END_OPCODES_GROUP

View File

@ -6,7 +6,12 @@
#include "Emu/SysCalls/SysCalls.h"
#include "rpcs3.h"
#include <stdint.h>
#ifdef _MSC_VER
#include <intrin.h>
#else
#include <x86intrin.h>
#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<float>(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);

View File

@ -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<m_branches.GetCount(); ++i)
{
if(name.Cmp(m_branches[i].m_name.GetPtr()) != 0) continue;
WriteError(wxString::Format("'%s' already declared", name));
WriteError(wxString::Format("'%s' already declared", name.mb_str()));
m_error = true;
break;
}
@ -1346,7 +1346,7 @@ void CompilePPUProgram::Compile()
if(a_name.type != ARG_ERR)
{
WriteError(wxString::Format("bad name '%s'", name));
WriteError(wxString::Format("bad name '%s'", name.mb_str()));
m_error = true;
}
@ -1425,7 +1425,7 @@ void CompilePPUProgram::Compile()
}
else
{
WriteError(wxString::Format("unknown instruction '%s'", op));
WriteError(wxString::Format("unknown instruction '%s'", op.mb_str()));
EndLn();
m_error = true;
}

View File

@ -355,6 +355,7 @@ struct PPCdouble
{
const int fpc = _fpclass(_double);
#ifndef __GNUG__
switch(fpc)
{
case _FPCLASS_SNAN:// return FPR_SNAN;
@ -368,6 +369,16 @@ struct PPCdouble
case _FPCLASS_PN: return FPR_PN;
case _FPCLASS_PINF: return FPR_PINF;
}
#else
switch (fpc)
{
case FP_NAN: return FPR_QNAN;
case FP_INFINITE: return signbit(_double) ? FPR_NINF : FPR_PINF;
case FP_SUBNORMAL: return signbit(_double) ? FPR_ND : FPR_PD;
case FP_ZERO: return signbit(_double) ? FPR_NZ : FPR_PZ;
default: return signbit(_double) ? FPR_NN : FPR_PN;
}
#endif
throw wxString::Format("PPCdouble::UpdateType() -> 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();
PPUThread& GetCurrentPPUThread();

View File

@ -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<u64>& 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());
}

View File

@ -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
{

View File

@ -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)

View File

@ -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());
}
};

View File

@ -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();
SPUThread& GetCurrentSPUThread();

View File

@ -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<VFSManagerEntry>& res, bool is_load)
entry_device.SaveValue(res[i].device);
}
}
}
}

View File

@ -1,3 +1,3 @@
#include "stdafx.h"
#include "vfsDirBase.cpp"
#include "vfsDirBase.h"

View File

@ -265,4 +265,4 @@ void GLfbo::Delete()
bool GLfbo::IsCreated() const
{
return m_id != 0;
}
}

View File

@ -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;
}
}
}

View File

@ -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,6 +603,7 @@ void GLGSRender::OnInitThread()
glEnable(GL_TEXTURE_2D);
glEnable(GL_SCISSOR_TEST);
glSwapInterval(Ini.GSVSyncEnable.GetValue() ? 1 : 0);
}
@ -641,11 +642,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 +659,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 +668,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 +702,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 +754,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 +1039,4 @@ void GLGSRender::Flip()
}
m_frame->Flip();
}
}

View File

@ -1,7 +1,7 @@
#pragma once
#include "Emu/GS/GSRender.h"
#include "Emu/GS/RSXThread.h"
#include "wx/glcanvas.h"
#include <wx/glcanvas.h>
#include "GLBuffers.h"
#include "GLProgram.h"
#include "OpenGL.h"
@ -462,4 +462,4 @@ protected:
virtual void OnReset();
virtual void ExecCMD();
virtual void Flip();
};
};

View File

@ -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);
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

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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()

View File

@ -43,4 +43,4 @@ void OpenGL::Close()
#include "GLProcTable.tbl"
#undef OPENGL_PROC
#undef OPENGL_PROC2
}
}

View File

@ -25,4 +25,4 @@ struct OpenGL
void Init();
void Close();
};
};

View File

@ -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);
}
};

View File

@ -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;
}
}

View File

@ -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();
}
};
};

View File

@ -21,7 +21,7 @@ const u32 DynamicMemoryBlockBase<PT>::GetUsedSize() const
template<typename PT>
bool DynamicMemoryBlockBase<PT>::IsInMyRange(const u64 addr)
{
return addr >= GetStartAddr() && addr < GetStartAddr() + GetSize();
return addr >= MemoryBlock::GetStartAddr() && addr < MemoryBlock::GetStartAddr() + GetSize();
}
template<typename PT>
@ -95,7 +95,7 @@ void DynamicMemoryBlockBase<PT>::AppendUsedMem(u64 addr, u32 size)
template<typename PT>
u64 DynamicMemoryBlockBase<PT>::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<PT>::GetMem(u64 addr) const
{
for(u32 i=0; i<m_used_mem.GetCount(); ++i)
{
u64 _addr = FixAddr(m_used_mem[i].addr);
u64 _addr = MemoryBlock::FixAddr(m_used_mem[i].addr);
if(addr >= _addr && addr < _addr + m_used_mem[i].size)
{
@ -157,4 +157,4 @@ u8* DynamicMemoryBlockBase<PT>::GetMem(u64 addr) const
ConLog.Error("GetMem(%llx) from not allocated address.", addr);
assert(0);
return nullptr;
}
}

View File

@ -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); }

View File

@ -87,10 +87,6 @@ public:
}
template<int size> 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<typename T> 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<MemoryBlocks.GetCount(); ++i)
{
MemoryBlock& b = MemoryBlocks[i];
const u32 baddr = (u32)b.GetMem();
const u64 baddr = (u64)b.GetMem();
if(raddr >= 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<typename T> static bool operator == (T* left, mem_ptr_t<T> right) { return left == (T*)&Memory[right.GetAddr()]; }
@ -539,14 +535,14 @@ public:
mem_t& operator = (T right)
{
(be_t<T>&)Memory[m_addr] = right;
(be_t<T>&)Memory[this->m_addr] = right;
return *this;
}
operator const T() const
{
return (be_t<T>&)Memory[m_addr];
return (be_t<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<T>&)Memory[m_addr] = right;
(be_t<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<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<T>* GetPtr()
{
return (be_t<T>*)&Memory[m_addr];
return (be_t<T>*)&Memory[this->m_addr];
}
const be_t<T>* GetPtr() const
{
return (const be_t<T>*)&Memory[m_addr];
return (const be_t<T>*)&Memory[this->m_addr];
}
};
@ -719,6 +715,11 @@ public:
return m_ptr;
}
T operator [](int index)
{
return *(m_ptr + index);
}
template<typename T1>
operator const mem_t<T1>() const
{
@ -757,4 +758,4 @@ typedef mem_list_ptr_t<u64> mem64_lptr_t;
typedef mem_list_ptr_t<u8> mem8_ptr_t;
typedef mem_list_ptr_t<u16> mem16_ptr_t;
typedef mem_list_ptr_t<u32> mem32_ptr_t;
typedef mem_list_ptr_t<u64> mem64_ptr_t;
typedef mem_list_ptr_t<u64> mem64_ptr_t;

View File

@ -470,3 +470,9 @@ u32 Module::GetNewId(void* data, u8 flags)
{
return Emu.GetIdManager().GetNewID(GetName(), data, flags);
}
template<typename T>
__forceinline void Module::AddFunc(u32 id, T func)
{
m_funcs_list.Move(new ModuleFunc(id, bind_func(func)));
}

View File

@ -67,11 +67,7 @@ public:
u32 GetNewId(void* data = nullptr, u8 flags = 0);
template<typename T>
__forceinline void AddFunc(u32 id, T func)
{
m_funcs_list.Move(new ModuleFunc(id, bind_func(func)));
}
template<typename T> __forceinline void AddFunc(u32 id, T func);
};
bool IsLoadedFunc(u32 id);

View File

@ -172,7 +172,7 @@ int cellGifDecOpen(u32 mainHandle, mem32_t subHandle, const mem_ptr_t<CellGifDec
// Get size of file
MemoryAllocator<CellFsStat> 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);*/
}
}

View File

@ -146,7 +146,7 @@ int cellJpgDecOpen(u32 mainHandle, mem32_t subHandle, u32 src_addr, mem_ptr_t<Ce
// Get size of file
MemoryAllocator<CellFsStat> 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);*/
}
}

View File

@ -136,7 +136,7 @@ int cellPngDecOpen(u32 mainHandle, mem32_t subHandle, u32 src_addr, u32 openInfo
// Get size of file
MemoryAllocator<CellFsStat> 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);*/
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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();
}

View File

@ -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;

View File

@ -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<TR, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(call);
}
#undef ARG(n)
#undef ARG(n)

View File

@ -361,4 +361,4 @@ public:
static s64 DoFunc(const u32 id);
};
//extern SysCalls SysCallsManager;
//extern SysCalls SysCallsManager;

View File

@ -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<CellFsStat> 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<CellFsStat> 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<CellFsStat> 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<CellFsStat> 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<CellFsStat> 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;
}
}

View File

@ -63,9 +63,9 @@ struct CellFsStat
be_t<u32> st_mode;
be_t<s32> st_uid;
be_t<s32> st_gid;
be_t<u64> st_atime;
be_t<u64> st_mtime;
be_t<u64> st_ctime;
be_t<u64> st_atime_;
be_t<u64> st_mtime_;
be_t<u64> st_ctime_;
be_t<u64> st_size;
be_t<u64> st_blksize;
};
@ -83,4 +83,4 @@ struct CellFsDirent
char d_name[CELL_MAX_FS_FILE_NAME_LENGTH + 1];
};
#pragma pack()
#pragma pack()

View File

@ -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))
{

View File

@ -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);

View File

@ -36,7 +36,7 @@ u32 LoadSpuImage(vfsStream& stream)
int sys_spu_image_open(mem_ptr_t<sys_spu_image> 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<sys_spu_image> 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_t<sys_spu
ConLog.Write("*** attr.option.ct=%d", attr->option.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;
}
}

View File

@ -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 <sys/timeb.h>
@ -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;
}
#else
return 10000000;
#endif
}

View File

@ -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<m_vfs.m_devices.GetCount(); ++i)
{
ConLog.Write("%s -> %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;
}

View File

@ -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");
}
}

View File

@ -1,7 +1,7 @@
#pragma once
#include "Emu/Cell/PPUOpcodes.h"
#include "wx/aui/aui.h"
#include <wx/aui/aui.h>
#include "Loader/ELF64.h"
#include <wx/richtext/richtextctrl.h>

View File

@ -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();
}
}

View File

@ -1,6 +1,6 @@
#pragma once
#include <wx/listctrl.h>
#include "wx/aui/aui.h"
#include <wx/aui/aui.h>
class DebuggerPanel : public wxPanel
{
@ -11,4 +11,4 @@ public:
~DebuggerPanel();
void UpdateUI();
};
};

View File

@ -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();

View File

@ -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();
}
}

View File

@ -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.");
}
}
}

View File

@ -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();
}

View File

@ -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))

View File

@ -1,6 +1,6 @@
#pragma once
#include "GameViewer.h"
#include "wx/aui/aui.h"
#include <wx/aui/aui.h>
class MainFrame : public FrameBase
{
@ -38,4 +38,4 @@ private:
private:
DECLARE_EVENT_TABLE()
};
};

View File

@ -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(); }
void MemoryViewerPanel::fPrev(wxCommandEvent& WXUNUSED(event)) { m_addr -= m_rowcount * m_colcount; ShowMemory(); }

View File

@ -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));
}
}

View File

@ -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);
}
}

View File

@ -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; i<count; ++i)
{
ConLog.Write("Importing '%s'", dropped[i]);
ConLog.Write("Importing '%s'", dropped[i].mb_str());
Import(dropped[i], wxFileName(dropped[i]).GetFullName());
}
@ -347,12 +347,10 @@ VHDDSetInfoDialog::VHDDSetInfoDialog(wxWindow* parent) : wxDialog(parent, wxID_A
m_ch_type->Append("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]);
}
}
}

View File

@ -154,4 +154,4 @@ public:
}
};
extern Inis Ini;
extern Inis Ini;

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -20,7 +20,7 @@ bool PSFLoader::Load(bool show)
ConLog.SkipLn();
for(uint i=0; i<m_table.GetCount(); ++i)
{
ConLog.Write("%s", m_table[i]);
ConLog.Write("%s", m_table[i].mb_str());
}
ConLog.SkipLn();
}
@ -162,19 +162,19 @@ bool PSFLoader::LoadValuesTable()
if(!m_table[i].Cmp("TITLE_ID"))
{
m_info.serial = PsfHelper::ReadString(psf_f);
m_table[i].Append(wxString::Format(": %s", m_info.serial));
m_table[i].Append(wxString::Format(": %s", m_info.serial.mb_str()));
PsfHelper::GoToNN(psf_f);
}
else if(!m_table[i](0, 5).Cmp("TITLE"))
{
m_info.name = PsfHelper::FixName(PsfHelper::ReadString(psf_f));
m_table[i].Append(wxString::Format(": %s", m_info.name));
m_table[i].Append(wxString::Format(": %s", m_info.name.mb_str()));
PsfHelper::GoToNN(psf_f);
}
else if(!m_table[i].Cmp("APP_VER"))
{
m_info.app_ver = PsfHelper::ReadString(psf_f, sizeof(u64));
m_table[i].Append(wxString::Format(": %s", m_info.app_ver));
m_table[i].Append(wxString::Format(": %s", m_info.app_ver.mb_str()));
}
else if(!m_table[i].Cmp("ATTRIBUTE"))
{
@ -184,7 +184,7 @@ bool PSFLoader::LoadValuesTable()
else if(!m_table[i].Cmp("CATEGORY"))
{
m_info.category = PsfHelper::ReadString(psf_f, sizeof(u32));
m_table[i].Append(wxString::Format(": %s", m_info.category));
m_table[i].Append(wxString::Format(": %s", m_info.category.mb_str()));
}
else if(!m_table[i].Cmp("BOOTABLE"))
{
@ -193,7 +193,7 @@ bool PSFLoader::LoadValuesTable()
}
else if(!m_table[i].Cmp("LICENSE"))
{
m_table[i].Append(wxString::Format(": %s", PsfHelper::ReadString(psf_f)));
m_table[i].Append(wxString::Format(": %s", PsfHelper::ReadString(psf_f).mb_str()));
psf_f.Seek(psf_f.Tell() + (sizeof(u64) * 7 * 2) - 1);
}
else if(!m_table[i](0, 14).Cmp("PARENTAL_LEVEL"))
@ -209,7 +209,7 @@ bool PSFLoader::LoadValuesTable()
else if(!m_table[i].Cmp("PS3_SYSTEM_VER"))
{
m_info.fw = PsfHelper::ReadString(psf_f, sizeof(u64));
m_table[i].Append(wxString::Format(": %s", m_info.fw));
m_table[i].Append(wxString::Format(": %s", m_info.fw.mb_str()));
}
else if(!m_table[i].Cmp("SOUND_FORMAT"))
{
@ -223,7 +223,7 @@ bool PSFLoader::LoadValuesTable()
}
else
{
m_table[i].Append(wxString::Format(": %s", PsfHelper::ReadString(psf_f)));
m_table[i].Append(wxString::Format(": %s", PsfHelper::ReadString(psf_f).mb_str()));
PsfHelper::GoToNN(psf_f);
}
}
@ -234,4 +234,4 @@ bool PSFLoader::LoadValuesTable()
}
return true;
}
}

View File

@ -18,17 +18,19 @@
#include <wx/wxprec.h>
#include <cstdint>
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;

View File

@ -15,6 +15,8 @@
#else
#include <unistd.h>
#include <getopt.h>
#define _access access
#define _strdup strdup
#endif
#include "types.h"

View File

@ -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
}

View File

@ -21,6 +21,10 @@
#include "scetool/aes.h"
#include "scetool/sha1.h"
#ifdef __GNUG__
#include <arpa/inet.h>
#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); }