ARMv7: more opcodes, some changes in loader

This commit is contained in:
Nekotekina 2014-11-02 02:19:14 +03:00
parent 536c5a900a
commit 3bdfc6b499
17 changed files with 725 additions and 111 deletions

View file

@ -3,6 +3,7 @@
#include "Emu/Memory/Memory.h"
#include "Emu/CPU/CPUDecoder.h"
#include "ARMv7Thread.h"
#include "PSVFuncList.h"
#include "ARMv7Interpreter.h"
void ARMv7Interpreter::UNK(const u32 data)
@ -40,7 +41,7 @@ void ARMv7Interpreter::HACK(const u32 data, const ARMv7_encoding type)
if (ConditionPassed(cond))
{
//
execute_psv_func_by_index(CPU, code);
}
}
@ -74,11 +75,42 @@ void ARMv7Interpreter::ADC_RSR(const u32 data, const ARMv7_encoding type)
void ARMv7Interpreter::ADD_IMM(const u32 data, const ARMv7_encoding type)
{
bool set_flags = !CPU.ITSTATE;
u32 cond = CPU.ITSTATE.advance();
u32 d = 0;
u32 n = 0;
u32 imm32 = 0;
switch (type)
{
case T1:
{
d = (data & 0x7);
n = (data & 0x38) >> 3;
imm32 = (data & 0x1c0) >> 6;
break;
}
case A1: throw __FUNCTION__;
default: throw __FUNCTION__;
}
if (ConditionPassed(cond))
{
if (set_flags)
{
bool carry, overflow;
u32 res = AddWithCarry(CPU.read_gpr(n), imm32, false, carry, overflow);
CPU.write_gpr(d, res);
CPU.APSR.N = res >> 31;
CPU.APSR.Z = res == 0;
CPU.APSR.C = carry;
CPU.APSR.V = overflow;
}
else
{
CPU.write_gpr(d, CPU.read_gpr(n) + imm32);
}
}
}
void ARMv7Interpreter::ADD_REG(const u32 data, const ARMv7_encoding type)
@ -809,9 +841,8 @@ void ARMv7Interpreter::MLS(const u32 data, const ARMv7_encoding type)
void ARMv7Interpreter::MOV_IMM(const u32 data, const ARMv7_encoding type)
{
bool set_flags = CPU.ITSTATE;
bool set_flags = !CPU.ITSTATE;
bool carry = CPU.APSR.C;
u32 cond = CPU.ITSTATE.advance();
u32 d = 0;
u32 imm32 = 0;
@ -855,20 +886,72 @@ void ARMv7Interpreter::MOV_IMM(const u32 data, const ARMv7_encoding type)
void ARMv7Interpreter::MOV_REG(const u32 data, const ARMv7_encoding type)
{
u32 cond = CPU.ITSTATE.advance();
u32 d = 0;
u32 m = 0;
bool set_flags = false;
switch (type)
{
case T1:
{
d = (data & 0x80) >> 4 | (data & 0x7);
m = (data & 0x78) >> 3;
break;
}
case T2:
{
d = (data & 0x7);
m = (data & 0x38) >> 3;
set_flags = true;
break;
}
case T3:
{
d = (data & 0xf00) >> 8;
m = (data & 0xf);
set_flags = (data & 0x100000);
break;
}
case A1: throw __FUNCTION__;
default: throw __FUNCTION__;
}
if (ConditionPassed(cond))
{
u32 res = CPU.read_gpr(m);
CPU.write_gpr(d, res);
if (set_flags)
{
CPU.APSR.N = res >> 31;
CPU.APSR.Z = res == 0;
//CPU.APSR.C = ?
}
}
}
void ARMv7Interpreter::MOVT(const u32 data, const ARMv7_encoding type)
{
u32 cond = CPU.ITSTATE.advance();
u32 d = 0;
u32 imm16 = 0;
switch (type)
{
case T1:
{
d = (data & 0xf00) >> 8;
imm16 = (data & 0xf0000) >> 4 | (data & 0x4000000) >> 14 | (data & 0x7000) >> 4 | (data & 0xff);
break;
}
case A1: throw __FUNCTION__;
default: throw __FUNCTION__;
}
if (ConditionPassed(cond))
{
CPU.write_gpr(d, (CPU.read_gpr(d) & 0xffff) | (imm16 << 16));
}
}
@ -1889,12 +1972,37 @@ void ARMv7Interpreter::SUB_RSR(const u32 data, const ARMv7_encoding type)
void ARMv7Interpreter::SUB_SPI(const u32 data, const ARMv7_encoding type)
{
u32 cond = CPU.ITSTATE.advance();
u32 d = 13;
u32 imm32 = 0;
bool set_flags = false;
switch (type)
{
case T1: if (ConditionPassed(cond)) CPU.SP -= (data & 0x7f) << 2; return;
case T1:
{
imm32 = (data & 0x7f) << 2;
break;
}
default: throw __FUNCTION__;
}
if (ConditionPassed(cond))
{
if (set_flags)
{
bool carry, overflow;
u32 res = AddWithCarry(CPU.SP, ~imm32, true, carry, overflow);
CPU.write_gpr(d, res);
CPU.APSR.N = res >> 31;
CPU.APSR.Z = res == 0;
CPU.APSR.C = carry;
CPU.APSR.V = overflow;
}
else
{
CPU.write_gpr(d, CPU.SP - imm32);
}
}
}
void ARMv7Interpreter::SUB_SPR(const u32 data, const ARMv7_encoding type)

View file

@ -225,11 +225,17 @@ public:
template<typename T> T AddWithCarry(T x, T y, bool carry_in, bool& carry_out, bool& overflow)
{
uint unsigned_sum = (uint)x + (uint)y + (uint)carry_in;
int signed_sum = (int)x + (int)y + (int)carry_in;
T result = unsigned_sum & ~(T(1) << (sizeof(T) - 1));
carry_out = (uint)result != unsigned_sum;
overflow = (int)result != signed_sum;
const T sign_mask = (T)1 << (sizeof(T) - 1);
T result = x + y;
carry_out = ((x & y) | ((x ^ y) & ~result)) & sign_mask;
overflow = (x ^ result) & (y ^ result) & sign_mask;
if (carry_in)
{
result += 1;
carry_out ^= (result == 0);
overflow ^= (result == sign_mask);
}
return result;
}

View file

@ -0,0 +1,41 @@
#include "stdafx.h"
#include "Emu/ARMv7/PSVFuncList.h"
extern psv_log_base sceLibc;
namespace sce_libc_func
{
void __cxa_atexit()
{
sceLibc.Todo(__FUNCTION__);
}
void exit()
{
sceLibc.Todo(__FUNCTION__);
}
void printf()
{
sceLibc.Todo(__FUNCTION__);
}
void __cxa_set_dso_handle_main()
{
sceLibc.Todo(__FUNCTION__);
}
}
psv_log_base sceLibc = []() -> psv_log_base&
{
psv_log_base* module = new psv_log_base("sceLibc");
#define REG_FUNC(nid, name) reg_psv_func(nid, module, sce_libc_func::name)
REG_FUNC(0x33b83b70, __cxa_atexit);
REG_FUNC(0x826bbbaf, exit);
REG_FUNC(0x9a004680, printf);
REG_FUNC(0xbfe02b3a, __cxa_set_dso_handle_main);
return std::move(*module);
}();

View file

@ -0,0 +1,45 @@
#include "stdafx.h"
#include "PSVFuncList.h"
std::vector<psv_func> g_psv_func_list;
void add_psv_func(psv_func& data)
{
g_psv_func_list.push_back(data);
}
psv_func* get_psv_func_by_nid(u32 nid)
{
for (auto& f : g_psv_func_list)
{
if (f.nid == nid)
{
return &f;
}
}
return nullptr;
}
u32 get_psv_func_index(psv_func* func)
{
u32 res = func - g_psv_func_list.data();
assert(res < g_psv_func_list.size());
return res;
}
void execute_psv_func_by_index(ARMv7Thread& CPU, u32 index)
{
assert(index < g_psv_func_list.size());
(*g_psv_func_list[index].func)(CPU);
}
extern psv_log_base sceLibc;
void list_known_psv_modules()
{
sceLibc.Log("");
}

View file

@ -0,0 +1,290 @@
#pragma once
#include "ARMv7Thread.h"
#include "Emu/SysCalls/LogBase.h"
class psv_log_base : public LogBase
{
std::string m_name;
public:
psv_log_base(const std::string& name)
: m_name(name)
{
}
virtual const std::string& GetName() const override
{
return m_name;
}
};
class psv_func_caller
{
public:
virtual void operator()(ARMv7Thread& CPU) = 0;
virtual ~psv_func_caller(){};
};
namespace psv_func_detail
{
enum bind_arg_type
{
ARG_GENERAL,
ARG_FLOAT,
ARG_VECTOR,
ARG_STACK,
};
template<typename T, bind_arg_type type, int g_count, int f_count, int v_count>
struct bind_arg;
template<typename T, int g_count, int f_count, int v_count>
struct bind_arg<T, ARG_GENERAL, g_count, f_count, v_count>
{
static_assert(sizeof(T) <= 4, "Invalid function argument type for ARG_GENERAL");
static __forceinline T func(ARMv7Thread& CPU)
{
return (T&)CPU.GPR[g_count - 1];
}
};
template<typename T, int g_count, int f_count, int v_count>
struct bind_arg<T, ARG_FLOAT, g_count, f_count, v_count>
{
static_assert(f_count <= 0, "TODO: Unsupported argument type (float)");
static_assert(sizeof(T) <= 8, "Invalid function argument type for ARG_FLOAT");
static __forceinline T func(ARMv7Thread& CPU)
{
}
};
template<typename T, int g_count, int f_count, int v_count>
struct bind_arg<T, ARG_VECTOR, g_count, f_count, v_count>
{
static_assert(v_count <= 0, "TODO: Unsupported argument type (vector)");
static_assert(sizeof(T) == 16, "Invalid function argument type for ARG_VECTOR");
static __forceinline T func(ARMv7Thread& CPU)
{
}
};
template<typename T, int g_count, int f_count, int v_count>
struct bind_arg<T, ARG_STACK, g_count, f_count, v_count>
{
static_assert(f_count <= 4, "TODO: Unsupported stack argument type (general)");
static_assert(f_count <= 0, "TODO: Unsupported stack argument type (float)");
static_assert(v_count <= 0, "TODO: Unsupported stack argument type (vector)");
static_assert(sizeof(T) <= 4, "Invalid function argument type for ARG_STACK");
static __forceinline T func(ARMv7Thread& CPU)
{
}
};
template<typename T, bind_arg_type type>
struct bind_result
{
static_assert(type != ARG_FLOAT, "TODO: Unsupported funcion result type (float)");
static_assert(type != ARG_VECTOR, "TODO: Unsupported funcion result type (vector)");
static_assert(type == ARG_GENERAL, "Wrong use of bind_result template");
static_assert(sizeof(T) <= 4, "Invalid function result type for ARG_GENERAL");
static __forceinline void func(ARMv7Thread& CPU, T result)
{
(T&)CPU.GPR[0] = result;
}
};
//template<typename T>
//struct bind_result<T, ARG_FLOAT>
//{
// static_assert(sizeof(T) <= 8, "Invalid function result type for ARG_FLOAT");
// static __forceinline void func(ARMv7Thread& CPU, T result)
// {
// }
//};
//template<typename T>
//struct bind_result<T, ARG_VECTOR>
//{
// static_assert(sizeof(T) == 16, "Invalid function result type for ARG_VECTOR");
// static __forceinline void func(ARMv7Thread& CPU, const T result)
// {
// }
//};
template <typename RT, typename F, typename Tuple, bool Done, int Total, int... N>
struct call_impl
{
static __forceinline RT call(F f, Tuple && t)
{
return call_impl<RT, F, Tuple, Total == 1 + sizeof...(N), Total, N..., sizeof...(N)>::call(f, std::forward<Tuple>(t));
}
};
template <typename RT, typename F, typename Tuple, int Total, int... N>
struct call_impl<RT, F, Tuple, true, Total, N...>
{
static __forceinline RT call(F f, Tuple && t)
{
return f(std::get<N>(std::forward<Tuple>(t))...);
}
};
template <typename RT, typename F, typename Tuple>
static __forceinline RT call(F f, Tuple && t)
{
typedef typename std::decay<Tuple>::type ttype;
return psv_func_detail::call_impl<RT, F, Tuple, 0 == std::tuple_size<ttype>::value, std::tuple_size<ttype>::value>::call(f, std::forward<Tuple>(t));
}
template<int g_count, int f_count, int v_count>
static __forceinline std::tuple<> iterate(ARMv7Thread& CPU)
{
// terminator
return std::tuple<>();
}
template<int g_count, int f_count, int v_count, typename T, typename... A>
static __forceinline std::tuple<T, A...> iterate(ARMv7Thread& CPU)
{
static_assert(!std::is_pointer<T>::value, "Invalid function argument type (pointer)");
static_assert(!std::is_reference<T>::value, "Invalid function argument type (reference)");
// TODO: check calculations
const bool is_float = std::is_floating_point<T>::value;
const bool is_vector = std::is_same<T, u128>::value;
const bind_arg_type t = is_float
? ((f_count >= 13) ? ARG_STACK : ARG_FLOAT)
: (is_vector ? ((v_count >= 12) ? ARG_STACK : ARG_VECTOR) : ((g_count >= 8) ? ARG_STACK : ARG_GENERAL));
const int g = g_count + (is_float || is_vector ? 0 : 1);
const int f = f_count + (is_float ? 1 : 0);
const int v = v_count + (is_vector ? 1 : 0);
return std::tuple_cat(std::tuple<T>(bind_arg<T, t, g, f, v>::func(CPU)), iterate<g, f, v, A...>(CPU));
}
template<typename RT, typename... T>
class func_binder;
template<typename... T>
class func_binder<void, T...> : public psv_func_caller
{
typedef void(*func_t)(T...);
const func_t m_call;
public:
func_binder(func_t call)
: psv_func_caller()
, m_call(call)
{
}
virtual void operator()(ARMv7Thread& CPU)
{
call<void>(m_call, iterate<0, 0, 0, T...>(CPU));
}
};
template<typename... T>
class func_binder<void, ARMv7Thread&, T...> : public psv_func_caller
{
typedef void(*func_t)(ARMv7Thread&, T...);
const func_t m_call;
public:
func_binder(func_t call)
: psv_func_caller()
, m_call(call)
{
}
virtual void operator()(ARMv7Thread& CPU)
{
call<void>(m_call, std::tuple_cat(std::tuple<ARMv7Thread&>(CPU), iterate<0, 0, 0, T...>(CPU)));
}
};
template<typename RT, typename... T>
class func_binder : public psv_func_caller
{
typedef RT(*func_t)(T...);
const func_t m_call;
public:
func_binder(func_t call)
: psv_func_caller()
, m_call(call)
{
}
virtual void operator()(ARMv7Thread& CPU)
{
static_assert(!std::is_pointer<RT>::value, "Invalid function result type (pointer)");
static_assert(!std::is_reference<RT>::value, "Invalid function result type (reference)");
const bool is_float = std::is_floating_point<RT>::value;
const bool is_vector = std::is_same<RT, u128>::value;
const bind_arg_type t = is_float ? ARG_FLOAT : (is_vector ? ARG_VECTOR : ARG_GENERAL);
bind_result<RT, t>::func(CPU, call<RT>(m_call, iterate<0, 0, 0, T...>(CPU)));
}
};
template<typename RT, typename... T>
class func_binder<RT, ARMv7Thread&, T...> : public psv_func_caller
{
typedef RT(*func_t)(ARMv7Thread&, T...);
const func_t m_call;
public:
func_binder(func_t call)
: psv_func_caller()
, m_call(call)
{
}
virtual void operator()(ARMv7Thread& CPU)
{
static_assert(!std::is_pointer<RT>::value, "Invalid function result type (pointer)");
static_assert(!std::is_reference<RT>::value, "Invalid function result type (reference)");
const bool is_float = std::is_floating_point<RT>::value;
const bool is_vector = std::is_same<RT, u128>::value;
const bind_arg_type t = is_float ? ARG_FLOAT : (is_vector ? ARG_VECTOR : ARG_GENERAL);
bind_result<RT, t>::func(CPU, call<RT>(m_call, std::tuple_cat(std::tuple<ARMv7Thread&>(CPU), iterate<0, 0, 0, T...>(CPU))));
}
};
}
struct psv_func
{
const u32 nid;
psv_func_caller* const func;
psv_log_base* const module;
};
void add_psv_func(psv_func& data);
template<typename RT, typename... T>
void reg_psv_func(u32 nid, psv_log_base* module, RT(*func)(T...))
{
psv_func f =
{
nid,
new psv_func_detail::func_binder<RT, T...>(func),
module
};
add_psv_func(f);
}
psv_func* get_psv_func_by_nid(u32 nid);
u32 get_psv_func_index(psv_func* func);
void execute_psv_func_by_index(ARMv7Thread& CPU, u32 index);
void list_known_psv_modules();

View file

@ -412,6 +412,12 @@ void DynamicMemoryBlockBase::Delete()
bool DynamicMemoryBlockBase::AllocFixed(u64 addr, u32 size)
{
if (!MemoryBlock::GetStartAddr())
{
LOG_ERROR(MEMORY, "DynamicMemoryBlockBase::AllocFixed(addr=0x%llx, size=0x%x): memory block not initialized", addr, size);
return false;
}
size = PAGE_4K(size + (addr & 4095)); // align size
addr &= ~4095; // align start address
@ -441,6 +447,12 @@ void DynamicMemoryBlockBase::AppendMem(u64 addr, u32 size) /* private */
u64 DynamicMemoryBlockBase::AllocAlign(u32 size, u32 align)
{
if (!MemoryBlock::GetStartAddr())
{
LOG_ERROR(MEMORY, "DynamicMemoryBlockBase::AllocAlign(size=0x%x, align=0x%x): memory block not initialized", size, align);
return 0;
}
size = PAGE_4K(size);
u32 exsize;

View file

@ -13,7 +13,7 @@ u32 libatrac3plus;
u32 libatrac3plus_rtoc;
#endif
s32 cellAtracSetDataAndGetMemSize(vm::ptr<CellAtracHandle> pHandle, u32 pucBufferAddr, u32 uiReadByte, u32 uiBufferByte, vm::ptr<u32> puiWorkMemByte)
s64 cellAtracSetDataAndGetMemSize(vm::ptr<CellAtracHandle> pHandle, u32 pucBufferAddr, u32 uiReadByte, u32 uiBufferByte, vm::ptr<u32> puiWorkMemByte)
{
cellAtrac->Warning("cellAtracSetDataAndGetMemSize(pHandle=0x%x, pucBufferAddr=0x%x, uiReadByte=0x%x, uiBufferByte=0x%x, puiWorkMemByte_addr=0x%x)",
pHandle.addr(), pucBufferAddr, uiReadByte, uiBufferByte, puiWorkMemByte.addr());
@ -25,7 +25,7 @@ s32 cellAtracSetDataAndGetMemSize(vm::ptr<CellAtracHandle> pHandle, u32 pucBuffe
return CELL_OK;
}
s32 cellAtracCreateDecoder(vm::ptr<CellAtracHandle> pHandle, u32 pucWorkMem_addr, u32 uiPpuThreadPriority, u32 uiSpuThreadPriority)
s64 cellAtracCreateDecoder(vm::ptr<CellAtracHandle> pHandle, u32 pucWorkMem_addr, u32 uiPpuThreadPriority, u32 uiSpuThreadPriority)
{
cellAtrac->Warning("cellAtracCreateDecoder(pHandle=0x%x, pucWorkMem_addr=0x%x, uiPpuThreadPriority=%d, uiSpuThreadPriority=%d)",
pHandle.addr(), pucWorkMem_addr, uiPpuThreadPriority, uiSpuThreadPriority);
@ -37,7 +37,7 @@ s32 cellAtracCreateDecoder(vm::ptr<CellAtracHandle> pHandle, u32 pucWorkMem_addr
return CELL_OK;
}
s32 cellAtracCreateDecoderExt(vm::ptr<CellAtracHandle> pHandle, u32 pucWorkMem_addr, u32 uiPpuThreadPriority, vm::ptr<CellAtracExtRes> pExtRes)
s64 cellAtracCreateDecoderExt(vm::ptr<CellAtracHandle> pHandle, u32 pucWorkMem_addr, u32 uiPpuThreadPriority, vm::ptr<CellAtracExtRes> pExtRes)
{
cellAtrac->Warning("cellAtracCreateDecoderExt(pHandle=0x%x, pucWorkMem_addr=0x%x, uiPpuThreadPriority=%d, pExtRes_addr=0x%x)",
pHandle.addr(), pucWorkMem_addr, uiPpuThreadPriority, pExtRes.addr());
@ -49,7 +49,7 @@ s32 cellAtracCreateDecoderExt(vm::ptr<CellAtracHandle> pHandle, u32 pucWorkMem_a
return CELL_OK;
}
s32 cellAtracDeleteDecoder(vm::ptr<CellAtracHandle> pHandle)
s64 cellAtracDeleteDecoder(vm::ptr<CellAtracHandle> pHandle)
{
cellAtrac->Warning("cellAtracDeleteDecoder(pHandle=0x%x)", pHandle.addr());
#ifdef PRX_DEBUG
@ -59,7 +59,7 @@ s32 cellAtracDeleteDecoder(vm::ptr<CellAtracHandle> pHandle)
return CELL_OK;
}
s32 cellAtracDecode(vm::ptr<CellAtracHandle> pHandle, u32 pfOutAddr, vm::ptr<u32> puiSamples, vm::ptr<u32> puiFinishflag, vm::ptr<u32> piRemainFrame)
s64 cellAtracDecode(vm::ptr<CellAtracHandle> pHandle, u32 pfOutAddr, vm::ptr<u32> puiSamples, vm::ptr<u32> puiFinishflag, vm::ptr<u32> piRemainFrame)
{
cellAtrac->Warning("cellAtracDecode(pHandle=0x%x, pfOutAddr=0x%x, puiSamples_addr=0x%x, puiFinishFlag_addr=0x%x, piRemainFrame_addr=0x%x)",
pHandle.addr(), pfOutAddr, puiSamples.addr(), puiFinishflag.addr(), piRemainFrame.addr());
@ -73,7 +73,7 @@ s32 cellAtracDecode(vm::ptr<CellAtracHandle> pHandle, u32 pfOutAddr, vm::ptr<u32
return CELL_OK;
}
s32 cellAtracGetStreamDataInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> ppucWritePointer, vm::ptr<u32> puiWritableByte, vm::ptr<u32> puiReadPosition)
s64 cellAtracGetStreamDataInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> ppucWritePointer, vm::ptr<u32> puiWritableByte, vm::ptr<u32> puiReadPosition)
{
cellAtrac->Warning("cellAtracGetStreamDataInfo(pHandle=0x%x, ppucWritePointer_addr=0x%x, puiWritableByte_addr=0x%x, puiReadPosition_addr=0x%x)",
pHandle.addr(), ppucWritePointer.addr(), puiWritableByte.addr(), puiReadPosition.addr());
@ -87,7 +87,7 @@ s32 cellAtracGetStreamDataInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> pp
return CELL_OK;
}
s32 cellAtracAddStreamData(vm::ptr<CellAtracHandle> pHandle, u32 uiAddByte)
s64 cellAtracAddStreamData(vm::ptr<CellAtracHandle> pHandle, u32 uiAddByte)
{
cellAtrac->Warning("cellAtracAddStreamData(pHandle=0x%x, uiAddByte=0x%x)", pHandle.addr(), uiAddByte);
#ifdef PRX_DEBUG
@ -97,7 +97,7 @@ s32 cellAtracAddStreamData(vm::ptr<CellAtracHandle> pHandle, u32 uiAddByte)
return CELL_OK;
}
s32 cellAtracGetRemainFrame(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> piRemainFrame)
s64 cellAtracGetRemainFrame(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> piRemainFrame)
{
cellAtrac->Warning("cellAtracGetRemainFrame(pHandle=0x%x, piRemainFrame_addr=0x%x)", pHandle.addr(), piRemainFrame.addr());
#ifdef PRX_DEBUG
@ -108,7 +108,7 @@ s32 cellAtracGetRemainFrame(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> piRem
return CELL_OK;
}
s32 cellAtracGetVacantSize(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiVacantSize)
s64 cellAtracGetVacantSize(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiVacantSize)
{
cellAtrac->Warning("cellAtracGetVacantSize(pHandle=0x%x, puiVacantSize_addr=0x%x)", pHandle.addr(), puiVacantSize.addr());
#ifdef PRX_DEBUG
@ -119,7 +119,7 @@ s32 cellAtracGetVacantSize(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiVac
return CELL_OK;
}
s32 cellAtracIsSecondBufferNeeded(vm::ptr<CellAtracHandle> pHandle)
s64 cellAtracIsSecondBufferNeeded(vm::ptr<CellAtracHandle> pHandle)
{
cellAtrac->Warning("cellAtracIsSecondBufferNeeded(pHandle=0x%x)", pHandle.addr());
#ifdef PRX_DEBUG
@ -129,7 +129,7 @@ s32 cellAtracIsSecondBufferNeeded(vm::ptr<CellAtracHandle> pHandle)
return CELL_OK;
}
s32 cellAtracGetSecondBufferInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiReadPosition, vm::ptr<u32> puiDataByte)
s64 cellAtracGetSecondBufferInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiReadPosition, vm::ptr<u32> puiDataByte)
{
cellAtrac->Warning("cellAtracGetSecondBufferInfo(pHandle=0x%x, puiReadPosition_addr=0x%x, puiDataByte_addr=0x%x)",
pHandle.addr(), puiReadPosition.addr(), puiDataByte.addr());
@ -142,7 +142,7 @@ s32 cellAtracGetSecondBufferInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32>
return CELL_OK;
}
s32 cellAtracSetSecondBuffer(vm::ptr<CellAtracHandle> pHandle, u32 pucSecondBufferAddr, u32 uiSecondBufferByte)
s64 cellAtracSetSecondBuffer(vm::ptr<CellAtracHandle> pHandle, u32 pucSecondBufferAddr, u32 uiSecondBufferByte)
{
cellAtrac->Warning("cellAtracSetSecondBuffer(pHandle=0x%x, pucSecondBufferAddr=0x%x, uiSecondBufferByte=0x%x)",
pHandle.addr(), pucSecondBufferAddr, uiSecondBufferByte);
@ -153,7 +153,7 @@ s32 cellAtracSetSecondBuffer(vm::ptr<CellAtracHandle> pHandle, u32 pucSecondBuff
return CELL_OK;
}
s32 cellAtracGetChannel(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiChannel)
s64 cellAtracGetChannel(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiChannel)
{
cellAtrac->Warning("cellAtracGetChannel(pHandle=0x%x, puiChannel_addr=0x%x)", pHandle.addr(), puiChannel.addr());
#ifdef PRX_DEBUG
@ -164,7 +164,7 @@ s32 cellAtracGetChannel(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiChanne
return CELL_OK;
}
s32 cellAtracGetMaxSample(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiMaxSample)
s64 cellAtracGetMaxSample(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiMaxSample)
{
cellAtrac->Warning("cellAtracGetMaxSample(pHandle=0x%x, puiMaxSample_addr=0x%x)", pHandle.addr(), puiMaxSample.addr());
#ifdef PRX_DEBUG
@ -175,7 +175,7 @@ s32 cellAtracGetMaxSample(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiMaxS
return CELL_OK;
}
s32 cellAtracGetNextSample(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiNextSample)
s64 cellAtracGetNextSample(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiNextSample)
{
cellAtrac->Warning("cellAtracGetNextSample(pHandle=0x%x, puiNextSample_addr=0x%x)", pHandle.addr(), puiNextSample.addr());
#ifdef PRX_DEBUG
@ -186,7 +186,7 @@ s32 cellAtracGetNextSample(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiNex
return CELL_OK;
}
s32 cellAtracGetSoundInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> piEndSample, vm::ptr<u32> piLoopStartSample, vm::ptr<u32> piLoopEndSample)
s64 cellAtracGetSoundInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> piEndSample, vm::ptr<u32> piLoopStartSample, vm::ptr<u32> piLoopEndSample)
{
cellAtrac->Warning("cellAtracGetSoundInfo(pHandle=0x%x, piEndSample_addr=0x%x, piLoopStartSample_addr=0x%x, piLoopEndSample_addr=0x%x)",
pHandle.addr(), piEndSample.addr(), piLoopStartSample.addr(), piLoopEndSample.addr());
@ -200,7 +200,7 @@ s32 cellAtracGetSoundInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> piEndSa
return CELL_OK;
}
s32 cellAtracGetNextDecodePosition(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiSamplePosition)
s64 cellAtracGetNextDecodePosition(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiSamplePosition)
{
cellAtrac->Warning("cellAtracGetNextDecodePosition(pHandle=0x%x, puiSamplePosition_addr=0x%x)",
pHandle.addr(), puiSamplePosition.addr());
@ -212,7 +212,7 @@ s32 cellAtracGetNextDecodePosition(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32
return CELL_ATRAC_ERROR_ALLDATA_WAS_DECODED;
}
s32 cellAtracGetBitrate(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiBitrate)
s64 cellAtracGetBitrate(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiBitrate)
{
cellAtrac->Warning("cellAtracGetBitrate(pHandle=0x%x, puiBitrate_addr=0x%x)",
pHandle.addr(), puiBitrate.addr());
@ -224,7 +224,7 @@ s32 cellAtracGetBitrate(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiBitrat
return CELL_OK;
}
s32 cellAtracGetLoopInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> piLoopNum, vm::ptr<u32> puiLoopStatus)
s64 cellAtracGetLoopInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> piLoopNum, vm::ptr<u32> puiLoopStatus)
{
cellAtrac->Warning("cellAtracGetLoopInfo(pHandle=0x%x, piLoopNum_addr=0x%x, puiLoopStatus_addr=0x%x)",
pHandle.addr(), piLoopNum.addr(), puiLoopStatus.addr());
@ -237,7 +237,7 @@ s32 cellAtracGetLoopInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> piLoopNu
return CELL_OK;
}
s32 cellAtracSetLoopNum(vm::ptr<CellAtracHandle> pHandle, int iLoopNum)
s64 cellAtracSetLoopNum(vm::ptr<CellAtracHandle> pHandle, int iLoopNum)
{
cellAtrac->Warning("cellAtracSetLoopNum(pHandle=0x%x, iLoopNum=0x%x)", pHandle.addr(), iLoopNum);
#ifdef PRX_DEBUG
@ -247,7 +247,7 @@ s32 cellAtracSetLoopNum(vm::ptr<CellAtracHandle> pHandle, int iLoopNum)
return CELL_OK;
}
s32 cellAtracGetBufferInfoForResetting(vm::ptr<CellAtracHandle> pHandle, u32 uiSample, vm::ptr<CellAtracBufferInfo> pBufferInfo)
s64 cellAtracGetBufferInfoForResetting(vm::ptr<CellAtracHandle> pHandle, u32 uiSample, vm::ptr<CellAtracBufferInfo> pBufferInfo)
{
cellAtrac->Warning("cellAtracGetBufferInfoForResetting(pHandle=0x%x, uiSample=0x%x, pBufferInfo_addr=0x%x)",
pHandle.addr(), uiSample, pBufferInfo.addr());
@ -262,7 +262,7 @@ s32 cellAtracGetBufferInfoForResetting(vm::ptr<CellAtracHandle> pHandle, u32 uiS
return CELL_OK;
}
s32 cellAtracResetPlayPosition(vm::ptr<CellAtracHandle> pHandle, u32 uiSample, u32 uiWriteByte)
s64 cellAtracResetPlayPosition(vm::ptr<CellAtracHandle> pHandle, u32 uiSample, u32 uiWriteByte)
{
cellAtrac->Warning("cellAtracResetPlayPosition(pHandle=0x%x, uiSample=0x%x, uiWriteByte=0x%x)",
pHandle.addr(), uiSample, uiWriteByte);
@ -273,7 +273,7 @@ s32 cellAtracResetPlayPosition(vm::ptr<CellAtracHandle> pHandle, u32 uiSample, u
return CELL_OK;
}
s32 cellAtracGetInternalErrorInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> piResult)
s64 cellAtracGetInternalErrorInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> piResult)
{
cellAtrac->Warning("cellAtracGetInternalErrorInfo(pHandle=0x%x, piResult_addr=0x%x)",
pHandle.addr(), piResult.addr());
@ -323,6 +323,8 @@ void cellAtrac_init(Module *pxThis)
#ifdef PRX_DEBUG
CallAfter([]()
{
if (!Memory.MainMem.GetStartAddr()) return;
libatrac3plus = (u32)Memory.MainMem.AllocAlign(sizeof(libatrac3plus_data), 0x100000);
memcpy(vm::get_ptr<void>(libatrac3plus), libatrac3plus_data, sizeof(libatrac3plus_data));
libatrac3plus_rtoc = libatrac3plus + 0xBED0;

View file

@ -16,7 +16,7 @@ u32 libpngdec;
u32 libpngdec_rtoc;
#endif
s32 pngDecCreate(
s64 pngDecCreate(
vm::ptr<u32> mainHandle,
vm::ptr<const CellPngDecThreadInParam> param,
vm::ptr<const CellPngDecExtThreadInParam> ext = vm::ptr<const CellPngDecExtThreadInParam>::make(0))
@ -45,7 +45,7 @@ s32 pngDecCreate(
return CELL_OK;
}
s32 pngDecDestroy(CellPngDecMainHandle dec)
s64 pngDecDestroy(CellPngDecMainHandle dec)
{
if (!Memory.Free(dec.addr()))
{
@ -55,7 +55,7 @@ s32 pngDecDestroy(CellPngDecMainHandle dec)
return CELL_OK;
}
s32 pngDecOpen(
s64 pngDecOpen(
CellPngDecMainHandle dec,
vm::ptr<u32> subHandle,
vm::ptr<const CellPngDecSrc> src,
@ -115,7 +115,7 @@ s32 pngDecOpen(
return CELL_OK;
}
s32 pngDecClose(CellPngDecSubHandle stream)
s64 pngDecClose(CellPngDecSubHandle stream)
{
cellFsClose(stream->fd);
if (!Memory.Free(stream.addr()))
@ -126,7 +126,7 @@ s32 pngDecClose(CellPngDecSubHandle stream)
return CELL_OK;
}
s32 pngReadHeader(
s64 pngReadHeader(
CellPngDecSubHandle stream,
vm::ptr<CellPngDecInfo> info,
vm::ptr<CellPngDecExtInfo> extInfo = vm::ptr<CellPngDecExtInfo>::make(0))
@ -189,7 +189,7 @@ s32 pngReadHeader(
return CELL_OK;
}
s32 pngDecSetParameter(
s64 pngDecSetParameter(
CellPngDecSubHandle stream,
vm::ptr<const CellPngDecInParam> inParam,
vm::ptr<CellPngDecOutParam> outParam,
@ -230,7 +230,7 @@ s32 pngDecSetParameter(
return CELL_OK;
}
s32 pngDecodeData(
s64 pngDecodeData(
CellPngDecSubHandle stream,
vm::ptr<u8> data,
vm::ptr<const CellPngDecDataCtrlParam> dataCtrlParam,
@ -359,7 +359,7 @@ s32 pngDecodeData(
return CELL_OK;
}
s32 cellPngDecCreate(vm::ptr<u32> mainHandle, vm::ptr<const CellPngDecThreadInParam> threadInParam, vm::ptr<CellPngDecThreadOutParam> threadOutParam)
s64 cellPngDecCreate(vm::ptr<u32> mainHandle, vm::ptr<const CellPngDecThreadInParam> threadInParam, vm::ptr<CellPngDecThreadOutParam> threadOutParam)
{
#ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__);
@ -379,7 +379,7 @@ s32 cellPngDecCreate(vm::ptr<u32> mainHandle, vm::ptr<const CellPngDecThreadInPa
#endif
}
s32 cellPngDecExtCreate(
s64 cellPngDecExtCreate(
vm::ptr<u32> mainHandle,
vm::ptr<const CellPngDecThreadInParam> threadInParam,
vm::ptr<CellPngDecThreadOutParam> threadOutParam,
@ -405,7 +405,7 @@ s32 cellPngDecExtCreate(
#endif
}
s32 cellPngDecDestroy(CellPngDecMainHandle mainHandle)
s64 cellPngDecDestroy(CellPngDecMainHandle mainHandle)
{
#ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__);
@ -418,7 +418,7 @@ s32 cellPngDecDestroy(CellPngDecMainHandle mainHandle)
#endif
}
s32 cellPngDecOpen(
s64 cellPngDecOpen(
CellPngDecMainHandle mainHandle,
vm::ptr<u32> subHandle,
vm::ptr<const CellPngDecSrc> src,
@ -436,7 +436,7 @@ s32 cellPngDecOpen(
#endif
}
s32 cellPngDecExtOpen(
s64 cellPngDecExtOpen(
CellPngDecMainHandle mainHandle,
vm::ptr<u32> subHandle,
vm::ptr<const CellPngDecSrc> src,
@ -456,7 +456,7 @@ s32 cellPngDecExtOpen(
#endif
}
s32 cellPngDecClose(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle)
s64 cellPngDecClose(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle)
{
#ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__);
@ -468,7 +468,7 @@ s32 cellPngDecClose(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHand
#endif
}
s32 cellPngDecReadHeader(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngDecInfo> info)
s64 cellPngDecReadHeader(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngDecInfo> info)
{
#ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__);
@ -481,7 +481,7 @@ s32 cellPngDecReadHeader(CellPngDecMainHandle mainHandle, CellPngDecSubHandle su
#endif
}
s32 cellPngDecExtReadHeader(
s64 cellPngDecExtReadHeader(
CellPngDecMainHandle mainHandle,
CellPngDecSubHandle subHandle,
vm::ptr<CellPngDecInfo> info,
@ -498,7 +498,7 @@ s32 cellPngDecExtReadHeader(
#endif
}
s32 cellPngDecSetParameter(
s64 cellPngDecSetParameter(
CellPngDecMainHandle mainHandle,
CellPngDecSubHandle subHandle,
vm::ptr<const CellPngDecInParam> inParam,
@ -515,7 +515,7 @@ s32 cellPngDecSetParameter(
#endif
}
s32 cellPngDecExtSetParameter(
s64 cellPngDecExtSetParameter(
CellPngDecMainHandle mainHandle,
CellPngDecSubHandle subHandle,
vm::ptr<const CellPngDecInParam> inParam,
@ -534,7 +534,7 @@ s32 cellPngDecExtSetParameter(
#endif
}
s32 cellPngDecDecodeData(
s64 cellPngDecDecodeData(
CellPngDecMainHandle mainHandle,
CellPngDecSubHandle subHandle,
vm::ptr<u8> data,
@ -552,7 +552,7 @@ s32 cellPngDecDecodeData(
#endif
}
s32 cellPngDecExtDecodeData(
s64 cellPngDecExtDecodeData(
CellPngDecMainHandle mainHandle,
CellPngDecSubHandle subHandle,
vm::ptr<u8> data,
@ -572,7 +572,7 @@ s32 cellPngDecExtDecodeData(
#endif
}
s32 cellPngDecGetUnknownChunks(
s64 cellPngDecGetUnknownChunks(
CellPngDecMainHandle mainHandle,
CellPngDecSubHandle subHandle,
vm::ptr<vm::bptr<CellPngUnknownChunk>> unknownChunk,
@ -587,7 +587,7 @@ s32 cellPngDecGetUnknownChunks(
#endif
}
s32 cellPngDecGetpCAL(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngPCAL> pcal)
s64 cellPngDecGetpCAL(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngPCAL> pcal)
{
#ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__);
@ -598,7 +598,7 @@ s32 cellPngDecGetpCAL(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHa
#endif
}
s32 cellPngDecGetcHRM(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngCHRM> chrm)
s64 cellPngDecGetcHRM(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngCHRM> chrm)
{
#ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__);
@ -609,7 +609,7 @@ s32 cellPngDecGetcHRM(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHa
#endif
}
s32 cellPngDecGetsCAL(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngSCAL> scal)
s64 cellPngDecGetsCAL(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngSCAL> scal)
{
#ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__);
@ -620,7 +620,7 @@ s32 cellPngDecGetsCAL(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHa
#endif
}
s32 cellPngDecGetpHYs(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngPHYS> phys)
s64 cellPngDecGetpHYs(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngPHYS> phys)
{
#ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__);
@ -631,7 +631,7 @@ s32 cellPngDecGetpHYs(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHa
#endif
}
s32 cellPngDecGetoFFs(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngOFFS> offs)
s64 cellPngDecGetoFFs(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngOFFS> offs)
{
#ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__);
@ -642,7 +642,7 @@ s32 cellPngDecGetoFFs(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHa
#endif
}
s32 cellPngDecGetsPLT(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngSPLT> splt)
s64 cellPngDecGetsPLT(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngSPLT> splt)
{
#ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__);
@ -653,7 +653,7 @@ s32 cellPngDecGetsPLT(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHa
#endif
}
s32 cellPngDecGetbKGD(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngBKGD> bkgd)
s64 cellPngDecGetbKGD(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngBKGD> bkgd)
{
#ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__);
@ -664,7 +664,7 @@ s32 cellPngDecGetbKGD(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHa
#endif
}
s32 cellPngDecGettIME(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngTIME> time)
s64 cellPngDecGettIME(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngTIME> time)
{
#ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__);
@ -675,7 +675,7 @@ s32 cellPngDecGettIME(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHa
#endif
}
s32 cellPngDecGethIST(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngHIST> hist)
s64 cellPngDecGethIST(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngHIST> hist)
{
#ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__);
@ -686,7 +686,7 @@ s32 cellPngDecGethIST(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHa
#endif
}
s32 cellPngDecGettRNS(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngTRNS> trns)
s64 cellPngDecGettRNS(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngTRNS> trns)
{
#ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__);
@ -697,7 +697,7 @@ s32 cellPngDecGettRNS(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHa
#endif
}
s32 cellPngDecGetsBIT(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngSBIT> sbit)
s64 cellPngDecGetsBIT(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngSBIT> sbit)
{
#ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__);
@ -708,7 +708,7 @@ s32 cellPngDecGetsBIT(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHa
#endif
}
s32 cellPngDecGetiCCP(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngICCP> iccp)
s64 cellPngDecGetiCCP(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngICCP> iccp)
{
#ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__);
@ -719,7 +719,7 @@ s32 cellPngDecGetiCCP(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHa
#endif
}
s32 cellPngDecGetsRGB(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngSRGB> srgb)
s64 cellPngDecGetsRGB(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngSRGB> srgb)
{
#ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__);
@ -730,7 +730,7 @@ s32 cellPngDecGetsRGB(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHa
#endif
}
s32 cellPngDecGetgAMA(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngGAMA> gama)
s64 cellPngDecGetgAMA(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngGAMA> gama)
{
#ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__);
@ -741,7 +741,7 @@ s32 cellPngDecGetgAMA(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHa
#endif
}
s32 cellPngDecGetPLTE(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngPLTE> plte)
s64 cellPngDecGetPLTE(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngPLTE> plte)
{
#ifdef PRX_DEBUG
cellPngDec->Warning("%s()", __FUNCTION__);
@ -752,7 +752,7 @@ s32 cellPngDecGetPLTE(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHa
#endif
}
s32 cellPngDecGetTextChunk(
s64 cellPngDecGetTextChunk(
CellPngDecMainHandle mainHandle,
CellPngDecSubHandle subHandle,
vm::ptr<u32> textInfoNum,
@ -804,6 +804,8 @@ void cellPngDec_init(Module *pxThis)
#ifdef PRX_DEBUG
CallAfter([]()
{
if (!Memory.MainMem.GetStartAddr()) return;
libpngdec = (u32)Memory.MainMem.AllocAlign(sizeof(libpngdec_data), 0x100000);
memcpy(vm::get_ptr<void>(libpngdec), libpngdec_data, sizeof(libpngdec_data));
libpngdec_rtoc = libpngdec + 0x49710;

View file

@ -183,77 +183,77 @@ struct CellPngDecDataOutInfo
};
// Functions
s32 cellPngDecCreate(vm::ptr<u32> mainHandle, vm::ptr<const CellPngDecThreadInParam> threadInParam, vm::ptr<CellPngDecThreadOutParam> threadOutParam);
s64 cellPngDecCreate(vm::ptr<u32> mainHandle, vm::ptr<const CellPngDecThreadInParam> threadInParam, vm::ptr<CellPngDecThreadOutParam> threadOutParam);
s32 cellPngDecExtCreate(
s64 cellPngDecExtCreate(
vm::ptr<u32> mainHandle,
vm::ptr<const CellPngDecThreadInParam> threadInParam,
vm::ptr<CellPngDecThreadOutParam> threadOutParam,
vm::ptr<const CellPngDecExtThreadInParam> extThreadInParam,
vm::ptr<CellPngDecExtThreadOutParam> extThreadOutParam);
s32 cellPngDecOpen(
s64 cellPngDecOpen(
CellPngDecMainHandle mainHandle,
vm::ptr<u32> subHandle,
vm::ptr<const CellPngDecSrc> src,
vm::ptr<CellPngDecOpnInfo> openInfo);
s32 cellPngDecReadHeader(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngDecInfo> info);
s64 cellPngDecReadHeader(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngDecInfo> info);
s32 cellPngDecSetParameter(
s64 cellPngDecSetParameter(
CellPngDecMainHandle mainHandle,
CellPngDecSubHandle subHandle,
vm::ptr<const CellPngDecInParam> inParam,
vm::ptr<CellPngDecOutParam> outParam);
s32 cellPngDecDecodeData(
s64 cellPngDecDecodeData(
CellPngDecMainHandle mainHandle,
CellPngDecSubHandle subHandle,
vm::ptr<u8> data,
vm::ptr<const CellPngDecDataCtrlParam> dataCtrlParam,
vm::ptr<CellPngDecDataOutInfo> dataOutInfo);
s32 cellPngDecClose(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle);
s64 cellPngDecClose(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle);
s32 cellPngDecDestroy(CellPngDecMainHandle mainHandle);
s64 cellPngDecDestroy(CellPngDecMainHandle mainHandle);
s32 cellPngDecGetTextChunk(
s64 cellPngDecGetTextChunk(
CellPngDecMainHandle mainHandle,
CellPngDecSubHandle subHandle,
vm::ptr<u32> textInfoNum,
vm::ptr<vm::bptr<CellPngTextInfo>> textInfo);
s32 cellPngDecGetPLTE(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngPLTE> plte);
s64 cellPngDecGetPLTE(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngPLTE> plte);
s32 cellPngDecGetgAMA(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngGAMA> gama);
s64 cellPngDecGetgAMA(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngGAMA> gama);
s32 cellPngDecGetsRGB(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngSRGB> srgb);
s64 cellPngDecGetsRGB(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngSRGB> srgb);
s32 cellPngDecGetiCCP(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngICCP> iccp);
s64 cellPngDecGetiCCP(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngICCP> iccp);
s32 cellPngDecGetsBIT(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngSBIT> sbit);
s64 cellPngDecGetsBIT(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngSBIT> sbit);
s32 cellPngDecGettRNS(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngTRNS> trns);
s64 cellPngDecGettRNS(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngTRNS> trns);
s32 cellPngDecGethIST(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngHIST> hist);
s64 cellPngDecGethIST(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngHIST> hist);
s32 cellPngDecGettIME(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngTIME> time);
s64 cellPngDecGettIME(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngTIME> time);
s32 cellPngDecGetbKGD(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngBKGD> bkgd);
s64 cellPngDecGetbKGD(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngBKGD> bkgd);
s32 cellPngDecGetsPLT(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngSPLT> splt);
s64 cellPngDecGetsPLT(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngSPLT> splt);
s32 cellPngDecGetoFFs(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngOFFS> offs);
s64 cellPngDecGetoFFs(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngOFFS> offs);
s32 cellPngDecGetpHYs(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngPHYS> phys);
s64 cellPngDecGetpHYs(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngPHYS> phys);
s32 cellPngDecGetsCAL(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngSCAL> scal);
s64 cellPngDecGetsCAL(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngSCAL> scal);
s32 cellPngDecGetcHRM(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngCHRM> chrm);
s64 cellPngDecGetcHRM(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngCHRM> chrm);
s32 cellPngDecGetpCAL(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngPCAL> pcal);
s64 cellPngDecGetpCAL(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngPCAL> pcal);
s32 cellPngDecGetUnknownChunks(
s64 cellPngDecGetUnknownChunks(
CellPngDecMainHandle mainHandle,
CellPngDecSubHandle subHandle,
vm::ptr<vm::bptr<CellPngUnknownChunk>> unknownChunk,
@ -349,7 +349,7 @@ struct CellPngDecCbCtrlDisp
};
// Functions
s32 cellPngDecExtOpen(
s64 cellPngDecExtOpen(
CellPngDecMainHandle mainHandle,
vm::ptr<u32> subHandle,
vm::ptr<const CellPngDecSrc> src,
@ -357,13 +357,13 @@ s32 cellPngDecExtOpen(
vm::ptr<const CellPngDecCbCtrlStrm> cbCtrlStrm,
vm::ptr<const CellPngDecOpnParam> opnParam);
s32 cellPngDecExtReadHeader(
s64 cellPngDecExtReadHeader(
CellPngDecMainHandle mainHandle,
CellPngDecSubHandle subHandle,
vm::ptr<CellPngDecInfo> info,
vm::ptr<CellPngDecExtInfo> extInfo);
s32 cellPngDecExtSetParameter(
s64 cellPngDecExtSetParameter(
CellPngDecMainHandle mainHandle,
CellPngDecSubHandle subHandle,
vm::ptr<const CellPngDecInParam> inParam,
@ -371,7 +371,7 @@ s32 cellPngDecExtSetParameter(
vm::ptr<const CellPngDecExtInParam> extInParam,
vm::ptr<CellPngDecExtOutParam> extOutParam);
s32 cellPngDecExtDecodeData(
s64 cellPngDecExtDecodeData(
CellPngDecMainHandle mainHandle,
CellPngDecSubHandle subHandle,
vm::ptr<u8> data,

View file

@ -557,9 +557,9 @@ s64 spursInit(
{
if (spurs->m.wklReadyCount[i].read_relaxed() ||
spurs->m.wklSet1.read_relaxed() & (0x8000u >> i) ||
spurs->m.wklFlag.flag.read_relaxed() == 0 &&
(spurs->m.wklFlag.flag.read_relaxed() == 0 &&
spurs->m.flagRecv.read_relaxed() == (u8)i
)
))
{
do_break = true;
break;
@ -575,9 +575,9 @@ s64 spursInit(
{
if (spurs->m.wklReadyCount[i + 0x10].read_relaxed() ||
spurs->m.wklSet2.read_relaxed() & (0x8000u >> i) ||
spurs->m.wklFlag.flag.read_relaxed() == 0 &&
(spurs->m.wklFlag.flag.read_relaxed() == 0 &&
spurs->m.flagRecv.read_relaxed() == (u8)i + 0x10
)
))
{
do_break = true;
break;
@ -953,11 +953,26 @@ s64 cellSpursAttributeEnableSystemWorkload(vm::ptr<CellSpursAttribute> attr, vm:
s64 cellSpursFinalize(vm::ptr<CellSpurs> spurs)
{
cellSpurs->Todo("cellSpursFinalize(spurs_addr=0x%x)", spurs.addr());
#ifdef PRX_DEBUG
cellSpurs->Warning("cellSpursFinalize(spurs_addr=0x%x)", spurs.addr());
#ifdef PRX_DEBUG_XXX
return GetCurrentPPUThread().FastCall2(libsre + 0x8568, libsre_rtoc);
#endif
if (!spurs)
{
return CELL_SPURS_CORE_ERROR_NULL_POINTER;
}
if (spurs.addr() % 128)
{
return CELL_SPURS_CORE_ERROR_ALIGN;
}
if (spurs->m.xD66.read_relaxed())
{
return CELL_SPURS_CORE_ERROR_STAT;
}
return CELL_OK;
}
@ -1360,13 +1375,7 @@ s32 spursAddWorkload(
spurs->m.wklSet2._and_not({ be_t<u16>::make(0x8000 >> index) }); // clear bit in wklFlag2
}
spurs->m.flagRecv.atomic_op([wnum](u8& FR)
{
if (FR == wnum)
{
FR = 0xff;
}
});
spurs->m.flagRecv.compare_and_swap(wnum, 0xff);
u32 res_wkl;
CellSpurs::_sub_str3& wkl = wnum <= 15 ? spurs->m.wklG1[wnum] : spurs->m.wklG2[wnum & 0xf];

View file

@ -766,6 +766,8 @@ void cellSpursJq_init(Module *pxThis)
#ifdef PRX_DEBUG
CallAfter([]()
{
if (!Memory.MainMem.GetStartAddr()) return;
libspurs_jq = (u32)Memory.MainMem.AllocAlign(sizeof(libspurs_jq_data), 0x100000);
memcpy(vm::get_ptr<void>(libspurs_jq), libspurs_jq_data, sizeof(libspurs_jq_data));
libspurs_jq_rtoc = libspurs_jq + 0x17E80;

View file

@ -1989,6 +1989,8 @@ void cellSync_init(Module *pxThis)
#ifdef PRX_DEBUG
CallAfter([]()
{
if (!Memory.MainMem.GetStartAddr()) return;
libsre = (u32)Memory.MainMem.AllocAlign(sizeof(libsre_data), 0x100000);
memcpy(vm::get_ptr<void>(libsre), libsre_data, sizeof(libsre_data));
libsre_rtoc = libsre + 0x399B0;

View file

@ -458,6 +458,8 @@ void cellSync2_init(Module *pxThis)
#ifdef PRX_DEBUG
CallAfter([]()
{
if (!Memory.MainMem.GetStartAddr()) return;
libsync2 = (u32)Memory.MainMem.AllocAlign(sizeof(libsync2_data), 0x100000);
memcpy(vm::get_ptr<void>(libsync2), libsync2_data, sizeof(libsync2_data));
libsync2_rtoc = libsync2 + 0xF280;

View file

@ -249,4 +249,4 @@ template<typename RT, typename... T>
func_caller* bind_func(RT(*call)(T...))
{
return new detail::func_binder<RT, T...>(call);
}
}

View file

@ -3,8 +3,11 @@
#include "Utilities/rFile.h"
#include "Emu/FS/vfsStream.h"
#include "Emu/Memory/Memory.h"
#include "Emu/ARMv7/PSVFuncList.h"
#include "ELF32.h"
#define LOADER_DEBUG
void Elf32_Ehdr::Show()
{
#ifdef LOADER_DEBUG
@ -502,6 +505,8 @@ bool ELF32Loader::LoadPhdrData(u64 _offset)
bool ELF32Loader::LoadShdrData(u64 offset)
{
u32 fnid_addr = 0;
for(u32 i=0; i<shdr_arr.size(); ++i)
{
Elf32_Shdr& shdr = shdr_arr[i];
@ -527,6 +532,79 @@ bool ELF32Loader::LoadShdrData(u64 offset)
{
max_addr = shdr.sh_addr + shdr.sh_size;
}
// probably should be in LoadPhdrData()
if (machine == MACHINE_ARM && !strcmp(shdr_name_arr[i].c_str(), ".sceFNID.rodata"))
{
fnid_addr = shdr.sh_addr;
}
else if (machine == MACHINE_ARM && !strcmp(shdr_name_arr[i].c_str(), ".sceFStub.rodata"))
{
list_known_psv_modules();
auto fnid = vm::psv::ptr<const u32>::make(fnid_addr);
auto fstub = vm::psv::ptr<const u32>::make(shdr.sh_addr);
for (u32 j = 0; j < shdr.sh_size / 4; j++)
{
u32 nid = fnid[j];
u32 addr = fstub[j];
if (auto func = get_psv_func_by_nid(nid))
{
LOG_NOTICE(LOADER, "Imported function 0x%x (addr=0x%x)", nid, addr);
// writing Thumb code (temporarily, because it should be ARM)
vm::psv::write16(addr + 0, 0xf870); // HACK (special instruction that calls HLE function
vm::psv::write16(addr + 2, (u16)get_psv_func_index(func));
vm::psv::write16(addr + 4, 0x4770); // BX LR
vm::psv::write16(addr + 6, 0); // null
}
else
{
LOG_ERROR(LOADER, "Unimplemented function 0x%x (addr=0x%x)", nid, addr);
// writing Thumb code (temporarily - it shouldn't be written in this case)
vm::psv::write16(addr + 0, 0xf06f); // MVN r0,#0x0
vm::psv::write16(addr + 2, 0x0000);
vm::psv::write16(addr + 4, 0x4770); // BX LR
vm::psv::write16(addr + 6, 0); // null
}
}
}
else if (machine == MACHINE_ARM && !strcmp(shdr_name_arr[i].c_str(), ".sceRefs.rodata"))
{
// basically unknown struct
struct reloc_info
{
u32 code; // 0xff
u32 data; // address that will be written
u32 code1; // 0x2f
u32 addr1; // address of movw r12,# instruction to be replaced
u32 code2; // 0x30
u32 addr2; // address of movt r12,# instruction to be replaced
u32 code3; // 0
};
auto rel = vm::psv::ptr<const reloc_info>::make(shdr.sh_addr);
for (u32 j = 0; j < shdr.sh_size / sizeof(reloc_info); j++)
{
if (rel[j].code == 0xff && rel[j].code1 == 0x2f && rel[j].code2 == 0x30 && rel[j].code3 == 0)
{
const u32 data = rel[j].data;
vm::psv::write16(rel[j].addr1 + 0, 0xf240 | (data & 0x800) >> 1 | (data & 0xf000) >> 12); // MOVW
vm::psv::write16(rel[j].addr1 + 2, 0x0c00 | (data & 0x700) << 4 | (data & 0xff));
vm::psv::write16(rel[j].addr2 + 0, 0xf2c0 | (data & 0x8000000) >> 17 | (data & 0xf0000000) >> 28); // MOVT
vm::psv::write16(rel[j].addr2 + 2, 0x0c00 | (data & 0x7000000) >> 12 | (data & 0xff0000) >> 16);
}
else
{
LOG_ERROR(LOADER, "sceRefs: unknown code found (code=0x%x, code1=0x%x, code2=0x%x, code3=0x%x)", rel[j].code, rel[j].code1, rel[j].code2, rel[j].code3);
}
}
}
}
//TODO

View file

@ -57,6 +57,8 @@
<ClCompile Include="Emu\ARMv7\ARMv7DisAsm.cpp" />
<ClCompile Include="Emu\ARMv7\ARMv7Interpreter.cpp" />
<ClCompile Include="Emu\ARMv7\ARMv7Thread.cpp" />
<ClCompile Include="Emu\ARMv7\Modules\sceLibc.cpp" />
<ClCompile Include="Emu\ARMv7\PSVFuncList.cpp" />
<ClCompile Include="Emu\Audio\AL\OpenALThread.cpp" />
<ClCompile Include="Emu\Audio\AudioDumper.cpp" />
<ClCompile Include="Emu\Audio\AudioManager.cpp" />
@ -264,6 +266,7 @@
<ClInclude Include="Emu\ARMv7\ARMv7Interpreter.h" />
<ClInclude Include="Emu\ARMv7\ARMv7Opcodes.h" />
<ClInclude Include="Emu\ARMv7\ARMv7Thread.h" />
<ClInclude Include="Emu\ARMv7\PSVFuncList.h" />
<ClInclude Include="Emu\Audio\AL\OpenALThread.h" />
<ClInclude Include="Emu\Audio\AudioDumper.h" />
<ClInclude Include="Emu\Audio\AudioManager.h" />

View file

@ -75,6 +75,9 @@
<Filter Include="Emu\SysCalls\currently_unused">
<UniqueIdentifier>{ead7494f-a872-4b4d-a864-1a61c3b6012f}</UniqueIdentifier>
</Filter>
<Filter Include="Emu\ARMv7\Modules">
<UniqueIdentifier>{1d9e6fc4-9a79-4329-a8b5-081e24822aaa}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Crypto\aes.cpp">
@ -638,6 +641,12 @@
<ClCompile Include="Emu\ARMv7\ARMv7DisAsm.cpp">
<Filter>Emu\ARMv7</Filter>
</ClCompile>
<ClCompile Include="Emu\ARMv7\PSVFuncList.cpp">
<Filter>Emu\ARMv7</Filter>
</ClCompile>
<ClCompile Include="Emu\ARMv7\Modules\sceLibc.cpp">
<Filter>Emu\ARMv7\Modules</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Crypto\aes.h">
@ -1249,5 +1258,8 @@
<ClInclude Include="Emu\Cell\PPULLVMRecompiler.h">
<Filter>Emu\Cell</Filter>
</ClInclude>
<ClInclude Include="Emu\ARMv7\PSVFuncList.h">
<Filter>Emu\ARMv7</Filter>
</ClInclude>
</ItemGroup>
</Project>