1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 10:42:36 +01:00

Merge remote-tracking branch 'upstream/master' into ppu_llvm_recompiler

Conflicts:
	Utilities/BEType.h
	rpcs3/Emu/Cell/PPUInterpreter.h
	rpcs3/emucore.vcxproj.filters
This commit is contained in:
S Gopal Rajagopal 2014-10-19 02:36:26 +05:30
commit 8a7ba5a709
99 changed files with 2228 additions and 728 deletions

View File

@ -1,20 +1,91 @@
#pragma once #pragma once
#include <emmintrin.h>
union _CRT_ALIGN(16) u128 union _CRT_ALIGN(16) u128
{ {
u64 _u64[2]; u64 _u64[2];
s64 _s64[2]; s64 _s64[2];
class u64_reversed_array_2
{
u64 data[2];
public:
u64& operator [] (s32 index)
{
return data[1 - index];
}
const u64& operator [] (s32 index) const
{
return data[1 - index];
}
} u64r;
u32 _u32[4]; u32 _u32[4];
s32 _s32[4]; s32 _s32[4];
class u32_reversed_array_4
{
u32 data[4];
public:
u32& operator [] (s32 index)
{
return data[3 - index];
}
const u32& operator [] (s32 index) const
{
return data[3 - index];
}
} u32r;
u16 _u16[8]; u16 _u16[8];
s16 _s16[8]; s16 _s16[8];
class u16_reversed_array_8
{
u16 data[8];
public:
u16& operator [] (s32 index)
{
return data[7 - index];
}
const u16& operator [] (s32 index) const
{
return data[7 - index];
}
} u16r;
u8 _u8[16]; u8 _u8[16];
s8 _s8[16]; s8 _s8[16];
class u8_reversed_array_16
{
u8 data[16];
public:
u8& operator [] (s32 index)
{
return data[15 - index];
}
const u8& operator [] (s32 index) const
{
return data[15 - index];
}
} u8r;
float _f[4]; float _f[4];
double _d[2]; double _d[2];
__m128 xmm; __m128 vf;
__m128i vi;
class bit_array_128 class bit_array_128
{ {
@ -94,6 +165,11 @@ union _CRT_ALIGN(16) u128
return ret; return ret;
} }
static u128 from64r(u64 _1, u64 _0 = 0)
{
return from64(_0, _1);
}
static u128 from32(u32 _0, u32 _1 = 0, u32 _2 = 0, u32 _3 = 0) static u128 from32(u32 _0, u32 _1 = 0, u32 _2 = 0, u32 _3 = 0)
{ {
u128 ret; u128 ret;
@ -105,12 +181,21 @@ union _CRT_ALIGN(16) u128
} }
static u128 from32r(u32 _3, u32 _2 = 0, u32 _1 = 0, u32 _0 = 0) static u128 from32r(u32 _3, u32 _2 = 0, u32 _1 = 0, u32 _0 = 0)
{
return from32(_0, _1, _2, _3);
}
static u128 from32p(u32 value)
{ {
u128 ret; u128 ret;
ret._u32[0] = _0; ret.vi = _mm_set1_epi32((int)value);
ret._u32[1] = _1; return ret;
ret._u32[2] = _2; }
ret._u32[3] = _3;
static u128 from8p(u8 value)
{
u128 ret;
ret.vi = _mm_set1_epi8((char)value);
return ret; return ret;
} }
@ -121,9 +206,41 @@ union _CRT_ALIGN(16) u128
return ret; return ret;
} }
void setBit(u32 bit) static u128 fromV(__m128i value)
{ {
_bit[bit] = true; u128 ret;
ret.vi = value;
return ret;
}
static __forceinline u128 add8(const u128& left, const u128& right)
{
return fromV(_mm_add_epi8(left.vi, right.vi));
}
static __forceinline u128 sub8(const u128& left, const u128& right)
{
return fromV(_mm_sub_epi8(left.vi, right.vi));
}
static __forceinline u128 minu8(const u128& left, const u128& right)
{
return fromV(_mm_min_epu8(left.vi, right.vi));
}
static __forceinline u128 eq8(const u128& left, const u128& right)
{
return fromV(_mm_cmpeq_epi8(left.vi, right.vi));
}
static __forceinline u128 gtu8(const u128& left, const u128& right)
{
return fromV(_mm_cmpgt_epu8(left.vi, right.vi));
}
static __forceinline u128 leu8(const u128& left, const u128& right)
{
return fromV(_mm_cmple_epu8(left.vi, right.vi));
} }
bool operator == (const u128& right) const bool operator == (const u128& right) const
@ -136,19 +253,19 @@ union _CRT_ALIGN(16) u128
return (_u64[0] != right._u64[0]) || (_u64[1] != right._u64[1]); return (_u64[0] != right._u64[0]) || (_u64[1] != right._u64[1]);
} }
u128 operator | (const u128& right) const __forceinline u128 operator | (const u128& right) const
{ {
return from64(_u64[0] | right._u64[0], _u64[1] | right._u64[1]); return fromV(_mm_or_si128(vi, right.vi));
} }
u128 operator & (const u128& right) const __forceinline u128 operator & (const u128& right) const
{ {
return from64(_u64[0] & right._u64[0], _u64[1] & right._u64[1]); return fromV(_mm_and_si128(vi, right.vi));
} }
u128 operator ^ (const u128& right) const __forceinline u128 operator ^ (const u128& right) const
{ {
return from64(_u64[0] ^ right._u64[0], _u64[1] ^ right._u64[1]); return fromV(_mm_xor_si128(vi, right.vi));
} }
u128 operator ~ () const u128 operator ~ () const
@ -156,6 +273,12 @@ union _CRT_ALIGN(16) u128
return from64(~_u64[0], ~_u64[1]); return from64(~_u64[0], ~_u64[1]);
} }
// result = (~left) & (right)
static __forceinline u128 andnot(const u128& left, const u128& right)
{
return fromV(_mm_andnot_si128(left.vi, right.vi));
}
void clear() void clear()
{ {
_u64[1] = _u64[0] = 0; _u64[1] = _u64[0] = 0;
@ -180,6 +303,72 @@ union _CRT_ALIGN(16) u128
} }
}; };
#ifndef InterlockedCompareExchange
static __forceinline u128 InterlockedCompareExchange(volatile u128* dest, u128 exch, u128 comp)
{
#if defined(__GNUG__)
auto res = __sync_val_compare_and_swap((volatile __int128_t*)dest, (__int128_t&)comp, (__int128_t&)exch);
return (u128&)res;
#else
_InterlockedCompareExchange128((volatile long long*)dest, exch._u64[1], exch._u64[0], (long long*)&comp);
return comp;
#endif
}
#endif
static __forceinline bool InterlockedCompareExchangeTest(volatile u128* dest, u128 exch, u128 comp)
{
#if defined(__GNUG__)
return __sync_bool_compare_and_swap((volatile __int128_t*)dest, (__int128_t&)comp, (__int128_t&)exch);
#else
return _InterlockedCompareExchange128((volatile long long*)dest, exch._u64[1], exch._u64[0], (long long*)&comp) != 0;
#endif
}
#ifndef InterlockedExchange
static __forceinline u128 InterlockedExchange(volatile u128* dest, u128 value)
{
while (true)
{
const u128 old = *(u128*)dest;
if (InterlockedCompareExchangeTest(dest, value, old)) return old;
}
}
#endif
#ifndef InterlockedOr
static __forceinline u128 InterlockedOr(volatile u128* dest, u128 value)
{
while (true)
{
const u128 old = *(u128*)dest;
if (InterlockedCompareExchangeTest(dest, old | value, old)) return old;
}
}
#endif
#ifndef InterlockedAnd
static __forceinline u128 InterlockedAnd(volatile u128* dest, u128 value)
{
while (true)
{
const u128 old = *(u128*)dest;
if (InterlockedCompareExchangeTest(dest, old & value, old)) return old;
}
}
#endif
#ifndef InterlockedXor
static __forceinline u128 InterlockedXor(volatile u128* dest, u128 value)
{
while (true)
{
const u128 old = *(u128*)dest;
if (InterlockedCompareExchangeTest(dest, old ^ value, old)) return old;
}
}
#endif
#define re16(val) _byteswap_ushort(val) #define re16(val) _byteswap_ushort(val)
#define re32(val) _byteswap_ulong(val) #define re32(val) _byteswap_ulong(val)
#define re64(val) _byteswap_uint64(val) #define re64(val) _byteswap_uint64(val)

View File

@ -1,5 +1,7 @@
#pragma once #pragma once
#include <emmintrin.h>
#ifdef _WIN32 #ifdef _WIN32
#define thread_local __declspec(thread) #define thread_local __declspec(thread)
#elif __APPLE__ #elif __APPLE__
@ -44,23 +46,6 @@ void strcpy_trunc(char(&dst)[size], const char(&src)[rsize])
#define _byteswap_uint64(x) __builtin_bswap64(x) #define _byteswap_uint64(x) __builtin_bswap64(x)
#define INFINITE 0xFFFFFFFF #define INFINITE 0xFFFFFFFF
#define _CRT_ALIGN(x) __attribute__((aligned(x))) #define _CRT_ALIGN(x) __attribute__((aligned(x)))
#define InterlockedCompareExchange(ptr,new_val,old_val) __sync_val_compare_and_swap(ptr,old_val,new_val)
#define InterlockedExchange(ptr, value) __sync_lock_test_and_set(ptr, value)
#define InterlockedOr(ptr, value) __sync_fetch_and_or(ptr, value)
#define InterlockedAnd(ptr, value) __sync_fetch_and_and(ptr, value)
#define InterlockedXor(ptr, value) __sync_fetch_and_xor(ptr, value)
//inline int64_t InterlockedOr64(volatile int64_t *dest, int64_t val)
//{
// int64_t olderval;
// int64_t oldval = *dest;
// do
// {
// olderval = oldval;
// oldval = __sync_val_compare_and_swap(dest, olderval | val, olderval);
// } while (olderval != oldval);
// return oldval;
//}
inline uint64_t __umulh(uint64_t a, uint64_t b) inline uint64_t __umulh(uint64_t a, uint64_t b)
{ {
@ -97,95 +82,208 @@ int clock_gettime(int foo, struct timespec *ts);
#ifndef InterlockedCompareExchange #ifndef InterlockedCompareExchange
static __forceinline uint8_t InterlockedCompareExchange(volatile uint8_t* dest, uint8_t exch, uint8_t comp) static __forceinline uint8_t InterlockedCompareExchange(volatile uint8_t* dest, uint8_t exch, uint8_t comp)
{ {
#if defined(__GNUG__)
return __sync_val_compare_and_swap(dest, comp, exch);
#else
return _InterlockedCompareExchange8((volatile char*)dest, exch, comp); return _InterlockedCompareExchange8((volatile char*)dest, exch, comp);
#endif
} }
static __forceinline uint16_t InterlockedCompareExchange(volatile uint16_t* dest, uint16_t exch, uint16_t comp) static __forceinline uint16_t InterlockedCompareExchange(volatile uint16_t* dest, uint16_t exch, uint16_t comp)
{ {
#if defined(__GNUG__)
return __sync_val_compare_and_swap(dest, comp, exch);
#else
return _InterlockedCompareExchange16((volatile short*)dest, exch, comp); return _InterlockedCompareExchange16((volatile short*)dest, exch, comp);
#endif
} }
static __forceinline uint32_t InterlockedCompareExchange(volatile uint32_t* dest, uint32_t exch, uint32_t comp) static __forceinline uint32_t InterlockedCompareExchange(volatile uint32_t* dest, uint32_t exch, uint32_t comp)
{ {
#if defined(__GNUG__)
return __sync_val_compare_and_swap(dest, comp, exch);
#else
return _InterlockedCompareExchange((volatile long*)dest, exch, comp); return _InterlockedCompareExchange((volatile long*)dest, exch, comp);
#endif
} }
static __forceinline uint64_t InterlockedCompareExchange(volatile uint64_t* dest, uint64_t exch, uint64_t comp) static __forceinline uint64_t InterlockedCompareExchange(volatile uint64_t* dest, uint64_t exch, uint64_t comp)
{ {
#if defined(__GNUG__)
return __sync_val_compare_and_swap(dest, comp, exch);
#else
return _InterlockedCompareExchange64((volatile long long*)dest, exch, comp); return _InterlockedCompareExchange64((volatile long long*)dest, exch, comp);
#endif
} }
#endif #endif
static __forceinline bool InterlockedCompareExchangeTest(volatile uint8_t* dest, uint8_t exch, uint8_t comp)
{
#if defined(__GNUG__)
return __sync_bool_compare_and_swap(dest, comp, exch);
#else
return (uint8_t)_InterlockedCompareExchange8((volatile char*)dest, exch, comp) == comp;
#endif
}
static __forceinline bool InterlockedCompareExchangeTest(volatile uint16_t* dest, uint16_t exch, uint16_t comp)
{
#if defined(__GNUG__)
return __sync_bool_compare_and_swap(dest, comp, exch);
#else
return (uint16_t)_InterlockedCompareExchange16((volatile short*)dest, exch, comp) == comp;
#endif
}
static __forceinline bool InterlockedCompareExchangeTest(volatile uint32_t* dest, uint32_t exch, uint32_t comp)
{
#if defined(__GNUG__)
return __sync_bool_compare_and_swap(dest, comp, exch);
#else
return (uint32_t)_InterlockedCompareExchange((volatile long*)dest, exch, comp) == comp;
#endif
}
static __forceinline bool InterlockedCompareExchangeTest(volatile uint64_t* dest, uint64_t exch, uint64_t comp)
{
#if defined(__GNUG__)
return __sync_bool_compare_and_swap(dest, comp, exch);
#else
return (uint64_t)_InterlockedCompareExchange64((volatile long long*)dest, exch, comp) == comp;
#endif
}
#ifndef InterlockedExchange #ifndef InterlockedExchange
static __forceinline uint8_t InterlockedExchange(volatile uint8_t* dest, uint8_t value) static __forceinline uint8_t InterlockedExchange(volatile uint8_t* dest, uint8_t value)
{ {
#if defined(__GNUG__)
return __sync_lock_test_and_set(dest, value);
#else
return _InterlockedExchange8((volatile char*)dest, value); return _InterlockedExchange8((volatile char*)dest, value);
#endif
} }
static __forceinline uint16_t InterlockedExchange(volatile uint16_t* dest, uint16_t value) static __forceinline uint16_t InterlockedExchange(volatile uint16_t* dest, uint16_t value)
{ {
#if defined(__GNUG__)
return __sync_lock_test_and_set(dest, value);
#else
return _InterlockedExchange16((volatile short*)dest, value); return _InterlockedExchange16((volatile short*)dest, value);
#endif
} }
static __forceinline uint32_t InterlockedExchange(volatile uint32_t* dest, uint32_t value) static __forceinline uint32_t InterlockedExchange(volatile uint32_t* dest, uint32_t value)
{ {
#if defined(__GNUG__)
return __sync_lock_test_and_set(dest, value);
#else
return _InterlockedExchange((volatile long*)dest, value); return _InterlockedExchange((volatile long*)dest, value);
#endif
} }
static __forceinline uint64_t InterlockedExchange(volatile uint64_t* dest, uint64_t value) static __forceinline uint64_t InterlockedExchange(volatile uint64_t* dest, uint64_t value)
{ {
#if defined(__GNUG__)
return __sync_lock_test_and_set(dest, value);
#else
return _InterlockedExchange64((volatile long long*)dest, value); return _InterlockedExchange64((volatile long long*)dest, value);
#endif
} }
#endif #endif
#ifndef InterlockedOr #ifndef InterlockedOr
static __forceinline uint8_t InterlockedOr(volatile uint8_t* dest, uint8_t value) static __forceinline uint8_t InterlockedOr(volatile uint8_t* dest, uint8_t value)
{ {
#if defined(__GNUG__)
return __sync_fetch_and_or(dest, value);
#else
return _InterlockedOr8((volatile char*)dest, value); return _InterlockedOr8((volatile char*)dest, value);
#endif
} }
static __forceinline uint16_t InterlockedOr(volatile uint16_t* dest, uint16_t value) static __forceinline uint16_t InterlockedOr(volatile uint16_t* dest, uint16_t value)
{ {
#if defined(__GNUG__)
return __sync_fetch_and_or(dest, value);
#else
return _InterlockedOr16((volatile short*)dest, value); return _InterlockedOr16((volatile short*)dest, value);
#endif
} }
static __forceinline uint32_t InterlockedOr(volatile uint32_t* dest, uint32_t value) static __forceinline uint32_t InterlockedOr(volatile uint32_t* dest, uint32_t value)
{ {
#if defined(__GNUG__)
return __sync_fetch_and_or(dest, value);
#else
return _InterlockedOr((volatile long*)dest, value); return _InterlockedOr((volatile long*)dest, value);
#endif
} }
static __forceinline uint64_t InterlockedOr(volatile uint64_t* dest, uint64_t value) static __forceinline uint64_t InterlockedOr(volatile uint64_t* dest, uint64_t value)
{ {
#if defined(__GNUG__)
return __sync_fetch_and_or(dest, value);
#else
return _InterlockedOr64((volatile long long*)dest, value); return _InterlockedOr64((volatile long long*)dest, value);
#endif
} }
#endif #endif
#ifndef InterlockedAnd #ifndef InterlockedAnd
static __forceinline uint8_t InterlockedAnd(volatile uint8_t* dest, uint8_t value) static __forceinline uint8_t InterlockedAnd(volatile uint8_t* dest, uint8_t value)
{ {
#if defined(__GNUG__)
return __sync_fetch_and_and(dest, value);
#else
return _InterlockedAnd8((volatile char*)dest, value); return _InterlockedAnd8((volatile char*)dest, value);
#endif
} }
static __forceinline uint16_t InterlockedAnd(volatile uint16_t* dest, uint16_t value) static __forceinline uint16_t InterlockedAnd(volatile uint16_t* dest, uint16_t value)
{ {
#if defined(__GNUG__)
return __sync_fetch_and_and(dest, value);
#else
return _InterlockedAnd16((volatile short*)dest, value); return _InterlockedAnd16((volatile short*)dest, value);
#endif
} }
static __forceinline uint32_t InterlockedAnd(volatile uint32_t* dest, uint32_t value) static __forceinline uint32_t InterlockedAnd(volatile uint32_t* dest, uint32_t value)
{ {
#if defined(__GNUG__)
return __sync_fetch_and_and(dest, value);
#else
return _InterlockedAnd((volatile long*)dest, value); return _InterlockedAnd((volatile long*)dest, value);
#endif
} }
static __forceinline uint64_t InterlockedAnd(volatile uint64_t* dest, uint64_t value) static __forceinline uint64_t InterlockedAnd(volatile uint64_t* dest, uint64_t value)
{ {
#if defined(__GNUG__)
return __sync_fetch_and_and(dest, value);
#else
return _InterlockedAnd64((volatile long long*)dest, value); return _InterlockedAnd64((volatile long long*)dest, value);
#endif
} }
#endif #endif
#ifndef InterlockedXor #ifndef InterlockedXor
static __forceinline uint8_t InterlockedXor(volatile uint8_t* dest, uint8_t value) static __forceinline uint8_t InterlockedXor(volatile uint8_t* dest, uint8_t value)
{ {
#if defined(__GNUG__)
return __sync_fetch_and_xor(dest, value);
#else
return _InterlockedXor8((volatile char*)dest, value); return _InterlockedXor8((volatile char*)dest, value);
#endif
} }
static __forceinline uint16_t InterlockedXor(volatile uint16_t* dest, uint16_t value) static __forceinline uint16_t InterlockedXor(volatile uint16_t* dest, uint16_t value)
{ {
#if defined(__GNUG__)
return __sync_fetch_and_xor(dest, value);
#else
return _InterlockedXor16((volatile short*)dest, value); return _InterlockedXor16((volatile short*)dest, value);
#endif
} }
static __forceinline uint32_t InterlockedXor(volatile uint32_t* dest, uint32_t value) static __forceinline uint32_t InterlockedXor(volatile uint32_t* dest, uint32_t value)
{ {
#if defined(__GNUG__)
return __sync_fetch_and_xor(dest, value);
#else
return _InterlockedXor((volatile long*)dest, value); return _InterlockedXor((volatile long*)dest, value);
#endif
} }
static __forceinline uint64_t InterlockedXor(volatile uint64_t* dest, uint64_t value) static __forceinline uint64_t InterlockedXor(volatile uint64_t* dest, uint64_t value)
{ {
#if defined(__GNUG__)
return __sync_fetch_and_xor(dest, value);
#else
return _InterlockedXor64((volatile long long*)dest, value); return _InterlockedXor64((volatile long long*)dest, value);
#endif
} }
#endif #endif
@ -222,3 +320,17 @@ static __forceinline uint64_t cntlz64(uint64_t arg)
} }
#endif #endif
} }
// compare 16 packed unsigned bytes (greater than)
static __forceinline __m128i _mm_cmpgt_epu8(__m128i A, __m128i B)
{
// (A xor 0x80) > (B xor 0x80)
return _mm_cmpgt_epi8(_mm_xor_si128(A, _mm_set1_epi8(-128)), _mm_xor_si128(B, _mm_set1_epi8(-128)));
}
// compare 16 packed unsigned bytes (less or equal)
static __forceinline __m128i _mm_cmple_epu8(__m128i A, __m128i B)
{
// ((B xor 0x80) > (A xor 0x80)) || A == B
return _mm_or_si128(_mm_cmpgt_epu8(B, A), _mm_cmpeq_epi8(A, B));
}

View File

@ -8,15 +8,3 @@ bool SM_IsAborted()
{ {
return Emu.IsStopped(); return Emu.IsStopped();
} }
void SM_Sleep()
{
if (NamedThreadBase* t = GetCurrentNamedThread())
{
t->WaitForAnySignal();
}
else
{
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
}

View File

@ -2,7 +2,6 @@
#include "Emu/Memory/atomic_type.h" #include "Emu/Memory/atomic_type.h"
bool SM_IsAborted(); bool SM_IsAborted();
void SM_Sleep();
enum SMutexResult enum SMutexResult
{ {
@ -20,8 +19,7 @@ template
< <
typename T, typename T,
const u64 free_value = 0, const u64 free_value = 0,
const u64 dead_value = 0xffffffffffffffffull, const u64 dead_value = 0xffffffffffffffffull
void (*wait)() = SM_Sleep
> >
class SMutexBase class SMutexBase
{ {
@ -118,7 +116,7 @@ public:
default: return res; default: return res;
} }
if (wait != nullptr) wait(); std::this_thread::sleep_for(std::chrono::milliseconds(1));
if (timeout && counter++ > timeout) if (timeout && counter++ > timeout)
{ {

View File

@ -33,7 +33,7 @@ public:
return false; return false;
} }
SM_Sleep(); std::this_thread::sleep_for(std::chrono::milliseconds(1));
continue; continue;
} }
@ -60,7 +60,7 @@ public:
return false; return false;
} }
SM_Sleep(); std::this_thread::sleep_for(std::chrono::milliseconds(1));
continue; continue;
} }
@ -112,7 +112,7 @@ public:
break; break;
} }
SM_Sleep(); std::this_thread::sleep_for(std::chrono::milliseconds(1));
continue; continue;
} }

View File

@ -1,4 +1,5 @@
#include "stdafx.h" #include "stdafx.h"
#include "Emu/System.h"
#include "Log.h" #include "Log.h"
#include "Thread.h" #include "Thread.h"
@ -207,3 +208,58 @@ bool thread::joinable() const
{ {
return m_thr.joinable(); return m_thr.joinable();
} }
bool waiter_map_t::is_stopped(u64 signal_id)
{
if (Emu.IsStopped())
{
LOG_WARNING(Log::HLE, "%s.waiter_op() aborted (signal_id=0x%llx)", m_name.c_str(), signal_id);
return true;
}
return false;
}
waiter_map_t::waiter_reg_t::waiter_reg_t(waiter_map_t& map, u64 signal_id)
: signal_id(signal_id)
, thread(GetCurrentNamedThread())
, map(map)
{
std::lock_guard<std::mutex> lock(map.m_mutex);
// add waiter
map.m_waiters.push_back({ signal_id, thread });
}
waiter_map_t::waiter_reg_t::~waiter_reg_t()
{
std::lock_guard<std::mutex> lock(map.m_mutex);
// remove waiter
for (size_t i = map.m_waiters.size() - 1; i >= 0; i--)
{
if (map.m_waiters[i].signal_id == signal_id && map.m_waiters[i].thread == thread)
{
map.m_waiters.erase(map.m_waiters.begin() + i);
return;
}
}
LOG_ERROR(HLE, "%s(): waiter not found (signal_id=0x%llx, map='%s')", __FUNCTION__, signal_id, map.m_name.c_str());
Emu.Pause();
}
void waiter_map_t::notify(u64 signal_id)
{
if (!m_waiters.size()) return;
std::lock_guard<std::mutex> lock(m_mutex);
// find waiter and signal
for (auto& v : m_waiters)
{
if (v.signal_id == signal_id)
{
v.thread->Notify();
}
}
}

View File

@ -69,4 +69,56 @@ public:
void detach(); void detach();
void join(); void join();
bool joinable() const; bool joinable() const;
}; };
class waiter_map_t
{
// TODO: optimize (use custom lightweight readers-writer lock)
std::mutex m_mutex;
struct waiter_t
{
u64 signal_id;
NamedThreadBase* thread;
};
std::vector<waiter_t> m_waiters;
std::string m_name;
struct waiter_reg_t
{
const u64 signal_id;
NamedThreadBase* const thread;
waiter_map_t& map;
waiter_reg_t(waiter_map_t& map, u64 signal_id);
~waiter_reg_t();
};
bool is_stopped(u64 signal_id);
public:
waiter_map_t(const char* name) : m_name(name) {}
// wait until waiter_func() returns true, signal_id is an arbitrary number
template<typename WT> __forceinline void wait_op(u64 signal_id, const WT waiter_func)
{
// check condition
if (waiter_func()) return;
// register waiter
waiter_reg_t waiter(*this, signal_id);
while (true)
{
// wait for 1 ms or until signal arrived
waiter.thread->WaitForAnySignal(1);
if (is_stopped(signal_id)) break;
if (waiter_func()) break;
}
}
// signal all threads waiting on waiter_op() with the same signal_id (signaling only hints those threads that corresponding conditions are *probably* met)
void notify(u64 signal_id);
};

2
asmjit

@ -1 +1 @@
Subproject commit 0cff228354124bd81050b949097282f78ad0e91a Subproject commit 1318c9aff7137b30aec7dee2ababb2b313ae0f06

View File

@ -28,6 +28,7 @@ CPUThread::CPUThread(CPUThreadType type)
, m_is_branch(false) , m_is_branch(false)
, m_status(Stopped) , m_status(Stopped)
, m_last_syscall(0) , m_last_syscall(0)
, m_trace_enabled(false)
{ {
} }
@ -298,7 +299,7 @@ void _se_translator(unsigned int u, EXCEPTION_POINTERS* pExp)
void CPUThread::Task() void CPUThread::Task()
{ {
if (Ini.HLELogging.GetValue()) LOG_NOTICE(PPU, "%s enter", CPUThread::GetFName().c_str()); if (Ini.HLELogging.GetValue()) LOG_NOTICE(GENERAL, "%s enter", CPUThread::GetFName().c_str());
const std::vector<u64>& bp = Emu.GetBreakPoints(); const std::vector<u64>& bp = Emu.GetBreakPoints();
@ -337,7 +338,7 @@ void CPUThread::Task()
} }
Step(); Step();
//if (PC - 0x13ED4 < 0x288) trace.push_back(PC); //if (m_trace_enabled) trace.push_back(PC);
NextPc(m_dec->DecodeMemory(PC + m_offset)); NextPc(m_dec->DecodeMemory(PC + m_offset));
if (status == CPUThread_Step) if (status == CPUThread_Step)
@ -373,7 +374,25 @@ void CPUThread::Task()
// TODO: linux version // TODO: linux version
#endif #endif
for (auto& v : trace) LOG_NOTICE(PPU, "PC = 0x%x", v); if (trace.size())
{
LOG_NOTICE(GENERAL, "Trace begin (%d elements)", trace.size());
if (Ini.HLELogging.GetValue()) LOG_NOTICE(PPU, "%s leave", CPUThread::GetFName().c_str()); u32 start = trace[0], prev = trace[0] - 4;
for (auto& v : trace) //LOG_NOTICE(GENERAL, "PC = 0x%x", v);
{
if (v - prev != 4)
{
LOG_NOTICE(GENERAL, "Trace: 0x%08x .. 0x%08x", start, prev);
start = v;
}
prev = v;
}
LOG_NOTICE(GENERAL, "Trace end: 0x%08x .. 0x%08x", start, prev);
}
if (Ini.HLELogging.GetValue()) LOG_NOTICE(GENERAL, "%s leave", CPUThread::GetFName().c_str());
} }

View File

@ -119,6 +119,7 @@ public:
u32 nPC; u32 nPC;
u64 cycle; u64 cycle;
bool m_is_branch; bool m_is_branch;
bool m_trace_enabled;
bool m_is_interrupt; bool m_is_interrupt;
bool m_has_interrupt; bool m_has_interrupt;

View File

@ -135,22 +135,6 @@ RawSPUThread* CPUThreadManager::GetRawSPUThread(u32 num)
} }
} }
void CPUThreadManager::NotifyThread(const u32 id)
{
if (!id) return;
std::lock_guard<std::mutex> lock(m_mtx_thread);
for (u32 i = 0; i < m_threads.size(); i++)
{
if (m_threads[i]->GetId() == id)
{
m_threads[i]->Notify();
return;
}
}
}
void CPUThreadManager::Exec() void CPUThreadManager::Exec()
{ {
std::lock_guard<std::mutex> lock(m_mtx_thread); std::lock_guard<std::mutex> lock(m_mtx_thread);

View File

@ -17,7 +17,6 @@ public:
CPUThread& AddThread(CPUThreadType type); CPUThread& AddThread(CPUThreadType type);
void RemoveThread(const u32 id); void RemoveThread(const u32 id);
void NotifyThread(const u32 id);
std::vector<CPUThread*>& GetThreads() { return m_threads; } std::vector<CPUThread*>& GetThreads() { return m_threads; }
s32 GetThreadNumById(CPUThreadType type, u32 id); s32 GetThreadNumById(CPUThreadType type, u32 id);

View File

@ -2216,11 +2216,11 @@ private:
{ {
if (is_r) // rldcr if (is_r) // rldcr
{ {
RLDICR(ra, rs, (u32)CPU.GPR[rb] & 0x3F, m_eb, rc); RLDICR(ra, rs, (u32)(CPU.GPR[rb] & 0x3F), m_eb, rc);
} }
else // rldcl else // rldcl
{ {
RLDICL(ra, rs, (u32)CPU.GPR[rb] & 0x3F, m_eb, rc); RLDICL(ra, rs, (u32)(CPU.GPR[rb] & 0x3F), m_eb, rc);
} }
} }
void CMP(u32 crfd, u32 l, u32 ra, u32 rb) void CMP(u32 crfd, u32 l, u32 ra, u32 rb)
@ -2367,7 +2367,6 @@ private:
} }
CPU.GPR[ra] = i; CPU.GPR[ra] = i;
if(rc) CPU.UpdateCR0<s64>(CPU.GPR[ra]); if(rc) CPU.UpdateCR0<s64>(CPU.GPR[ra]);
} }
void SLD(u32 ra, u32 rs, u32 rb, bool rc) void SLD(u32 ra, u32 rs, u32 rb, bool rc)

View File

@ -251,10 +251,12 @@ private:
} }
void BIZ(u32 intr, u32 rt, u32 ra) void BIZ(u32 intr, u32 rt, u32 ra)
{ {
if (intr) switch (intr)
{ {
UNIMPLEMENTED(); case 0: break;
return; case 0x10: break; // enable interrupts
case 0x20: break; // disable interrupts
default: UNIMPLEMENTED(); return;
} }
u32 target = branchTarget(CPU.GPR[ra]._u32[3], 0); u32 target = branchTarget(CPU.GPR[ra]._u32[3], 0);
@ -270,10 +272,12 @@ private:
} }
void BINZ(u32 intr, u32 rt, u32 ra) void BINZ(u32 intr, u32 rt, u32 ra)
{ {
if (intr) switch (intr)
{ {
UNIMPLEMENTED(); case 0: break;
return; case 0x10: break; // enable interrupts
case 0x20: break; // disable interrupts
default: UNIMPLEMENTED(); return;
} }
u32 target = branchTarget(CPU.GPR[ra]._u32[3], 0); u32 target = branchTarget(CPU.GPR[ra]._u32[3], 0);
@ -289,10 +293,12 @@ private:
} }
void BIHZ(u32 intr, u32 rt, u32 ra) void BIHZ(u32 intr, u32 rt, u32 ra)
{ {
if (intr) switch (intr)
{ {
UNIMPLEMENTED(); case 0: break;
return; case 0x10: break; // enable interrupts
case 0x20: break; // disable interrupts
default: UNIMPLEMENTED(); return;
} }
u32 target = branchTarget(CPU.GPR[ra]._u32[3], 0); u32 target = branchTarget(CPU.GPR[ra]._u32[3], 0);
@ -308,10 +314,12 @@ private:
} }
void BIHNZ(u32 intr, u32 rt, u32 ra) void BIHNZ(u32 intr, u32 rt, u32 ra)
{ {
if (intr) switch (intr)
{ {
UNIMPLEMENTED(); case 0: break;
return; case 0x10: break; // enable interrupts
case 0x20: break; // disable interrupts
default: UNIMPLEMENTED(); return;
} }
u32 target = branchTarget(CPU.GPR[ra]._u32[3], 0); u32 target = branchTarget(CPU.GPR[ra]._u32[3], 0);
@ -337,10 +345,12 @@ private:
} }
void BI(u32 intr, u32 ra) void BI(u32 intr, u32 ra)
{ {
if (intr) switch (intr)
{ {
UNIMPLEMENTED(); case 0: break;
return; case 0x10: break; // enable interrupts
case 0x20: break; // disable interrupts
default: UNIMPLEMENTED(); return;
} }
u32 target = branchTarget(CPU.GPR[ra]._u32[3], 0); u32 target = branchTarget(CPU.GPR[ra]._u32[3], 0);
@ -349,10 +359,12 @@ private:
} }
void BISL(u32 intr, u32 rt, u32 ra) void BISL(u32 intr, u32 rt, u32 ra)
{ {
if (intr) switch (intr)
{ {
UNIMPLEMENTED(); case 0: break;
return; case 0x10: break; // enable interrupts
case 0x20: break; // disable interrupts
default: UNIMPLEMENTED(); return;
} }
u32 target = branchTarget(CPU.GPR[ra]._u32[3], 0); u32 target = branchTarget(CPU.GPR[ra]._u32[3], 0);

View File

@ -9,64 +9,6 @@ using namespace asmjit::host;
#define UNIMPLEMENTED() UNK(__FUNCTION__) #define UNIMPLEMENTED() UNK(__FUNCTION__)
#define mmToU64Ptr(x) ((u64*)(&x))
#define mmToU32Ptr(x) ((u32*)(&x))
#define mmToU16Ptr(x) ((u16*)(&x))
#define mmToU8Ptr(x) ((u8*)(&x))
struct g_imm_table_struct
{
//u16 cntb_table[65536];
__m128i fsmb_table[65536];
__m128i fsmh_table[256];
__m128i fsm_table[16];
__m128i sldq_pshufb[32];
__m128i srdq_pshufb[32];
__m128i rldq_pshufb[16];
g_imm_table_struct()
{
/*static_assert(offsetof(g_imm_table_struct, cntb_table) == 0, "offsetof(cntb_table) != 0");
for (u32 i = 0; i < sizeof(cntb_table) / sizeof(cntb_table[0]); i++)
{
u32 cnt_low = 0, cnt_high = 0;
for (u32 j = 0; j < 8; j++)
{
cnt_low += (i >> j) & 1;
cnt_high += (i >> (j + 8)) & 1;
}
cntb_table[i] = (cnt_high << 8) | cnt_low;
}*/
for (u32 i = 0; i < sizeof(fsm_table) / sizeof(fsm_table[0]); i++)
{
for (u32 j = 0; j < 4; j++) mmToU32Ptr(fsm_table[i])[j] = (i & (1 << j)) ? ~0 : 0;
}
for (u32 i = 0; i < sizeof(fsmh_table) / sizeof(fsmh_table[0]); i++)
{
for (u32 j = 0; j < 8; j++) mmToU16Ptr(fsmh_table[i])[j] = (i & (1 << j)) ? ~0 : 0;
}
for (u32 i = 0; i < sizeof(fsmb_table) / sizeof(fsmb_table[0]); i++)
{
for (u32 j = 0; j < 16; j++) mmToU8Ptr(fsmb_table[i])[j] = (i & (1 << j)) ? ~0 : 0;
}
for (u32 i = 0; i < sizeof(sldq_pshufb) / sizeof(sldq_pshufb[0]); i++)
{
for (u32 j = 0; j < 16; j++) mmToU8Ptr(sldq_pshufb[i])[j] = (u8)(j - i);
}
for (u32 i = 0; i < sizeof(srdq_pshufb) / sizeof(srdq_pshufb[0]); i++)
{
for (u32 j = 0; j < 16; j++) mmToU8Ptr(srdq_pshufb[i])[j] = (j + i > 15) ? 0xff : (u8)(j + i);
}
for (u32 i = 0; i < sizeof(rldq_pshufb) / sizeof(rldq_pshufb[0]); i++)
{
for (u32 j = 0; j < 16; j++) mmToU8Ptr(rldq_pshufb[i])[j] = (u8)(j - i) & 0xf;
}
}
};
class SPURecompiler; class SPURecompiler;
class SPURecompilerCore : public CPUDecoder class SPURecompilerCore : public CPUDecoder
@ -1132,10 +1074,12 @@ private:
} }
void BIZ(u32 intr, u32 rt, u32 ra) void BIZ(u32 intr, u32 rt, u32 ra)
{ {
if (intr) switch (intr)
{ {
UNIMPLEMENTED(); case 0: break;
return; case 0x10: break; // enable interrupts
case 0x20: break; // disable interrupts
default: UNIMPLEMENTED(); return;
} }
c.mov(cpu_dword(PC), CPU.PC); c.mov(cpu_dword(PC), CPU.PC);
@ -1151,10 +1095,12 @@ private:
} }
void BINZ(u32 intr, u32 rt, u32 ra) void BINZ(u32 intr, u32 rt, u32 ra)
{ {
if (intr) switch (intr)
{ {
UNIMPLEMENTED(); case 0: break;
return; case 0x10: break; // enable interrupts
case 0x20: break; // disable interrupts
default: UNIMPLEMENTED(); return;
} }
c.mov(cpu_dword(PC), CPU.PC); c.mov(cpu_dword(PC), CPU.PC);
@ -1170,10 +1116,12 @@ private:
} }
void BIHZ(u32 intr, u32 rt, u32 ra) void BIHZ(u32 intr, u32 rt, u32 ra)
{ {
if (intr) switch (intr)
{ {
UNIMPLEMENTED(); case 0: break;
return; case 0x10: break; // enable interrupts
case 0x20: break; // disable interrupts
default: UNIMPLEMENTED(); return;
} }
c.mov(cpu_dword(PC), CPU.PC); c.mov(cpu_dword(PC), CPU.PC);
@ -1189,10 +1137,12 @@ private:
} }
void BIHNZ(u32 intr, u32 rt, u32 ra) void BIHNZ(u32 intr, u32 rt, u32 ra)
{ {
if (intr) switch (intr)
{ {
UNIMPLEMENTED(); case 0: break;
return; case 0x10: break; // enable interrupts
case 0x20: break; // disable interrupts
default: UNIMPLEMENTED(); return;
} }
c.mov(cpu_dword(PC), CPU.PC); c.mov(cpu_dword(PC), CPU.PC);
@ -1239,10 +1189,12 @@ private:
} }
void BI(u32 intr, u32 ra) void BI(u32 intr, u32 ra)
{ {
if (intr) switch (intr)
{ {
UNIMPLEMENTED(); case 0: break;
return; case 0x10: break; // enable interrupts
case 0x20: break; // disable interrupts
default: UNIMPLEMENTED(); return;
} }
c.mov(cpu_dword(PC), CPU.PC); c.mov(cpu_dword(PC), CPU.PC);
@ -1255,10 +1207,12 @@ private:
} }
void BISL(u32 intr, u32 rt, u32 ra) void BISL(u32 intr, u32 rt, u32 ra)
{ {
if (intr) switch (intr)
{ {
UNIMPLEMENTED(); case 0: break;
return; case 0x10: break; // enable interrupts
case 0x20: break; // disable interrupts
default: UNIMPLEMENTED(); return;
} }
XmmInvalidate(rt); XmmInvalidate(rt);

View File

@ -13,7 +13,7 @@
#include "SPUInterpreter.h" #include "SPUInterpreter.h"
#include "SPURecompiler.h" #include "SPURecompiler.h"
static const g_imm_table_struct g_imm_table; const g_imm_table_struct g_imm_table;
SPURecompilerCore::SPURecompilerCore(SPUThread& cpu) SPURecompilerCore::SPURecompilerCore(SPUThread& cpu)
: m_enc(new SPURecompiler(cpu, *this)) : m_enc(new SPURecompiler(cpu, *this))

View File

@ -1018,7 +1018,7 @@ void SPUThread::StopAndSignal(u32 code)
case 0x003: case 0x003:
{ {
GPR[3]._u32[3] = m_code3_func(*this); GPR[3]._u64[1] = m_code3_func(*this);
break; break;
} }
@ -1161,7 +1161,7 @@ void SPUThread::StopAndSignal(u32 code)
{ {
LOG_ERROR(Log::SPU, "Unknown STOP code: 0x%x (message=0x%x)", code, SPU.Out_MBox.GetValue()); LOG_ERROR(Log::SPU, "Unknown STOP code: 0x%x (message=0x%x)", code, SPU.Out_MBox.GetValue());
} }
Stop(); Emu.Pause();
break; break;
} }
} }

View File

@ -105,6 +105,66 @@ enum
SPU_RdSigNotify2_offs = 0x1C00C, SPU_RdSigNotify2_offs = 0x1C00C,
}; };
#define mmToU64Ptr(x) ((u64*)(&x))
#define mmToU32Ptr(x) ((u32*)(&x))
#define mmToU16Ptr(x) ((u16*)(&x))
#define mmToU8Ptr(x) ((u8*)(&x))
struct g_imm_table_struct
{
//u16 cntb_table[65536];
__m128i fsmb_table[65536];
__m128i fsmh_table[256];
__m128i fsm_table[16];
__m128i sldq_pshufb[32];
__m128i srdq_pshufb[32];
__m128i rldq_pshufb[16];
g_imm_table_struct()
{
/*static_assert(offsetof(g_imm_table_struct, cntb_table) == 0, "offsetof(cntb_table) != 0");
for (u32 i = 0; i < sizeof(cntb_table) / sizeof(cntb_table[0]); i++)
{
u32 cnt_low = 0, cnt_high = 0;
for (u32 j = 0; j < 8; j++)
{
cnt_low += (i >> j) & 1;
cnt_high += (i >> (j + 8)) & 1;
}
cntb_table[i] = (cnt_high << 8) | cnt_low;
}*/
for (u32 i = 0; i < sizeof(fsm_table) / sizeof(fsm_table[0]); i++)
{
for (u32 j = 0; j < 4; j++) mmToU32Ptr(fsm_table[i])[j] = (i & (1 << j)) ? ~0 : 0;
}
for (u32 i = 0; i < sizeof(fsmh_table) / sizeof(fsmh_table[0]); i++)
{
for (u32 j = 0; j < 8; j++) mmToU16Ptr(fsmh_table[i])[j] = (i & (1 << j)) ? ~0 : 0;
}
for (u32 i = 0; i < sizeof(fsmb_table) / sizeof(fsmb_table[0]); i++)
{
for (u32 j = 0; j < 16; j++) mmToU8Ptr(fsmb_table[i])[j] = (i & (1 << j)) ? ~0 : 0;
}
for (u32 i = 0; i < sizeof(sldq_pshufb) / sizeof(sldq_pshufb[0]); i++)
{
for (u32 j = 0; j < 16; j++) mmToU8Ptr(sldq_pshufb[i])[j] = (u8)(j - i);
}
for (u32 i = 0; i < sizeof(srdq_pshufb) / sizeof(srdq_pshufb[0]); i++)
{
for (u32 j = 0; j < 16; j++) mmToU8Ptr(srdq_pshufb[i])[j] = (j + i > 15) ? 0xff : (u8)(j + i);
}
for (u32 i = 0; i < sizeof(rldq_pshufb) / sizeof(rldq_pshufb[0]); i++)
{
for (u32 j = 0; j < 16; j++) mmToU8Ptr(rldq_pshufb[i])[j] = (u8)(j - i) & 0xf;
}
}
};
extern const g_imm_table_struct g_imm_table;
//Floating point status and control register. Unsure if this is one of the GPRs or SPRs //Floating point status and control register. Unsure if this is one of the GPRs or SPRs
//Is 128 bits, but bits 0-19, 24-28, 32-49, 56-60, 64-81, 88-92, 96-115, 120-124 are unused //Is 128 bits, but bits 0-19, 24-28, 32-49, 56-60, 64-81, 88-92, 96-115, 120-124 are unused
class FPSCR class FPSCR
@ -451,7 +511,7 @@ public:
void WriteLS128(const u32 lsa, const u128& data) const { vm::write128(lsa + m_offset, data); } void WriteLS128(const u32 lsa, const u128& data) const { vm::write128(lsa + m_offset, data); }
std::function<void(SPUThread& SPU)> m_custom_task; std::function<void(SPUThread& SPU)> m_custom_task;
std::function<u32(SPUThread& SPU)> m_code3_func; std::function<u64(SPUThread& SPU)> m_code3_func;
public: public:
SPUThread(CPUThreadType type = CPU_THREAD_SPU); SPUThread(CPUThreadType type = CPU_THREAD_SPU);

View File

@ -49,7 +49,7 @@ public:
// atomically compare data with cmp, replace with exch if equal, return true if data was replaced // atomically compare data with cmp, replace with exch if equal, return true if data was replaced
__forceinline bool compare_and_swap_test(const T& cmp, const T& exch) volatile __forceinline bool compare_and_swap_test(const T& cmp, const T& exch) volatile
{ {
return InterlockedCompareExchange(&data, (atomic_type&)(exch), (atomic_type&)(cmp)) == (atomic_type&)(cmp); return InterlockedCompareExchangeTest(&data, (atomic_type&)(exch), (atomic_type&)(cmp));
} }
// read data with memory barrier // read data with memory barrier

View File

@ -90,7 +90,7 @@ std::string GLFragmentDecompilerThread::AddConst()
return name; return name;
} }
auto data = vm::ptr<be_t<u32>>::make(m_addr + m_size + m_offset); auto data = vm::ptr<u32>::make(m_addr + m_size + m_offset);
m_offset += 4 * 4; m_offset += 4 * 4;
u32 x = GetData(data[0]); u32 x = GetData(data[0]);
@ -279,7 +279,7 @@ std::string GLFragmentDecompilerThread::BuildCode()
void GLFragmentDecompilerThread::Task() void GLFragmentDecompilerThread::Task()
{ {
auto data = vm::ptr<be_t<u32>>::make(m_addr); auto data = vm::ptr<u32>::make(m_addr);
m_size = 0; m_size = 0;
m_location = 0; m_location = 0;
m_loop_count = 0; m_loop_count = 0;

View File

@ -3,6 +3,7 @@
#include "Utilities/Log.h" #include "Utilities/Log.h"
#include "Emu/Memory/Memory.h" #include "Emu/Memory/Memory.h"
#include "Emu/System.h" #include "Emu/System.h"
#include "Emu/RSX/GSManager.h"
#include "RSXThread.h" #include "RSXThread.h"
#include "Emu/SysCalls/Callback.h" #include "Emu/SysCalls/Callback.h"
@ -45,15 +46,40 @@ void RSXThread::nativeRescale(float width, float height)
u32 GetAddress(u32 offset, u32 location) u32 GetAddress(u32 offset, u32 location)
{ {
u32 res = 0;
switch(location) switch(location)
{ {
case CELL_GCM_LOCATION_LOCAL: return (u32)Memory.RSXFBMem.GetStartAddr() + offset; case CELL_GCM_LOCATION_LOCAL:
case CELL_GCM_LOCATION_MAIN: return (u32)Memory.RSXIOMem.RealAddr(offset); // TODO: Error Check? {
res = (u32)Memory.RSXFBMem.GetStartAddr() + offset;
break;
}
case CELL_GCM_LOCATION_MAIN:
{
res = (u32)Memory.RSXIOMem.RealAddr(offset); // TODO: Error Check?
if (res == 0)
{
LOG_ERROR(RSX, "GetAddress(offset=0x%x): RSXIO memory not mapped", offset);
Emu.Pause();
break;
}
if (Emu.GetGSManager().GetRender().m_strict_ordering[offset >> 20])
{
_mm_mfence(); // probably doesn't have any effect on current implementation
}
break;
}
default:
{
LOG_ERROR(RSX, "GetAddress(offset=0x%x, location=0x%x): invalid location", offset, location);
Emu.Pause();
break;
}
} }
LOG_ERROR(RSX, "GetAddress(offset=0x%x, location=0x%x)", location); return res;
assert(0);
return 0;
} }
RSXVertexData::RSXVertexData() RSXVertexData::RSXVertexData()
@ -144,7 +170,7 @@ u32 RSXVertexData::GetTypeSize()
u32 RSXThread::OutOfArgsCount(const uint x, const u32 cmd, const u32 count, const u32 args_addr) u32 RSXThread::OutOfArgsCount(const uint x, const u32 cmd, const u32 count, const u32 args_addr)
{ {
auto args = vm::ptr<be_t<u32>>::make(args_addr); auto args = vm::ptr<u32>::make(args_addr);
std::string debug = GetMethodName(cmd); std::string debug = GetMethodName(cmd);
debug += "("; debug += "(";
for(u32 i=0; i<count; ++i) debug += (i ? ", " : "") + fmt::Format("0x%x", ARGS(i)); for(u32 i=0; i<count; ++i) debug += (i ? ", " : "") + fmt::Format("0x%x", ARGS(i));
@ -211,7 +237,7 @@ u32 RSXThread::OutOfArgsCount(const uint x, const u32 cmd, const u32 count, cons
void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const u32 count) void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const u32 count)
{ {
auto args = vm::ptr<be_t<u32>>::make(args_addr); auto args = vm::ptr<u32>::make(args_addr);
#if CMD_DEBUG #if CMD_DEBUG
std::string debug = GetMethodName(cmd); std::string debug = GetMethodName(cmd);
@ -2234,19 +2260,19 @@ void RSXThread::Task()
if(cmd & CELL_GCM_METHOD_FLAG_NON_INCREMENT) if(cmd & CELL_GCM_METHOD_FLAG_NON_INCREMENT)
{ {
//LOG_WARNING(RSX, "non increment cmd! 0x%x", cmd); //LOG_WARNING(RSX, "non increment cmd! 0x%x", cmd);
inc=0; inc = 0;
} }
if(cmd == 0) if(cmd == 0)
{ {
LOG_ERROR(Log::RSX, "null cmd: cmd=0x%x, put=0x%x, get=0x%x (addr=0x%x)", cmd, put, get, (u32)Memory.RSXIOMem.RealAddr(get)); LOG_ERROR(Log::RSX, "null cmd: cmd=0x%x, put=0x%x, get=0x%x (addr=0x%x)", cmd, put, get, (u32)Memory.RSXIOMem.RealAddr(get));
Emu.Pause(); //Emu.Pause();
//HACK! We couldn't be here //HACK! We shouldn't be here
m_ctrl->get = get + (count + 1) * 4; m_ctrl->get = get + (count + 1) * 4;
continue; continue;
} }
auto args = vm::ptr<be_t<u32>>::make((u32)Memory.RSXIOMem.RealAddr(get + 4)); auto args = vm::ptr<u32>::make((u32)Memory.RSXIOMem.RealAddr(get + 4));
for(u32 i=0; i<count; i++) for(u32 i=0; i<count; i++)
{ {

View File

@ -134,6 +134,7 @@ public:
u32 m_report_main_addr; u32 m_report_main_addr;
u32 m_local_mem_addr, m_main_mem_addr; u32 m_local_mem_addr, m_main_mem_addr;
bool m_strict_ordering[0x1000];
public: public:
uint m_draw_mode; uint m_draw_mode;

View File

@ -24,6 +24,8 @@ extern void cellGem_unload();
extern void cellJpgDec_init(Module *pxThis); extern void cellJpgDec_init(Module *pxThis);
extern void cellGifDec_init(Module *pxThis); extern void cellGifDec_init(Module *pxThis);
extern void cellL10n_init(Module *pxThis); extern void cellL10n_init(Module *pxThis);
extern void cellMic_init(Module *pxThis);
extern void cellMic_unload();
extern void cellNetCtl_init(Module *pxThis); extern void cellNetCtl_init(Module *pxThis);
extern void cellNetCtl_unload(); extern void cellNetCtl_unload();
extern void cellOvis_init(Module *pxThis); extern void cellOvis_init(Module *pxThis);
@ -109,7 +111,7 @@ static const g_modules_list[] =
{ 0x001f, "cellResc", cellResc_init, cellResc_load, cellResc_unload }, { 0x001f, "cellResc", cellResc_init, cellResc_load, cellResc_unload },
{ 0x0020, "cellDaisy", nullptr, nullptr, nullptr }, { 0x0020, "cellDaisy", nullptr, nullptr, nullptr },
{ 0x0021, "cellKey2char", nullptr, nullptr, nullptr }, { 0x0021, "cellKey2char", nullptr, nullptr, nullptr },
{ 0x0022, "cellMic", nullptr, nullptr, nullptr }, { 0x0022, "cellMic", cellMic_init, nullptr, cellMic_unload },
{ 0x0023, "cellCamera", cellCamera_init, nullptr, cellCamera_unload }, { 0x0023, "cellCamera", cellCamera_init, nullptr, cellCamera_unload },
{ 0x0024, "cellVdecMpeg2", nullptr, nullptr, nullptr }, { 0x0024, "cellVdecMpeg2", nullptr, nullptr, nullptr },
{ 0x0025, "cellVdecAvc", nullptr, nullptr, nullptr }, { 0x0025, "cellVdecAvc", nullptr, nullptr, nullptr },

View File

@ -605,7 +605,7 @@ int cellAdecQueryAttr(vm::ptr<CellAdecType> type, vm::ptr<CellAdecAttr> attr)
return CELL_OK; return CELL_OK;
} }
int cellAdecOpen(vm::ptr<CellAdecType> type, vm::ptr<CellAdecResource> res, vm::ptr<CellAdecCb> cb, vm::ptr<be_t<u32>> handle) int cellAdecOpen(vm::ptr<CellAdecType> type, vm::ptr<CellAdecResource> res, vm::ptr<CellAdecCb> cb, vm::ptr<u32> handle)
{ {
cellAdec->Warning("cellAdecOpen(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)", cellAdec->Warning("cellAdecOpen(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)",
type.addr(), res.addr(), cb.addr(), handle.addr()); type.addr(), res.addr(), cb.addr(), handle.addr());
@ -617,7 +617,7 @@ int cellAdecOpen(vm::ptr<CellAdecType> type, vm::ptr<CellAdecResource> res, vm::
return CELL_OK; return CELL_OK;
} }
int cellAdecOpenEx(vm::ptr<CellAdecType> type, vm::ptr<CellAdecResourceEx> res, vm::ptr<CellAdecCb> cb, vm::ptr<be_t<u32>> handle) int cellAdecOpenEx(vm::ptr<CellAdecType> type, vm::ptr<CellAdecResourceEx> res, vm::ptr<CellAdecCb> cb, vm::ptr<u32> handle)
{ {
cellAdec->Warning("cellAdecOpenEx(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)", cellAdec->Warning("cellAdecOpenEx(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)",
type.addr(), res.addr(), cb.addr(), handle.addr()); type.addr(), res.addr(), cb.addr(), handle.addr());
@ -757,7 +757,7 @@ int cellAdecGetPcm(u32 handle, vm::ptr<float> outBuffer)
return CELL_OK; return CELL_OK;
} }
int cellAdecGetPcmItem(u32 handle, vm::ptr<be_t<u32>> pcmItem_ptr) int cellAdecGetPcmItem(u32 handle, vm::ptr<u32> pcmItem_ptr)
{ {
cellAdec->Log("cellAdecGetPcmItem(handle=%d, pcmItem_ptr_addr=0x%x)", handle, pcmItem_ptr.addr()); cellAdec->Log("cellAdecGetPcmItem(handle=%d, pcmItem_ptr_addr=0x%x)", handle, pcmItem_ptr.addr());

View File

@ -6,7 +6,7 @@ Module *cellAtrac = nullptr;
#include "cellAtrac.h" #include "cellAtrac.h"
int cellAtracSetDataAndGetMemSize(vm::ptr<CellAtracHandle> pHandle, u32 pucBufferAddr, u32 uiReadByte, u32 uiBufferByte, vm::ptr<be_t<u32>> puiWorkMemByte) int cellAtracSetDataAndGetMemSize(vm::ptr<CellAtracHandle> pHandle, u32 pucBufferAddr, u32 uiReadByte, u32 uiBufferByte, vm::ptr<u32> puiWorkMemByte)
{ {
cellAtrac->Todo("cellAtracSetDataAndGetMemSize(pHandle=0x%x, pucBufferAddr=0x%x, uiReadByte=0x%x, uiBufferByte=0x%x, puiWorkMemByte_addr=0x%x)", cellAtrac->Todo("cellAtracSetDataAndGetMemSize(pHandle=0x%x, pucBufferAddr=0x%x, uiReadByte=0x%x, uiBufferByte=0x%x, puiWorkMemByte_addr=0x%x)",
pHandle.addr(), pucBufferAddr, uiReadByte, uiBufferByte, puiWorkMemByte.addr()); pHandle.addr(), pucBufferAddr, uiReadByte, uiBufferByte, puiWorkMemByte.addr());
@ -39,7 +39,7 @@ int cellAtracDeleteDecoder(vm::ptr<CellAtracHandle> pHandle)
return CELL_OK; return CELL_OK;
} }
int cellAtracDecode(vm::ptr<CellAtracHandle> pHandle, u32 pfOutAddr, vm::ptr<be_t<u32>> puiSamples, vm::ptr<be_t<u32>> puiFinishflag, vm::ptr<be_t<u32>> piRemainFrame) int cellAtracDecode(vm::ptr<CellAtracHandle> pHandle, u32 pfOutAddr, vm::ptr<u32> puiSamples, vm::ptr<u32> puiFinishflag, vm::ptr<u32> piRemainFrame)
{ {
cellAtrac->Todo("cellAtracDecode(pHandle=0x%x, pfOutAddr=0x%x, puiSamples_addr=0x%x, puiFinishFlag_addr=0x%x, piRemainFrame_addr=0x%x)", cellAtrac->Todo("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()); pHandle.addr(), pfOutAddr, puiSamples.addr(), puiFinishflag.addr(), piRemainFrame.addr());
@ -50,7 +50,7 @@ int cellAtracDecode(vm::ptr<CellAtracHandle> pHandle, u32 pfOutAddr, vm::ptr<be_
return CELL_OK; return CELL_OK;
} }
int cellAtracGetStreamDataInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<be_t<u32>> ppucWritePointer, vm::ptr<be_t<u32>> puiWritableByte, vm::ptr<be_t<u32>> puiReadPosition) int cellAtracGetStreamDataInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> ppucWritePointer, vm::ptr<u32> puiWritableByte, vm::ptr<u32> puiReadPosition)
{ {
cellAtrac->Todo("cellAtracGetStreamDataInfo(pHandle=0x%x, ppucWritePointer_addr=0x%x, puiWritableByte_addr=0x%x, puiReadPosition_addr=0x%x)", cellAtrac->Todo("cellAtracGetStreamDataInfo(pHandle=0x%x, ppucWritePointer_addr=0x%x, puiWritableByte_addr=0x%x, puiReadPosition_addr=0x%x)",
pHandle.addr(), ppucWritePointer.addr(), puiWritableByte.addr(), puiReadPosition.addr()); pHandle.addr(), ppucWritePointer.addr(), puiWritableByte.addr(), puiReadPosition.addr());
@ -67,7 +67,7 @@ int cellAtracAddStreamData(vm::ptr<CellAtracHandle> pHandle, u32 uiAddByte)
return CELL_OK; return CELL_OK;
} }
int cellAtracGetRemainFrame(vm::ptr<CellAtracHandle> pHandle, vm::ptr<be_t<u32>> piRemainFrame) int cellAtracGetRemainFrame(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> piRemainFrame)
{ {
cellAtrac->Todo("cellAtracGetRemainFrame(pHandle=0x%x, piRemainFrame_addr=0x%x)", pHandle.addr(), piRemainFrame.addr()); cellAtrac->Todo("cellAtracGetRemainFrame(pHandle=0x%x, piRemainFrame_addr=0x%x)", pHandle.addr(), piRemainFrame.addr());
@ -75,7 +75,7 @@ int cellAtracGetRemainFrame(vm::ptr<CellAtracHandle> pHandle, vm::ptr<be_t<u32>>
return CELL_OK; return CELL_OK;
} }
int cellAtracGetVacantSize(vm::ptr<CellAtracHandle> pHandle, vm::ptr<be_t<u32>> puiVacantSize) int cellAtracGetVacantSize(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiVacantSize)
{ {
cellAtrac->Todo("cellAtracGetVacantSize(pHandle=0x%x, puiVacantSize_addr=0x%x)", pHandle.addr(), puiVacantSize.addr()); cellAtrac->Todo("cellAtracGetVacantSize(pHandle=0x%x, puiVacantSize_addr=0x%x)", pHandle.addr(), puiVacantSize.addr());
@ -89,7 +89,7 @@ int cellAtracIsSecondBufferNeeded(vm::ptr<CellAtracHandle> pHandle)
return CELL_OK; return CELL_OK;
} }
int cellAtracGetSecondBufferInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<be_t<u32>> puiReadPosition, vm::ptr<be_t<u32>> puiDataByte) int cellAtracGetSecondBufferInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiReadPosition, vm::ptr<u32> puiDataByte)
{ {
cellAtrac->Todo("cellAtracGetSecondBufferInfo(pHandle=0x%x, puiReadPosition_addr=0x%x, puiDataByte_addr=0x%x)", cellAtrac->Todo("cellAtracGetSecondBufferInfo(pHandle=0x%x, puiReadPosition_addr=0x%x, puiDataByte_addr=0x%x)",
pHandle.addr(), puiReadPosition.addr(), puiDataByte.addr()); pHandle.addr(), puiReadPosition.addr(), puiDataByte.addr());
@ -106,7 +106,7 @@ int cellAtracSetSecondBuffer(vm::ptr<CellAtracHandle> pHandle, u32 pucSecondBuff
return CELL_OK; return CELL_OK;
} }
int cellAtracGetChannel(vm::ptr<CellAtracHandle> pHandle, vm::ptr<be_t<u32>> puiChannel) int cellAtracGetChannel(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiChannel)
{ {
cellAtrac->Todo("cellAtracGetChannel(pHandle=0x%x, puiChannel_addr=0x%x)", pHandle.addr(), puiChannel.addr()); cellAtrac->Todo("cellAtracGetChannel(pHandle=0x%x, puiChannel_addr=0x%x)", pHandle.addr(), puiChannel.addr());
@ -114,7 +114,7 @@ int cellAtracGetChannel(vm::ptr<CellAtracHandle> pHandle, vm::ptr<be_t<u32>> pui
return CELL_OK; return CELL_OK;
} }
int cellAtracGetMaxSample(vm::ptr<CellAtracHandle> pHandle, vm::ptr<be_t<u32>> puiMaxSample) int cellAtracGetMaxSample(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiMaxSample)
{ {
cellAtrac->Todo("cellAtracGetMaxSample(pHandle=0x%x, puiMaxSample_addr=0x%x)", pHandle.addr(), puiMaxSample.addr()); cellAtrac->Todo("cellAtracGetMaxSample(pHandle=0x%x, puiMaxSample_addr=0x%x)", pHandle.addr(), puiMaxSample.addr());
@ -122,7 +122,7 @@ int cellAtracGetMaxSample(vm::ptr<CellAtracHandle> pHandle, vm::ptr<be_t<u32>> p
return CELL_OK; return CELL_OK;
} }
int cellAtracGetNextSample(vm::ptr<CellAtracHandle> pHandle, vm::ptr<be_t<u32>> puiNextSample) int cellAtracGetNextSample(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiNextSample)
{ {
cellAtrac->Todo("cellAtracGetNextSample(pHandle=0x%x, puiNextSample_addr=0x%x)", pHandle.addr(), puiNextSample.addr()); cellAtrac->Todo("cellAtracGetNextSample(pHandle=0x%x, puiNextSample_addr=0x%x)", pHandle.addr(), puiNextSample.addr());
@ -130,7 +130,7 @@ int cellAtracGetNextSample(vm::ptr<CellAtracHandle> pHandle, vm::ptr<be_t<u32>>
return CELL_OK; return CELL_OK;
} }
int cellAtracGetSoundInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<be_t<u32>> piEndSample, vm::ptr<be_t<u32>> piLoopStartSample, vm::ptr<be_t<u32>> piLoopEndSample) int cellAtracGetSoundInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> piEndSample, vm::ptr<u32> piLoopStartSample, vm::ptr<u32> piLoopEndSample)
{ {
cellAtrac->Todo("cellAtracGetSoundInfo(pHandle=0x%x, piEndSample_addr=0x%x, piLoopStartSample_addr=0x%x, piLoopEndSample_addr=0x%x)", cellAtrac->Todo("cellAtracGetSoundInfo(pHandle=0x%x, piEndSample_addr=0x%x, piLoopStartSample_addr=0x%x, piLoopEndSample_addr=0x%x)",
pHandle.addr(), piEndSample.addr(), piLoopStartSample.addr(), piLoopEndSample.addr()); pHandle.addr(), piEndSample.addr(), piLoopStartSample.addr(), piLoopEndSample.addr());
@ -141,7 +141,7 @@ int cellAtracGetSoundInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<be_t<u32>> p
return CELL_OK; return CELL_OK;
} }
int cellAtracGetNextDecodePosition(vm::ptr<CellAtracHandle> pHandle, vm::ptr<be_t<u32>> puiSamplePosition) int cellAtracGetNextDecodePosition(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiSamplePosition)
{ {
cellAtrac->Todo("cellAtracGetNextDecodePosition(pHandle=0x%x, puiSamplePosition_addr=0x%x)", cellAtrac->Todo("cellAtracGetNextDecodePosition(pHandle=0x%x, puiSamplePosition_addr=0x%x)",
pHandle.addr(), puiSamplePosition.addr()); pHandle.addr(), puiSamplePosition.addr());
@ -150,7 +150,7 @@ int cellAtracGetNextDecodePosition(vm::ptr<CellAtracHandle> pHandle, vm::ptr<be_
return CELL_ATRAC_ERROR_ALLDATA_WAS_DECODED; return CELL_ATRAC_ERROR_ALLDATA_WAS_DECODED;
} }
int cellAtracGetBitrate(vm::ptr<CellAtracHandle> pHandle, vm::ptr<be_t<u32>> puiBitrate) int cellAtracGetBitrate(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> puiBitrate)
{ {
cellAtrac->Todo("cellAtracGetBitrate(pHandle=0x%x, puiBitrate_addr=0x%x)", cellAtrac->Todo("cellAtracGetBitrate(pHandle=0x%x, puiBitrate_addr=0x%x)",
pHandle.addr(), puiBitrate.addr()); pHandle.addr(), puiBitrate.addr());
@ -159,7 +159,7 @@ int cellAtracGetBitrate(vm::ptr<CellAtracHandle> pHandle, vm::ptr<be_t<u32>> pui
return CELL_OK; return CELL_OK;
} }
int cellAtracGetLoopInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<be_t<u32>> piLoopNum, vm::ptr<be_t<u32>> puiLoopStatus) int cellAtracGetLoopInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> piLoopNum, vm::ptr<u32> puiLoopStatus)
{ {
cellAtrac->Todo("cellAtracGetLoopInfo(pHandle=0x%x, piLoopNum_addr=0x%x, puiLoopStatus_addr=0x%x)", cellAtrac->Todo("cellAtracGetLoopInfo(pHandle=0x%x, piLoopNum_addr=0x%x, puiLoopStatus_addr=0x%x)",
pHandle.addr(), piLoopNum.addr(), puiLoopStatus.addr()); pHandle.addr(), piLoopNum.addr(), puiLoopStatus.addr());
@ -194,7 +194,7 @@ int cellAtracResetPlayPosition(vm::ptr<CellAtracHandle> pHandle, u32 uiSample, u
return CELL_OK; return CELL_OK;
} }
int cellAtracGetInternalErrorInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<be_t<u32>> piResult) int cellAtracGetInternalErrorInfo(vm::ptr<CellAtracHandle> pHandle, vm::ptr<u32> piResult)
{ {
cellAtrac->Todo("cellAtracGetInternalErrorInfo(pHandle=0x%x, piResult_addr=0x%x)", cellAtrac->Todo("cellAtracGetInternalErrorInfo(pHandle=0x%x, piResult_addr=0x%x)",
pHandle.addr(), piResult.addr()); pHandle.addr(), piResult.addr());

View File

@ -385,7 +385,7 @@ int cellAudioInit()
{ {
std::lock_guard<std::mutex> lock(audioMutex); std::lock_guard<std::mutex> lock(audioMutex);
// update indexes: // update indexes:
auto indexes = vm::ptr<be_t<u64>>::make(m_config.m_indexes); auto indexes = vm::ptr<u64>::make(m_config.m_indexes);
for (u32 i = 0; i < m_config.AUDIO_PORT_COUNT; i++) for (u32 i = 0; i < m_config.AUDIO_PORT_COUNT; i++)
{ {
if (!m_config.m_ports[i].m_is_audio_port_started) continue; if (!m_config.m_ports[i].m_is_audio_port_started) continue;
@ -505,7 +505,7 @@ int cellAudioQuit()
return CELL_OK; return CELL_OK;
} }
int cellAudioPortOpen(vm::ptr<CellAudioPortParam> audioParam, vm::ptr<be_t<u32>> portNum) int cellAudioPortOpen(vm::ptr<CellAudioPortParam> audioParam, vm::ptr<u32> portNum)
{ {
cellAudio->Warning("cellAudioPortOpen(audioParam_addr=0x%x, portNum_addr=0x%x)", audioParam.addr(), portNum.addr()); cellAudio->Warning("cellAudioPortOpen(audioParam_addr=0x%x, portNum_addr=0x%x)", audioParam.addr(), portNum.addr());
@ -657,7 +657,7 @@ int cellAudioPortStop(u32 portNum)
return CELL_OK; return CELL_OK;
} }
int cellAudioGetPortTimestamp(u32 portNum, u64 tag, vm::ptr<be_t<u64>> stamp) int cellAudioGetPortTimestamp(u32 portNum, u64 tag, vm::ptr<u64> stamp)
{ {
cellAudio->Log("cellAudioGetPortTimestamp(portNum=0x%x, tag=0x%llx, stamp_addr=0x%x)", portNum, tag, stamp.addr()); cellAudio->Log("cellAudioGetPortTimestamp(portNum=0x%x, tag=0x%llx, stamp_addr=0x%x)", portNum, tag, stamp.addr());
@ -685,7 +685,7 @@ int cellAudioGetPortTimestamp(u32 portNum, u64 tag, vm::ptr<be_t<u64>> stamp)
return CELL_OK; return CELL_OK;
} }
int cellAudioGetPortBlockTag(u32 portNum, u64 blockNo, vm::ptr<be_t<u64>> tag) int cellAudioGetPortBlockTag(u32 portNum, u64 blockNo, vm::ptr<u64> tag)
{ {
cellAudio->Log("cellAudioGetPortBlockTag(portNum=0x%x, blockNo=0x%llx, tag_addr=0x%x)", portNum, blockNo, tag.addr()); cellAudio->Log("cellAudioGetPortBlockTag(portNum=0x%x, blockNo=0x%llx, tag_addr=0x%x)", portNum, blockNo, tag.addr());
@ -736,7 +736,7 @@ int cellAudioSetPortLevel(u32 portNum, float level)
} }
// Utility Functions // Utility Functions
int cellAudioCreateNotifyEventQueue(vm::ptr<be_t<u32>> id, vm::ptr<be_t<u64>> key) int cellAudioCreateNotifyEventQueue(vm::ptr<u32> id, vm::ptr<u64> key)
{ {
cellAudio->Warning("cellAudioCreateNotifyEventQueue(id_addr=0x%x, key_addr=0x%x)", id.addr(), key.addr()); cellAudio->Warning("cellAudioCreateNotifyEventQueue(id_addr=0x%x, key_addr=0x%x)", id.addr(), key.addr());
@ -764,7 +764,7 @@ int cellAudioCreateNotifyEventQueue(vm::ptr<be_t<u32>> id, vm::ptr<be_t<u64>> ke
return CELL_OK; return CELL_OK;
} }
int cellAudioCreateNotifyEventQueueEx(vm::ptr<be_t<u32>> id, vm::ptr<be_t<u64>> key, u32 iFlags) int cellAudioCreateNotifyEventQueueEx(vm::ptr<u32> id, vm::ptr<u64> key, u32 iFlags)
{ {
cellAudio->Todo("cellAudioCreateNotifyEventQueueEx(id_addr=0x%x, key_addr=0x%x, iFlags=0x%x)", id.addr(), key.addr(), iFlags); cellAudio->Todo("cellAudioCreateNotifyEventQueueEx(id_addr=0x%x, key_addr=0x%x, iFlags=0x%x)", id.addr(), key.addr(), iFlags);
return CELL_OK; return CELL_OK;

View File

@ -720,7 +720,7 @@ int cellDmuxQueryAttr2(vm::ptr<const CellDmuxType2> demuxerType2, vm::ptr<CellDm
} }
int cellDmuxOpen(vm::ptr<const CellDmuxType> demuxerType, vm::ptr<const CellDmuxResource> demuxerResource, int cellDmuxOpen(vm::ptr<const CellDmuxType> demuxerType, vm::ptr<const CellDmuxResource> demuxerResource,
vm::ptr<const CellDmuxCb> demuxerCb, vm::ptr<be_t<u32>> demuxerHandle) vm::ptr<const CellDmuxCb> demuxerCb, vm::ptr<u32> demuxerHandle)
{ {
cellDmux->Warning("cellDmuxOpen(demuxerType_addr=0x%x, demuxerResource_addr=0x%x, demuxerCb_addr=0x%x, demuxerHandle_addr=0x%x)", cellDmux->Warning("cellDmuxOpen(demuxerType_addr=0x%x, demuxerResource_addr=0x%x, demuxerCb_addr=0x%x, demuxerHandle_addr=0x%x)",
demuxerType.addr(), demuxerResource.addr(), demuxerCb.addr(), demuxerHandle.addr()); demuxerType.addr(), demuxerResource.addr(), demuxerCb.addr(), demuxerHandle.addr());
@ -738,7 +738,7 @@ int cellDmuxOpen(vm::ptr<const CellDmuxType> demuxerType, vm::ptr<const CellDmux
} }
int cellDmuxOpenEx(vm::ptr<const CellDmuxType> demuxerType, vm::ptr<const CellDmuxResourceEx> demuxerResourceEx, int cellDmuxOpenEx(vm::ptr<const CellDmuxType> demuxerType, vm::ptr<const CellDmuxResourceEx> demuxerResourceEx,
vm::ptr<const CellDmuxCb> demuxerCb, vm::ptr<be_t<u32>> demuxerHandle) vm::ptr<const CellDmuxCb> demuxerCb, vm::ptr<u32> demuxerHandle)
{ {
cellDmux->Warning("cellDmuxOpenEx(demuxerType_addr=0x%x, demuxerResourceEx_addr=0x%x, demuxerCb_addr=0x%x, demuxerHandle_addr=0x%x)", cellDmux->Warning("cellDmuxOpenEx(demuxerType_addr=0x%x, demuxerResourceEx_addr=0x%x, demuxerCb_addr=0x%x, demuxerHandle_addr=0x%x)",
demuxerType.addr(), demuxerResourceEx.addr(), demuxerCb.addr(), demuxerHandle.addr()); demuxerType.addr(), demuxerResourceEx.addr(), demuxerCb.addr(), demuxerHandle.addr());
@ -756,7 +756,7 @@ int cellDmuxOpenEx(vm::ptr<const CellDmuxType> demuxerType, vm::ptr<const CellDm
} }
int cellDmuxOpen2(vm::ptr<const CellDmuxType2> demuxerType2, vm::ptr<const CellDmuxResource2> demuxerResource2, int cellDmuxOpen2(vm::ptr<const CellDmuxType2> demuxerType2, vm::ptr<const CellDmuxResource2> demuxerResource2,
vm::ptr<const CellDmuxCb> demuxerCb, vm::ptr<be_t<u32>> demuxerHandle) vm::ptr<const CellDmuxCb> demuxerCb, vm::ptr<u32> demuxerHandle)
{ {
cellDmux->Warning("cellDmuxOpen2(demuxerType2_addr=0x%x, demuxerResource2_addr=0x%x, demuxerCb_addr=0x%x, demuxerHandle_addr=0x%x)", cellDmux->Warning("cellDmuxOpen2(demuxerType2_addr=0x%x, demuxerResource2_addr=0x%x, demuxerCb_addr=0x%x, demuxerHandle_addr=0x%x)",
demuxerType2.addr(), demuxerResource2.addr(), demuxerCb.addr(), demuxerHandle.addr()); demuxerType2.addr(), demuxerResource2.addr(), demuxerCb.addr(), demuxerHandle.addr());
@ -923,7 +923,7 @@ int cellDmuxQueryEsAttr2(vm::ptr<const CellDmuxType2> demuxerType2, vm::ptr<cons
int cellDmuxEnableEs(u32 demuxerHandle, vm::ptr<const CellCodecEsFilterId> esFilterId, int cellDmuxEnableEs(u32 demuxerHandle, vm::ptr<const CellCodecEsFilterId> esFilterId,
vm::ptr<const CellDmuxEsResource> esResourceInfo, vm::ptr<const CellDmuxEsCb> esCb, vm::ptr<const CellDmuxEsResource> esResourceInfo, vm::ptr<const CellDmuxEsCb> esCb,
const u32 esSpecificInfo_addr, vm::ptr<be_t<u32>> esHandle) const u32 esSpecificInfo_addr, vm::ptr<u32> esHandle)
{ {
cellDmux->Warning("cellDmuxEnableEs(demuxerHandle=%d, esFilterId_addr=0x%x, esResourceInfo_addr=0x%x, esCb_addr=0x%x, " cellDmux->Warning("cellDmuxEnableEs(demuxerHandle=%d, esFilterId_addr=0x%x, esResourceInfo_addr=0x%x, esCb_addr=0x%x, "
"esSpecificInfo_addr=0x%x, esHandle_addr=0x%x)", demuxerHandle, esFilterId.addr(), esResourceInfo.addr(), "esSpecificInfo_addr=0x%x, esHandle_addr=0x%x)", demuxerHandle, esFilterId.addr(), esResourceInfo.addr(),
@ -992,7 +992,7 @@ int cellDmuxResetEs(u32 esHandle)
return CELL_OK; return CELL_OK;
} }
int cellDmuxGetAu(u32 esHandle, vm::ptr<be_t<u32>> auInfo_ptr, vm::ptr<be_t<u32>> auSpecificInfo_ptr) int cellDmuxGetAu(u32 esHandle, vm::ptr<u32> auInfo_ptr, vm::ptr<u32> auSpecificInfo_ptr)
{ {
cellDmux->Log("cellDmuxGetAu(esHandle=0x%x, auInfo_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)", cellDmux->Log("cellDmuxGetAu(esHandle=0x%x, auInfo_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)",
esHandle, auInfo_ptr.addr(), auSpecificInfo_ptr.addr()); esHandle, auInfo_ptr.addr(), auSpecificInfo_ptr.addr());
@ -1015,7 +1015,7 @@ int cellDmuxGetAu(u32 esHandle, vm::ptr<be_t<u32>> auInfo_ptr, vm::ptr<be_t<u32>
return CELL_OK; return CELL_OK;
} }
int cellDmuxPeekAu(u32 esHandle, vm::ptr<be_t<u32>> auInfo_ptr, vm::ptr<be_t<u32>> auSpecificInfo_ptr) int cellDmuxPeekAu(u32 esHandle, vm::ptr<u32> auInfo_ptr, vm::ptr<u32> auSpecificInfo_ptr)
{ {
cellDmux->Log("cellDmuxPeekAu(esHandle=0x%x, auInfo_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)", cellDmux->Log("cellDmuxPeekAu(esHandle=0x%x, auInfo_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)",
esHandle, auInfo_ptr.addr(), auSpecificInfo_ptr.addr()); esHandle, auInfo_ptr.addr(), auSpecificInfo_ptr.addr());
@ -1038,7 +1038,7 @@ int cellDmuxPeekAu(u32 esHandle, vm::ptr<be_t<u32>> auInfo_ptr, vm::ptr<be_t<u32
return CELL_OK; return CELL_OK;
} }
int cellDmuxGetAuEx(u32 esHandle, vm::ptr<be_t<u32>> auInfoEx_ptr, vm::ptr<be_t<u32>> auSpecificInfo_ptr) int cellDmuxGetAuEx(u32 esHandle, vm::ptr<u32> auInfoEx_ptr, vm::ptr<u32> auSpecificInfo_ptr)
{ {
cellDmux->Log("cellDmuxGetAuEx(esHandle=0x%x, auInfoEx_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)", cellDmux->Log("cellDmuxGetAuEx(esHandle=0x%x, auInfoEx_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)",
esHandle, auInfoEx_ptr.addr(), auSpecificInfo_ptr.addr()); esHandle, auInfoEx_ptr.addr(), auSpecificInfo_ptr.addr());
@ -1061,7 +1061,7 @@ int cellDmuxGetAuEx(u32 esHandle, vm::ptr<be_t<u32>> auInfoEx_ptr, vm::ptr<be_t<
return CELL_OK; return CELL_OK;
} }
int cellDmuxPeekAuEx(u32 esHandle, vm::ptr<be_t<u32>> auInfoEx_ptr, vm::ptr<be_t<u32>> auSpecificInfo_ptr) int cellDmuxPeekAuEx(u32 esHandle, vm::ptr<u32> auInfoEx_ptr, vm::ptr<u32> auSpecificInfo_ptr)
{ {
cellDmux->Log("cellDmuxPeekAuEx(esHandle=0x%x, auInfoEx_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)", cellDmux->Log("cellDmuxPeekAuEx(esHandle=0x%x, auInfoEx_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)",
esHandle, auInfoEx_ptr.addr(), auSpecificInfo_ptr.addr()); esHandle, auInfoEx_ptr.addr(), auSpecificInfo_ptr.addr());

View File

@ -383,7 +383,7 @@ int cellFontGetEffectSlant(vm::ptr<CellFont> font, vm::ptr<be_t<float>> slantPar
return CELL_FONT_OK; return CELL_FONT_OK;
} }
int cellFontGetFontIdCode(vm::ptr<CellFont> font, u32 code, vm::ptr<be_t<u32>> fontId, vm::ptr<be_t<u32>> fontCode) int cellFontGetFontIdCode(vm::ptr<CellFont> font, u32 code, vm::ptr<u32> fontId, vm::ptr<u32> fontCode)
{ {
cellFont->Todo("cellFontGetFontIdCode(font_addr=0x%x, code=0x%x, fontId_addr=0x%x, fontCode_addr=0x%x", cellFont->Todo("cellFontGetFontIdCode(font_addr=0x%x, code=0x%x, fontId_addr=0x%x, fontCode_addr=0x%x",
font.addr(), code, fontId.addr(), fontCode.addr()); font.addr(), code, fontId.addr(), fontCode.addr());

View File

@ -15,7 +15,7 @@ Module *cellGame = nullptr;
std::string contentInfo = ""; std::string contentInfo = "";
std::string usrdir = ""; std::string usrdir = "";
int cellGameBootCheck(vm::ptr<be_t<u32>> type, vm::ptr<be_t<u32>> attributes, vm::ptr<CellGameContentSize> size, vm::ptr<char[CELL_GAME_DIRNAME_SIZE]> dirName) int cellGameBootCheck(vm::ptr<u32> type, vm::ptr<u32> attributes, vm::ptr<CellGameContentSize> size, vm::ptr<char[CELL_GAME_DIRNAME_SIZE]> dirName)
{ {
cellGame->Warning("cellGameBootCheck(type_addr=0x%x, attributes_addr=0x%x, size_addr=0x%x, dirName_addr=0x%x)", cellGame->Warning("cellGameBootCheck(type_addr=0x%x, attributes_addr=0x%x, size_addr=0x%x, dirName_addr=0x%x)",
type.addr(), attributes.addr(), size.addr(), dirName.addr()); type.addr(), attributes.addr(), size.addr(), dirName.addr());
@ -325,7 +325,7 @@ int cellGameDeleteGameData()
return CELL_OK; return CELL_OK;
} }
int cellGameGetParamInt(u32 id, vm::ptr<be_t<u32>> value) int cellGameGetParamInt(u32 id, vm::ptr<u32> value)
{ {
cellGame->Warning("cellGameGetParamInt(id=%d, value_addr=0x%x)", id, value.addr()); cellGame->Warning("cellGameGetParamInt(id=%d, value_addr=0x%x)", id, value.addr());

View File

@ -61,11 +61,11 @@ CellGcmOffsetTable offsetTable;
void InitOffsetTable() void InitOffsetTable()
{ {
offsetTable.ioAddress = (u32)Memory.Alloc(3072 * sizeof(u16), 1); offsetTable.ioAddress.set(be_t<u32>::make((u32)Memory.Alloc(3072 * sizeof(u16), 1)));
offsetTable.eaAddress = (u32)Memory.Alloc(512 * sizeof(u16), 1); offsetTable.eaAddress.set(be_t<u32>::make((u32)Memory.Alloc(512 * sizeof(u16), 1)));
memset(vm::get_ptr<void>(offsetTable.ioAddress), 0xFF, 3072 * sizeof(u16)); memset(offsetTable.ioAddress.get_ptr(), 0xFF, 3072 * sizeof(u16));
memset(vm::get_ptr<void>(offsetTable.eaAddress), 0xFF, 512 * sizeof(u16)); memset(offsetTable.eaAddress.get_ptr(), 0xFF, 512 * sizeof(u16));
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -129,7 +129,7 @@ u32 cellGcmGetNotifyDataAddress(u32 index)
cellGcmGetOffsetTable(table); cellGcmGetOffsetTable(table);
// If entry not in use, return NULL // If entry not in use, return NULL
u16 entry = vm::read16(table->eaAddress + 241 * sizeof(u16)); u16 entry = table->eaAddress[241];
if (entry == 0xFFFF) { if (entry == 0xFFFF) {
return 0; return 0;
} }
@ -540,7 +540,9 @@ int cellGcmSetSecondVFrequency(u32 freq)
switch (freq) switch (freq)
{ {
case CELL_GCM_DISPLAY_FREQUENCY_59_94HZ: case CELL_GCM_DISPLAY_FREQUENCY_59_94HZ:
cellGcmSys->Todo("Unimplemented display frequency: 59.94Hz");
case CELL_GCM_DISPLAY_FREQUENCY_SCANOUT: case CELL_GCM_DISPLAY_FREQUENCY_SCANOUT:
cellGcmSys->Todo("Unimplemented display frequency: Scanout");
case CELL_GCM_DISPLAY_FREQUENCY_DISABLE: case CELL_GCM_DISPLAY_FREQUENCY_DISABLE:
Emu.GetGSManager().GetRender().m_frequency_mode = freq; Emu.GetGSManager().GetRender().m_frequency_mode = freq;
break; break;
@ -814,7 +816,7 @@ s32 cellGcmAddressToOffset(u64 address, vm::ptr<be_t<u32>> offset)
// Address in main memory else check // Address in main memory else check
else else
{ {
u16 upper12Bits = vm::read16(offsetTable.ioAddress + sizeof(u16)*(address >> 20)); u16 upper12Bits = offsetTable.ioAddress[address >> 20];
// If the address is mapped in IO // If the address is mapped in IO
if (upper12Bits != 0xFFFF) { if (upper12Bits != 0xFFFF) {
@ -858,10 +860,8 @@ s32 cellGcmIoOffsetToAddress(u32 ioOffset, u64 address)
return CELL_OK; return CELL_OK;
} }
s32 cellGcmMapEaIoAddress(u32 ea, u32 io, u32 size) s32 gcmMapEaIoAddress(u32 ea, u32 io, u32 size, bool is_strict)
{ {
cellGcmSys->Warning("cellGcmMapEaIoAddress(ea=0x%x, io=0x%x, size=0x%x)", ea, io, size);
if ((ea & 0xFFFFF) || (io & 0xFFFFF) || (size & 0xFFFFF)) return CELL_GCM_ERROR_FAILURE; if ((ea & 0xFFFFF) || (io & 0xFFFFF) || (size & 0xFFFFF)) return CELL_GCM_ERROR_FAILURE;
// Check if the mapping was successfull // Check if the mapping was successfull
@ -870,8 +870,9 @@ s32 cellGcmMapEaIoAddress(u32 ea, u32 io, u32 size)
// Fill the offset table // Fill the offset table
for (u32 i = 0; i<(size >> 20); i++) for (u32 i = 0; i<(size >> 20); i++)
{ {
vm::write16(offsetTable.ioAddress + ((ea >> 20) + i)*sizeof(u16), (io >> 20) + i); offsetTable.ioAddress[(ea >> 20) + i] = (io >> 20) + i;
vm::write16(offsetTable.eaAddress + ((io >> 20) + i)*sizeof(u16), (ea >> 20) + i); offsetTable.eaAddress[(io >> 20) + i] = (ea >> 20) + i;
Emu.GetGSManager().GetRender().m_strict_ordering[(io >> 20) + i] = is_strict;
} }
} }
else else
@ -883,10 +884,20 @@ s32 cellGcmMapEaIoAddress(u32 ea, u32 io, u32 size)
return CELL_OK; return CELL_OK;
} }
s32 cellGcmMapEaIoAddress(u32 ea, u32 io, u32 size)
{
cellGcmSys->Warning("cellGcmMapEaIoAddress(ea=0x%x, io=0x%x, size=0x%x)", ea, io, size);
return gcmMapEaIoAddress(ea, io, size, false);
}
s32 cellGcmMapEaIoAddressWithFlags(u32 ea, u32 io, u32 size, u32 flags) s32 cellGcmMapEaIoAddressWithFlags(u32 ea, u32 io, u32 size, u32 flags)
{ {
cellGcmSys->Warning("cellGcmMapEaIoAddressWithFlags(ea=0x%x, io=0x%x, size=0x%x, flags=0x%x)", ea, io, size, flags); cellGcmSys->Warning("cellGcmMapEaIoAddressWithFlags(ea=0x%x, io=0x%x, size=0x%x, flags=0x%x)", ea, io, size, flags);
return cellGcmMapEaIoAddress(ea, io, size); // TODO: strict ordering
assert(flags == 2 /*CELL_GCM_IOMAP_FLAG_STRICT_ORDERING*/);
return gcmMapEaIoAddress(ea, io, size, true);
} }
s32 cellGcmMapLocalMemory(u64 address, u64 size) s32 cellGcmMapLocalMemory(u64 address, u64 size)
@ -910,7 +921,7 @@ s32 cellGcmMapLocalMemory(u64 address, u64 size)
return CELL_OK; return CELL_OK;
} }
s32 cellGcmMapMainMemory(u32 ea, u32 size, vm::ptr<be_t<u32>> offset) s32 cellGcmMapMainMemory(u32 ea, u32 size, vm::ptr<u32> offset)
{ {
cellGcmSys->Warning("cellGcmMapMainMemory(ea=0x%x,size=0x%x,offset_addr=0x%x)", ea, size, offset.addr()); cellGcmSys->Warning("cellGcmMapMainMemory(ea=0x%x,size=0x%x,offset_addr=0x%x)", ea, size, offset.addr());
@ -919,13 +930,14 @@ s32 cellGcmMapMainMemory(u32 ea, u32 size, vm::ptr<be_t<u32>> offset)
u32 io = Memory.RSXIOMem.Map(ea, size); u32 io = Memory.RSXIOMem.Map(ea, size);
//check if the mapping was successfull //check if the mapping was successfull
if (Memory.RSXIOMem.Write32(io, 0)) if (Memory.RSXIOMem.RealAddr(io) == ea)
{ {
//fill the offset table //fill the offset table
for (u32 i = 0; i<(size >> 20); i++) for (u32 i = 0; i<(size >> 20); i++)
{ {
vm::write16(offsetTable.ioAddress + ((ea >> 20) + i) * sizeof(u16), (u16)(io >> 20) + i); offsetTable.ioAddress[(ea >> 20) + i] = (u16)((io >> 20) + i);
vm::write16(offsetTable.eaAddress + ((io >> 20) + i) * sizeof(u16), (u16)(ea >> 20) + i); offsetTable.eaAddress[(io >> 20) + i] = (u16)((ea >> 20) + i);
Emu.GetGSManager().GetRender().m_strict_ordering[(io >> 20) + i] = false;
} }
*offset = io; *offset = io;
@ -970,12 +982,12 @@ s32 cellGcmUnmapEaIoAddress(u64 ea)
{ {
u64 io; u64 io;
ea = ea >> 20; ea = ea >> 20;
io = vm::read16(offsetTable.ioAddress + (ea*sizeof(u16))); io = offsetTable.ioAddress[ea];
for (u32 i = 0; i<size; i++) for (u32 i = 0; i<size; i++)
{ {
vm::write16(offsetTable.ioAddress + ((ea + i)*sizeof(u16)), 0xFFFF); offsetTable.ioAddress[ea + i] = 0xFFFF;
vm::write16(offsetTable.eaAddress + ((io + i)*sizeof(u16)), 0xFFFF); offsetTable.eaAddress[io + i] = 0xFFFF;
} }
} }
else else
@ -996,12 +1008,12 @@ s32 cellGcmUnmapIoAddress(u64 io)
{ {
u64 ea; u64 ea;
io = io >> 20; io = io >> 20;
ea = vm::read16(offsetTable.eaAddress + (io*sizeof(u16))); ea = offsetTable.eaAddress[io];
for (u32 i = 0; i<size; i++) for (u32 i = 0; i<size; i++)
{ {
vm::write16(offsetTable.ioAddress + ((ea + i)*sizeof(u16)), 0xFFFF); offsetTable.ioAddress[ea + i] = 0xFFFF;
vm::write16(offsetTable.eaAddress + ((io + i)*sizeof(u16)), 0xFFFF); offsetTable.eaAddress[io + i] = 0xFFFF;
} }
} }
else else

View File

@ -12,8 +12,8 @@ enum
struct CellGcmOffsetTable struct CellGcmOffsetTable
{ {
be_t<u32> ioAddress; // u16* vm::bptr<u16> ioAddress;
be_t<u32> eaAddress; // u16* vm::bptr<u16> eaAddress;
}; };
// Auxiliary functions // Auxiliary functions
@ -30,7 +30,7 @@ void cellGcmGetOffsetTable(vm::ptr<CellGcmOffsetTable> table);
s32 cellGcmIoOffsetToAddress(u32 ioOffset, u64 address); s32 cellGcmIoOffsetToAddress(u32 ioOffset, u64 address);
s32 cellGcmMapEaIoAddress(u32 ea, u32 io, u32 size); s32 cellGcmMapEaIoAddress(u32 ea, u32 io, u32 size);
s32 cellGcmMapEaIoAddressWithFlags(u32 ea, u32 io, u32 size, u32 flags); s32 cellGcmMapEaIoAddressWithFlags(u32 ea, u32 io, u32 size, u32 flags);
s32 cellGcmMapMainMemory(u32 ea, u32 size, vm::ptr<be_t<u32>> offset); s32 cellGcmMapMainMemory(u32 ea, u32 size, vm::ptr<u32> offset);
s32 cellGcmReserveIoMapSize(u32 size); s32 cellGcmReserveIoMapSize(u32 size);
s32 cellGcmUnmapEaIoAddress(u64 ea); s32 cellGcmUnmapEaIoAddress(u64 ea);
s32 cellGcmUnmapIoAddress(u64 io); s32 cellGcmUnmapIoAddress(u64 io);

View File

@ -21,36 +21,60 @@ cellGemInternal cellGemInstance;
int cellGemCalibrate() int cellGemCalibrate()
{ {
UNIMPLEMENTED_FUNC(cellGem); UNIMPLEMENTED_FUNC(cellGem);
if (!cellGemInstance.m_bInitialized)
return CELL_GEM_ERROR_UNINITIALIZED;
return CELL_OK; return CELL_OK;
} }
int cellGemClearStatusFlags() int cellGemClearStatusFlags()
{ {
UNIMPLEMENTED_FUNC(cellGem); UNIMPLEMENTED_FUNC(cellGem);
if (!cellGemInstance.m_bInitialized)
return CELL_GEM_ERROR_UNINITIALIZED;
return CELL_OK; return CELL_OK;
} }
int cellGemConvertVideoFinish() int cellGemConvertVideoFinish()
{ {
UNIMPLEMENTED_FUNC(cellGem); UNIMPLEMENTED_FUNC(cellGem);
if (!cellGemInstance.m_bInitialized)
return CELL_GEM_ERROR_UNINITIALIZED;
return CELL_OK; return CELL_OK;
} }
int cellGemConvertVideoStart() int cellGemConvertVideoStart()
{ {
UNIMPLEMENTED_FUNC(cellGem); UNIMPLEMENTED_FUNC(cellGem);
if (!cellGemInstance.m_bInitialized)
return CELL_GEM_ERROR_UNINITIALIZED;
return CELL_OK; return CELL_OK;
} }
int cellGemEnableCameraPitchAngleCorrection() int cellGemEnableCameraPitchAngleCorrection()
{ {
UNIMPLEMENTED_FUNC(cellGem); UNIMPLEMENTED_FUNC(cellGem);
if (!cellGemInstance.m_bInitialized)
return CELL_GEM_ERROR_UNINITIALIZED;
return CELL_OK; return CELL_OK;
} }
int cellGemEnableMagnetometer() int cellGemEnableMagnetometer()
{ {
UNIMPLEMENTED_FUNC(cellGem); UNIMPLEMENTED_FUNC(cellGem);
if (!cellGemInstance.m_bInitialized)
return CELL_GEM_ERROR_UNINITIALIZED;
return CELL_OK; return CELL_OK;
} }
@ -69,60 +93,100 @@ int cellGemEnd()
int cellGemFilterState() int cellGemFilterState()
{ {
UNIMPLEMENTED_FUNC(cellGem); UNIMPLEMENTED_FUNC(cellGem);
if (!cellGemInstance.m_bInitialized)
return CELL_GEM_ERROR_UNINITIALIZED;
return CELL_OK; return CELL_OK;
} }
int cellGemForceRGB() int cellGemForceRGB()
{ {
UNIMPLEMENTED_FUNC(cellGem); UNIMPLEMENTED_FUNC(cellGem);
if (!cellGemInstance.m_bInitialized)
return CELL_GEM_ERROR_UNINITIALIZED;
return CELL_OK; return CELL_OK;
} }
int cellGemGetAccelerometerPositionInDevice() int cellGemGetAccelerometerPositionInDevice()
{ {
UNIMPLEMENTED_FUNC(cellGem); UNIMPLEMENTED_FUNC(cellGem);
if (!cellGemInstance.m_bInitialized)
return CELL_GEM_ERROR_UNINITIALIZED;
return CELL_OK; return CELL_OK;
} }
int cellGemGetAllTrackableHues() int cellGemGetAllTrackableHues()
{ {
UNIMPLEMENTED_FUNC(cellGem); UNIMPLEMENTED_FUNC(cellGem);
if (!cellGemInstance.m_bInitialized)
return CELL_GEM_ERROR_UNINITIALIZED;
return CELL_OK; return CELL_OK;
} }
int cellGemGetCameraState() int cellGemGetCameraState()
{ {
UNIMPLEMENTED_FUNC(cellGem); UNIMPLEMENTED_FUNC(cellGem);
if (!cellGemInstance.m_bInitialized)
return CELL_GEM_ERROR_UNINITIALIZED;
return CELL_OK; return CELL_OK;
} }
int cellGemGetEnvironmentLightingColor() int cellGemGetEnvironmentLightingColor()
{ {
UNIMPLEMENTED_FUNC(cellGem); UNIMPLEMENTED_FUNC(cellGem);
if (!cellGemInstance.m_bInitialized)
return CELL_GEM_ERROR_UNINITIALIZED;
return CELL_OK; return CELL_OK;
} }
int cellGemGetHuePixels() int cellGemGetHuePixels()
{ {
UNIMPLEMENTED_FUNC(cellGem); UNIMPLEMENTED_FUNC(cellGem);
if (!cellGemInstance.m_bInitialized)
return CELL_GEM_ERROR_UNINITIALIZED;
return CELL_OK; return CELL_OK;
} }
int cellGemGetImageState() int cellGemGetImageState()
{ {
UNIMPLEMENTED_FUNC(cellGem); UNIMPLEMENTED_FUNC(cellGem);
if (!cellGemInstance.m_bInitialized)
return CELL_GEM_ERROR_UNINITIALIZED;
return CELL_OK; return CELL_OK;
} }
int cellGemGetInertialState() int cellGemGetInertialState()
{ {
UNIMPLEMENTED_FUNC(cellGem); UNIMPLEMENTED_FUNC(cellGem);
if (!cellGemInstance.m_bInitialized)
return CELL_GEM_ERROR_UNINITIALIZED;
return CELL_OK; return CELL_OK;
} }
int cellGemGetInfo() int cellGemGetInfo()
{ {
UNIMPLEMENTED_FUNC(cellGem); UNIMPLEMENTED_FUNC(cellGem);
if (!cellGemInstance.m_bInitialized)
return CELL_GEM_ERROR_UNINITIALIZED;
return CELL_OK; return CELL_OK;
} }
@ -140,30 +204,50 @@ s32 cellGemGetMemorySize(be_t<s32> max_connect)
int cellGemGetRGB() int cellGemGetRGB()
{ {
UNIMPLEMENTED_FUNC(cellGem); UNIMPLEMENTED_FUNC(cellGem);
if (!cellGemInstance.m_bInitialized)
return CELL_GEM_ERROR_UNINITIALIZED;
return CELL_OK; return CELL_OK;
} }
int cellGemGetRumble() int cellGemGetRumble()
{ {
UNIMPLEMENTED_FUNC(cellGem); UNIMPLEMENTED_FUNC(cellGem);
if (!cellGemInstance.m_bInitialized)
return CELL_GEM_ERROR_UNINITIALIZED;
return CELL_OK; return CELL_OK;
} }
int cellGemGetState() int cellGemGetState()
{ {
UNIMPLEMENTED_FUNC(cellGem); UNIMPLEMENTED_FUNC(cellGem);
if (!cellGemInstance.m_bInitialized)
return CELL_GEM_ERROR_UNINITIALIZED;
return CELL_OK; return CELL_OK;
} }
int cellGemGetStatusFlags() int cellGemGetStatusFlags()
{ {
UNIMPLEMENTED_FUNC(cellGem); UNIMPLEMENTED_FUNC(cellGem);
if (!cellGemInstance.m_bInitialized)
return CELL_GEM_ERROR_UNINITIALIZED;
return CELL_OK; return CELL_OK;
} }
int cellGemGetTrackerHue() int cellGemGetTrackerHue()
{ {
UNIMPLEMENTED_FUNC(cellGem); UNIMPLEMENTED_FUNC(cellGem);
if (!cellGemInstance.m_bInitialized)
return CELL_GEM_ERROR_UNINITIALIZED;
return CELL_OK; return CELL_OK;
} }
@ -188,6 +272,10 @@ int cellGemInit(vm::ptr<CellGemAttribute> attribute)
int cellGemInvalidateCalibration() int cellGemInvalidateCalibration()
{ {
UNIMPLEMENTED_FUNC(cellGem); UNIMPLEMENTED_FUNC(cellGem);
if (!cellGemInstance.m_bInitialized)
return CELL_GEM_ERROR_UNINITIALIZED;
return CELL_OK; return CELL_OK;
} }
@ -200,54 +288,90 @@ int cellGemIsTrackableHue()
int cellGemPrepareCamera() int cellGemPrepareCamera()
{ {
UNIMPLEMENTED_FUNC(cellGem); UNIMPLEMENTED_FUNC(cellGem);
if (!cellGemInstance.m_bInitialized)
return CELL_GEM_ERROR_UNINITIALIZED;
return CELL_OK; return CELL_OK;
} }
int cellGemPrepareVideoConvert() int cellGemPrepareVideoConvert()
{ {
UNIMPLEMENTED_FUNC(cellGem); UNIMPLEMENTED_FUNC(cellGem);
if (!cellGemInstance.m_bInitialized)
return CELL_GEM_ERROR_UNINITIALIZED;
return CELL_OK; return CELL_OK;
} }
int cellGemReset() int cellGemReset()
{ {
UNIMPLEMENTED_FUNC(cellGem); UNIMPLEMENTED_FUNC(cellGem);
if (!cellGemInstance.m_bInitialized)
return CELL_GEM_ERROR_UNINITIALIZED;
return CELL_OK; return CELL_OK;
} }
int cellGemSetRumble() int cellGemSetRumble()
{ {
UNIMPLEMENTED_FUNC(cellGem); UNIMPLEMENTED_FUNC(cellGem);
if (!cellGemInstance.m_bInitialized)
return CELL_GEM_ERROR_UNINITIALIZED;
return CELL_OK; return CELL_OK;
} }
int cellGemSetYaw() int cellGemSetYaw()
{ {
UNIMPLEMENTED_FUNC(cellGem); UNIMPLEMENTED_FUNC(cellGem);
if (!cellGemInstance.m_bInitialized)
return CELL_GEM_ERROR_UNINITIALIZED;
return CELL_OK; return CELL_OK;
} }
int cellGemTrackHues() int cellGemTrackHues()
{ {
UNIMPLEMENTED_FUNC(cellGem); UNIMPLEMENTED_FUNC(cellGem);
if (!cellGemInstance.m_bInitialized)
return CELL_GEM_ERROR_UNINITIALIZED;
return CELL_OK; return CELL_OK;
} }
int cellGemUpdateFinish() int cellGemUpdateFinish()
{ {
UNIMPLEMENTED_FUNC(cellGem); UNIMPLEMENTED_FUNC(cellGem);
if (!cellGemInstance.m_bInitialized)
return CELL_GEM_ERROR_UNINITIALIZED;
return CELL_OK; return CELL_OK;
} }
int cellGemUpdateStart() int cellGemUpdateStart()
{ {
UNIMPLEMENTED_FUNC(cellGem); UNIMPLEMENTED_FUNC(cellGem);
if (!cellGemInstance.m_bInitialized)
return CELL_GEM_ERROR_UNINITIALIZED;
return CELL_OK; return CELL_OK;
} }
int cellGemWriteExternalPort() int cellGemWriteExternalPort()
{ {
UNIMPLEMENTED_FUNC(cellGem); UNIMPLEMENTED_FUNC(cellGem);
if (!cellGemInstance.m_bInitialized)
return CELL_GEM_ERROR_UNINITIALIZED;
return CELL_OK; return CELL_OK;
} }

View File

@ -21,7 +21,7 @@ int cellGifDecExtCreate(u32 mainHandle, u32 threadInParam, u32 threadOutParam, u
return CELL_OK; return CELL_OK;
} }
int cellGifDecOpen(u32 mainHandle, vm::ptr<be_t<u32>> subHandle, vm::ptr<CellGifDecSrc> src, vm::ptr<CellGifDecOpnInfo> openInfo) int cellGifDecOpen(u32 mainHandle, vm::ptr<u32> subHandle, vm::ptr<CellGifDecSrc> src, vm::ptr<CellGifDecOpnInfo> openInfo)
{ {
cellGifDec->Warning("cellGifDecOpen(mainHandle=0x%x, subHandle_addr=0x%x, src_addr=0x%x, openInfo_addr=0x%x)", cellGifDec->Warning("cellGifDecOpen(mainHandle=0x%x, subHandle_addr=0x%x, src_addr=0x%x, openInfo_addr=0x%x)",
mainHandle, subHandle.addr(), src.addr(), openInfo.addr()); mainHandle, subHandle.addr(), src.addr(), openInfo.addr());
@ -39,7 +39,7 @@ int cellGifDecOpen(u32 mainHandle, vm::ptr<be_t<u32>> subHandle, vm::ptr<CellGif
case se32(CELL_GIFDEC_FILE): case se32(CELL_GIFDEC_FILE):
// Get file descriptor // Get file descriptor
vm::var<be_t<u32>> fd; vm::var<be_t<u32>> fd;
int ret = cellFsOpen(vm::ptr<const char>::make(src->fileName.addr()), 0, fd, vm::ptr<be_t<u32>>::make(0), 0); int ret = cellFsOpen(vm::ptr<const char>::make(src->fileName.addr()), 0, fd, vm::ptr<u32>::make(0), 0);
current_subHandle->fd = fd->ToLE(); current_subHandle->fd = fd->ToLE();
if (ret != CELL_OK) return CELL_GIFDEC_ERROR_OPEN_FILE; if (ret != CELL_OK) return CELL_GIFDEC_ERROR_OPEN_FILE;

View File

@ -26,7 +26,7 @@ int cellJpgDecDestroy(u32 mainHandle)
return CELL_OK; return CELL_OK;
} }
int cellJpgDecOpen(u32 mainHandle, vm::ptr<be_t<u32>> subHandle, vm::ptr<CellJpgDecSrc> src, vm::ptr<CellJpgDecOpnInfo> openInfo) int cellJpgDecOpen(u32 mainHandle, vm::ptr<u32> subHandle, vm::ptr<CellJpgDecSrc> src, vm::ptr<CellJpgDecOpnInfo> openInfo)
{ {
cellJpgDec->Warning("cellJpgDecOpen(mainHandle=0x%x, subHandle_addr=0x%x, src_addr=0x%x, openInfo_addr=0x%x)", cellJpgDec->Warning("cellJpgDecOpen(mainHandle=0x%x, subHandle_addr=0x%x, src_addr=0x%x, openInfo_addr=0x%x)",
mainHandle, subHandle.addr(), src.addr(), openInfo.addr()); mainHandle, subHandle.addr(), src.addr(), openInfo.addr());
@ -45,7 +45,7 @@ int cellJpgDecOpen(u32 mainHandle, vm::ptr<be_t<u32>> subHandle, vm::ptr<CellJpg
case se32(CELL_JPGDEC_FILE): case se32(CELL_JPGDEC_FILE):
// Get file descriptor // Get file descriptor
vm::var<be_t<u32>> fd; vm::var<be_t<u32>> fd;
int ret = cellFsOpen(vm::ptr<const char>::make(src->fileName.addr()), 0, fd, vm::ptr<be_t<u32>>::make(0), 0); int ret = cellFsOpen(vm::ptr<const char>::make(src->fileName.addr()), 0, fd, vm::ptr<u32>::make(0), 0);
current_subHandle->fd = fd->ToLE(); current_subHandle->fd = fd->ToLE();
if (ret != CELL_OK) return CELL_JPGDEC_ERROR_OPEN_FILE; if (ret != CELL_OK) return CELL_JPGDEC_ERROR_OPEN_FILE;

View File

@ -16,7 +16,7 @@
Module *cellL10n = nullptr; Module *cellL10n = nullptr;
int UTF16stoUTF8s(vm::lptrl<const char16_t> utf16, vm::ptr<be_t<u32>> utf16_len, vm::ptr<char> utf8, vm::ptr<be_t<u32>> utf8_len) int UTF16stoUTF8s(vm::lptrl<const char16_t> utf16, vm::ptr<u32> utf16_len, vm::ptr<char> utf8, vm::ptr<u32> utf8_len)
{ {
cellL10n->Warning("UTF16stoUTF8s(utf16_addr=0x%x, utf16_len_addr=0x%x, utf8_addr=0x%x, utf8_len_addr=0x%x)", cellL10n->Warning("UTF16stoUTF8s(utf16_addr=0x%x, utf16_len_addr=0x%x, utf8_addr=0x%x, utf8_len_addr=0x%x)",
utf16.addr(), utf16_len.addr(), utf8.addr(), utf8_len.addr()); utf16.addr(), utf16_len.addr(), utf8.addr(), utf8_len.addr());
@ -281,7 +281,7 @@ int _L10nConvertStr(int src_code, const void* src, size_t * src_len, int dst_cod
#endif #endif
//TODO: Check the code in emulation. If support for UTF8/UTF16/UTF32/UCS2/UCS4 should use wider chars.. awful. //TODO: Check the code in emulation. If support for UTF8/UTF16/UTF32/UCS2/UCS4 should use wider chars.. awful.
int L10nConvertStr(int src_code, vm::ptr<const void> src, vm::ptr<be_t<u32>> src_len, int dst_code, vm::ptr<void> dst, vm::ptr<be_t<u32>> dst_len) int L10nConvertStr(int src_code, vm::ptr<const void> src, vm::ptr<u32> src_len, int dst_code, vm::ptr<void> dst, vm::ptr<u32> dst_len)
{ {
cellL10n->Error("L10nConvertStr(src_code=%d, srca_addr=0x%x, src_len_addr=0x%x, dst_code=%d, dst_addr=0x%x, dst_len_addr=0x%x)", cellL10n->Error("L10nConvertStr(src_code=%d, srca_addr=0x%x, src_len_addr=0x%x, dst_code=%d, dst_addr=0x%x, dst_len_addr=0x%x)",
src_code, src.addr(), src_len.addr(), dst_code, dst.addr(), dst_len.addr()); src_code, src.addr(), src_len.addr(), dst_code, dst.addr(), dst_len.addr());

View File

@ -1,40 +1,45 @@
#include "stdafx.h" #include "stdafx.h"
#if 0 #include "Emu/Memory/Memory.h"
#include "Emu/System.h"
#include "Emu/SysCalls/Modules.h"
void cellMic_init(); #include "cellMic.h"
Module cellMic(0x0022, cellMic_init);
// Error Codes Module *cellMic = nullptr;
enum
struct cellMicInternal
{ {
CELL_MICIN_ERROR_ALREADY_INIT = 0x80140101, bool m_bCellMicInitialized;;
CELL_MICIN_ERROR_SYSTEM = 0x80140102,
CELL_MICIN_ERROR_NOT_INIT = 0x80140103, cellMicInternal()
CELL_MICIN_ERROR_PARAM = 0x80140104, : m_bCellMicInitialized(false)
CELL_MICIN_ERROR_PORT_FULL = 0x80140105, {
CELL_MICIN_ERROR_ALREADY_OPEN = 0x80140106, }
CELL_MICIN_ERROR_NOT_OPEN = 0x80140107,
CELL_MICIN_ERROR_NOT_RUN = 0x80140108,
CELL_MICIN_ERROR_TRANS_EVENT = 0x80140109,
CELL_MICIN_ERROR_OPEN = 0x8014010a,
CELL_MICIN_ERROR_SHAREDMEMORY = 0x8014010b,
CELL_MICIN_ERROR_MUTEX = 0x8014010c,
CELL_MICIN_ERROR_EVENT_QUEUE = 0x8014010d,
CELL_MICIN_ERROR_DEVICE_NOT_FOUND = 0x8014010e,
CELL_MICIN_ERROR_SYSTEM_NOT_FOUND = 0x8014010e,
CELL_MICIN_ERROR_FATAL = 0x8014010f,
CELL_MICIN_ERROR_DEVICE_NOT_SUPPORT = 0x80140110,
}; };
cellMicInternal CellMicInstance;
int cellMicInit() int cellMicInit()
{ {
UNIMPLEMENTED_FUNC(cellMic); cellMic->Warning("cellMicInit()");
if (CellMicInstance.m_bCellMicInitialized)
return CELL_MICIN_ERROR_ALREADY_INIT;
CellMicInstance.m_bCellMicInitialized = true;
return CELL_OK; return CELL_OK;
} }
int cellMicEnd() int cellMicEnd()
{ {
UNIMPLEMENTED_FUNC(cellMic); cellMic->Warning("cellMicEnd()");
if (!CellMicInstance.m_bCellMicInitialized)
return CELL_MICIN_ERROR_NOT_INIT;
CellMicInstance.m_bCellMicInitialized = false;
return CELL_OK; return CELL_OK;
} }
@ -278,54 +283,60 @@ int cellMicGetDeviceIdentifier()
return CELL_OK; return CELL_OK;
} }
void cellMic_init() void cellMic_unload()
{ {
cellMic.AddFunc(0x8325e02d, cellMicInit); CellMicInstance.m_bCellMicInitialized = false;
cellMic.AddFunc(0xc6328caa, cellMicEnd); }
cellMic.AddFunc(0xdd1b59f0, cellMicOpen);
cellMic.AddFunc(0x8d229f8e, cellMicClose); void cellMic_init(Module *pxThis)
{
cellMic.AddFunc(0x017024a8, cellMicGetDeviceGUID); cellMic = pxThis;
cellMic.AddFunc(0xa52d2ae4, cellMicGetType);
cellMic.AddFunc(0x1b42101b, cellMicIsAttached); cellMic->AddFunc(0x8325e02d, cellMicInit);
cellMic.AddFunc(0x186cb1fb, cellMicIsOpen); cellMic->AddFunc(0xc6328caa, cellMicEnd);
cellMic.AddFunc(0x6a024aa0, cellMicGetDeviceAttr); cellMic->AddFunc(0xdd1b59f0, cellMicOpen);
cellMic.AddFunc(0xb2c16321, cellMicSetDeviceAttr); cellMic->AddFunc(0x8d229f8e, cellMicClose);
cellMic.AddFunc(0xac5ba03a, cellMicGetSignalAttr);
cellMic.AddFunc(0x323deb41, cellMicSetSignalAttr); cellMic->AddFunc(0x017024a8, cellMicGetDeviceGUID);
cellMic.AddFunc(0xb30780eb, cellMicGetSignalState); cellMic->AddFunc(0xa52d2ae4, cellMicGetType);
cellMic->AddFunc(0x1b42101b, cellMicIsAttached);
cellMic.AddFunc(0xdd724314, cellMicStart); cellMic->AddFunc(0x186cb1fb, cellMicIsOpen);
cellMic.AddFunc(0x07e1b12c, cellMicRead); cellMic->AddFunc(0x6a024aa0, cellMicGetDeviceAttr);
cellMic.AddFunc(0xfcfaf246, cellMicStop); cellMic->AddFunc(0xb2c16321, cellMicSetDeviceAttr);
cellMic.AddFunc(0x6bc46aab, cellMicReset); cellMic->AddFunc(0xac5ba03a, cellMicGetSignalAttr);
cellMic->AddFunc(0x323deb41, cellMicSetSignalAttr);
cellMic.AddFunc(0x7903400e, cellMicSetNotifyEventQueue); cellMic->AddFunc(0xb30780eb, cellMicGetSignalState);
cellMic.AddFunc(0x6cc7ae00, cellMicSetNotifyEventQueue2);
cellMic.AddFunc(0x65336418, cellMicRemoveNotifyEventQueue); cellMic->AddFunc(0xdd724314, cellMicStart);
cellMic->AddFunc(0x07e1b12c, cellMicRead);
cellMic.AddFunc(0x05709bbf, cellMicOpenEx); cellMic->AddFunc(0xfcfaf246, cellMicStop);
cellMic.AddFunc(0xddd19a89, cellMicStartEx); cellMic->AddFunc(0x6bc46aab, cellMicReset);
cellMic.AddFunc(0x4e0b69ee, cellMicGetFormatRaw);
cellMic.AddFunc(0xfda12276, cellMicGetFormatAux); cellMic->AddFunc(0x7903400e, cellMicSetNotifyEventQueue);
cellMic.AddFunc(0x87a08d29, cellMicGetFormatDsp); cellMic->AddFunc(0x6cc7ae00, cellMicSetNotifyEventQueue2);
cellMic.AddFunc(0xa42ac07a, cellMicOpenRaw); cellMic->AddFunc(0x65336418, cellMicRemoveNotifyEventQueue);
cellMic.AddFunc(0x72165a7f, cellMicReadRaw);
cellMic.AddFunc(0x3acc118e, cellMicReadAux); cellMic->AddFunc(0x05709bbf, cellMicOpenEx);
cellMic.AddFunc(0xc414faa5, cellMicReadDsp); cellMic->AddFunc(0xddd19a89, cellMicStartEx);
cellMic->AddFunc(0x4e0b69ee, cellMicGetFormatRaw);
cellMic.AddFunc(0x25c5723f, cellMicGetStatus); cellMic->AddFunc(0xfda12276, cellMicGetFormatAux);
cellMic.AddFunc(0xe839380f, cellMicStopEx); cellMic->AddFunc(0x87a08d29, cellMicGetFormatDsp);
cellMic.AddFunc(0x3ace58f3, cellMicSysShareClose); cellMic->AddFunc(0xa42ac07a, cellMicOpenRaw);
cellMic.AddFunc(0x48108a23, cellMicGetFormat); cellMic->AddFunc(0x72165a7f, cellMicReadRaw);
cellMic.AddFunc(0x891c6291, cellMicSetMultiMicNotifyEventQueue); cellMic->AddFunc(0x3acc118e, cellMicReadAux);
cellMic.AddFunc(0xad049ecf, cellMicGetFormatEx); cellMic->AddFunc(0xc414faa5, cellMicReadDsp);
cellMic.AddFunc(0xbdfd51e2, cellMicSysShareStop);
cellMic.AddFunc(0xc3610dbd, cellMicSysShareOpen); cellMic->AddFunc(0x25c5723f, cellMicGetStatus);
cellMic.AddFunc(0xc461563c, cellMicCommand); cellMic->AddFunc(0xe839380f, cellMicStopEx);
cellMic.AddFunc(0xcac7e7d7, cellMicSysShareStart); cellMic->AddFunc(0x3ace58f3, cellMicSysShareClose);
cellMic.AddFunc(0xd127cd3e, cellMicSysShareInit); cellMic->AddFunc(0x48108a23, cellMicGetFormat);
cellMic.AddFunc(0xf82bbf7c, cellMicSysShareEnd); cellMic->AddFunc(0x891c6291, cellMicSetMultiMicNotifyEventQueue);
cellMic.AddFunc(0xfdbbe469, cellMicGetDeviceIdentifier); cellMic->AddFunc(0xad049ecf, cellMicGetFormatEx);
cellMic->AddFunc(0xbdfd51e2, cellMicSysShareStop);
cellMic->AddFunc(0xc3610dbd, cellMicSysShareOpen);
cellMic->AddFunc(0xc461563c, cellMicCommand);
cellMic->AddFunc(0xcac7e7d7, cellMicSysShareStart);
cellMic->AddFunc(0xd127cd3e, cellMicSysShareInit);
cellMic->AddFunc(0xf82bbf7c, cellMicSysShareEnd);
cellMic->AddFunc(0xfdbbe469, cellMicGetDeviceIdentifier);
} }
#endif

View File

@ -91,8 +91,8 @@ int cellMsgDialogOpen2(u32 type, vm::ptr<const char> msgString, vm::ptr<CellMsgD
{ {
switch (type & CELL_MSGDIALOG_TYPE_SE_TYPE) switch (type & CELL_MSGDIALOG_TYPE_SE_TYPE)
{ {
case CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL: LOG_WARNING(TTY, "%s", msg.c_str()); break; case CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL: LOG_WARNING(TTY, "\n%s", msg.c_str()); break;
case CELL_MSGDIALOG_TYPE_SE_TYPE_ERROR: LOG_ERROR(TTY, "%s", msg.c_str()); break; case CELL_MSGDIALOG_TYPE_SE_TYPE_ERROR: LOG_ERROR(TTY, "\n%s", msg.c_str()); break;
} }
switch (type & CELL_MSGDIALOG_TYPE_SE_MUTE) // TODO switch (type & CELL_MSGDIALOG_TYPE_SE_MUTE) // TODO
@ -135,9 +135,10 @@ int cellMsgDialogOpen2(u32 type, vm::ptr<const char> msgString, vm::ptr<CellMsgD
if (callback && (g_msg_dialog_state != msgDialogAbort)) if (callback && (g_msg_dialog_state != msgDialogAbort))
{ {
Emu.GetCallbackManager().Register([callback, userData]() -> s32 s32 status = (s32)g_msg_dialog_status;
Emu.GetCallbackManager().Register([callback, userData, status]() -> s32
{ {
callback((s32)g_msg_dialog_status, userData); callback(status, userData);
return CELL_OK; return CELL_OK;
}); });
} }

View File

@ -257,4 +257,4 @@ struct CellNetCtlNatInfo
be_t<u32> mapped_addr; be_t<u32> mapped_addr;
}; };
typedef void(*cellNetCtlHandler)(s32 prev_state, s32 new_state, s32 event, s32 error_code, vm::ptr<be_t<u32>> arg); typedef void(*cellNetCtlHandler)(s32 prev_state, s32 new_state, s32 event, s32 error_code, vm::ptr<u32> arg);

View File

@ -124,7 +124,7 @@ u8 pamfGetStreamChannel(vm::ptr<CellPamfReader> pSelf, u8 stream)
} }
int cellPamfGetHeaderSize(vm::ptr<PamfHeader> pAddr, u64 fileSize, vm::ptr<be_t<u64>> pSize) int cellPamfGetHeaderSize(vm::ptr<PamfHeader> pAddr, u64 fileSize, vm::ptr<u64> pSize)
{ {
cellPamf->Warning("cellPamfGetHeaderSize(pAddr=0x%x, fileSize=%d, pSize_addr=0x%x)", pAddr.addr(), fileSize, pSize.addr()); cellPamf->Warning("cellPamfGetHeaderSize(pAddr=0x%x, fileSize=%d, pSize_addr=0x%x)", pAddr.addr(), fileSize, pSize.addr());
@ -136,7 +136,7 @@ int cellPamfGetHeaderSize(vm::ptr<PamfHeader> pAddr, u64 fileSize, vm::ptr<be_t<
return CELL_OK; return CELL_OK;
} }
int cellPamfGetHeaderSize2(vm::ptr<PamfHeader> pAddr, u64 fileSize, u32 attribute, vm::ptr<be_t<u64>> pSize) int cellPamfGetHeaderSize2(vm::ptr<PamfHeader> pAddr, u64 fileSize, u32 attribute, vm::ptr<u64> pSize)
{ {
cellPamf->Warning("cellPamfGetHeaderSize2(pAddr=0x%x, fileSize=%d, attribute=0x%x, pSize_addr=0x%x)", pAddr.addr(), fileSize, attribute, pSize.addr()); cellPamf->Warning("cellPamfGetHeaderSize2(pAddr=0x%x, fileSize=%d, attribute=0x%x, pSize_addr=0x%x)", pAddr.addr(), fileSize, attribute, pSize.addr());
@ -148,7 +148,7 @@ int cellPamfGetHeaderSize2(vm::ptr<PamfHeader> pAddr, u64 fileSize, u32 attribut
return CELL_OK; return CELL_OK;
} }
int cellPamfGetStreamOffsetAndSize(vm::ptr<PamfHeader> pAddr, u64 fileSize, vm::ptr<be_t<u64>> pOffset, vm::ptr<be_t<u64>> pSize) int cellPamfGetStreamOffsetAndSize(vm::ptr<PamfHeader> pAddr, u64 fileSize, vm::ptr<u64> pOffset, vm::ptr<u64> pSize)
{ {
cellPamf->Warning("cellPamfGetStreamOffsetAndSize(pAddr=0x%x, fileSize=%d, pOffset_addr=0x%x, pSize_addr=0x%x)", pAddr.addr(), fileSize, pOffset.addr(), pSize.addr()); cellPamf->Warning("cellPamfGetStreamOffsetAndSize(pAddr=0x%x, fileSize=%d, pOffset_addr=0x%x, pSize_addr=0x%x)", pAddr.addr(), fileSize, pOffset.addr(), pSize.addr());

View File

@ -84,7 +84,7 @@ s32 pngDecOpen(
case se32(CELL_PNGDEC_FILE): case se32(CELL_PNGDEC_FILE):
// Get file descriptor // Get file descriptor
vm::var<be_t<u32>> fd; vm::var<be_t<u32>> fd;
int ret = cellFsOpen(vm::ptr<const char>::make(src->fileName.addr()), 0, fd, vm::ptr<be_t<u32>>::make(0), 0); int ret = cellFsOpen(vm::ptr<const char>::make(src->fileName.addr()), 0, fd, vm::ptr<u32>::make(0), 0);
stream->fd = fd->ToLE(); stream->fd = fd->ToLE();
if (ret != CELL_OK) return CELL_PNGDEC_ERROR_OPEN_FILE; if (ret != CELL_OK) return CELL_PNGDEC_ERROR_OPEN_FILE;
@ -804,7 +804,7 @@ void cellPngDec_init(Module *pxThis)
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
CallAfter([]() CallAfter([]()
{ {
libpngdec = (u32)Memory.PRXMem.AllocAlign(sizeof(libpngdec_data), 4096); libpngdec = (u32)Memory.MainMem.AllocAlign(sizeof(libpngdec_data), 0x100000);
memcpy(vm::get_ptr<void>(libpngdec), libpngdec_data, sizeof(libpngdec_data)); memcpy(vm::get_ptr<void>(libpngdec), libpngdec_data, sizeof(libpngdec_data));
libpngdec_rtoc = libpngdec + 0x49710; libpngdec_rtoc = libpngdec + 0x49710;

View File

@ -620,7 +620,7 @@ void cellRescExit()
s_rescInternalInstance->m_bInitialized = false; s_rescInternalInstance->m_bInitialized = false;
} }
int cellRescVideoOutResolutionId2RescBufferMode(u32 resolutionId, vm::ptr<be_t<u32>> bufferMode) int cellRescVideoOutResolutionId2RescBufferMode(u32 resolutionId, vm::ptr<u32> bufferMode)
{ {
cellResc->Log("cellRescVideoOutResolutionId2RescBufferMode(resolutionId=%d, bufferMode_addr=0x%x)", resolutionId, bufferMode.addr()); cellResc->Log("cellRescVideoOutResolutionId2RescBufferMode(resolutionId=%d, bufferMode_addr=0x%x)", resolutionId, bufferMode.addr());
@ -858,7 +858,7 @@ int cellRescSetPalInterpolateDropFlexRatio(float ratio)
return CELL_OK; return CELL_OK;
} }
int cellRescGetBufferSize(vm::ptr<be_t<u32>> colorBuffers, vm::ptr<be_t<u32>> vertexArray, vm::ptr<be_t<u32>> fragmentShader) int cellRescGetBufferSize(vm::ptr<u32> colorBuffers, vm::ptr<u32> vertexArray, vm::ptr<u32> fragmentShader)
{ {
cellResc->Warning("cellRescGetBufferSize(colorBuffers_addr=0x%x, vertexArray_addr=0x%x, fragmentShader_addr=0x%x)", cellResc->Warning("cellRescGetBufferSize(colorBuffers_addr=0x%x, vertexArray_addr=0x%x, fragmentShader_addr=0x%x)",
colorBuffers.addr(), vertexArray.addr(), fragmentShader.addr()); colorBuffers.addr(), vertexArray.addr(), fragmentShader.addr());
@ -1029,7 +1029,7 @@ int cellRescSetWaitFlip()
return CELL_OK; return CELL_OK;
} }
int cellRescSetBufferAddress(vm::ptr<be_t<u32>> colorBuffers, vm::ptr<be_t<u32>> vertexArray, vm::ptr<be_t<u32>> fragmentShader) int cellRescSetBufferAddress(vm::ptr<u32> colorBuffers, vm::ptr<u32> vertexArray, vm::ptr<u32> fragmentShader)
{ {
cellResc->Warning("cellRescSetBufferAddress(colorBuffers_addr=0x%x, vertexArray_addr=0x%x, fragmentShader_addr=0x%x)", colorBuffers.addr(), vertexArray.addr(), fragmentShader.addr()); cellResc->Warning("cellRescSetBufferAddress(colorBuffers_addr=0x%x, vertexArray_addr=0x%x, fragmentShader_addr=0x%x)", colorBuffers.addr(), vertexArray.addr(), fragmentShader.addr());
@ -1169,8 +1169,8 @@ int CreateInterlaceTable(u32 ea_addr, float srcH, float dstH, CellRescTableEleme
float bandwidth = 0.5f / (srcH / dstH); float bandwidth = 0.5f / (srcH / dstH);
float phi_b = 2.f * PI * bandwidth; float phi_b = 2.f * PI * bandwidth;
float window[4]; float window[4];
auto buf16 = vm::ptr<be_t<u16>>::make(ea_addr); auto buf16 = vm::ptr<u16>::make(ea_addr);
auto buf32 = vm::ptr<be_t<float>>::make(ea_addr); auto buf32 = vm::ptr<float>::make(ea_addr);
blackman(window); blackman(window);

View File

@ -310,7 +310,7 @@ int cellRtcConvertLocalTimeToUtc(vm::ptr<CellRtcTick> pLocalTime, vm::ptr<CellRt
return CELL_OK; return CELL_OK;
} }
int cellRtcGetDosTime(vm::ptr<CellRtcDateTime> pDateTime, vm::ptr<be_t<u32>> puiDosTime) int cellRtcGetDosTime(vm::ptr<CellRtcDateTime> pDateTime, vm::ptr<u32> puiDosTime)
{ {
cellRtc->Log("cellRtcGetDosTime(pDateTime=0x%x, puiDosTime=0x%x)", pDateTime.addr(), puiDosTime.addr()); cellRtc->Log("cellRtcGetDosTime(pDateTime=0x%x, puiDosTime=0x%x)", pDateTime.addr(), puiDosTime.addr());
@ -321,7 +321,7 @@ int cellRtcGetDosTime(vm::ptr<CellRtcDateTime> pDateTime, vm::ptr<be_t<u32>> pui
return CELL_OK; return CELL_OK;
} }
int cellRtcGetTime_t(vm::ptr<CellRtcDateTime> pDateTime, vm::ptr<be_t<s64>> piTime) int cellRtcGetTime_t(vm::ptr<CellRtcDateTime> pDateTime, vm::ptr<s64> piTime)
{ {
cellRtc->Log("cellRtcGetTime_t(pDateTime=0x%x, piTime=0x%x)", pDateTime.addr(), piTime.addr()); cellRtc->Log("cellRtcGetTime_t(pDateTime=0x%x, piTime=0x%x)", pDateTime.addr(), piTime.addr());
@ -333,7 +333,7 @@ int cellRtcGetTime_t(vm::ptr<CellRtcDateTime> pDateTime, vm::ptr<be_t<s64>> piTi
return CELL_OK; return CELL_OK;
} }
int cellRtcGetWin32FileTime(vm::ptr<CellRtcDateTime> pDateTime, vm::ptr<be_t<u64>> pulWin32FileTime) int cellRtcGetWin32FileTime(vm::ptr<CellRtcDateTime> pDateTime, vm::ptr<u64> pulWin32FileTime)
{ {
cellRtc->Log("cellRtcGetWin32FileTime(pDateTime=0x%x, pulWin32FileTime=0x%x)", pDateTime.addr(), pulWin32FileTime.addr()); cellRtc->Log("cellRtcGetWin32FileTime(pDateTime=0x%x, pulWin32FileTime=0x%x)", pDateTime.addr(), pulWin32FileTime.addr());

View File

@ -6,9 +6,12 @@
Module *cellSail = nullptr; Module *cellSail = nullptr;
int cellSailMemAllocatorInitialize() int cellSailMemAllocatorInitialize(vm::ptr<CellSailMemAllocator> pSelf, vm::ptr<CellSailMemAllocatorFuncs> pCallbacks)
{ {
UNIMPLEMENTED_FUNC(cellSail); cellSail->Warning("cellSailMemAllocatorInitialize(pSelf_addr=0x%x, pCallbacks_addr=0x%x)", pSelf.addr(), pCallbacks.addr());
pSelf->callbacks = pCallbacks;
return CELL_OK; return CELL_OK;
} }
@ -66,16 +69,19 @@ int cellSailDescriptorGetMediaInfo()
return CELL_OK; return CELL_OK;
} }
int cellSailDescriptorSetAutoSelection() int cellSailDescriptorSetAutoSelection(vm::ptr<CellSailDescriptor> pSelf, bool autoSelection)
{ {
UNIMPLEMENTED_FUNC(cellSail); cellSail->Todo("cellSailDescriptorSetAutoSelection(pSelf_addr=0x%x, autoSelection=%b)", pSelf.addr(), autoSelection);
return CELL_OK;
pSelf->autoSelection = autoSelection;
return autoSelection;
} }
int cellSailDescriptorIsAutoSelection() int cellSailDescriptorIsAutoSelection(vm::ptr<CellSailDescriptor> pSelf)
{ {
UNIMPLEMENTED_FUNC(cellSail); cellSail->Warning("cellSailDescriptorIsAutoSelection(pSelf_addr=0x%x)", pSelf.addr());
return CELL_OK; return pSelf->autoSelection;
} }
int cellSailDescriptorCreateDatabase() int cellSailDescriptorCreateDatabase()
@ -486,9 +492,18 @@ int cellSailPlayerInitialize()
return CELL_OK; return CELL_OK;
} }
int cellSailPlayerInitialize2() int cellSailPlayerInitialize2(vm::ptr<CellSailPlayer> pSelf, vm::ptr<CellSailMemAllocator> pAllocator, vm::ptr<CellSailPlayerFuncNotified> pCallback, u64 callbackArg,
vm::ptr<CellSailPlayerAttribute> pAttribute, vm::ptr<CellSailPlayerResource> pResource)
{ {
UNIMPLEMENTED_FUNC(cellSail); cellSail->Warning("cellSailPlayerInitialize2(pSelf_addr=0x%x, pAllocator_addr=0x%x, pCallback=0x%x, callbackArg=%d, pAttribute_addr=0x%x, pResource=0x%x)", pSelf.addr(),
pAllocator.addr(), pCallback.addr(), callbackArg, pAttribute.addr(), pResource.addr());
pSelf->allocator = pAllocator;
pSelf->callback = pCallback;
pSelf->callbackArgument = callbackArg;
pSelf->attribute = pAttribute;
pSelf->resource = pResource;
return CELL_OK; return CELL_OK;
} }
@ -576,34 +591,76 @@ int cellSailPlayerBoot()
return CELL_OK; return CELL_OK;
} }
int cellSailPlayerCreateDescriptor() int cellSailPlayerAddDescriptor(vm::ptr<CellSailPlayer> pSelf, vm::ptr<CellSailDescriptor> pDesc)
{ {
UNIMPLEMENTED_FUNC(cellSail); cellSail->Warning("cellSailPlayerAddDescriptor(pSelf_addr=0x%x, pDesc_addr=0x%x)", pSelf.addr(), pDesc.addr());
if (pSelf->descriptors < 3)
{
pSelf->descriptors++;
pSelf->registeredDescriptors[pSelf->descriptors] = pDesc;
pDesc->registered = true;
}
else
{
cellSail->Error("Descriptor limit reached! This should never happen, report this to a developer.");
}
return CELL_OK; return CELL_OK;
} }
int cellSailPlayerDestroyDescriptor() int cellSailPlayerCreateDescriptor(vm::ptr<CellSailPlayer> pSelf, s32 streamType, vm::ptr<u32> pMediaInfo, vm::ptr<const char> pUri, vm::ptr<CellSailDescriptor> ppDesc)
{ {
UNIMPLEMENTED_FUNC(cellSail); cellSail->Todo("cellSailPlayerCreateDescriptor(pSelf_addr=0x%x, streamType=%d, pMediaInfo_addr=0x%x, pUri_addr=0x%x, ppDesc_addr=0x%x)", pSelf.addr(), streamType,
pMediaInfo.addr(), pUri.addr(), ppDesc.addr());
// TODO: Let the game allocate memory for the descriptor, setup the descriptor and pass it back to the game
//CellSailDescriptor *pDesc = new CellSailDescriptor();
//u32 descriptorAddress = pSelf->allocator->callbacks->pAlloc(pSelf->allocator->pArg, 4, descriptorAddress);
//cellSail->Error("Address: 0x%x", descriptorAddress);
//vm::ptr<CellSailDescriptor> descriptor = vm::ptr<CellSailDescriptor>::make(Memory.RealToVirtualAddr(&descriptorAddress));
//descriptor->streamType = streamType;
//descriptor->registered = false;
pSelf->descriptors = 0;
pSelf->repeatMode = 0;
//ppDesc = descriptor;
//cellSail->Todo("pSelf_addr=0x%x, pDesc_addr=0x%x", pSelf.addr(), descriptor.addr());
//cellSailPlayerAddDescriptor(pSelf, ppDesc);
return CELL_OK; return CELL_OK;
} }
int cellSailPlayerAddDescriptor() int cellSailPlayerDestroyDescriptor(vm::ptr<CellSailPlayer> pSelf, vm::ptr<CellSailDescriptor> pDesc)
{ {
UNIMPLEMENTED_FUNC(cellSail); cellSail->Todo("cellSailPlayerAddDescriptor(pSelf_addr=0x%x, pDesc_addr=0x%x)", pSelf.addr(), pDesc.addr());
if (pDesc->registered)
return CELL_SAIL_ERROR_INVALID_STATE;
return CELL_OK; return CELL_OK;
} }
int cellSailPlayerRemoveDescriptor() int cellSailPlayerRemoveDescriptor(vm::ptr<CellSailPlayer> pSelf, vm::ptr<CellSailDescriptor> ppDesc)
{ {
UNIMPLEMENTED_FUNC(cellSail); cellSail->Warning("cellSailPlayerAddDescriptor(pSelf_addr=0x%x, pDesc_addr=0x%x)", pSelf.addr(), ppDesc.addr());
return CELL_OK;
if (pSelf->descriptors > 0)
{
ppDesc = pSelf->registeredDescriptors[pSelf->descriptors];
delete &pSelf->registeredDescriptors[pSelf->descriptors];
pSelf->descriptors--;
}
return pSelf->descriptors;
} }
int cellSailPlayerGetDescriptorCount() int cellSailPlayerGetDescriptorCount(vm::ptr<CellSailPlayer> pSelf)
{ {
UNIMPLEMENTED_FUNC(cellSail); cellSail->Warning("cellSailPlayerGetDescriptorCount(pSelf_addr=0x%x)", pSelf.addr());
return CELL_OK; return pSelf->descriptors;
} }
int cellSailPlayerGetCurrentDescriptor() int cellSailPlayerGetCurrentDescriptor()
@ -714,16 +771,23 @@ int cellSailPlayerIsPaused()
return CELL_OK; return CELL_OK;
} }
int cellSailPlayerSetRepeatMode() int cellSailPlayerSetRepeatMode(vm::ptr<CellSailPlayer> pSelf, s32 repeatMode, vm::ptr<CellSailStartCommand> pCommand)
{ {
UNIMPLEMENTED_FUNC(cellSail); cellSail->Warning("cellSailPlayerSetRepeatMode(pSelf_addr=0x%x, repeatMode=%i, pCommand_addr=0x%x)", pSelf.addr(), repeatMode, pCommand.addr());
return CELL_OK;
pSelf->repeatMode = repeatMode;
pSelf->playbackCommand = pCommand;
return pSelf->repeatMode;
} }
int cellSailPlayerGetRepeatMode() int cellSailPlayerGetRepeatMode(vm::ptr<CellSailPlayer> pSelf, vm::ptr<CellSailStartCommand> pCommand)
{ {
UNIMPLEMENTED_FUNC(cellSail); cellSail->Warning("cellSailPlayerGetRepeatMode(pSelf_addr=0x%x, pCommand_addr=0x%x)", pSelf.addr(), pCommand.addr());
return CELL_OK;
pCommand = pSelf->playbackCommand;
return pSelf->repeatMode;
} }
int cellSailPlayerSetEsAudioMuted() int cellSailPlayerSetEsAudioMuted()

View File

@ -17,6 +17,519 @@ enum
CELL_SAIL_ERROR_FATAL = 0x806107FF, CELL_SAIL_ERROR_FATAL = 0x806107FF,
}; };
// Call types
enum {
CELL_SAIL_PLAYER_CALL_NONE = 0,
CELL_SAIL_PLAYER_CALL_BOOT = 1,
CELL_SAIL_PLAYER_CALL_OPEN_STREAM = 2,
CELL_SAIL_PLAYER_CALL_CLOSE_STREAM = 3,
CELL_SAIL_PLAYER_CALL_OPEN_ES_AUDIO = 4,
CELL_SAIL_PLAYER_CALL_OPEN_ES_VIDEO = 5,
CELL_SAIL_PLAYER_CALL_OPEN_ES_USER = 6,
CELL_SAIL_PLAYER_CALL_CLOSE_ES_AUDIO = 7,
CELL_SAIL_PLAYER_CALL_CLOSE_ES_VIDEO = 8,
CELL_SAIL_PLAYER_CALL_CLOSE_ES_USER = 9,
CELL_SAIL_PLAYER_CALL_START = 10,
CELL_SAIL_PLAYER_CALL_STOP = 11,
CELL_SAIL_PLAYER_CALL_NEXT = 12,
CELL_SAIL_PLAYER_CALL_REOPEN_ES_AUDIO = 13,
CELL_SAIL_PLAYER_CALL_REOPEN_ES_VIDEO = 14,
CELL_SAIL_PLAYER_CALL_REOPEN_ES_USER = 15,
_CELL_SAIL_PLAYER_CALL_TYPE_NUM_OF_ELEMENTS = 16, // Never used?
};
// State types
enum {
CELL_SAIL_PLAYER_STATE_INITIALIZED = 0,
CELL_SAIL_PLAYER_STATE_BOOT_TRANSITION = 1,
CELL_SAIL_PLAYER_STATE_CLOSED = 2,
CELL_SAIL_PLAYER_STATE_OPEN_TRANSITION = 3,
CELL_SAIL_PLAYER_STATE_OPENED = 4,
CELL_SAIL_PLAYER_STATE_START_TRANSITION = 5,
CELL_SAIL_PLAYER_STATE_RUNNING = 6,
CELL_SAIL_PLAYER_STATE_STOP_TRANSITION = 7,
CELL_SAIL_PLAYER_STATE_CLOSE_TRANSITION = 8,
CELL_SAIL_PLAYER_STATE_LOST = 9,
_CELL_SAIL_PLAYER_STATE_TYPE_NUM_OF_ELEMENTS = 10, // Never used?
};
// Preset types
enum {
CELL_SAIL_PLAYER_PRESET_AV_SYNC = 0, // Deprecated, same as 59_94HZ
CELL_SAIL_PLAYER_PRESET_AS_IS = 1,
CELL_SAIL_PLAYER_PRESET_AV_SYNC_59_94HZ = 2,
CELL_SAIL_PLAYER_PRESET_AV_SYNC_29_97HZ = 3,
CELL_SAIL_PLAYER_PRESET_AV_SYNC_50HZ = 4,
CELL_SAIL_PLAYER_PRESET_AV_SYNC_25HZ = 5,
CELL_SAIL_PLAYER_PRESET_AV_SYNC_AUTO_DETECT = 6,
};
// Parameter types
enum {
CELL_SAIL_PARAMETER_ENABLE_VPOST = 0,
// Player
CELL_SAIL_PARAMETER_CONTROL_QUEUE_DEPTH = 1,
CELL_SAIL_PARAMETER_CONTROL_PPU_THREAD_PRIORITY = 2,
// SPURS
CELL_SAIL_PARAMETER_SPURS_NUM_OF_SPUS = 3,
CELL_SAIL_PARAMETER_SPURS_SPU_THREAD_PRIORITY = 4,
CELL_SAIL_PARAMETER_SPURS_PPU_THREAD_PRIORITY = 5,
CELL_SAIL_PARAMETER_SPURS_EXIT_IF_NO_WORK = 6,
// Source
CELL_SAIL_PARAMETER_IO_PPU_THREAD_PRIORITY = 7,
// Dmux
CELL_SAIL_PARAMETER_DMUX_PPU_THREAD_PRIORITY = 8,
CELL_SAIL_PARAMETER_DMUX_SPU_THREAD_PRIORITY = 9, // Deprecated
CELL_SAIL_PARAMETER_DMUX_NUM_OF_SPUS = 10,
CELL_SAIL_PARAMETER_DMUX_SPURS_TASK_PRIORITIES = 11,
// Adec
CELL_SAIL_PARAMETER_ADEC_PPU_THREAD_PRIORITY = 12,
CELL_SAIL_PARAMETER_ADEC_SPU_THREAD_PRIORITY = 13, // Deprecated
CELL_SAIL_PARAMETER_ADEC_NUM_OF_SPUS = 14,
CELL_SAIL_PARAMETER_ADEC_SPURS_TASK_PRIORITIES = 15,
// Vdec
CELL_SAIL_PARAMETER_VDEC_PPU_THREAD_PRIORITY = 16,
CELL_SAIL_PARAMETER_VDEC_SPU_THREAD_PRIORITY = 17, // Deprecated
CELL_SAIL_PARAMETER_VDEC_M2V_NUM_OF_SPUS = 18,
CELL_SAIL_PARAMETER_VDEC_AVC_NUM_OF_SPUS = 19,
CELL_SAIL_PARAMETER_VDEC_SPURS_TASK_PRIORITIES = 20,
// Vpost */
CELL_SAIL_PARAMETER_VPOST_PPU_THREAD_PRIORITY = 21, // Deprecated
CELL_SAIL_PARAMETER_VPOST_SPU_THREAD_PRIORITY = 22, // Deprecated
CELL_SAIL_PARAMETER_VPOST_NUM_OF_SPUS = 23,
CELL_SAIL_PARAMETER_VPOST_SPURS_TASK_PRIORITIES = 24,
// Graphics Adapter
CELL_SAIL_PARAMETER_GRAPHICS_ADAPTER_BUFFER_RELEASE_DELAY = 25,
// AV Sync
CELL_SAIL_PARAMETER_AV_SYNC_ES_AUDIO = 26,
CELL_SAIL_PARAMETER_AV_SYNC_ES_VIDEO = 27,
CELL_SAIL_PARAMETER_AV_SYNC_ES_USER = 28, // Not available
// Control
CELL_SAIL_PARAMETER_CONTROL_PPU_THREAD_STACK_SIZE = 29,
CELL_SAIL_PARAMETER_RESERVED0_ = 30, // Should be never used
CELL_SAIL_PARAMETER_RESERVED1 = 31, // Should be never used
// Apost
CELL_SAIL_PARAMETER_ENABLE_APOST_SRC = 32,
// File I/O Interface
CELL_SAIL_PARAMETER_FS = 33,
CELL_SAIL_PARAMETER_IO_PPU_THREAD_STACK_SIZE = 34,
CELL_SAIL_PARAMETER_VIDEO_PERFORMANCE_POLICY = 35,
_CELL_SAIL_PARAMETER_TYPE_NUM_OF_ELEMENTS = 36, // Should be never used
CELL_SAIL_PARAMETER_SOURCE_PPU_THREAD_PRIORITY = CELL_SAIL_PARAMETER_IO_PPU_THREAD_PRIORITY,
CELL_SAIL_PARAMETER_DMUX_SPURS_TASK_PRIORITY = CELL_SAIL_PARAMETER_DMUX_SPURS_TASK_PRIORITIES, // Deprecated
CELL_SAIL_PARAMETER_VDEC_SPURS_TASK_PRIORITY = CELL_SAIL_PARAMETER_VDEC_SPURS_TASK_PRIORITIES, // Deprecated
CELL_SAIL_PARAMETER_ADEC_SPURS_TASK_PRIORITY = CELL_SAIL_PARAMETER_ADEC_SPURS_TASK_PRIORITIES, // Deprecated
CELL_SAIL_PARAMETER_VPOST_SPURS_TASK_PRIORITY = CELL_SAIL_PARAMETER_VPOST_SPURS_TASK_PRIORITIES, // Deprecated
};
// Media states
enum {
CELL_SAIL_MEDIA_STATE_FINE = 0,
CELL_SAIL_MEDIA_STATE_BAD = 1,
CELL_SAIL_MEDIA_STATE_LOST = 2,
};
// Stream Types
enum
{
CELL_SAIL_STREAM_PAMF = 0,
CELL_SAIL_STREAM_MP4 = 1,
CELL_SAIL_STREAM_AVI = 2,
CELL_SAIL_STREAM_UNSPECIFIED = -1,
};
// Sync Types
enum {
CELL_SAIL_SYNC_MODE_REPEAT = 1 << 0,
CELL_SAIL_SYNC_MODE_SKIP = 1 << 1,
};
// Flags
enum {
CELL_SAIL_AVISF_DISABLED = 0x00000001,
CELL_SAIL_AVIF_HASINDEX = 0x00000010,
CELL_SAIL_AVIF_MUSTUSEINDEX = 0x00000020,
CELL_SAIL_AVIF_ISINTERLEAVED = 0x00000100,
CELL_SAIL_AVIF_WASCAPTUREFILE = 0x00010000,
CELL_SAIL_AVISF_VIDEO_PALCHANGES = 0x00010000,
CELL_SAIL_AVIF_COPYRIGHTED = 0x00020000,
CELL_SAIL_AVIF_TRUSTCKTYPE = 0x00000800, // Open-DML only
};
// Wave types
enum {
CELL_SAIL_WAVE_FORMAT_PCM = 0x0001,
CELL_SAIL_WAVE_FORMAT_MPEG = 0x0050,
CELL_SAIL_WAVE_FORMAT_MPEGLAYER3 = 0x0055,
CELL_SAIL_WAVE_FORMAT_AC3 = 0x2000,
CELL_SAIL_WAVE_FORMAT_UNSPECIFIED = 0xFFFF,
};
// MPEG Layers
enum {
CELL_SAIL_ACM_MPEG_LAYER1 = 0x0001,
CELL_SAIL_ACM_MPEG_LAYER2 = 0x0002,
CELL_SAIL_ACM_MPEG_LAYER3 = 0x0004,
};
// MPEG Modes
enum {
CELL_SAIL_ACM_MPEG_STEREO = 0x0001,
CELL_SAIL_ACM_MPEG_JOINTSTEREO = 0x0002,
CELL_SAIL_ACM_MPEG_DUALCHANNEL = 0x0004,
CELL_SAIL_ACM_MPEG_SINGLECHANNEL = 0x0008,
};
// MPEG Flags
enum {
CELL_SAIL_ACM_MPEG_PRIVATEBIT = 0x0001,
CELL_SAIL_ACM_MPEG_COPYRIGHT = 0x0002,
CELL_SAIL_ACM_MPEG_ORIGINALHOME = 0x0004,
CELL_SAIL_ACM_MPEG_PROTECTIONBIT = 0x0008,
CELL_SAIL_ACM_MPEG_ID_MPEG1 = 0x0010,
};
// MPEG Layer 3 Flags
enum {
CELL_SAIL_MPEGLAYER3_ID_UNKNOWN = 0,
CELL_SAIL_MPEGLAYER3_ID_MPEG = 1,
CELL_SAIL_MPEGLAYER3_ID_CONSTANTFRAMESIZE = 2,
CELL_SAIL_MPEGLAYER3_FLAG_PADDING_ISO = 0x00000000,
CELL_SAIL_MPEGLAYER3_FLAG_PADDING_ON = 0x00000001,
CELL_SAIL_MPEGLAYER3_FLAG_PADDING_OFF = 0x00000002,
};
// ES Types
enum {
CELL_SAIL_ES_AUDIO = 0,
CELL_SAIL_ES_VIDEO = 1,
CELL_SAIL_ES_USER = 2,
};
// Audio Coding Types
enum {
CELL_SAIL_AUDIO_CODING_UNSPECIFIED = -1,
CELL_SAIL_AUDIO_CODING_LPCM_FLOAT32 = 1,
};
enum {
CELL_SAIL_AUDIO_CHNUM_UNSPECIFIED = -1,
CELL_SAIL_AUDIO_CH_NUM_UNSPECIFIED = -1,
CELL_SAIL_AUDIO_AUSAMPLE_UNSPECIFIED = -1,
CELL_SAIL_AUDIO_SAMPLE_NUM_UNSPECIFIED = -1,
};
enum {
CELL_SAIL_AUDIO_FS_32000HZ = 32000,
CELL_SAIL_AUDIO_FS_44100HZ = 44100,
CELL_SAIL_AUDIO_FS_48000HZ = 48000,
CELL_SAIL_AUDIO_FS_96000HZ = 96000,
CELL_SAIL_AUDIO_FS_88200HZ = 88200,
CELL_SAIL_AUDIO_FS_64000HZ = 64000,
//CELL_SAIL_AUDIO_FS_48000HZ = 48000,
//CELL_SAIL_AUDIO_FS_44100HZ = 44100,
//CELL_SAIL_AUDIO_FS_32000HZ = 32000,
CELL_SAIL_AUDIO_FS_24000HZ = 24000,
CELL_SAIL_AUDIO_FS_22050HZ = 22050,
CELL_SAIL_AUDIO_FS_16000HZ = 16000,
CELL_SAIL_AUDIO_FS_12000HZ = 12000,
CELL_SAIL_AUDIO_FS_11025HZ = 11025,
CELL_SAIL_AUDIO_FS_8000HZ = 8000,
CELL_SAIL_AUDIO_FS_7350HZ = 7350,
CELL_SAIL_AUDIO_FS_192000HZ = 192000,
//CELL_SAIL_AUDIO_FS_11024HZ = 11025,
CELL_SAIL_AUDIO_FS_UNSPECIFIED = -1,
};
enum {
CELL_SAIL_AUDIO_CH_LAYOUT_UNDEFINED = 0,
// monoral
CELL_SAIL_AUDIO_CH_LAYOUT_1CH = 1,
// 1. Front Left
// 2. Front Right
CELL_SAIL_AUDIO_CH_LAYOUT_2CH_LR = 2,
// 1. Front Left
// 2. Front Center
// 3. Front Right
// for m4aac ac3
CELL_SAIL_AUDIO_CH_LAYOUT_3CH_LCR = 3,
// 1. Front Left
// 2. Front Center
// 3. Surround
// for m4aac ac3
CELL_SAIL_AUDIO_CH_LAYOUT_3CH_LRc = 4,
// 1. Front Left
// 2. Front Center
// 3. Front Right
// 4. Surround
// for m4aac ac3
CELL_SAIL_AUDIO_CH_LAYOUT_4CH_LCRc = 5,
// 1. Front Left
// 2. Front Right
// 3. Surround Left
// 4. Surround Right
// for m4aac
CELL_SAIL_AUDIO_CH_LAYOUT_4CH_LRlr = 6,
// 1. Front Left
// 2. Front Center
// 3. Front Right
// 4. Surround Left
// 5. Surround Right
// for m4aac
CELL_SAIL_AUDIO_CH_LAYOUT_5CH_LCRlr = 7,
// 1. Front Left
// 2. Front Center
// 3. Front Right
// 4. Surround Left
// 5. Surround Right
// 6. LFE
// for lpcm ac3 m4aac
CELL_SAIL_AUDIO_CH_LAYOUT_6CH_LCRlrE = 8,
// 1. Front Left
// 2. Front Center
// 3. Front Right
// 4. Back Left
// 5. Back Right
// 6. LFE
// for at3plus
CELL_SAIL_AUDIO_CH_LAYOUT_6CH_LCRxyE = 9,
// 1. Front Left
// 2. Front Center
// 3. Front Right
// 4. Back Left
// 5. Back Right
// 6. Back Center
// 7. LFE
// (for at3plus)
CELL_SAIL_AUDIO_CH_LAYOUT_7CH_LCRxycE = 10,
// 1. Front Left
// 2. Front Center
// 3. Front Right
// 4. LFE
// 5. Surround Left
// 6. Surround Right
// 7. Back Left (Left-Extend)
// 8. Back Right (Right-Extend)
// for lpcm at3plus
CELL_SAIL_AUDIO_CH_LAYOUT_8CH_LRCElrxy = 11,
CELL_SAIL_AUDIO_CH_LAYOUT_2CH_DUAL = 12,
CELL_SAIL_AUDIO_CH_LAYOUT_UNSPECIFIED = -1,
};
// Video Codings
enum {
CELL_SAIL_VIDEO_CODING_UNSPECIFIED = -1,
CELL_SAIL_VIDEO_CODING_ARGB_INTERLEAVED = 0,
CELL_SAIL_VIDEO_CODING_RGBA_INTERLEAVED = 1,
CELL_SAIL_VIDEO_CODING_YUV422_U_Y0_V_Y1 = 2,
CELL_SAIL_VIDEO_CODING_YUV420_PLANAR = 3,
// Suported by cellCamera
CELL_SAIL_VIDEO_CODING_YUV422_Y0_U_Y1_V = 4,
CELL_SAIL_VIDEO_CODING_YUV422_V_Y1_U_Y0 = 9,
CELL_SAIL_VIDEO_CODING_YUV422_Y1_V_Y0_U = 10,
CELL_SAIL_VIDEO_CODING_JPEG = 11,
CELL_SAIL_VIDEO_CODING_RAW8_BAYER_BGGR = 12,
_CELL_SAIL_VIDEO_CODING_TYPE_NUM_OF_ELEMENTS = 13,
CELL_SAIL_VIDEO_CODING_UYVY422_INTERLEAVED = 2,
CELL_SAIL_VIDEO_CODING_YUYV422_INTERLEAVED = 4,
CELL_SAIL_VIDEO_CODING_VYUY422_REVERSE_INTERLEAVED = 9,
CELL_SAIL_VIDEO_CODING_RAW8_BAYER_GRBG = 12,
};
// Video Color Types
enum {
CELL_SAIL_VIDEO_COLOR_MATRIX_UNSPECIFIED = -1,
CELL_SAIL_VIDEO_COLOR_MATRIX_BT601 = 0,
CELL_SAIL_VIDEO_COLOR_MATRIX_BT709 = 1,
_CELL_SAIL_VIDEO_COLOR_MATRIX_TYPE_NUM_OF_ELEMENTS = 2,
};
// Video Scan Types
enum {
CELL_SAIL_VIDEO_SCAN_UNSPECIFIED = -1,
CELL_SAIL_VIDEO_SCAN_PROGRESSIVE = 0,
CELL_SAIL_VIDEO_SCAN_INTERLACE = 1,
_CELL_SAIL_VIDEO_SCAN_TYPE_NUM_OF_ELEMENTS = 2,
};
// Framerates
enum {
CELL_SAIL_VIDEO_FRAME_RATE_UNSPECIFIED = -1,
CELL_SAIL_VIDEO_FRAME_RATE_24000_1001HZ = 0,
CELL_SAIL_VIDEO_FRAME_RATE_24HZ = 1,
CELL_SAIL_VIDEO_FRAME_RATE_25HZ = 2,
CELL_SAIL_VIDEO_FRAME_RATE_30000_1001HZ = 3,
CELL_SAIL_VIDEO_FRAME_RATE_30HZ = 4,
CELL_SAIL_VIDEO_FRAME_RATE_50HZ = 5,
CELL_SAIL_VIDEO_FRAME_RATE_60000_1001HZ = 6,
CELL_SAIL_VIDEO_FRAME_RATE_60HZ = 7,
_CELL_SAIL_VIDEO_FRAME_RATE_TYPE_NUM_OF_ELEMENTS = 8,
};
// Aspect Ratios
enum {
CELL_SAIL_VIDEO_ASPECT_RATIO_UNSPECIFIED = -1,
CELL_SAIL_VIDEO_ASPECT_RATIO_1_1 = 1, // 1920x1080 1280x720
CELL_SAIL_VIDEO_ASPECT_RATIO_12_11 = 2, // 720x576 normal
CELL_SAIL_VIDEO_ASPECT_RATIO_10_11 = 3, // 720x480 normal
CELL_SAIL_VIDEO_ASPECT_RATIO_16_11 = 4, // 720x576 wide
CELL_SAIL_VIDEO_ASPECT_RATIO_40_33 = 5, // 720x480 wide
CELL_SAIL_VIDEO_ASPECT_RATIO_4_3 = 14, // 1440x1080
};
enum {
CELL_SAIL_VIDEO_WIDTH_UNSPECIFIED = -1,
CELL_SAIL_VIDEO_HEIGHT_UNSPECIFIED = -1,
CELL_SAIL_VIDEO_PITCH_UNSPECIFIED = -1,
CELL_SAIL_VIDEO_BITS_PER_COLOR_UNSPECIFIED = -1,
CELL_SAIL_VIDEO_ALPHA_UNSPECIFIED = -1,
};
// Color Ranges
enum {
CELL_SAIL_VIDEO_COLOR_RANGE_UNSPECIFIED = -1,
CELL_SAIL_VIDEO_COLOR_RANGE_LIMITED = 1,
CELL_SAIL_VIDEO_COLOR_RANGE_FULL = 0,
};
enum {
CELL_SAIL_START_NOT_SPECIFIED = 0,
CELL_SAIL_START_NORMAL = 1 << 0, //1
CELL_SAIL_START_TIME_SCALE = 1 << 2, //4
CELL_SAIL_START_EP_SKIP = 1 << 4, //16
CELL_SAIL_START_EP_SKIP_REVERSE = 1 << 5, //32
CELL_SAIL_START_FRAME_STEP = 1 << 6, //64
};
// Seek Types
enum {
CELL_SAIL_SEEK_NOT_SPECIFIED = 0,
CELL_SAIL_SEEK_ABSOLUTE_BYTE_POSITION = 1 << 0, // For PAMF
CELL_SAIL_SEEK_RELATIVE_BYTE_POSITION = 1 << 1, // Not implemented
CELL_SAIL_SEEK_ABSOLUTE_TIME_POSITION = 1 << 4, // MP4, AVI
CELL_SAIL_SEEK_CURRENT_POSITION = 1 << 6,
CELL_SAIL_SEEK_MP4_SCALE_AND_TIME = 1 << 4, // For MP4, obsolete
};
// Terminus Types
enum {
CELL_SAIL_TERMINUS_NOT_SPECIFIED = 0,
CELL_SAIL_TERMINUS_EOS = 1 << 0,
CELL_SAIL_TERMINUS_ABSOLUTE_BYTE_POSITION = 1 << 1, // For PAMF
CELL_SAIL_TERMINUS_RELATIVE_BYTE_POSITION = 1 << 2, // Mot implemented
CELL_SAIL_TERMINUS_ABSOLUTE_TIME_POSITION = 1 << 5, // For MP4, AVI
CELL_SAIL_TERMINUS_MP4_SCALE_AND_TIME = 1 << 5, // For MP4, obsolete
CELL_SAIL_TERMINUS_MP4_SCALE_ANT_TIME = 1 << 5, // For MP4, here because of a typo
};
// Start Flag Types
enum {
CELL_SAIL_START_FLAG_NOT_SPECIFIED = 0,
CELL_SAIL_START_FLAG_UNFLUSH = 1 << 0,
CELL_SAIL_START_FLAG_PAUSE_BEGIN = 1 << 1,
CELL_SAIL_START_FLAG_PAUSE_END = 1 << 2,
CELL_SAIL_START_FLAG_COMPLETE_STREAM = 1 << 3,
CELL_SAIL_START_FLAG_STICKY = 1 << 4,
CELL_SAIL_START_FLAG_PAUSE = 1 << 1, // Obsolete
};
enum {
_CELL_SAIL_SYNC_SHIFT_NUM = 8,
// Buffering
CELL_SAIL_SYNC_UNDERFLOW = 1,
// = 2, Reserved
// Sync Status
CELL_SAIL_SYNC_ON_TIME = 1 << 2,
CELL_SAIL_SYNC_MAYBE_ON_TIME = 2 << 2,
CELL_SAIL_SYNC_EARLY = 3 << 2,
CELL_SAIL_SYNC_LATE = 4 << 2,
CELL_SAIL_SYNC_NO_SYNC = 5 << 2,
CELL_SAIL_SYNC_NO_PTS = 6 << 2,
CELL_SAIL_SYNC_NOT_READY = 7 << 2,
CELL_SAIL_SYNC_DISABLED = 8 << 2,
CELL_SAIL_SYNC_PAUSED = 9 << 2,
CELL_SAIL_SYNC_DISABLED_PAUSED = 10 << 2,
CELL_SAIL_SYNC_MUTED = 11 << 2,
CELL_SAIL_SYNC_DONE = 12 << 2,
// = 13 << 2, Reserved
// = 14 << 2, Reserved
// = 15 << 2, Reserved
//CELL_SAIL_SYNC_FIRST_FRAME = 64,
//CELL_SAIL_SYNC_LAST_FRAME = 128,
// Frame Status
CELL_SAIL_SYNC_NO_FRAME = 0,
CELL_SAIL_SYNC_REPEATED = 1 << _CELL_SAIL_SYNC_SHIFT_NUM,
CELL_SAIL_SYNC_NEXT = 2 << _CELL_SAIL_SYNC_SHIFT_NUM,
CELL_SAIL_SYNC_SKIPPED_ONE = 3 << _CELL_SAIL_SYNC_SHIFT_NUM,
};
enum {
CELL_SAIL_EVENT_RECORDER_CALL_COMPLETED = 2,
CELL_SAIL_EVENT_RECORDER_STATE_CHANGED = 3,
};
enum {
CELL_SAIL_VIDEO_FRAME_RATE_100HZ = 8,
CELL_SAIL_VIDEO_FRAME_RATE_120000_1001HZ = 9,
CELL_SAIL_VIDEO_FRAME_RATE_120HZ = 10,
};
enum {
CELL_SAIL_GRAPHICS_ADAPTER_FIELD_TOP = 0,
CELL_SAIL_GRAPHICS_ADAPTER_FIELD_BOTTOM = 1,
CELL_SAIL_GRAPHICS_ADAPTER_FIELD_DONT_CARE = 2,
};
enum {
CELL_SAIL_SOURCE_SEEK_ABSOLUTE_BYTE_POSITION = 1 << 0,
};
enum {
CELL_SAIL_SOURCE_CAPABILITY_NONE = 0,
CELL_SAIL_SOURCE_CAPABILITY_SEEK_ABSOLUTE_BYTE_POSITION = 1 << 0,
CELL_SAIL_SOURCE_CAPABILITY_PAUSE = 1 << 4,
CELL_SAIL_SOURCE_CAPABILITY_GAPLESS = 1 << 5,
CELL_SAIL_SOURCE_CAPABILITY_EOS = 1 << 6,
CELL_SAIL_SOURCE_CAPABILITY_SEEK_ABSOLUTE_TIME_POSITION = 1 << 7,
};
struct CellSailAudioFormat struct CellSailAudioFormat
{ {
s8 coding; s8 coding;
@ -105,8 +618,8 @@ union CellSailEvent
}; };
}; };
typedef void(*CellSailMemAllocatorFuncAlloc)(u32 pArg, u32 boundary, u32 size); typedef u32(*CellSailMemAllocatorFuncAlloc)(u32 pArg, u32 boundary, u32 size);
typedef void(*CellSailMemAllocatorFuncFree)(u32 pArg, u32 boundary, u32 pMemory); typedef u32(*CellSailMemAllocatorFuncFree)(u32 pArg, u32 boundary, u32 pMemory);
typedef int(*CellSailSoundAdapterFuncMakeup)(u32 pArg); typedef int(*CellSailSoundAdapterFuncMakeup)(u32 pArg);
typedef int(*CellSailSoundAdapterFuncCleanup)(u32 pArg); typedef int(*CellSailSoundAdapterFuncCleanup)(u32 pArg);
@ -172,7 +685,7 @@ struct CellSailMemAllocatorFuncs
struct CellSailMemAllocator struct CellSailMemAllocator
{ {
CellSailMemAllocatorFuncs callbacks; vm::ptr<CellSailMemAllocatorFuncs> callbacks;
be_t<u32> pArg; be_t<u32> pArg;
}; };
@ -522,6 +1035,9 @@ struct CellSailMpegLayer3WaveFormat
struct CellSailDescriptor struct CellSailDescriptor
{ {
bool autoSelection;
bool registered;
be_t<s32> streamType;
be_t<u64> internalData[32]; be_t<u64> internalData[32];
}; };
@ -577,5 +1093,13 @@ struct CellSailPlayerResource
struct CellSailPlayer struct CellSailPlayer
{ {
be_t<u64> internalData[128]; vm::ptr<CellSailMemAllocator> allocator;
vm::ptr<CellSailPlayerFuncNotified> callback;
be_t<u64> callbackArgument;
vm::ptr<CellSailPlayerAttribute> attribute;
vm::ptr<CellSailPlayerResource> resource;
vm::ptr<CellSailStartCommand> playbackCommand;
be_t<s32> repeatMode;
be_t<u32> descriptors;
vm::ptr<CellSailDescriptor> registeredDescriptors[2];
}; };

View File

@ -989,7 +989,7 @@ int cellSaveDataFixedExport() //const char *dirName, u32 maxSizeKB, CellSaveData
return CELL_SAVEDATA_RET_OK; return CELL_SAVEDATA_RET_OK;
} }
int cellSaveDataGetListItem() //const char *dirName, CellSaveDataDirStat *dir, CellSaveDataSystemFileParam *sysFileParam, vm::ptr<be_t<u32>> bind, vm::ptr<be_t<u32>> sizeKB int cellSaveDataGetListItem() //const char *dirName, CellSaveDataDirStat *dir, CellSaveDataSystemFileParam *sysFileParam, vm::ptr<u32> bind, vm::ptr<u32> sizeKB
{ {
UNIMPLEMENTED_FUNC(cellSysutil); UNIMPLEMENTED_FUNC(cellSysutil);
return CELL_SAVEDATA_RET_OK; return CELL_SAVEDATA_RET_OK;
@ -1025,7 +1025,7 @@ int cellSaveDataUserFixedExport() //CellSysutilUserId userId, const char *dirNam
return CELL_SAVEDATA_RET_OK; return CELL_SAVEDATA_RET_OK;
} }
int cellSaveDataUserGetListItem() //CellSysutilUserId userId, const char *dirName, CellSaveDataDirStat *dir, CellSaveDataSystemFileParam *sysFileParam, vm::ptr<be_t<u32>> bind, vm::ptr<be_t<u32>> sizeKB int cellSaveDataUserGetListItem() //CellSysutilUserId userId, const char *dirName, CellSaveDataDirStat *dir, CellSaveDataSystemFileParam *sysFileParam, vm::ptr<u32> bind, vm::ptr<u32> sizeKB
{ {
UNIMPLEMENTED_FUNC(cellSysutil); UNIMPLEMENTED_FUNC(cellSysutil);
return CELL_SAVEDATA_RET_OK; return CELL_SAVEDATA_RET_OK;

View File

@ -25,7 +25,7 @@ s64 spursCreateLv2EventQueue(vm::ptr<CellSpurs> spurs, u32& queue_id, vm::ptr<u8
{ {
#ifdef PRX_DEBUG_XXX #ifdef PRX_DEBUG_XXX
vm::var<be_t<u32>> queue; vm::var<be_t<u32>> queue;
s32 res = cb_call<s32, vm::ptr<CellSpurs>, vm::ptr<be_t<u32>>, vm::ptr<u8>, s32, u32>(GetCurrentPPUThread(), libsre + 0xB14C, libsre_rtoc, s32 res = cb_call<s32, vm::ptr<CellSpurs>, vm::ptr<u32>, vm::ptr<u8>, s32, u32>(GetCurrentPPUThread(), libsre + 0xB14C, libsre_rtoc,
spurs, queue, port, size, vm::read32(libsre_rtoc - 0x7E2C)); spurs, queue, port, size, vm::read32(libsre_rtoc - 0x7E2C));
queue_id = queue->ToLE(); queue_id = queue->ToLE();
return res; return res;
@ -60,6 +60,7 @@ s64 spursInit(
return cb_call<s32, vm::ptr<CellSpurs>, u32, u32, s32, s32, s32, u32, u32, u32, u32, u32, u32, u32>(GetCurrentPPUThread(), libsre + 0x74E4, libsre_rtoc, return cb_call<s32, vm::ptr<CellSpurs>, u32, u32, s32, s32, s32, u32, u32, u32, u32, u32, u32, u32>(GetCurrentPPUThread(), libsre + 0x74E4, libsre_rtoc,
spurs, revision, sdkVersion, nSpus, spuPriority, ppuPriority, flags, Memory.RealToVirtualAddr(prefix), prefixSize, container, Memory.RealToVirtualAddr(swlPriority), swlMaxSpu, swlIsPreem); spurs, revision, sdkVersion, nSpus, spuPriority, ppuPriority, flags, Memory.RealToVirtualAddr(prefix), prefixSize, container, Memory.RealToVirtualAddr(swlPriority), swlMaxSpu, swlIsPreem);
#endif #endif
// SPURS initialization (asserts should actually rollback and return the error instead) // SPURS initialization (asserts should actually rollback and return the error instead)
if (!spurs) if (!spurs)
@ -170,13 +171,267 @@ s64 spursInit(
SPU.GPR[4]._u64[1] = spurs.addr(); SPU.GPR[4]._u64[1] = spurs.addr();
return SPU.FastCall(SPU.PC); return SPU.FastCall(SPU.PC);
#endif #endif
//SPU.WriteLS32(0x808, 2); // hack for cellSpursModuleExit
//SPU.WriteLS32(0x260, 3); // hack for cellSpursModulePollStatus // code replacement:
//SPU.WriteLS32(0x264, 0x35000000); // bi $0 {
const u32 addr = /*SPU.ReadLS32(0x1e0) +*/ 8; //SPU.ReadLS32(0x1e4);
SPU.WriteLS32(addr + 0, 3); // hack for cellSpursModulePollStatus
SPU.WriteLS32(addr + 4, 0x35000000); // bi $0
SPU.WriteLS32(0x1e4, addr);
SPU.WriteLS32(SPU.ReadLS32(0x1e0), 2); // hack for cellSpursModuleExit
}
if (!isSecond) SPU.m_code3_func = [spurs, num](SPUThread& SPU) -> u64 // first kernel
{
LV2_LOCK(0); // TODO: lock-free implementation if possible
const u32 arg1 = SPU.GPR[3]._u32[3];
u32 var0 = SPU.ReadLS32(0x1d8);
u32 var1 = SPU.ReadLS32(0x1dc);
u128 wklA = vm::read128(spurs.addr() + 0x20);
u128 wklB = vm::read128(spurs.addr() + 0x30);
u128 savedA = SPU.ReadLS128(0x180);
u128 savedB = SPU.ReadLS128(0x190);
u128 vAA = u128::sub8(wklA, savedA);
u128 vBB = u128::sub8(wklB, savedB);
u128 vM1 = {}; if (var1 <= 15) vM1.u8r[var1] = 0xff;
u128 vAABB = (arg1 == 0) ? vAA : u128::add8(vAA, u128::andnot(vM1, vBB));
u32 vNUM = 0x20;
u64 vRES = 0x20ull << 32;
u128 vSET = {};
if (spurs->m.x72.read_relaxed() & (1 << num))
{
SPU.WriteLS8(0x1eb, 0); // var4
if (arg1 == 0 || var1 == 0x20)
{
spurs->m.x72._and_not(1 << num);
}
}
else
{
u128 wklReadyCount0 = vm::read128(spurs.addr() + 0x0);
u128 wklReadyCount1 = vm::read128(spurs.addr() + 0x10);
u128 savedC = SPU.ReadLS128(0x1A0);
u128 savedD = SPU.ReadLS128(0x1B0);
u128 vRC = u128::add8(u128::minu8(wklReadyCount0, u128::from8p(8)), u128::minu8(wklReadyCount1, u128::from8p(8)));
u32 wklFlag = spurs->m.wklFlag.flag.read_relaxed();
u32 flagRecv = spurs->m.flagRecv.read_relaxed();
u128 vFM = u128::fromV(g_imm_table.fsmb_table[(wklFlag == 0) && (flagRecv < 16) ? 0x8000 >> flagRecv : 0]);
u128 wklSet1 = u128::fromV(g_imm_table.fsmb_table[spurs->m.wklSet1.read_relaxed()]);
u128 vFMS1 = vFM | wklSet1;
u128 vFMV1 = u128::fromV(g_imm_table.fsmb_table[(var1 < 16) ? 0x8000 >> var1 : 0]);
u32 var5 = SPU.ReadLS32(0x1ec);
u128 wklMinCnt = vm::read128(spurs.addr() + 0x40);
u128 wklMaxCnt = vm::read128(spurs.addr() + 0x50);
u128 vCC = u128::andnot(vFMS1, u128::eq8(wklReadyCount0, {}) | u128::leu8(vRC, vAABB)) |
u128::leu8(wklMaxCnt, vAABB) |
u128::eq8(savedC, {}) |
u128::fromV(g_imm_table.fsmb_table[(~var5) >> 16]);
u128 vCCH1 = u128::andnot(vCC,
u128::from8p(0x80) & (vFMS1 | u128::gtu8(wklReadyCount0, vAABB)) |
u128::from8p(0x7f) & savedC);
u128 vCCL1 = u128::andnot(vCC,
u128::from8p(0x80) & vFMV1 |
u128::from8p(0x40) & u128::gtu8(vAABB, {}) & u128::gtu8(wklMinCnt, vAABB) |
u128::from8p(0x3c) & u128::fromV(_mm_slli_epi32(u128::sub8(u128::from8p(8), vAABB).vi, 2)) |
u128::from8p(0x02) & u128::eq8(savedD, u128::from8p((u8)var0)) |
u128::from8p(0x01));
u128 vSTAT =
u128::from8p(0x01) & u128::gtu8(wklReadyCount0, vAABB) |
u128::from8p(0x02) & wklSet1 |
u128::from8p(0x04) & vFM;
for (s32 i = 0, max = -1; i < 0x10; i++)
{
const s32 value = ((s32)vCCH1.u8r[i] << 8) | ((s32)vCCL1.u8r[i]);
if (value > max && (vCC.u8r[i] & 1) == 0)
{
vNUM = i;
max = value;
}
}
if (vNUM < 0x10)
{
vRES = ((u64)vNUM << 32) | vSTAT.u8r[vNUM];
vSET.u8r[vNUM] = 0x01;
}
SPU.WriteLS8(0x1eb, vNUM == 0x20);
if (!arg1 || var1 == vNUM)
{
spurs->m.wklSet1._and_not(be_t<u16>::make((u16)(vNUM < 16 ? 0x8000 >> vNUM : 0)));
if (vNUM == flagRecv && wklFlag == 0)
{
spurs->m.wklFlag.flag.write_relaxed(be_t<u32>::make(-1));
}
}
}
if (arg1 == 0)
{
vm::write128(spurs.addr() + 0x20, u128::add8(vAA, vSET)); // update wklA
SPU.WriteLS128(0x180, vSET); // update savedA
SPU.WriteLS32(0x1dc, vNUM); // update var1
}
if (arg1 == 1 && vNUM != var1)
{
vm::write128(spurs.addr() + 0x30, u128::add8(vBB, vSET)); // update wklB
SPU.WriteLS128(0x190, vSET); // update savedB
}
else
{
vm::write128(spurs.addr() + 0x30, vBB); // update wklB
SPU.WriteLS128(0x190, {}); // update savedB
}
return vRES;
};
else SPU.m_code3_func = [spurs, num](SPUThread& SPU) -> u64 // second kernel
{
LV2_LOCK(0); // TODO: lock-free implementation if possible
const u32 arg1 = SPU.GPR[3]._u32[3];
u32 var0 = SPU.ReadLS32(0x1d8);
u32 var1 = SPU.ReadLS32(0x1dc);
u128 wklA = vm::read128(spurs.addr() + 0x20);
u128 wklB = vm::read128(spurs.addr() + 0x30);
u128 savedA = SPU.ReadLS128(0x180);
u128 savedB = SPU.ReadLS128(0x190);
u128 vAA = u128::sub8(wklA, savedA);
u128 vBB = u128::sub8(wklB, savedB);
u128 vM1 = {}; if (var1 <= 31) vM1.u8r[var1 & 0xf] = (var1 <= 15) ? 0xf : 0xf0;
u128 vAABB = (arg1 == 0) ? vAA : u128::add8(vAA, u128::andnot(vM1, vBB));
u32 vNUM = 0x20;
u64 vRES = 0x20ull << 32;
u128 vSET = {};
if (spurs->m.x72.read_relaxed() & (1 << num))
{
SPU.WriteLS8(0x1eb, 0); // var4
if (arg1 == 0 || var1 == 0x20)
{
spurs->m.x72._and_not(1 << num);
}
}
else
{
u128 wklReadyCount0 = vm::read128(spurs.addr() + 0x0);
u128 wklReadyCount1 = vm::read128(spurs.addr() + 0x10);
u128 savedC = SPU.ReadLS128(0x1A0);
u128 wklMaxCnt = vm::read128(spurs.addr() + 0x50);
u32 wklFlag = spurs->m.wklFlag.flag.read_relaxed();
u32 flagRecv = spurs->m.flagRecv.read_relaxed();
u128 wklSet1 = u128::fromV(g_imm_table.fsmb_table[spurs->m.wklSet1.read_relaxed()]);
u128 wklSet2 = u128::fromV(g_imm_table.fsmb_table[spurs->m.wklSet2.read_relaxed()]);
u128 vABL = vAABB & u128::from8p(0x0f);
u128 vABH = u128::fromV(_mm_srli_epi32((vAABB & u128::from8p(0xf0)).vi, 4));
u32 var5 = SPU.ReadLS32(0x1ec);
u128 v5L = u128::fromV(g_imm_table.fsmb_table[var5 >> 16]);
u128 v5H = u128::fromV(g_imm_table.fsmb_table[(u16)var5]);
u128 vFML = u128::fromV(g_imm_table.fsmb_table[(wklFlag == 0) && (flagRecv < 16) ? 0x8000 >> flagRecv : 0]);
u128 vFMH = u128::fromV(g_imm_table.fsmb_table[(u16)((wklFlag == 0) && (flagRecv < 32) ? 0x80000000 >> flagRecv : 0)]);
u128 vCL = u128::fromV(_mm_slli_epi32((savedC & u128::from8p(0x0f)).vi, 4));
u128 vCH = savedC & u128::from8p(0xf0);
u128 vABRL = u128::gtu8(wklReadyCount0, vABL);
u128 vABRH = u128::gtu8(wklReadyCount1, vABH);
u128 vCCL = v5L & u128::gtu8(vCL, {}) & u128::gtu8(wklMaxCnt & u128::from8p(0x0f), vABL) & (wklSet1 | vFML | vABRL);
u128 vCCH = v5H & u128::gtu8(vCH, {}) & u128::gtu8(u128::fromV(_mm_srli_epi32((wklMaxCnt & u128::from8p(0xf0)).vi, 4)), vABH) & (wklSet2 | vFMH | vABRH);
u128 v1H = {}; if (var1 <= 31 && var1 > 15) v1H.u8r[var1 & 0xf] = 4;
u128 v1L = {}; if (var1 <= 15) v1L.u8r[var1] = 4;
u128 vCH1 = (v1H | vCH & u128::from8p(0xFB)) & vCCH;
u128 vCL1 = (v1L | vCL & u128::from8p(0xFB)) & vCCL;
u128 vSTATL = vABRL & u128::from8p(1) | wklSet1 & u128::from8p(2) | vFML & u128::from8p(4);
u128 vSTATH = vABRH & u128::from8p(1) | wklSet2 & u128::from8p(2) | vFMH & u128::from8p(4);
s32 max = -1;
for (u32 i = 0; i < 0x10; i++)
{
const s32 value = vCL1.u8r[i];
if (value > max && (vCCL.u8r[i] & 1))
{
vNUM = i;
max = value;
}
}
for (u32 i = 16; i < 0x20; i++)
{
const s32 value = vCH1.u8r[i];
if (value > max && (vCCH.u8r[i] & 1))
{
vNUM = i;
max = value;
}
}
if (vNUM < 0x10)
{
vRES = ((u64)vNUM << 32) | vSTATL.u8r[vNUM];
vSET.u8r[vNUM] = 0x01;
}
else if (vNUM < 0x20)
{
vRES = ((u64)vNUM << 32) | vSTATH.u8r[vNUM & 0xf];
vSET.u8r[vNUM] = 0x10;
}
SPU.WriteLS8(0x1eb, vNUM == 0x20);
if (!arg1 || var1 == vNUM)
{
spurs->m.wklSet1._and_not(be_t<u16>::make((u16)(vNUM < 16 ? 0x8000 >> vNUM : 0)));
spurs->m.wklSet2._and_not(be_t<u16>::make((u16)(0x80000000 >> vNUM)));
if (vNUM == flagRecv && wklFlag == 0)
{
spurs->m.wklFlag.flag.write_relaxed(be_t<u32>::make(-1));
}
}
}
if (arg1 == 0)
{
vm::write128(spurs.addr() + 0x20, u128::add8(vAA, vSET)); // update wklA
SPU.WriteLS128(0x180, vSET); // update savedA
SPU.WriteLS32(0x1dc, vNUM); // update var1
}
if (arg1 == 1 && vNUM != var1)
{
vm::write128(spurs.addr() + 0x30, u128::add8(vBB, vSET)); // update wklB
SPU.WriteLS128(0x190, vSET); // update savedB
}
else
{
vm::write128(spurs.addr() + 0x30, vBB); // update wklB
SPU.WriteLS128(0x190, {}); // update savedB
}
return vRES;
};
//SPU.m_code3_func = [spurs, num](SPUThread& SPU) -> u64 // test
//{
// LV2_LOCK(0);
// SPU.FastCall(0x290);
// u64 vRES = SPU.GPR[3]._u64[1];
// return vRES;
//};
SPU.WriteLS128(0x1c0, u128::from32r(0, spurs.addr(), num, 0x1f)); SPU.WriteLS128(0x1c0, u128::from32r(0, spurs.addr(), num, 0x1f));
u32 wid = 0x20; u32 wid = 0x20;
u32 stat = 0;
while (true) while (true)
{ {
if (Emu.IsStopped()) if (Emu.IsStopped())
@ -202,7 +457,7 @@ s64 spursInit(
SPU.GPR[1]._u32[3] = 0x3FFB0; SPU.GPR[1]._u32[3] = 0x3FFB0;
SPU.GPR[3]._u32[3] = 0x100; SPU.GPR[3]._u32[3] = 0x100;
SPU.GPR[4]._u64[1] = wkl.data; SPU.GPR[4]._u64[1] = wkl.data;
SPU.GPR[5]._u32[3] = 0; SPU.GPR[5]._u32[3] = stat;
SPU.FastCall(0xa00); SPU.FastCall(0xa00);
// check status: // check status:
@ -217,8 +472,11 @@ s64 spursInit(
} }
// get workload id: // get workload id:
//SPU.GPR[3].clear(); SPU.GPR[3].clear();
//wid = SPU.m_code3_func(SPU); assert(SPU.m_code3_func);
u64 res = SPU.m_code3_func(SPU);
stat = (u32)(res);
wid = (u32)(res >> 32);
} }
})->GetId(); })->GetId();
@ -262,6 +520,7 @@ s64 spursInit(
#ifdef PRX_DEBUG_XXX #ifdef PRX_DEBUG_XXX
return cb_call<void, vm::ptr<CellSpurs>>(CPU, libsre + 0x9214, libsre_rtoc, spurs); return cb_call<void, vm::ptr<CellSpurs>>(CPU, libsre + 0x9214, libsre_rtoc, spurs);
#endif #endif
if (spurs->m.flags & SAF_UNKNOWN_FLAG_30) if (spurs->m.flags & SAF_UNKNOWN_FLAG_30)
{ {
return; return;
@ -346,7 +605,7 @@ s64 spursInit(
if (Emu.IsStopped()) continue; if (Emu.IsStopped()) continue;
assert(sys_spu_thread_group_start(spurs->m.spuTG) == CELL_OK); assert(sys_spu_thread_group_start(spurs->m.spuTG) == CELL_OK);
if (s32 res = sys_spu_thread_group_join(spurs->m.spuTG, vm::ptr<be_t<u32>>::make(0), vm::ptr<be_t<u32>>::make(0))) if (s32 res = sys_spu_thread_group_join(spurs->m.spuTG, vm::ptr<u32>::make(0), vm::ptr<u32>::make(0)))
{ {
if (res == CELL_ESTAT) if (res == CELL_ESTAT)
{ {
@ -408,10 +667,10 @@ s64 cellSpursInitialize(vm::ptr<CellSpurs> spurs, s32 nSpus, s32 spuPriority, s3
{ {
cellSpurs->Warning("cellSpursInitialize(spurs_addr=0x%x, nSpus=%d, spuPriority=%d, ppuPriority=%d, exitIfNoWork=%d)", cellSpurs->Warning("cellSpursInitialize(spurs_addr=0x%x, nSpus=%d, spuPriority=%d, ppuPriority=%d, exitIfNoWork=%d)",
spurs.addr(), nSpus, spuPriority, ppuPriority, exitIfNoWork ? 1 : 0); spurs.addr(), nSpus, spuPriority, ppuPriority, exitIfNoWork ? 1 : 0);
#ifdef PRX_DEBUG_XXX #ifdef PRX_DEBUG_XXX
return GetCurrentPPUThread().FastCall2(libsre + 0x8480, libsre_rtoc); return GetCurrentPPUThread().FastCall2(libsre + 0x8480, libsre_rtoc);
#endif #endif
return spursInit( return spursInit(
spurs, spurs,
0, 0,
@ -431,10 +690,10 @@ s64 cellSpursInitialize(vm::ptr<CellSpurs> spurs, s32 nSpus, s32 spuPriority, s3
s64 cellSpursInitializeWithAttribute(vm::ptr<CellSpurs> spurs, vm::ptr<const CellSpursAttribute> attr) s64 cellSpursInitializeWithAttribute(vm::ptr<CellSpurs> spurs, vm::ptr<const CellSpursAttribute> attr)
{ {
cellSpurs->Warning("cellSpursInitializeWithAttribute(spurs_addr=0x%x, attr_addr=0x%x)", spurs.addr(), attr.addr()); cellSpurs->Warning("cellSpursInitializeWithAttribute(spurs_addr=0x%x, attr_addr=0x%x)", spurs.addr(), attr.addr());
#ifdef PRX_DEBUG_XXX #ifdef PRX_DEBUG_XXX
return GetCurrentPPUThread().FastCall2(libsre + 0x839C, libsre_rtoc); return GetCurrentPPUThread().FastCall2(libsre + 0x839C, libsre_rtoc);
#endif #endif
if (!attr) if (!attr)
{ {
return CELL_SPURS_CORE_ERROR_NULL_POINTER; return CELL_SPURS_CORE_ERROR_NULL_POINTER;
@ -467,10 +726,10 @@ s64 cellSpursInitializeWithAttribute(vm::ptr<CellSpurs> spurs, vm::ptr<const Cel
s64 cellSpursInitializeWithAttribute2(vm::ptr<CellSpurs> spurs, vm::ptr<const CellSpursAttribute> attr) s64 cellSpursInitializeWithAttribute2(vm::ptr<CellSpurs> spurs, vm::ptr<const CellSpursAttribute> attr)
{ {
cellSpurs->Warning("cellSpursInitializeWithAttribute2(spurs_addr=0x%x, attr_addr=0x%x)", spurs.addr(), attr.addr()); cellSpurs->Warning("cellSpursInitializeWithAttribute2(spurs_addr=0x%x, attr_addr=0x%x)", spurs.addr(), attr.addr());
#ifdef PRX_DEBUG_XXX #ifdef PRX_DEBUG_XXX
return GetCurrentPPUThread().FastCall2(libsre + 0x82B4, libsre_rtoc); return GetCurrentPPUThread().FastCall2(libsre + 0x82B4, libsre_rtoc);
#endif #endif
if (!attr) if (!attr)
{ {
return CELL_SPURS_CORE_ERROR_NULL_POINTER; return CELL_SPURS_CORE_ERROR_NULL_POINTER;
@ -504,10 +763,10 @@ s64 _cellSpursAttributeInitialize(vm::ptr<CellSpursAttribute> attr, u32 revision
{ {
cellSpurs->Warning("_cellSpursAttributeInitialize(attr_addr=0x%x, revision=%d, sdkVersion=0x%x, nSpus=%d, spuPriority=%d, ppuPriority=%d, exitIfNoWork=%d)", cellSpurs->Warning("_cellSpursAttributeInitialize(attr_addr=0x%x, revision=%d, sdkVersion=0x%x, nSpus=%d, spuPriority=%d, ppuPriority=%d, exitIfNoWork=%d)",
attr.addr(), revision, sdkVersion, nSpus, spuPriority, ppuPriority, exitIfNoWork ? 1 : 0); attr.addr(), revision, sdkVersion, nSpus, spuPriority, ppuPriority, exitIfNoWork ? 1 : 0);
#ifdef PRX_DEBUG_XXX #ifdef PRX_DEBUG_XXX
return GetCurrentPPUThread().FastCall2(libsre + 0x72CC, libsre_rtoc); return GetCurrentPPUThread().FastCall2(libsre + 0x72CC, libsre_rtoc);
#endif #endif
if (!attr) if (!attr)
{ {
return CELL_SPURS_CORE_ERROR_NULL_POINTER; return CELL_SPURS_CORE_ERROR_NULL_POINTER;
@ -530,10 +789,10 @@ s64 _cellSpursAttributeInitialize(vm::ptr<CellSpursAttribute> attr, u32 revision
s64 cellSpursAttributeSetMemoryContainerForSpuThread(vm::ptr<CellSpursAttribute> attr, u32 container) s64 cellSpursAttributeSetMemoryContainerForSpuThread(vm::ptr<CellSpursAttribute> attr, u32 container)
{ {
cellSpurs->Warning("cellSpursAttributeSetMemoryContainerForSpuThread(attr_addr=0x%x, container=%d)", attr.addr(), container); cellSpurs->Warning("cellSpursAttributeSetMemoryContainerForSpuThread(attr_addr=0x%x, container=%d)", attr.addr(), container);
#ifdef PRX_DEBUG_XXX #ifdef PRX_DEBUG_XXX
return GetCurrentPPUThread().FastCall2(libsre + 0x6FF8, libsre_rtoc); return GetCurrentPPUThread().FastCall2(libsre + 0x6FF8, libsre_rtoc);
#endif #endif
if (!attr) if (!attr)
{ {
return CELL_SPURS_CORE_ERROR_NULL_POINTER; return CELL_SPURS_CORE_ERROR_NULL_POINTER;
@ -556,10 +815,10 @@ s64 cellSpursAttributeSetMemoryContainerForSpuThread(vm::ptr<CellSpursAttribute>
s64 cellSpursAttributeSetNamePrefix(vm::ptr<CellSpursAttribute> attr, vm::ptr<const char> prefix, u32 size) s64 cellSpursAttributeSetNamePrefix(vm::ptr<CellSpursAttribute> attr, vm::ptr<const char> prefix, u32 size)
{ {
cellSpurs->Warning("cellSpursAttributeSetNamePrefix(attr_addr=0x%x, prefix_addr=0x%x, size=%d)", attr.addr(), prefix.addr(), size); cellSpurs->Warning("cellSpursAttributeSetNamePrefix(attr_addr=0x%x, prefix_addr=0x%x, size=%d)", attr.addr(), prefix.addr(), size);
#ifdef PRX_DEBUG_XXX #ifdef PRX_DEBUG_XXX
return GetCurrentPPUThread().FastCall2(libsre + 0x7234, libsre_rtoc); return GetCurrentPPUThread().FastCall2(libsre + 0x7234, libsre_rtoc);
#endif #endif
if (!attr || !prefix) if (!attr || !prefix)
{ {
return CELL_SPURS_CORE_ERROR_NULL_POINTER; return CELL_SPURS_CORE_ERROR_NULL_POINTER;
@ -582,10 +841,10 @@ s64 cellSpursAttributeSetNamePrefix(vm::ptr<CellSpursAttribute> attr, vm::ptr<co
s64 cellSpursAttributeEnableSpuPrintfIfAvailable(vm::ptr<CellSpursAttribute> attr) s64 cellSpursAttributeEnableSpuPrintfIfAvailable(vm::ptr<CellSpursAttribute> attr)
{ {
cellSpurs->Warning("cellSpursAttributeEnableSpuPrintfIfAvailable(attr_addr=0x%x)", attr.addr()); cellSpurs->Warning("cellSpursAttributeEnableSpuPrintfIfAvailable(attr_addr=0x%x)", attr.addr());
#ifdef PRX_DEBUG_XXX #ifdef PRX_DEBUG_XXX
return GetCurrentPPUThread().FastCall2(libsre + 0x7150, libsre_rtoc); return GetCurrentPPUThread().FastCall2(libsre + 0x7150, libsre_rtoc);
#endif #endif
if (!attr) if (!attr)
{ {
return CELL_SPURS_CORE_ERROR_NULL_POINTER; return CELL_SPURS_CORE_ERROR_NULL_POINTER;
@ -602,10 +861,10 @@ s64 cellSpursAttributeEnableSpuPrintfIfAvailable(vm::ptr<CellSpursAttribute> att
s64 cellSpursAttributeSetSpuThreadGroupType(vm::ptr<CellSpursAttribute> attr, s32 type) s64 cellSpursAttributeSetSpuThreadGroupType(vm::ptr<CellSpursAttribute> attr, s32 type)
{ {
cellSpurs->Warning("cellSpursAttributeSetSpuThreadGroupType(attr_addr=0x%x, type=%d)", attr.addr(), type); cellSpurs->Warning("cellSpursAttributeSetSpuThreadGroupType(attr_addr=0x%x, type=%d)", attr.addr(), type);
#ifdef PRX_DEBUG_XXX #ifdef PRX_DEBUG_XXX
return GetCurrentPPUThread().FastCall2(libsre + 0x70C8, libsre_rtoc); return GetCurrentPPUThread().FastCall2(libsre + 0x70C8, libsre_rtoc);
#endif #endif
if (!attr) if (!attr)
{ {
return CELL_SPURS_CORE_ERROR_NULL_POINTER; return CELL_SPURS_CORE_ERROR_NULL_POINTER;
@ -638,10 +897,10 @@ s64 cellSpursAttributeEnableSystemWorkload(vm::ptr<CellSpursAttribute> attr, vm:
{ {
cellSpurs->Warning("cellSpursAttributeEnableSystemWorkload(attr_addr=0x%x, priority_addr=0x%x, maxSpu=%d, isPreemptible_addr=0x%x)", cellSpurs->Warning("cellSpursAttributeEnableSystemWorkload(attr_addr=0x%x, priority_addr=0x%x, maxSpu=%d, isPreemptible_addr=0x%x)",
attr.addr(), priority.addr(), maxSpu, isPreemptible.addr()); attr.addr(), priority.addr(), maxSpu, isPreemptible.addr());
#ifdef PRX_DEBUG_XXX #ifdef PRX_DEBUG_XXX
return GetCurrentPPUThread().FastCall2(libsre + 0xF410, libsre_rtoc); return GetCurrentPPUThread().FastCall2(libsre + 0xF410, libsre_rtoc);
#endif #endif
if (!attr) if (!attr)
{ {
return CELL_SPURS_CORE_ERROR_NULL_POINTER; return CELL_SPURS_CORE_ERROR_NULL_POINTER;
@ -694,11 +953,11 @@ s64 cellSpursAttributeEnableSystemWorkload(vm::ptr<CellSpursAttribute> attr, vm:
s64 cellSpursFinalize(vm::ptr<CellSpurs> spurs) s64 cellSpursFinalize(vm::ptr<CellSpurs> spurs)
{ {
cellSpurs->Warning("cellSpursFinalize(spurs_addr=0x%x)", spurs.addr()); cellSpurs->Todo("cellSpursFinalize(spurs_addr=0x%x)", spurs.addr());
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
return GetCurrentPPUThread().FastCall2(libsre + 0x8568, libsre_rtoc); return GetCurrentPPUThread().FastCall2(libsre + 0x8568, libsre_rtoc);
#endif #endif
return CELL_OK; return CELL_OK;
} }
@ -708,6 +967,7 @@ s64 spursAttachLv2EventQueue(vm::ptr<CellSpurs> spurs, u32 queue, vm::ptr<u8> po
return cb_call<s32, vm::ptr<CellSpurs>, u32, vm::ptr<u8>, s32, bool>(GetCurrentPPUThread(), libsre + 0xAE34, libsre_rtoc, return cb_call<s32, vm::ptr<CellSpurs>, u32, vm::ptr<u8>, s32, bool>(GetCurrentPPUThread(), libsre + 0xAE34, libsre_rtoc,
spurs, queue, port, isDynamic, wasCreated); spurs, queue, port, isDynamic, wasCreated);
#endif #endif
if (!spurs || !port) if (!spurs || !port)
{ {
return CELL_SPURS_CORE_ERROR_NULL_POINTER; return CELL_SPURS_CORE_ERROR_NULL_POINTER;
@ -767,10 +1027,10 @@ s64 cellSpursAttachLv2EventQueue(vm::ptr<CellSpurs> spurs, u32 queue, vm::ptr<u8
{ {
cellSpurs->Warning("cellSpursAttachLv2EventQueue(spurs_addr=0x%x, queue=%d, port_addr=0x%x, isDynamic=%d)", cellSpurs->Warning("cellSpursAttachLv2EventQueue(spurs_addr=0x%x, queue=%d, port_addr=0x%x, isDynamic=%d)",
spurs.addr(), queue, port.addr(), isDynamic); spurs.addr(), queue, port.addr(), isDynamic);
#ifdef PRX_DEBUG_XXX #ifdef PRX_DEBUG_XXX
return GetCurrentPPUThread().FastCall2(libsre + 0xAFE0, libsre_rtoc); return GetCurrentPPUThread().FastCall2(libsre + 0xAFE0, libsre_rtoc);
#endif #endif
return spursAttachLv2EventQueue(spurs, queue, port, isDynamic, false); return spursAttachLv2EventQueue(spurs, queue, port, isDynamic, false);
} }
@ -796,37 +1056,69 @@ s64 cellSpursGetSpuGuid()
#endif #endif
} }
s64 cellSpursGetSpuThreadGroupId(vm::ptr<CellSpurs> spurs, vm::ptr<be_t<u32>> group) s64 cellSpursGetSpuThreadGroupId(vm::ptr<CellSpurs> spurs, vm::ptr<u32> group)
{ {
#ifdef PRX_DEBUG
cellSpurs->Warning("cellSpursGetSpuThreadGroupId(spurs_addr=0x%x, group_addr=0x%x)", spurs.addr(), group.addr()); cellSpurs->Warning("cellSpursGetSpuThreadGroupId(spurs_addr=0x%x, group_addr=0x%x)", spurs.addr(), group.addr());
#ifdef PRX_DEBUG_XXX
return GetCurrentPPUThread().FastCall2(libsre + 0x8B30, libsre_rtoc); return GetCurrentPPUThread().FastCall2(libsre + 0x8B30, libsre_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpurs);
return CELL_OK;
#endif #endif
if (!spurs || !group)
{
return CELL_SPURS_CORE_ERROR_NULL_POINTER;
}
if (spurs.addr() % 128)
{
return CELL_SPURS_CORE_ERROR_ALIGN;
}
*group = spurs->m.spuTG;
return CELL_OK;
} }
s64 cellSpursGetNumSpuThread(vm::ptr<CellSpurs> spurs, vm::ptr<be_t<u32>> nThreads) s64 cellSpursGetNumSpuThread(vm::ptr<CellSpurs> spurs, vm::ptr<u32> nThreads)
{ {
#ifdef PRX_DEBUG
cellSpurs->Warning("cellSpursGetNumSpuThread(spurs_addr=0x%x, nThreads_addr=0x%x)", spurs.addr(), nThreads.addr()); cellSpurs->Warning("cellSpursGetNumSpuThread(spurs_addr=0x%x, nThreads_addr=0x%x)", spurs.addr(), nThreads.addr());
#ifdef PRX_DEBUG_XXX
return GetCurrentPPUThread().FastCall2(libsre + 0x8B78, libsre_rtoc); return GetCurrentPPUThread().FastCall2(libsre + 0x8B78, libsre_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpurs);
return CELL_OK;
#endif #endif
if (!spurs || !nThreads)
{
return CELL_SPURS_CORE_ERROR_NULL_POINTER;
}
if (spurs.addr() % 128)
{
return CELL_SPURS_CORE_ERROR_ALIGN;
}
*nThreads = (u32)spurs->m.nSpus;
return CELL_OK;
} }
s64 cellSpursGetSpuThreadId(vm::ptr<CellSpurs> spurs, vm::ptr<be_t<u32>> thread, vm::ptr<be_t<u32>> nThreads) s64 cellSpursGetSpuThreadId(vm::ptr<CellSpurs> spurs, vm::ptr<u32> thread, vm::ptr<u32> nThreads)
{ {
#ifdef PRX_DEBUG
cellSpurs->Warning("cellSpursGetSpuThreadId(spurs_addr=0x%x, thread_addr=0x%x, nThreads_addr=0x%x)", spurs.addr(), thread.addr(), nThreads.addr()); cellSpurs->Warning("cellSpursGetSpuThreadId(spurs_addr=0x%x, thread_addr=0x%x, nThreads_addr=0x%x)", spurs.addr(), thread.addr(), nThreads.addr());
#ifdef PRX_DEBUG_XXX
return GetCurrentPPUThread().FastCall2(libsre + 0x8A98, libsre_rtoc); return GetCurrentPPUThread().FastCall2(libsre + 0x8A98, libsre_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpurs);
return CELL_OK;
#endif #endif
if (!spurs || !thread || !nThreads)
{
return CELL_SPURS_CORE_ERROR_NULL_POINTER;
}
if (spurs.addr() % 128)
{
return CELL_SPURS_CORE_ERROR_ALIGN;
}
const u32 count = std::min<u32>(*nThreads, spurs->m.nSpus);
for (u32 i = 0; i < count; i++)
{
thread[i] = spurs->m.spus[i];
}
*nThreads = count;
return CELL_OK;
} }
s64 cellSpursSetMaxContention(vm::ptr<CellSpurs> spurs, u32 workloadId, u32 maxContention) s64 cellSpursSetMaxContention(vm::ptr<CellSpurs> spurs, u32 workloadId, u32 maxContention)
@ -912,6 +1204,7 @@ s64 spursWakeUp(vm::ptr<CellSpurs> spurs)
#ifdef PRX_DEBUG_XXX #ifdef PRX_DEBUG_XXX
return cb_call<s32, vm::ptr<CellSpurs>>(GetCurrentPPUThread(), libsre + 0x84D8, libsre_rtoc, spurs); return cb_call<s32, vm::ptr<CellSpurs>>(GetCurrentPPUThread(), libsre + 0x84D8, libsre_rtoc, spurs);
#endif #endif
if (!spurs) if (!spurs)
{ {
return CELL_SPURS_POLICY_MODULE_ERROR_NULL_POINTER; return CELL_SPURS_POLICY_MODULE_ERROR_NULL_POINTER;
@ -961,6 +1254,7 @@ s32 spursAddWorkload(
spurs, wid, pm, size, data, Memory.RealToVirtualAddr(priorityTable), minContention, maxContention, spurs, wid, pm, size, data, Memory.RealToVirtualAddr(priorityTable), minContention, maxContention,
nameClass.addr(), nameInstance.addr(), hook.addr(), hookArg.addr()); nameClass.addr(), nameInstance.addr(), hook.addr(), hookArg.addr());
#endif #endif
if (!spurs || !wid || !pm) if (!spurs || !wid || !pm)
{ {
return CELL_SPURS_POLICY_MODULE_ERROR_NULL_POINTER; return CELL_SPURS_POLICY_MODULE_ERROR_NULL_POINTER;
@ -1123,7 +1417,6 @@ s64 cellSpursAddWorkload(
{ {
cellSpurs->Warning("%s(spurs_addr=0x%x, wid_addr=0x%x, pm_addr=0x%x, size=0x%x, data=0x%llx, priorityTable_addr=0x%x, minContention=0x%x, maxContention=0x%x)", cellSpurs->Warning("%s(spurs_addr=0x%x, wid_addr=0x%x, pm_addr=0x%x, size=0x%x, data=0x%llx, priorityTable_addr=0x%x, minContention=0x%x, maxContention=0x%x)",
__FUNCTION__, spurs.addr(), wid.addr(), pm.addr(), size, data, priorityTable.addr(), minContention, maxContention); __FUNCTION__, spurs.addr(), wid.addr(), pm.addr(), size, data, priorityTable.addr(), minContention, maxContention);
#ifdef PRX_DEBUG_XXX #ifdef PRX_DEBUG_XXX
return GetCurrentPPUThread().FastCall2(libsre + 0x9ED0, libsre_rtoc); return GetCurrentPPUThread().FastCall2(libsre + 0x9ED0, libsre_rtoc);
#endif #endif
@ -1156,10 +1449,10 @@ s64 _cellSpursWorkloadAttributeInitialize(
{ {
cellSpurs->Warning("%s(attr_addr=0x%x, revision=%d, sdkVersion=0x%x, pm_addr=0x%x, size=0x%x, data=0x%llx, priorityTable_addr=0x%x, minContention=0x%x, maxContention=0x%x)", cellSpurs->Warning("%s(attr_addr=0x%x, revision=%d, sdkVersion=0x%x, pm_addr=0x%x, size=0x%x, data=0x%llx, priorityTable_addr=0x%x, minContention=0x%x, maxContention=0x%x)",
__FUNCTION__, attr.addr(), revision, sdkVersion, pm.addr(), size, data, priorityTable.addr(), minContention, maxContention); __FUNCTION__, attr.addr(), revision, sdkVersion, pm.addr(), size, data, priorityTable.addr(), minContention, maxContention);
#ifdef PRX_DEBUG_XXX #ifdef PRX_DEBUG_XXX
return GetCurrentPPUThread().FastCall2(libsre + 0x9F08, libsre_rtoc); return GetCurrentPPUThread().FastCall2(libsre + 0x9F08, libsre_rtoc);
#endif #endif
if (!attr) if (!attr)
{ {
return CELL_SPURS_POLICY_MODULE_ERROR_NULL_POINTER; return CELL_SPURS_POLICY_MODULE_ERROR_NULL_POINTER;
@ -1196,10 +1489,10 @@ s64 _cellSpursWorkloadAttributeInitialize(
s64 cellSpursWorkloadAttributeSetName(vm::ptr<CellSpursWorkloadAttribute> attr, vm::ptr<const char> nameClass, vm::ptr<const char> nameInstance) s64 cellSpursWorkloadAttributeSetName(vm::ptr<CellSpursWorkloadAttribute> attr, vm::ptr<const char> nameClass, vm::ptr<const char> nameInstance)
{ {
cellSpurs->Warning("%s(attr_addr=0x%x, nameClass_addr=0x%x, nameInstance_addr=0x%x)", __FUNCTION__, attr.addr(), nameClass.addr(), nameInstance.addr()); cellSpurs->Warning("%s(attr_addr=0x%x, nameClass_addr=0x%x, nameInstance_addr=0x%x)", __FUNCTION__, attr.addr(), nameClass.addr(), nameInstance.addr());
#ifdef PRX_DEBUG_XXX #ifdef PRX_DEBUG_XXX
return GetCurrentPPUThread().FastCall2(libsre + 0x9664, libsre_rtoc); return GetCurrentPPUThread().FastCall2(libsre + 0x9664, libsre_rtoc);
#endif #endif
if (!attr) if (!attr)
{ {
return CELL_SPURS_POLICY_MODULE_ERROR_NULL_POINTER; return CELL_SPURS_POLICY_MODULE_ERROR_NULL_POINTER;
@ -1217,10 +1510,10 @@ s64 cellSpursWorkloadAttributeSetName(vm::ptr<CellSpursWorkloadAttribute> attr,
s64 cellSpursWorkloadAttributeSetShutdownCompletionEventHook(vm::ptr<CellSpursWorkloadAttribute> attr, vm::ptr<CellSpursShutdownCompletionEventHook> hook, vm::ptr<void> arg) s64 cellSpursWorkloadAttributeSetShutdownCompletionEventHook(vm::ptr<CellSpursWorkloadAttribute> attr, vm::ptr<CellSpursShutdownCompletionEventHook> hook, vm::ptr<void> arg)
{ {
cellSpurs->Warning("%s(attr_addr=0x%x, hook_addr=0x%x, arg=0x%x)", __FUNCTION__, attr.addr(), hook.addr(), arg.addr()); cellSpurs->Warning("%s(attr_addr=0x%x, hook_addr=0x%x, arg=0x%x)", __FUNCTION__, attr.addr(), hook.addr(), arg.addr());
#ifdef PRX_DEBUG_XXX #ifdef PRX_DEBUG_XXX
return GetCurrentPPUThread().FastCall2(libsre + 0x96A4, libsre_rtoc); return GetCurrentPPUThread().FastCall2(libsre + 0x96A4, libsre_rtoc);
#endif #endif
if (!attr || !hook) if (!attr || !hook)
{ {
return CELL_SPURS_POLICY_MODULE_ERROR_NULL_POINTER; return CELL_SPURS_POLICY_MODULE_ERROR_NULL_POINTER;
@ -1238,10 +1531,10 @@ s64 cellSpursWorkloadAttributeSetShutdownCompletionEventHook(vm::ptr<CellSpursWo
s64 cellSpursAddWorkloadWithAttribute(vm::ptr<CellSpurs> spurs, vm::ptr<u32> wid, vm::ptr<const CellSpursWorkloadAttribute> attr) s64 cellSpursAddWorkloadWithAttribute(vm::ptr<CellSpurs> spurs, vm::ptr<u32> wid, vm::ptr<const CellSpursWorkloadAttribute> attr)
{ {
cellSpurs->Warning("%s(spurs_addr=0x%x, wid_addr=0x%x, attr_addr=0x%x)", __FUNCTION__, spurs.addr(), wid.addr(), attr.addr()); cellSpurs->Warning("%s(spurs_addr=0x%x, wid_addr=0x%x, attr_addr=0x%x)", __FUNCTION__, spurs.addr(), wid.addr(), attr.addr());
#ifdef PRX_DEBUG_XXX #ifdef PRX_DEBUG_XXX
return GetCurrentPPUThread().FastCall2(libsre + 0x9E14, libsre_rtoc); return GetCurrentPPUThread().FastCall2(libsre + 0x9E14, libsre_rtoc);
#endif #endif
if (!attr) if (!attr)
{ {
return CELL_SPURS_POLICY_MODULE_ERROR_NULL_POINTER; return CELL_SPURS_POLICY_MODULE_ERROR_NULL_POINTER;
@ -1306,10 +1599,10 @@ s64 cellSpursShutdownWorkload()
s64 _cellSpursWorkloadFlagReceiver(vm::ptr<CellSpurs> spurs, u32 wid, u32 is_set) s64 _cellSpursWorkloadFlagReceiver(vm::ptr<CellSpurs> spurs, u32 wid, u32 is_set)
{ {
cellSpurs->Warning("%s(spurs_addr=0x%x, wid=%d, is_set=%d)", __FUNCTION__, spurs.addr(), wid, is_set); cellSpurs->Warning("%s(spurs_addr=0x%x, wid=%d, is_set=%d)", __FUNCTION__, spurs.addr(), wid, is_set);
#ifdef PRX_DEBUG_XXX #ifdef PRX_DEBUG_XXX
return GetCurrentPPUThread().FastCall2(libsre + 0xF158, libsre_rtoc); return GetCurrentPPUThread().FastCall2(libsre + 0xF158, libsre_rtoc);
#endif #endif
if (!spurs) if (!spurs)
{ {
return CELL_SPURS_POLICY_MODULE_ERROR_NULL_POINTER; return CELL_SPURS_POLICY_MODULE_ERROR_NULL_POINTER;
@ -1376,10 +1669,10 @@ s64 _cellSpursWorkloadFlagReceiver(vm::ptr<CellSpurs> spurs, u32 wid, u32 is_set
s64 cellSpursGetWorkloadFlag(vm::ptr<CellSpurs> spurs, vm::ptr<vm::bptr<CellSpursWorkloadFlag>> flag) s64 cellSpursGetWorkloadFlag(vm::ptr<CellSpurs> spurs, vm::ptr<vm::bptr<CellSpursWorkloadFlag>> flag)
{ {
cellSpurs->Warning("%s(spurs_addr=0x%x, flag_addr=0x%x)", __FUNCTION__, spurs.addr(), flag.addr()); cellSpurs->Warning("%s(spurs_addr=0x%x, flag_addr=0x%x)", __FUNCTION__, spurs.addr(), flag.addr());
#ifdef PRX_DEBUG_XXX #ifdef PRX_DEBUG_XXX
return GetCurrentPPUThread().FastCall2(libsre + 0xEC00, libsre_rtoc); return GetCurrentPPUThread().FastCall2(libsre + 0xEC00, libsre_rtoc);
#endif #endif
if (!spurs || !flag) if (!spurs || !flag)
{ {
return CELL_SPURS_POLICY_MODULE_ERROR_NULL_POINTER; return CELL_SPURS_POLICY_MODULE_ERROR_NULL_POINTER;
@ -1418,10 +1711,10 @@ s64 cellSpursGetWorkloadData()
s64 cellSpursReadyCountStore(vm::ptr<CellSpurs> spurs, u32 wid, u32 value) s64 cellSpursReadyCountStore(vm::ptr<CellSpurs> spurs, u32 wid, u32 value)
{ {
cellSpurs->Warning("%s(spurs_addr=0x%x, wid=%d, value=0x%x)", __FUNCTION__, spurs.addr(), wid, value); cellSpurs->Warning("%s(spurs_addr=0x%x, wid=%d, value=0x%x)", __FUNCTION__, spurs.addr(), wid, value);
#ifdef PRX_DEBUG_XXX #ifdef PRX_DEBUG_XXX
return GetCurrentPPUThread().FastCall2(libsre + 0xAB2C, libsre_rtoc); return GetCurrentPPUThread().FastCall2(libsre + 0xAB2C, libsre_rtoc);
#endif #endif
if (!spurs) if (!spurs)
{ {
return CELL_SPURS_POLICY_MODULE_ERROR_NULL_POINTER; return CELL_SPURS_POLICY_MODULE_ERROR_NULL_POINTER;
@ -1569,7 +1862,7 @@ s64 cellSpursEventFlagDetachLv2EventQueue(vm::ptr<CellSpursEventFlag> eventFlag)
#endif #endif
} }
s64 cellSpursEventFlagWait(vm::ptr<CellSpursEventFlag> eventFlag, vm::ptr<be_t<u16>> mask, u32 mode) s64 cellSpursEventFlagWait(vm::ptr<CellSpursEventFlag> eventFlag, vm::ptr<u16> mask, u32 mode)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpurs->Warning("cellSpursEventFlagWait(eventFlag_addr=0x%x, mask_addr=0x%x, mode=%d)", eventFlag.addr(), mask.addr(), mode); cellSpurs->Warning("cellSpursEventFlagWait(eventFlag_addr=0x%x, mask_addr=0x%x, mode=%d)", eventFlag.addr(), mask.addr(), mode);
@ -1602,7 +1895,7 @@ s64 cellSpursEventFlagSet(vm::ptr<CellSpursEventFlag> eventFlag, u16 bits)
#endif #endif
} }
s64 cellSpursEventFlagTryWait(vm::ptr<CellSpursEventFlag> eventFlag, vm::ptr<be_t<u16>> mask, u32 mode) s64 cellSpursEventFlagTryWait(vm::ptr<CellSpursEventFlag> eventFlag, vm::ptr<u16> mask, u32 mode)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpurs->Warning("cellSpursEventFlagTryWait(eventFlag_addr=0x%x, mask_addr=0x%x, mode=0x%x)", eventFlag.addr(), mask.addr(), mode); cellSpurs->Warning("cellSpursEventFlagTryWait(eventFlag_addr=0x%x, mask_addr=0x%x, mode=0x%x)", eventFlag.addr(), mask.addr(), mode);
@ -1613,7 +1906,7 @@ s64 cellSpursEventFlagTryWait(vm::ptr<CellSpursEventFlag> eventFlag, vm::ptr<be_
#endif #endif
} }
s64 cellSpursEventFlagGetDirection(vm::ptr<CellSpursEventFlag> eventFlag, vm::ptr<be_t<u32>> direction) s64 cellSpursEventFlagGetDirection(vm::ptr<CellSpursEventFlag> eventFlag, vm::ptr<u32> direction)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpurs->Warning("cellSpursEventFlagGetDirection(eventFlag_addr=0x%x, direction_addr=0x%x)", eventFlag.addr(), direction.addr()); cellSpurs->Warning("cellSpursEventFlagGetDirection(eventFlag_addr=0x%x, direction_addr=0x%x)", eventFlag.addr(), direction.addr());
@ -1624,7 +1917,7 @@ s64 cellSpursEventFlagGetDirection(vm::ptr<CellSpursEventFlag> eventFlag, vm::pt
#endif #endif
} }
s64 cellSpursEventFlagGetClearMode(vm::ptr<CellSpursEventFlag> eventFlag, vm::ptr<be_t<u32>> clear_mode) s64 cellSpursEventFlagGetClearMode(vm::ptr<CellSpursEventFlag> eventFlag, vm::ptr<u32> clear_mode)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpurs->Warning("cellSpursEventFlagGetClearMode(eventFlag_addr=0x%x, clear_mode_addr=0x%x)", eventFlag.addr(), clear_mode.addr()); cellSpurs->Warning("cellSpursEventFlagGetClearMode(eventFlag_addr=0x%x, clear_mode_addr=0x%x)", eventFlag.addr(), clear_mode.addr());
@ -1980,7 +2273,7 @@ s64 cellSpursJoinTaskset(vm::ptr<CellSpursTaskset> taskset)
#endif #endif
} }
s64 cellSpursGetTasksetId(vm::ptr<CellSpursTaskset> taskset, vm::ptr<be_t<u32>> workloadId) s64 cellSpursGetTasksetId(vm::ptr<CellSpursTaskset> taskset, vm::ptr<u32> workloadId)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
cellSpurs->Warning("cellSpursGetTasksetId(taskset_addr=0x%x, workloadId_addr=0x%x)", taskset.addr(), workloadId.addr()); cellSpurs->Warning("cellSpursGetTasksetId(taskset_addr=0x%x, workloadId_addr=0x%x)", taskset.addr(), workloadId.addr());
@ -2002,7 +2295,7 @@ s64 cellSpursShutdownTaskset(vm::ptr<CellSpursTaskset> taskset)
#endif #endif
} }
s64 cellSpursCreateTask(vm::ptr<CellSpursTaskset> taskset, vm::ptr<be_t<u32>> taskID, u32 elf_addr, u32 context_addr, u32 context_size, vm::ptr<CellSpursTaskLsPattern> lsPattern, s64 cellSpursCreateTask(vm::ptr<CellSpursTaskset> taskset, vm::ptr<u32> taskID, u32 elf_addr, u32 context_addr, u32 context_size, vm::ptr<CellSpursTaskLsPattern> lsPattern,
vm::ptr<CellSpursTaskArgument> argument) vm::ptr<CellSpursTaskArgument> argument)
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG

View File

@ -766,7 +766,7 @@ void cellSpursJq_init(Module *pxThis)
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
CallAfter([]() CallAfter([]()
{ {
libspurs_jq = (u32)Memory.PRXMem.AllocAlign(sizeof(libspurs_jq_data), 4096); 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)); memcpy(vm::get_ptr<void>(libspurs_jq), libspurs_jq_data, sizeof(libspurs_jq_data));
libspurs_jq_rtoc = libspurs_jq + 0x17E80; libspurs_jq_rtoc = libspurs_jq + 0x17E80;

View File

@ -16,6 +16,13 @@ u32 libsre;
u32 libsre_rtoc; u32 libsre_rtoc;
#endif #endif
waiter_map_t g_sync_mutex_wm("sync_mutex_wm");
waiter_map_t g_sync_barrier_wait_wm("sync_barrier_wait_wm");
waiter_map_t g_sync_barrier_notify_wm("sync_barrier_notify_wm");
waiter_map_t g_sync_rwm_read_wm("sync_rwm_read_wm");
waiter_map_t g_sync_rwm_write_wm("sync_rwm_write_wm");
waiter_map_t g_sync_queue_wm("sync_queue_wm");
s32 syncMutexInitialize(vm::ptr<CellSyncMutex> mutex) s32 syncMutexInitialize(vm::ptr<CellSyncMutex> mutex)
{ {
if (!mutex) if (!mutex)
@ -60,15 +67,10 @@ s32 cellSyncMutexLock(vm::ptr<CellSyncMutex> mutex)
}); });
// prx: wait until this old value is equal to m_rel // prx: wait until this old value is equal to m_rel
while (order != mutex->data.read_relaxed().m_rel) g_sync_mutex_wm.wait_op(mutex.addr(), [mutex, order]()
{ {
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack return order == mutex->data.read_relaxed().m_rel;
if (Emu.IsStopped()) });
{
cellSync->Warning("cellSyncMutexLock(mutex_addr=0x%x) aborted", mutex.addr());
break;
}
}
// prx: sync // prx: sync
mutex->data.read_sync(); mutex->data.read_sync();
@ -116,6 +118,8 @@ s32 cellSyncMutexUnlock(vm::ptr<CellSyncMutex> mutex)
{ {
mutex.m_rel++; mutex.m_rel++;
}); });
g_sync_mutex_wm.notify(mutex.addr());
return CELL_OK; return CELL_OK;
} }
@ -177,15 +181,12 @@ s32 cellSyncBarrierNotify(vm::ptr<CellSyncBarrier> barrier)
return CELL_SYNC_ERROR_ALIGN; return CELL_SYNC_ERROR_ALIGN;
} }
while (barrier->data.atomic_op_sync(CELL_OK, syncBarrierTryNotifyOp)) g_sync_barrier_notify_wm.wait_op(barrier.addr(), [barrier]()
{ {
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack return barrier->data.atomic_op_sync(CELL_OK, syncBarrierTryNotifyOp) == CELL_OK;
if (Emu.IsStopped()) });
{
cellSync->Warning("cellSyncBarrierNotify(barrier_addr=0x%x) aborted", barrier.addr()); g_sync_barrier_wait_wm.notify(barrier.addr());
return CELL_OK;
}
}
return CELL_OK; return CELL_OK;
} }
@ -202,7 +203,13 @@ s32 cellSyncBarrierTryNotify(vm::ptr<CellSyncBarrier> barrier)
return CELL_SYNC_ERROR_ALIGN; return CELL_SYNC_ERROR_ALIGN;
} }
return barrier->data.atomic_op_sync(CELL_OK, syncBarrierTryNotifyOp); if (s32 res = barrier->data.atomic_op_sync(CELL_OK, syncBarrierTryNotifyOp))
{
return res;
}
g_sync_barrier_wait_wm.notify(barrier.addr());
return CELL_OK;
} }
s32 syncBarrierTryWaitOp(CellSyncBarrier::data_t& barrier) s32 syncBarrierTryWaitOp(CellSyncBarrier::data_t& barrier)
@ -236,15 +243,12 @@ s32 cellSyncBarrierWait(vm::ptr<CellSyncBarrier> barrier)
return CELL_SYNC_ERROR_ALIGN; return CELL_SYNC_ERROR_ALIGN;
} }
while (barrier->data.atomic_op_sync(CELL_OK, syncBarrierTryWaitOp)) g_sync_barrier_wait_wm.wait_op(barrier.addr(), [barrier]()
{ {
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack return barrier->data.atomic_op_sync(CELL_OK, syncBarrierTryWaitOp) == CELL_OK;
if (Emu.IsStopped()) });
{
cellSync->Warning("cellSyncBarrierWait(barrier_addr=0x%x) aborted", barrier.addr()); g_sync_barrier_notify_wm.notify(barrier.addr());
return CELL_OK;
}
}
return CELL_OK; return CELL_OK;
} }
@ -261,7 +265,13 @@ s32 cellSyncBarrierTryWait(vm::ptr<CellSyncBarrier> barrier)
return CELL_SYNC_ERROR_ALIGN; return CELL_SYNC_ERROR_ALIGN;
} }
return barrier->data.atomic_op_sync(CELL_OK, syncBarrierTryWaitOp); if (s32 res = barrier->data.atomic_op_sync(CELL_OK, syncBarrierTryWaitOp))
{
return res;
}
g_sync_barrier_notify_wm.notify(barrier.addr());
return CELL_OK;
} }
s32 syncRwmInitialize(vm::ptr<CellSyncRwm> rwm, vm::ptr<void> buffer, u32 buffer_size) s32 syncRwmInitialize(vm::ptr<CellSyncRwm> rwm, vm::ptr<void> buffer, u32 buffer_size)
@ -299,6 +309,7 @@ s32 syncRwmTryReadBeginOp(CellSyncRwm::data_t& rwm)
{ {
return CELL_SYNC_ERROR_BUSY; return CELL_SYNC_ERROR_BUSY;
} }
rwm.m_readers++; rwm.m_readers++;
return CELL_OK; return CELL_OK;
} }
@ -310,6 +321,7 @@ s32 syncRwmReadEndOp(CellSyncRwm::data_t& rwm)
cellSync->Error("syncRwmReadEndOp(rwm_addr=0x%x): m_readers == 0 (m_writers=%d)", Memory.RealToVirtualAddr(&rwm), (u16)rwm.m_writers); cellSync->Error("syncRwmReadEndOp(rwm_addr=0x%x): m_readers == 0 (m_writers=%d)", Memory.RealToVirtualAddr(&rwm), (u16)rwm.m_writers);
return CELL_SYNC_ERROR_ABORT; return CELL_SYNC_ERROR_ABORT;
} }
rwm.m_readers--; rwm.m_readers--;
return CELL_OK; return CELL_OK;
} }
@ -328,21 +340,22 @@ s32 cellSyncRwmRead(vm::ptr<CellSyncRwm> rwm, vm::ptr<void> buffer)
} }
// prx: increase m_readers, wait until m_writers is zero // prx: increase m_readers, wait until m_writers is zero
while (rwm->data.atomic_op(CELL_OK, syncRwmTryReadBeginOp)) g_sync_rwm_read_wm.wait_op(rwm.addr(), [rwm]()
{ {
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack return rwm->data.atomic_op(CELL_OK, syncRwmTryReadBeginOp) == CELL_OK;
if (Emu.IsStopped()) });
{
cellSync->Warning("cellSyncRwmRead(rwm_addr=0x%x) aborted", rwm.addr());
return CELL_OK;
}
}
// copy data to buffer_addr // copy data to buffer_addr
memcpy(buffer.get_ptr(), rwm->m_buffer.get_ptr(), (u32)rwm->m_size); memcpy(buffer.get_ptr(), rwm->m_buffer.get_ptr(), (u32)rwm->m_size);
// prx: decrease m_readers (return 0x8041010C if already zero) // prx: decrease m_readers (return 0x8041010C if already zero)
return rwm->data.atomic_op(CELL_OK, syncRwmReadEndOp); if (s32 res = rwm->data.atomic_op(CELL_OK, syncRwmReadEndOp))
{
return res;
}
g_sync_rwm_write_wm.notify(rwm.addr());
return CELL_OK;
} }
s32 cellSyncRwmTryRead(vm::ptr<CellSyncRwm> rwm, vm::ptr<void> buffer) s32 cellSyncRwmTryRead(vm::ptr<CellSyncRwm> rwm, vm::ptr<void> buffer)
@ -365,7 +378,13 @@ s32 cellSyncRwmTryRead(vm::ptr<CellSyncRwm> rwm, vm::ptr<void> buffer)
memcpy(buffer.get_ptr(), rwm->m_buffer.get_ptr(), (u32)rwm->m_size); memcpy(buffer.get_ptr(), rwm->m_buffer.get_ptr(), (u32)rwm->m_size);
return rwm->data.atomic_op(CELL_OK, syncRwmReadEndOp); if (s32 res = rwm->data.atomic_op(CELL_OK, syncRwmReadEndOp))
{
return res;
}
g_sync_rwm_write_wm.notify(rwm.addr());
return CELL_OK;
} }
s32 syncRwmTryWriteBeginOp(CellSyncRwm::data_t& rwm) s32 syncRwmTryWriteBeginOp(CellSyncRwm::data_t& rwm)
@ -374,6 +393,7 @@ s32 syncRwmTryWriteBeginOp(CellSyncRwm::data_t& rwm)
{ {
return CELL_SYNC_ERROR_BUSY; return CELL_SYNC_ERROR_BUSY;
} }
rwm.m_writers = 1; rwm.m_writers = 1;
return CELL_OK; return CELL_OK;
} }
@ -391,32 +411,23 @@ s32 cellSyncRwmWrite(vm::ptr<CellSyncRwm> rwm, vm::ptr<const void> buffer)
return CELL_SYNC_ERROR_ALIGN; return CELL_SYNC_ERROR_ALIGN;
} }
while (rwm->data.atomic_op(CELL_OK, syncRwmTryWriteBeginOp)) g_sync_rwm_read_wm.wait_op(rwm.addr(), [rwm]()
{ {
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack return rwm->data.atomic_op(CELL_OK, syncRwmTryWriteBeginOp) == CELL_OK;
if (Emu.IsStopped()) });
{
cellSync->Warning("cellSyncRwmWrite(rwm_addr=0x%x) aborted (I)", rwm.addr());
return CELL_OK;
}
}
// prx: wait until m_readers == 0 // prx: wait until m_readers == 0
while (rwm->data.read_relaxed().m_readers.ToBE()) g_sync_rwm_write_wm.wait_op(rwm.addr(), [rwm]()
{ {
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack return rwm->data.read_relaxed().m_readers.ToBE() == 0;
if (Emu.IsStopped()) });
{
cellSync->Warning("cellSyncRwmWrite(rwm_addr=0x%x) aborted (II)", rwm.addr());
return CELL_OK;
}
}
// prx: copy data from buffer_addr // prx: copy data from buffer_addr
memcpy(rwm->m_buffer.get_ptr(), buffer.get_ptr(), (u32)rwm->m_size); memcpy(rwm->m_buffer.get_ptr(), buffer.get_ptr(), (u32)rwm->m_size);
// prx: sync and zeroize m_readers and m_writers // prx: sync and zeroize m_readers and m_writers
rwm->data.exchange({}); rwm->data.exchange({});
g_sync_rwm_read_wm.notify(rwm.addr());
return CELL_OK; return CELL_OK;
} }
@ -434,7 +445,7 @@ s32 cellSyncRwmTryWrite(vm::ptr<CellSyncRwm> rwm, vm::ptr<const void> buffer)
} }
// prx: compare m_readers | m_writers with 0, return if not zero, set m_writers to 1 // prx: compare m_readers | m_writers with 0, return if not zero, set m_writers to 1
if (!rwm->data.compare_and_swap_test({}, {be_t<u16>::make(0), be_t<u16>::make(1)})) if (!rwm->data.compare_and_swap_test({}, { be_t<u16>::make(0), be_t<u16>::make(1) }))
{ {
return CELL_SYNC_ERROR_BUSY; return CELL_SYNC_ERROR_BUSY;
} }
@ -444,6 +455,7 @@ s32 cellSyncRwmTryWrite(vm::ptr<CellSyncRwm> rwm, vm::ptr<const void> buffer)
// prx: sync and zeroize m_readers and m_writers // prx: sync and zeroize m_readers and m_writers
rwm->data.exchange({}); rwm->data.exchange({});
g_sync_rwm_read_wm.notify(rwm.addr());
return CELL_OK; return CELL_OK;
} }
@ -520,24 +532,20 @@ s32 cellSyncQueuePush(vm::ptr<CellSyncQueue> queue, vm::ptr<const void> buffer)
assert(((u32)data.m_v1 & 0xffffff) <= depth && ((u32)data.m_v2 & 0xffffff) <= depth); assert(((u32)data.m_v1 & 0xffffff) <= depth && ((u32)data.m_v2 & 0xffffff) <= depth);
u32 position; u32 position;
while (queue->data.atomic_op(CELL_OK, [depth, &position](CellSyncQueue::data_t& queue) -> s32 g_sync_queue_wm.wait_op(queue.addr(), [queue, depth, &position]()
{ {
return syncQueueTryPushOp(queue, depth, position); return CELL_OK == queue->data.atomic_op(CELL_OK, [depth, &position](CellSyncQueue::data_t& queue) -> s32
}))
{
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
if (Emu.IsStopped())
{ {
cellSync->Warning("cellSyncQueuePush(queue_addr=0x%x) aborted", queue.addr()); return syncQueueTryPushOp(queue, depth, position);
return CELL_OK; });
} });
}
// prx: memcpy(position * m_size + m_addr, buffer_addr, m_size), sync // prx: memcpy(position * m_size + m_addr, buffer_addr, m_size), sync
memcpy(&queue->m_buffer[position * size], buffer.get_ptr(), size); memcpy(&queue->m_buffer[position * size], buffer.get_ptr(), size);
// prx: atomically insert 0 in 5th u8 // prx: atomically insert 0 in 5th u8
queue->data &= { be_t<u32>::make(~0), be_t<u32>::make(0xffffff) }; queue->data &= { be_t<u32>::make(~0), be_t<u32>::make(0xffffff) };
g_sync_queue_wm.notify(queue.addr());
return CELL_OK; return CELL_OK;
} }
@ -570,6 +578,7 @@ s32 cellSyncQueueTryPush(vm::ptr<CellSyncQueue> queue, vm::ptr<const void> buffe
memcpy(&queue->m_buffer[position * size], buffer.get_ptr(), size); memcpy(&queue->m_buffer[position * size], buffer.get_ptr(), size);
queue->data &= { be_t<u32>::make(~0), be_t<u32>::make(0xffffff) }; queue->data &= { be_t<u32>::make(~0), be_t<u32>::make(0xffffff) };
g_sync_queue_wm.notify(queue.addr());
return CELL_OK; return CELL_OK;
} }
@ -612,24 +621,20 @@ s32 cellSyncQueuePop(vm::ptr<CellSyncQueue> queue, vm::ptr<void> buffer)
assert(((u32)data.m_v1 & 0xffffff) <= depth && ((u32)data.m_v2 & 0xffffff) <= depth); assert(((u32)data.m_v1 & 0xffffff) <= depth && ((u32)data.m_v2 & 0xffffff) <= depth);
u32 position; u32 position;
while (queue->data.atomic_op(CELL_OK, [depth, &position](CellSyncQueue::data_t& queue) -> s32 g_sync_queue_wm.wait_op(queue.addr(), [queue, depth, &position]()
{ {
return syncQueueTryPopOp(queue, depth, position); return CELL_OK == queue->data.atomic_op(CELL_OK, [depth, &position](CellSyncQueue::data_t& queue) -> s32
}))
{
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
if (Emu.IsStopped())
{ {
cellSync->Warning("cellSyncQueuePop(queue_addr=0x%x) aborted", queue.addr()); return syncQueueTryPopOp(queue, depth, position);
return CELL_OK; });
} });
}
// prx: (sync), memcpy(buffer_addr, position * m_size + m_addr, m_size) // prx: (sync), memcpy(buffer_addr, position * m_size + m_addr, m_size)
memcpy(buffer.get_ptr(), &queue->m_buffer[position * size], size); memcpy(buffer.get_ptr(), &queue->m_buffer[position * size], size);
// prx: atomically insert 0 in first u8 // prx: atomically insert 0 in first u8
queue->data &= { be_t<u32>::make(0xffffff), be_t<u32>::make(~0) }; queue->data &= { be_t<u32>::make(0xffffff), be_t<u32>::make(~0) };
g_sync_queue_wm.notify(queue.addr());
return CELL_OK; return CELL_OK;
} }
@ -662,6 +667,7 @@ s32 cellSyncQueueTryPop(vm::ptr<CellSyncQueue> queue, vm::ptr<void> buffer)
memcpy(buffer.get_ptr(), &queue->m_buffer[position * size], size); memcpy(buffer.get_ptr(), &queue->m_buffer[position * size], size);
queue->data &= { be_t<u32>::make(0xffffff), be_t<u32>::make(~0) }; queue->data &= { be_t<u32>::make(0xffffff), be_t<u32>::make(~0) };
g_sync_queue_wm.notify(queue.addr());
return CELL_OK; return CELL_OK;
} }
@ -698,21 +704,17 @@ s32 cellSyncQueuePeek(vm::ptr<CellSyncQueue> queue, vm::ptr<void> buffer)
assert(((u32)data.m_v1 & 0xffffff) <= depth && ((u32)data.m_v2 & 0xffffff) <= depth); assert(((u32)data.m_v1 & 0xffffff) <= depth && ((u32)data.m_v2 & 0xffffff) <= depth);
u32 position; u32 position;
while (queue->data.atomic_op(CELL_OK, [depth, &position](CellSyncQueue::data_t& queue) -> s32 g_sync_queue_wm.wait_op(queue.addr(), [queue, depth, &position]()
{ {
return syncQueueTryPeekOp(queue, depth, position); return CELL_OK == queue->data.atomic_op(CELL_OK, [depth, &position](CellSyncQueue::data_t& queue) -> s32
}))
{
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
if (Emu.IsStopped())
{ {
cellSync->Warning("cellSyncQueuePeek(queue_addr=0x%x) aborted", queue.addr()); return syncQueueTryPeekOp(queue, depth, position);
return CELL_OK; });
} });
}
memcpy(buffer.get_ptr(), &queue->m_buffer[position * size], size); memcpy(buffer.get_ptr(), &queue->m_buffer[position * size], size);
queue->data &= { be_t<u32>::make(0xffffff), be_t<u32>::make(~0) }; queue->data &= { be_t<u32>::make(0xffffff), be_t<u32>::make(~0) };
g_sync_queue_wm.notify(queue.addr());
return CELL_OK; return CELL_OK;
} }
@ -745,6 +747,7 @@ s32 cellSyncQueueTryPeek(vm::ptr<CellSyncQueue> queue, vm::ptr<void> buffer)
memcpy(buffer.get_ptr(), &queue->m_buffer[position * size], size); memcpy(buffer.get_ptr(), &queue->m_buffer[position * size], size);
queue->data &= { be_t<u32>::make(0xffffff), be_t<u32>::make(~0) }; queue->data &= { be_t<u32>::make(0xffffff), be_t<u32>::make(~0) };
g_sync_queue_wm.notify(queue.addr());
return CELL_OK; return CELL_OK;
} }
@ -787,47 +790,40 @@ s32 cellSyncQueueClear(vm::ptr<CellSyncQueue> queue)
assert(((u32)data.m_v1 & 0xffffff) <= depth && ((u32)data.m_v2 & 0xffffff) <= depth); assert(((u32)data.m_v1 & 0xffffff) <= depth && ((u32)data.m_v2 & 0xffffff) <= depth);
// TODO: optimize if possible // TODO: optimize if possible
while (queue->data.atomic_op(CELL_OK, [depth](CellSyncQueue::data_t& queue) -> s32 g_sync_queue_wm.wait_op(queue.addr(), [queue, depth]()
{ {
const u32 v1 = (u32)queue.m_v1; return CELL_OK == queue->data.atomic_op(CELL_OK, [depth](CellSyncQueue::data_t& queue) -> s32
// prx: extract first u8, repeat if not zero, insert 1
if (v1 >> 24)
{ {
return CELL_SYNC_ERROR_BUSY; const u32 v1 = (u32)queue.m_v1;
} // prx: extract first u8, repeat if not zero, insert 1
queue.m_v1 = v1 | 0x1000000; if (v1 >> 24)
return CELL_OK; {
})) return CELL_SYNC_ERROR_BUSY;
{ }
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
if (Emu.IsStopped())
{
cellSync->Warning("cellSyncQueueClear(queue_addr=0x%x) aborted (I)", queue.addr());
return CELL_OK;
}
}
while (queue->data.atomic_op(CELL_OK, [depth](CellSyncQueue::data_t& queue) -> s32 queue.m_v1 = v1 | 0x1000000;
{
const u32 v2 = (u32)queue.m_v2;
// prx: extract 5th u8, repeat if not zero, insert 1
if (v2 >> 24)
{
return CELL_SYNC_ERROR_BUSY;
}
queue.m_v2 = v2 | 0x1000000;
return CELL_OK;
}))
{
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
if (Emu.IsStopped())
{
cellSync->Warning("cellSyncQueueClear(queue_addr=0x%x) aborted (II)", queue.addr());
return CELL_OK; return CELL_OK;
} });
} });
g_sync_queue_wm.wait_op(queue.addr(), [queue, depth]()
{
return CELL_OK == queue->data.atomic_op(CELL_OK, [depth](CellSyncQueue::data_t& queue) -> s32
{
const u32 v2 = (u32)queue.m_v2;
// prx: extract 5th u8, repeat if not zero, insert 1
if (v2 >> 24)
{
return CELL_SYNC_ERROR_BUSY;
}
queue.m_v2 = v2 | 0x1000000;
return CELL_OK;
});
});
queue->data.exchange({}); queue->data.exchange({});
g_sync_queue_wm.notify(queue.addr());
return CELL_OK; return CELL_OK;
} }
@ -1092,7 +1088,7 @@ s32 syncLFQueueGetPushPointer(vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32
} }
} }
s32 _cellSyncLFQueueGetPushPointer(vm::ptr<CellSyncLFQueue> queue, vm::ptr<be_t<u32>> pointer, u32 isBlocking, u32 useEventQueue) s32 _cellSyncLFQueueGetPushPointer(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u32> pointer, u32 isBlocking, u32 useEventQueue)
{ {
cellSync->Todo("_cellSyncLFQueueGetPushPointer(queue_addr=0x%x, pointer_addr=0x%x, isBlocking=%d, useEventQueue=%d)", cellSync->Todo("_cellSyncLFQueueGetPushPointer(queue_addr=0x%x, pointer_addr=0x%x, isBlocking=%d, useEventQueue=%d)",
queue.addr(), pointer.addr(), isBlocking, useEventQueue); queue.addr(), pointer.addr(), isBlocking, useEventQueue);
@ -1111,7 +1107,7 @@ s32 syncLFQueueGetPushPointer2(vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32
return CELL_OK; return CELL_OK;
} }
s32 _cellSyncLFQueueGetPushPointer2(vm::ptr<CellSyncLFQueue> queue, vm::ptr<be_t<u32>> pointer, u32 isBlocking, u32 useEventQueue) s32 _cellSyncLFQueueGetPushPointer2(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u32> pointer, u32 isBlocking, u32 useEventQueue)
{ {
// arguments copied from _cellSyncLFQueueGetPushPointer // arguments copied from _cellSyncLFQueueGetPushPointer
cellSync->Todo("_cellSyncLFQueueGetPushPointer2(queue_addr=0x%x, pointer_addr=0x%x, isBlocking=%d, useEventQueue=%d)", cellSync->Todo("_cellSyncLFQueueGetPushPointer2(queue_addr=0x%x, pointer_addr=0x%x, isBlocking=%d, useEventQueue=%d)",
@ -1471,7 +1467,7 @@ s32 syncLFQueueGetPopPointer(vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32 i
} }
} }
s32 _cellSyncLFQueueGetPopPointer(vm::ptr<CellSyncLFQueue> queue, vm::ptr<be_t<u32>> pointer, u32 isBlocking, u32 arg4, u32 useEventQueue) s32 _cellSyncLFQueueGetPopPointer(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u32> pointer, u32 isBlocking, u32 arg4, u32 useEventQueue)
{ {
cellSync->Todo("_cellSyncLFQueueGetPopPointer(queue_addr=0x%x, pointer_addr=0x%x, isBlocking=%d, arg4=%d, useEventQueue=%d)", cellSync->Todo("_cellSyncLFQueueGetPopPointer(queue_addr=0x%x, pointer_addr=0x%x, isBlocking=%d, arg4=%d, useEventQueue=%d)",
queue.addr(), pointer.addr(), isBlocking, arg4, useEventQueue); queue.addr(), pointer.addr(), isBlocking, arg4, useEventQueue);
@ -1490,7 +1486,7 @@ s32 syncLFQueueGetPopPointer2(vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32
return CELL_OK; return CELL_OK;
} }
s32 _cellSyncLFQueueGetPopPointer2(vm::ptr<CellSyncLFQueue> queue, vm::ptr<be_t<u32>> pointer, u32 isBlocking, u32 useEventQueue) s32 _cellSyncLFQueueGetPopPointer2(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u32> pointer, u32 isBlocking, u32 useEventQueue)
{ {
// arguments copied from _cellSyncLFQueueGetPopPointer // arguments copied from _cellSyncLFQueueGetPopPointer
cellSync->Todo("_cellSyncLFQueueGetPopPointer2(queue_addr=0x%x, pointer_addr=0x%x, isBlocking=%d, useEventQueue=%d)", cellSync->Todo("_cellSyncLFQueueGetPopPointer2(queue_addr=0x%x, pointer_addr=0x%x, isBlocking=%d, useEventQueue=%d)",
@ -1797,7 +1793,7 @@ s32 cellSyncLFQueueClear(vm::ptr<CellSyncLFQueue> queue)
return CELL_OK; return CELL_OK;
} }
s32 cellSyncLFQueueSize(vm::ptr<CellSyncLFQueue> queue, vm::ptr<be_t<u32>> size) s32 cellSyncLFQueueSize(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u32> size)
{ {
cellSync->Warning("cellSyncLFQueueSize(queue_addr=0x%x, size_addr=0x%x)", queue.addr(), size.addr()); cellSync->Warning("cellSyncLFQueueSize(queue_addr=0x%x, size_addr=0x%x)", queue.addr(), size.addr());
@ -1832,7 +1828,7 @@ s32 cellSyncLFQueueSize(vm::ptr<CellSyncLFQueue> queue, vm::ptr<be_t<u32>> size)
} }
} }
s32 cellSyncLFQueueDepth(vm::ptr<CellSyncLFQueue> queue, vm::ptr<be_t<u32>> depth) s32 cellSyncLFQueueDepth(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u32> depth)
{ {
cellSync->Log("cellSyncLFQueueDepth(queue_addr=0x%x, depth_addr=0x%x)", queue.addr(), depth.addr()); cellSync->Log("cellSyncLFQueueDepth(queue_addr=0x%x, depth_addr=0x%x)", queue.addr(), depth.addr());
@ -1849,7 +1845,7 @@ s32 cellSyncLFQueueDepth(vm::ptr<CellSyncLFQueue> queue, vm::ptr<be_t<u32>> dept
return CELL_OK; return CELL_OK;
} }
s32 _cellSyncLFQueueGetSignalAddress(vm::ptr<const CellSyncLFQueue> queue, vm::ptr<be_t<u32>> ppSignal) s32 _cellSyncLFQueueGetSignalAddress(vm::ptr<const CellSyncLFQueue> queue, vm::ptr<u32> ppSignal)
{ {
cellSync->Log("_cellSyncLFQueueGetSignalAddress(queue_addr=0x%x, ppSignal_addr=0x%x)", queue.addr(), ppSignal.addr()); cellSync->Log("_cellSyncLFQueueGetSignalAddress(queue_addr=0x%x, ppSignal_addr=0x%x)", queue.addr(), ppSignal.addr());
@ -1866,7 +1862,7 @@ s32 _cellSyncLFQueueGetSignalAddress(vm::ptr<const CellSyncLFQueue> queue, vm::p
return CELL_OK; return CELL_OK;
} }
s32 cellSyncLFQueueGetDirection(vm::ptr<const CellSyncLFQueue> queue, vm::ptr<be_t<CellSyncQueueDirection>> direction) s32 cellSyncLFQueueGetDirection(vm::ptr<const CellSyncLFQueue> queue, vm::ptr<CellSyncQueueDirection> direction)
{ {
cellSync->Log("cellSyncLFQueueGetDirection(queue_addr=0x%x, direction_addr=0x%x)", queue.addr(), direction.addr()); cellSync->Log("cellSyncLFQueueGetDirection(queue_addr=0x%x, direction_addr=0x%x)", queue.addr(), direction.addr());
@ -1883,7 +1879,7 @@ s32 cellSyncLFQueueGetDirection(vm::ptr<const CellSyncLFQueue> queue, vm::ptr<be
return CELL_OK; return CELL_OK;
} }
s32 cellSyncLFQueueGetEntrySize(vm::ptr<const CellSyncLFQueue> queue, vm::ptr<be_t<u32>> entry_size) s32 cellSyncLFQueueGetEntrySize(vm::ptr<const CellSyncLFQueue> queue, vm::ptr<u32> entry_size)
{ {
cellSync->Log("cellSyncLFQueueGetEntrySize(queue_addr=0x%x, entry_size_addr=0x%x)", queue.addr(), entry_size.addr()); cellSync->Log("cellSyncLFQueueGetEntrySize(queue_addr=0x%x, entry_size_addr=0x%x)", queue.addr(), entry_size.addr());
@ -1990,7 +1986,7 @@ void cellSync_init(Module *pxThis)
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
CallAfter([]() CallAfter([]()
{ {
libsre = (u32)Memory.PRXMem.AllocAlign(sizeof(libsre_data), 4096); libsre = (u32)Memory.MainMem.AllocAlign(sizeof(libsre_data), 0x100000);
memcpy(vm::get_ptr<void>(libsre), libsre_data, sizeof(libsre_data)); memcpy(vm::get_ptr<void>(libsre), libsre_data, sizeof(libsre_data));
libsre_rtoc = libsre + 0x399B0; libsre_rtoc = libsre + 0x399B0;

View File

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

View File

@ -23,7 +23,7 @@ typedef void (*CellHddGameStatCallback)(vm::ptr<CellHddGameCBResult> cbResult, v
Module *cellSysutil = nullptr; Module *cellSysutil = nullptr;
int cellSysutilGetSystemParamInt(int id, vm::ptr<be_t<u32>> value) int cellSysutilGetSystemParamInt(int id, vm::ptr<u32> value)
{ {
cellSysutil->Log("cellSysutilGetSystemParamInt(id=0x%x, value_addr=0x%x)", id, value.addr()); cellSysutil->Log("cellSysutilGetSystemParamInt(id=0x%x, value_addr=0x%x)", id, value.addr());
@ -825,7 +825,7 @@ int cellSysutilGetBgmPlaybackStatus2(vm::ptr<CellSysutilBgmPlaybackStatus2> stat
return CELL_OK; return CELL_OK;
} }
int cellWebBrowserEstimate2(const vm::ptr<const CellWebBrowserConfig2> config, vm::ptr<be_t<u32>> memSize) int cellWebBrowserEstimate2(const vm::ptr<const CellWebBrowserConfig2> config, vm::ptr<u32> memSize)
{ {
cellSysutil->Warning("cellWebBrowserEstimate2(config_addr=0x%x, memSize_addr=0x%x)", config.addr(), memSize.addr()); cellSysutil->Warning("cellWebBrowserEstimate2(config_addr=0x%x, memSize_addr=0x%x)", config.addr(), memSize.addr());

View File

@ -55,7 +55,7 @@ int cellUserInfoEnableOverlay()
return CELL_OK; return CELL_OK;
} }
int cellUserInfoGetList(vm::ptr<be_t<u32>> listNum, vm::ptr<CellUserInfoUserList> listBuf, vm::ptr<be_t<u32>> currentUserId) int cellUserInfoGetList(vm::ptr<u32> listNum, vm::ptr<CellUserInfoUserList> listBuf, vm::ptr<u32> currentUserId)
{ {
cellUserInfo->Warning("cellUserInfoGetList(listNum_addr=0x%x, listBuf_addr=0x%x, currentUserId_addr=0x%x)", cellUserInfo->Warning("cellUserInfoGetList(listNum_addr=0x%x, listBuf_addr=0x%x, currentUserId_addr=0x%x)",
listNum.addr(), listBuf.addr(), currentUserId.addr()); listNum.addr(), listBuf.addr(), currentUserId.addr());

View File

@ -484,7 +484,7 @@ int cellVdecQueryAttrEx(vm::ptr<const CellVdecTypeEx> type, vm::ptr<CellVdecAttr
return vdecQueryAttr(type->codecType, type->profileLevel, type->codecSpecificInfo_addr, attr); return vdecQueryAttr(type->codecType, type->profileLevel, type->codecSpecificInfo_addr, attr);
} }
int cellVdecOpen(vm::ptr<const CellVdecType> type, vm::ptr<const CellVdecResource> res, vm::ptr<const CellVdecCb> cb, vm::ptr<be_t<u32>> handle) int cellVdecOpen(vm::ptr<const CellVdecType> type, vm::ptr<const CellVdecResource> res, vm::ptr<const CellVdecCb> cb, vm::ptr<u32> handle)
{ {
cellVdec->Warning("cellVdecOpen(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)", cellVdec->Warning("cellVdecOpen(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)",
type.addr(), res.addr(), cb.addr(), handle.addr()); type.addr(), res.addr(), cb.addr(), handle.addr());
@ -494,7 +494,7 @@ int cellVdecOpen(vm::ptr<const CellVdecType> type, vm::ptr<const CellVdecResourc
return CELL_OK; return CELL_OK;
} }
int cellVdecOpenEx(vm::ptr<const CellVdecTypeEx> type, vm::ptr<const CellVdecResourceEx> res, vm::ptr<const CellVdecCb> cb, vm::ptr<be_t<u32>> handle) int cellVdecOpenEx(vm::ptr<const CellVdecTypeEx> type, vm::ptr<const CellVdecResourceEx> res, vm::ptr<const CellVdecCb> cb, vm::ptr<u32> handle)
{ {
cellVdec->Warning("cellVdecOpenEx(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)", cellVdec->Warning("cellVdecOpenEx(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)",
type.addr(), res.addr(), cb.addr(), handle.addr()); type.addr(), res.addr(), cb.addr(), handle.addr());
@ -658,7 +658,7 @@ int cellVdecGetPicture(u32 handle, vm::ptr<const CellVdecPicFormat> format, vm::
return CELL_OK; return CELL_OK;
} }
int cellVdecGetPicItem(u32 handle, vm::ptr<be_t<u32>> picItem_ptr) int cellVdecGetPicItem(u32 handle, vm::ptr<u32> picItem_ptr)
{ {
cellVdec->Log("cellVdecGetPicItem(handle=%d, picItem_ptr_addr=0x%x)", handle, picItem_ptr.addr()); cellVdec->Log("cellVdecGetPicItem(handle=%d, picItem_ptr_addr=0x%x)", handle, picItem_ptr.addr());

View File

@ -35,7 +35,7 @@ u32 vpostOpen(VpostInstance* data)
return id; return id;
} }
int cellVpostOpen(vm::ptr<const CellVpostCfgParam> cfgParam, vm::ptr<const CellVpostResource> resource, vm::ptr<be_t<u32>> handle) int cellVpostOpen(vm::ptr<const CellVpostCfgParam> cfgParam, vm::ptr<const CellVpostResource> resource, vm::ptr<u32> handle)
{ {
cellVpost->Warning("cellVpostOpen(cfgParam_addr=0x%x, resource_addr=0x%x, handle_addr=0x%x)", cellVpost->Warning("cellVpostOpen(cfgParam_addr=0x%x, resource_addr=0x%x, handle_addr=0x%x)",
cfgParam.addr(), resource.addr(), handle.addr()); cfgParam.addr(), resource.addr(), handle.addr());
@ -45,7 +45,7 @@ int cellVpostOpen(vm::ptr<const CellVpostCfgParam> cfgParam, vm::ptr<const CellV
return CELL_OK; return CELL_OK;
} }
int cellVpostOpenEx(vm::ptr<const CellVpostCfgParam> cfgParam, vm::ptr<const CellVpostResourceEx> resource, vm::ptr<be_t<u32>> handle) int cellVpostOpenEx(vm::ptr<const CellVpostCfgParam> cfgParam, vm::ptr<const CellVpostResourceEx> resource, vm::ptr<u32> handle)
{ {
cellVpost->Warning("cellVpostOpenEx(cfgParam_addr=0x%x, resource_addr=0x%x, handle_addr=0x%x)", cellVpost->Warning("cellVpostOpenEx(cfgParam_addr=0x%x, resource_addr=0x%x, handle_addr=0x%x)",
cfgParam.addr(), resource.addr(), handle.addr()); cfgParam.addr(), resource.addr(), handle.addr());

View File

@ -140,7 +140,7 @@ int cellAANDisconnect(u32 receive, u32 receivePortNo, u32 source, u32 sourcePort
return CELL_OK; return CELL_OK;
} }
int cellSSPlayerCreate(vm::ptr<be_t<u32>> handle, vm::ptr<CellSSPlayerConfig> config) int cellSSPlayerCreate(vm::ptr<u32> handle, vm::ptr<CellSSPlayerConfig> config)
{ {
libmixer->Warning("cellSSPlayerCreate(handle_addr=0x%x, config_addr=0x%x)", libmixer->Warning("cellSSPlayerCreate(handle_addr=0x%x, config_addr=0x%x)",
handle.addr(), config.addr()); handle.addr(), config.addr());
@ -471,14 +471,14 @@ int cellSurMixerCreate(vm::ptr<const CellSurMixerConfig> config)
return CELL_OK; return CELL_OK;
} }
int cellSurMixerGetAANHandle(vm::ptr<be_t<u32>> handle) int cellSurMixerGetAANHandle(vm::ptr<u32> handle)
{ {
libmixer->Warning("cellSurMixerGetAANHandle(handle_addr=0x%x) -> %d", handle.addr(), 0x11111111); libmixer->Warning("cellSurMixerGetAANHandle(handle_addr=0x%x) -> %d", handle.addr(), 0x11111111);
*handle = 0x11111111; *handle = 0x11111111;
return CELL_OK; return CELL_OK;
} }
int cellSurMixerChStripGetAANPortNo(vm::ptr<be_t<u32>> port, u32 type, u32 index) int cellSurMixerChStripGetAANPortNo(vm::ptr<u32> port, u32 type, u32 index)
{ {
libmixer->Warning("cellSurMixerChStripGetAANPortNo(port_addr=0x%x, type=0x%x, index=0x%x) -> 0x%x", port.addr(), type, index, (type << 16) | index); libmixer->Warning("cellSurMixerChStripGetAANPortNo(port_addr=0x%x, type=0x%x, index=0x%x) -> 0x%x", port.addr(), type, index, (type << 16) | index);
*port = (type << 16) | index; *port = (type << 16) | index;
@ -593,7 +593,7 @@ int cellSurMixerPause(u32 type)
return CELL_OK; return CELL_OK;
} }
int cellSurMixerGetCurrentBlockTag(vm::ptr<be_t<u64>> tag) int cellSurMixerGetCurrentBlockTag(vm::ptr<u64> tag)
{ {
libmixer->Log("cellSurMixerGetCurrentBlockTag(tag_addr=0x%x)", tag.addr()); libmixer->Log("cellSurMixerGetCurrentBlockTag(tag_addr=0x%x)", tag.addr());
@ -601,7 +601,7 @@ int cellSurMixerGetCurrentBlockTag(vm::ptr<be_t<u64>> tag)
return CELL_OK; return CELL_OK;
} }
int cellSurMixerGetTimestamp(u64 tag, vm::ptr<be_t<u64>> stamp) int cellSurMixerGetTimestamp(u64 tag, vm::ptr<u64> stamp)
{ {
libmixer->Log("cellSurMixerGetTimestamp(tag=0x%llx, stamp_addr=0x%x)", tag, stamp.addr()); libmixer->Log("cellSurMixerGetTimestamp(tag=0x%llx, stamp_addr=0x%x)", tag, stamp.addr());

View File

@ -181,7 +181,7 @@ int sceNpDrmExecuteGamePurchase()
return CELL_OK; return CELL_OK;
} }
int sceNpDrmGetTimelimit(u32 drm_path_addr, vm::ptr<be_t<u64>> time_remain_usec) int sceNpDrmGetTimelimit(u32 drm_path_addr, vm::ptr<u64> time_remain_usec)
{ {
UNIMPLEMENTED_FUNC(sceNp); UNIMPLEMENTED_FUNC(sceNp);
return CELL_OK; return CELL_OK;
@ -901,7 +901,7 @@ int sceNpManagerUnregisterCallback()
return CELL_OK; return CELL_OK;
} }
int sceNpManagerGetStatus(vm::ptr<be_t<u32>> status) int sceNpManagerGetStatus(vm::ptr<u32> status)
{ {
sceNp->Log("sceNpManagerGetStatus(status_addr=0x%x)", status.addr()); sceNp->Log("sceNpManagerGetStatus(status_addr=0x%x)", status.addr());
@ -962,9 +962,17 @@ int sceNpManagerGetAccountAge()
return CELL_OK; return CELL_OK;
} }
int sceNpManagerGetContentRatingFlag() int sceNpManagerGetContentRatingFlag(vm::ptr<u32> isRestricted, vm::ptr<u32> age)
{ {
UNIMPLEMENTED_FUNC(sceNp); sceNp->Warning("sceNpManagerGetContentRatingFlag(isRestricted=%d, age=%d)", isRestricted, age);
if (!sceNpInstance.m_bSceNpInitialized)
return SCE_NP_ERROR_NOT_INITIALIZED;
// TODO: read user's parental control information
*isRestricted = 0;
*age = 18;
return CELL_OK; return CELL_OK;
} }

View File

@ -84,7 +84,7 @@ int sceNpTrophyInit(u32 pool_addr, u32 poolSize, u32 containerId, u64 options)
return CELL_OK; return CELL_OK;
} }
int sceNpTrophyCreateContext(vm::ptr<be_t<u32>> context, vm::ptr<SceNpCommunicationId> commID, vm::ptr<SceNpCommunicationSignature> commSign, u64 options) int sceNpTrophyCreateContext(vm::ptr<u32> context, vm::ptr<SceNpCommunicationId> commID, vm::ptr<SceNpCommunicationSignature> commSign, u64 options)
{ {
sceNpTrophy->Warning("sceNpTrophyCreateContext(context_addr=0x%x, commID_addr=0x%x, commSign_addr=0x%x, options=0x%llx)", sceNpTrophy->Warning("sceNpTrophyCreateContext(context_addr=0x%x, commID_addr=0x%x, commSign_addr=0x%x, options=0x%llx)",
context.addr(), commID.addr(), commSign.addr(), options); context.addr(), commID.addr(), commSign.addr(), options);
@ -122,7 +122,7 @@ int sceNpTrophyCreateContext(vm::ptr<be_t<u32>> context, vm::ptr<SceNpCommunicat
return SCE_NP_TROPHY_ERROR_CONF_DOES_NOT_EXIST; return SCE_NP_TROPHY_ERROR_CONF_DOES_NOT_EXIST;
} }
int sceNpTrophyCreateHandle(vm::ptr<be_t<u32>> handle) int sceNpTrophyCreateHandle(vm::ptr<u32> handle)
{ {
sceNpTrophy->Warning("sceNpTrophyCreateHandle(handle_addr=0x%x)", handle.addr()); sceNpTrophy->Warning("sceNpTrophyCreateHandle(handle_addr=0x%x)", handle.addr());
@ -212,7 +212,7 @@ int sceNpTrophySetSoundLevel()
return CELL_OK; return CELL_OK;
} }
int sceNpTrophyGetRequiredDiskSpace(u32 context, u32 handle, vm::ptr<be_t<u64>> reqspace, u64 options) int sceNpTrophyGetRequiredDiskSpace(u32 context, u32 handle, vm::ptr<u64> reqspace, u64 options)
{ {
sceNpTrophy->Warning("sceNpTrophyGetRequiredDiskSpace(context=%d, handle=%d, reqspace_addr=0x%x, options=0x%llx)", sceNpTrophy->Warning("sceNpTrophyGetRequiredDiskSpace(context=%d, handle=%d, reqspace_addr=0x%x, options=0x%llx)",
context, handle, reqspace.addr(), options); context, handle, reqspace.addr(), options);
@ -307,7 +307,7 @@ int sceNpTrophyDestroyHandle()
return CELL_OK; return CELL_OK;
} }
int sceNpTrophyUnlockTrophy(u32 context, u32 handle, s32 trophyId, vm::ptr<be_t<u32>> platinumId) int sceNpTrophyUnlockTrophy(u32 context, u32 handle, s32 trophyId, vm::ptr<u32> platinumId)
{ {
sceNpTrophy->Warning("sceNpTrophyUnlockTrophy(context=%d, handle=%d, trophyId=%d, platinumId_addr=0x%x)", sceNpTrophy->Warning("sceNpTrophyUnlockTrophy(context=%d, handle=%d, trophyId=%d, platinumId_addr=0x%x)",
context, handle, trophyId, platinumId.addr()); context, handle, trophyId, platinumId.addr());
@ -344,7 +344,7 @@ int sceNpTrophyTerm()
return CELL_OK; return CELL_OK;
} }
int sceNpTrophyGetTrophyUnlockState(u32 context, u32 handle, vm::ptr<SceNpTrophyFlagArray> flags, vm::ptr<be_t<u32>> count) int sceNpTrophyGetTrophyUnlockState(u32 context, u32 handle, vm::ptr<SceNpTrophyFlagArray> flags, vm::ptr<u32> count)
{ {
sceNpTrophy->Warning("sceNpTrophyGetTrophyUnlockState(context=%d, handle=%d, flags_addr=0x%x, count_addr=0x%x)", sceNpTrophy->Warning("sceNpTrophyGetTrophyUnlockState(context=%d, handle=%d, flags_addr=0x%x, count_addr=0x%x)",
context, handle, flags.addr(), count.addr()); context, handle, flags.addr(), count.addr());

View File

@ -81,7 +81,7 @@ s64 sys_prx_exitspawn_with_level()
return CELL_OK; return CELL_OK;
} }
int sys_spu_elf_get_information(u32 elf_img, vm::ptr<be_t<u32>> entry, vm::ptr<be_t<u32>> nseg) int sys_spu_elf_get_information(u32 elf_img, vm::ptr<u32> entry, vm::ptr<u32> nseg)
{ {
sysPrxForUser->Todo("sys_spu_elf_get_information(elf_img=0x%x, entry_addr=0x%x, nseg_addr=0x%x)", elf_img, entry.addr(), nseg.addr()); sysPrxForUser->Todo("sys_spu_elf_get_information(elf_img=0x%x, entry_addr=0x%x, nseg_addr=0x%x)", elf_img, entry.addr(), nseg.addr());
return CELL_OK; return CELL_OK;
@ -106,7 +106,7 @@ int sys_spu_image_close(vm::ptr<sys_spu_image> img)
return CELL_OK; return CELL_OK;
} }
int sys_raw_spu_load(s32 id, vm::ptr<const char> path, vm::ptr<be_t<u32>> entry) int sys_raw_spu_load(s32 id, vm::ptr<const char> path, vm::ptr<u32> entry)
{ {
sysPrxForUser->Warning("sys_raw_spu_load(id=0x%x, path_addr=0x%x('%s'), entry_addr=0x%x)", sysPrxForUser->Warning("sys_raw_spu_load(id=0x%x, path_addr=0x%x('%s'), entry_addr=0x%x)",
id, path.addr(), path.get_ptr(), entry.addr()); id, path.addr(), path.get_ptr(), entry.addr());

View File

@ -111,7 +111,7 @@ int sdata_unpack(const std::string& packed_file, const std::string& unpacked_fil
} }
int cellFsSdataOpen(vm::ptr<const char> path, int flags, vm::ptr<be_t<u32>> fd, vm::ptr<be_t<u32>> arg, u64 size) int cellFsSdataOpen(vm::ptr<const char> path, int flags, vm::ptr<be_t<u32>> fd, vm::ptr<u32> arg, u64 size)
{ {
sys_fs->Warning("cellFsSdataOpen(path=\"%s\", flags=0x%x, fd_addr=0x%x, arg_addr=0x%x, size=0x%llx) -> cellFsOpen()", sys_fs->Warning("cellFsSdataOpen(path=\"%s\", flags=0x%x, fd_addr=0x%x, arg_addr=0x%x, size=0x%llx) -> cellFsOpen()",
path.get_ptr(), flags, fd.addr(), arg.addr(), size); path.get_ptr(), flags, fd.addr(), arg.addr(), size);
@ -136,7 +136,7 @@ int cellFsSdataOpen(vm::ptr<const char> path, int flags, vm::ptr<be_t<u32>> fd,
return cellFsOpen(path, flags, fd, arg, size); return cellFsOpen(path, flags, fd, arg, size);
} }
int cellFsSdataOpenByFd(int mself_fd, int flags, vm::ptr<be_t<u32>> sdata_fd, u64 offset, vm::ptr<be_t<u32>> arg, u64 size) int cellFsSdataOpenByFd(int mself_fd, int flags, vm::ptr<u32> sdata_fd, u64 offset, vm::ptr<u32> arg, u64 size)
{ {
sys_fs->Todo("cellFsSdataOpenByFd(mself_fd=0x%x, flags=0x%x, sdata_fd_addr=0x%x, offset=0x%llx, arg_addr=0x%x, size=0x%llx) -> cellFsOpen()", sys_fs->Todo("cellFsSdataOpenByFd(mself_fd=0x%x, flags=0x%x, sdata_fd_addr=0x%x, offset=0x%llx, arg_addr=0x%x, size=0x%llx) -> cellFsOpen()",
mself_fd, flags, sdata_fd.addr(), offset, arg.addr(), size); mself_fd, flags, sdata_fd.addr(), offset, arg.addr(), size);
@ -208,7 +208,7 @@ void fsAioRead(u32 fd, vm::ptr<CellFsAio> aio, int xid, vm::ptr<void (*)(vm::ptr
g_FsAioReadCur++; g_FsAioReadCur++;
} }
int cellFsAioRead(vm::ptr<CellFsAio> aio, vm::ptr<be_t<u32>> aio_id, vm::ptr<void(*)(vm::ptr<CellFsAio> xaio, int error, int xid, u64 size)> func) int cellFsAioRead(vm::ptr<CellFsAio> aio, vm::ptr<u32> aio_id, vm::ptr<void(*)(vm::ptr<CellFsAio> xaio, int error, int xid, u64 size)> func)
{ {
sys_fs->Warning("cellFsAioRead(aio_addr=0x%x, id_addr=0x%x, func_addr=0x%x)", aio.addr(), aio_id.addr(), func.addr()); sys_fs->Warning("cellFsAioRead(aio_addr=0x%x, id_addr=0x%x, func_addr=0x%x)", aio.addr(), aio_id.addr(), func.addr());
@ -239,7 +239,7 @@ int cellFsAioRead(vm::ptr<CellFsAio> aio, vm::ptr<be_t<u32>> aio_id, vm::ptr<voi
return CELL_OK; return CELL_OK;
} }
int cellFsAioWrite(vm::ptr<CellFsAio> aio, vm::ptr<be_t<u32>> aio_id, vm::ptr<void(*)(vm::ptr<CellFsAio> xaio, int error, int xid, u64 size)> func) int cellFsAioWrite(vm::ptr<CellFsAio> aio, vm::ptr<u32> aio_id, vm::ptr<void(*)(vm::ptr<CellFsAio> xaio, int error, int xid, u64 size)> func)
{ {
sys_fs->Todo("cellFsAioWrite(aio_addr=0x%x, id_addr=0x%x, func_addr=0x%x)", aio.addr(), aio_id.addr(), func.addr()); sys_fs->Todo("cellFsAioWrite(aio_addr=0x%x, id_addr=0x%x, func_addr=0x%x)", aio.addr(), aio_id.addr(), func.addr());

View File

@ -19,7 +19,7 @@ extern "C"
Module *sys_net = nullptr; Module *sys_net = nullptr;
vm::ptr<be_t<s32>> g_lastError = vm::ptr<be_t<s32>>::make(0); vm::ptr<s32> g_lastError = vm::ptr<s32>::make(0);
// Auxiliary Functions // Auxiliary Functions
@ -341,7 +341,7 @@ int socketselect()
int sys_net_initialize_network_ex(vm::ptr<sys_net_initialize_parameter> param) int sys_net_initialize_network_ex(vm::ptr<sys_net_initialize_parameter> param)
{ {
sys_net->Warning("sys_net_initialize_network_ex(param_addr=0x%x)", param.addr()); sys_net->Warning("sys_net_initialize_network_ex(param_addr=0x%x)", param.addr());
g_lastError = vm::ptr<be_t<s32>>::make((u32)Memory.Alloc(4, 1)); g_lastError = vm::ptr<s32>::make((u32)Memory.Alloc(4, 1));
#ifdef _WIN32 #ifdef _WIN32
WSADATA wsaData; WSADATA wsaData;
WORD wVersionRequested = MAKEWORD(1,1); WORD wVersionRequested = MAKEWORD(1,1);
@ -474,7 +474,7 @@ int sys_net_finalize_network()
{ {
sys_net->Warning("sys_net_initialize_network_ex()"); sys_net->Warning("sys_net_initialize_network_ex()");
Memory.Free(g_lastError.addr()); Memory.Free(g_lastError.addr());
g_lastError = vm::ptr<be_t<s32>>::make(0); g_lastError = vm::ptr<s32>::make(0);
#ifdef _WIN32 #ifdef _WIN32
WSACleanup(); WSACleanup();
#endif #endif

View File

@ -30,7 +30,7 @@ struct FsRingBufferConfig
} fs_config; } fs_config;
s32 cellFsOpen(vm::ptr<const char> path, s32 flags, vm::ptr<be_t<u32>> fd, vm::ptr<be_t<u32>> arg, u64 size) s32 cellFsOpen(vm::ptr<const char> path, s32 flags, vm::ptr<be_t<u32>> fd, vm::ptr<u32> arg, u64 size)
{ {
sys_fs->Log("cellFsOpen(path=\"%s\", flags=0x%x, fd_addr=0x%x, arg_addr=0x%x, size=0x%llx)", sys_fs->Log("cellFsOpen(path=\"%s\", flags=0x%x, fd_addr=0x%x, arg_addr=0x%x, size=0x%llx)",
path.get_ptr(), flags, fd.addr(), arg.addr(), size); path.get_ptr(), flags, fd.addr(), arg.addr(), size);
@ -137,7 +137,7 @@ s32 cellFsRead(u32 fd, vm::ptr<void> buf, u64 nbytes, vm::ptr<be_t<u64>> nread)
return CELL_OK; return CELL_OK;
} }
s32 cellFsWrite(u32 fd, vm::ptr<const void> buf, u64 nbytes, vm::ptr<be_t<u64>> nwrite) s32 cellFsWrite(u32 fd, vm::ptr<const void> buf, u64 nbytes, vm::ptr<u64> nwrite)
{ {
sys_fs->Log("cellFsWrite(fd=%d, buf_addr=0x%x, nbytes=0x%llx, nwrite_addr=0x%x)", sys_fs->Log("cellFsWrite(fd=%d, buf_addr=0x%x, nbytes=0x%llx, nwrite_addr=0x%x)",
fd, buf.addr(), nbytes, nwrite.addr()); fd, buf.addr(), nbytes, nwrite.addr());
@ -170,7 +170,7 @@ s32 cellFsClose(u32 fd)
return CELL_OK; return CELL_OK;
} }
s32 cellFsOpendir(vm::ptr<const char> path, vm::ptr<be_t<u32>> fd) s32 cellFsOpendir(vm::ptr<const char> path, vm::ptr<u32> fd)
{ {
sys_fs->Warning("cellFsOpendir(path=\"%s\", fd_addr=0x%x)", path.get_ptr(), fd.addr()); sys_fs->Warning("cellFsOpendir(path=\"%s\", fd_addr=0x%x)", path.get_ptr(), fd.addr());
@ -187,7 +187,7 @@ s32 cellFsOpendir(vm::ptr<const char> path, vm::ptr<be_t<u32>> fd)
return CELL_OK; return CELL_OK;
} }
s32 cellFsReaddir(u32 fd, vm::ptr<CellFsDirent> dir, vm::ptr<be_t<u64>> nread) s32 cellFsReaddir(u32 fd, vm::ptr<CellFsDirent> dir, vm::ptr<u64> nread)
{ {
sys_fs->Warning("cellFsReaddir(fd=%d, dir_addr=0x%x, nread_addr=0x%x)", fd, dir.addr(), nread.addr()); sys_fs->Warning("cellFsReaddir(fd=%d, dir_addr=0x%x, nread_addr=0x%x)", fd, dir.addr(), nread.addr());
@ -496,7 +496,7 @@ s32 cellFsTruncate(vm::ptr<const char> path, u64 size)
return CELL_OK; return CELL_OK;
} }
s32 cellFsFGetBlockSize(u32 fd, vm::ptr<be_t<u64>> sector_size, vm::ptr<be_t<u64>> block_size) s32 cellFsFGetBlockSize(u32 fd, vm::ptr<u64> sector_size, vm::ptr<u64> block_size)
{ {
sys_fs->Warning("cellFsFGetBlockSize(fd=%d, sector_size_addr=0x%x, block_size_addr=0x%x)", sys_fs->Warning("cellFsFGetBlockSize(fd=%d, sector_size_addr=0x%x, block_size_addr=0x%x)",
fd, sector_size.addr(), block_size.addr()); fd, sector_size.addr(), block_size.addr());
@ -512,7 +512,7 @@ s32 cellFsFGetBlockSize(u32 fd, vm::ptr<be_t<u64>> sector_size, vm::ptr<be_t<u64
return CELL_OK; return CELL_OK;
} }
s32 cellFsGetBlockSize(vm::ptr<const char> path, vm::ptr<be_t<u64>> sector_size, vm::ptr<be_t<u64>> block_size) s32 cellFsGetBlockSize(vm::ptr<const char> path, vm::ptr<u64> sector_size, vm::ptr<u64> block_size)
{ {
sys_fs->Warning("cellFsGetBlockSize(file='%s', sector_size_addr=0x%x, block_size_addr=0x%x)", sys_fs->Warning("cellFsGetBlockSize(file='%s', sector_size_addr=0x%x, block_size_addr=0x%x)",
path.get_ptr(), sector_size.addr(), block_size.addr()); path.get_ptr(), sector_size.addr(), block_size.addr());
@ -525,7 +525,7 @@ s32 cellFsGetBlockSize(vm::ptr<const char> path, vm::ptr<be_t<u64>> sector_size,
return CELL_OK; return CELL_OK;
} }
s32 cellFsGetFreeSize(vm::ptr<const char> path, vm::ptr<be_t<u32>> block_size, vm::ptr<be_t<u64>> block_count) s32 cellFsGetFreeSize(vm::ptr<const char> path, vm::ptr<u32> block_size, vm::ptr<u64> block_count)
{ {
sys_fs->Warning("cellFsGetFreeSize(path=\"%s\", block_size_addr=0x%x, block_count_addr=0x%x)", sys_fs->Warning("cellFsGetFreeSize(path=\"%s\", block_size_addr=0x%x, block_count_addr=0x%x)",
path.get_ptr(), block_size.addr(), block_count.addr()); path.get_ptr(), block_size.addr(), block_count.addr());
@ -539,7 +539,7 @@ s32 cellFsGetFreeSize(vm::ptr<const char> path, vm::ptr<be_t<u32>> block_size, v
return CELL_OK; return CELL_OK;
} }
s32 cellFsGetDirectoryEntries(u32 fd, vm::ptr<CellFsDirectoryEntry> entries, u32 entries_size, vm::ptr<be_t<u32>> data_count) s32 cellFsGetDirectoryEntries(u32 fd, vm::ptr<CellFsDirectoryEntry> entries, u32 entries_size, vm::ptr<u32> data_count)
{ {
sys_fs->Warning("cellFsGetDirectoryEntries(fd=%d, entries_addr=0x%x, entries_size=0x%x, data_count_addr=0x%x)", sys_fs->Warning("cellFsGetDirectoryEntries(fd=%d, entries_addr=0x%x, entries_size=0x%x, data_count_addr=0x%x)",
fd, entries.addr(), entries_size, data_count.addr()); fd, entries.addr(), entries_size, data_count.addr());
@ -637,7 +637,7 @@ s32 cellFsStReadGetRingBuf(u32 fd, vm::ptr<CellFsRingBuffer> ringbuf)
return CELL_OK; return CELL_OK;
} }
s32 cellFsStReadGetStatus(u32 fd, vm::ptr<be_t<u64>> status) s32 cellFsStReadGetStatus(u32 fd, vm::ptr<u64> status)
{ {
sys_fs->Warning("cellFsStReadGetRingBuf(fd=%d, status_addr=0x%x)", fd, status.addr()); sys_fs->Warning("cellFsStReadGetRingBuf(fd=%d, status_addr=0x%x)", fd, status.addr());
@ -651,7 +651,7 @@ s32 cellFsStReadGetStatus(u32 fd, vm::ptr<be_t<u64>> status)
return CELL_OK; return CELL_OK;
} }
s32 cellFsStReadGetRegid(u32 fd, vm::ptr<be_t<u64>> regid) s32 cellFsStReadGetRegid(u32 fd, vm::ptr<u64> regid)
{ {
sys_fs->Warning("cellFsStReadGetRingBuf(fd=%d, regid_addr=0x%x)", fd, regid.addr()); sys_fs->Warning("cellFsStReadGetRingBuf(fd=%d, regid_addr=0x%x)", fd, regid.addr());
@ -694,7 +694,7 @@ s32 cellFsStReadStop(u32 fd)
return CELL_OK; return CELL_OK;
} }
s32 cellFsStRead(u32 fd, u32 buf_addr, u64 size, vm::ptr<be_t<u64>> rsize) s32 cellFsStRead(u32 fd, u32 buf_addr, u64 size, vm::ptr<u64> rsize)
{ {
sys_fs->Warning("cellFsStRead(fd=%d, buf_addr=0x%x, size=0x%llx, rsize_addr=0x%x)", fd, buf_addr, size, rsize.addr()); sys_fs->Warning("cellFsStRead(fd=%d, buf_addr=0x%x, size=0x%llx, rsize_addr=0x%x)", fd, buf_addr, size, rsize.addr());
@ -714,7 +714,7 @@ s32 cellFsStRead(u32 fd, u32 buf_addr, u64 size, vm::ptr<be_t<u64>> rsize)
return CELL_OK; return CELL_OK;
} }
s32 cellFsStReadGetCurrentAddr(u32 fd, vm::ptr<be_t<u32>> addr, vm::ptr<be_t<u64>> size) s32 cellFsStReadGetCurrentAddr(u32 fd, vm::ptr<u32> addr, vm::ptr<u64> size)
{ {
sys_fs->Todo("cellFsStReadGetCurrentAddr(fd=%d, addr_addr=0x%x, size_addr=0x%x)", fd, addr.addr(), size.addr()); sys_fs->Todo("cellFsStReadGetCurrentAddr(fd=%d, addr_addr=0x%x, size_addr=0x%x)", fd, addr.addr(), size.addr());

View File

@ -128,12 +128,12 @@ struct CellFsRingBuffer
}; };
// SysCalls // SysCalls
s32 cellFsOpen(vm::ptr<const char> path, s32 flags, vm::ptr<be_t<u32>> fd, vm::ptr<be_t<u32>> arg, u64 size); s32 cellFsOpen(vm::ptr<const char> path, s32 flags, vm::ptr<be_t<u32>> fd, vm::ptr<u32> arg, u64 size);
s32 cellFsRead(u32 fd, vm::ptr<void> buf, u64 nbytes, vm::ptr<be_t<u64>> nread); s32 cellFsRead(u32 fd, vm::ptr<void> buf, u64 nbytes, vm::ptr<be_t<u64>> nread);
s32 cellFsWrite(u32 fd, vm::ptr<const void> buf, u64 nbytes, vm::ptr<be_t<u64>> nwrite); s32 cellFsWrite(u32 fd, vm::ptr<const void> buf, u64 nbytes, vm::ptr<u64> nwrite);
s32 cellFsClose(u32 fd); s32 cellFsClose(u32 fd);
s32 cellFsOpendir(vm::ptr<const char> path, vm::ptr<be_t<u32>> fd); s32 cellFsOpendir(vm::ptr<const char> path, vm::ptr<u32> fd);
s32 cellFsReaddir(u32 fd, vm::ptr<CellFsDirent> dir, vm::ptr<be_t<u64>> nread); s32 cellFsReaddir(u32 fd, vm::ptr<CellFsDirent> dir, vm::ptr<u64> nread);
s32 cellFsClosedir(u32 fd); s32 cellFsClosedir(u32 fd);
s32 cellFsStat(vm::ptr<const char> path, vm::ptr<CellFsStat> sb); s32 cellFsStat(vm::ptr<const char> path, vm::ptr<CellFsStat> sb);
s32 cellFsFstat(u32 fd, vm::ptr<CellFsStat> sb); s32 cellFsFstat(u32 fd, vm::ptr<CellFsStat> sb);
@ -146,19 +146,19 @@ s32 cellFsUnlink(vm::ptr<const char> path);
s32 cellFsLseek(u32 fd, s64 offset, u32 whence, vm::ptr<be_t<u64>> pos); s32 cellFsLseek(u32 fd, s64 offset, u32 whence, vm::ptr<be_t<u64>> pos);
s32 cellFsFtruncate(u32 fd, u64 size); s32 cellFsFtruncate(u32 fd, u64 size);
s32 cellFsTruncate(vm::ptr<const char> path, u64 size); s32 cellFsTruncate(vm::ptr<const char> path, u64 size);
s32 cellFsFGetBlockSize(u32 fd, vm::ptr<be_t<u64>> sector_size, vm::ptr<be_t<u64>> block_size); s32 cellFsFGetBlockSize(u32 fd, vm::ptr<u64> sector_size, vm::ptr<u64> block_size);
s32 cellFsGetBlockSize(vm::ptr<const char> path, vm::ptr<be_t<u64>> sector_size, vm::ptr<be_t<u64>> block_size); s32 cellFsGetBlockSize(vm::ptr<const char> path, vm::ptr<u64> sector_size, vm::ptr<u64> block_size);
s32 cellFsGetFreeSize(vm::ptr<const char> path, vm::ptr<be_t<u32>> block_size, vm::ptr<be_t<u64>> block_count); s32 cellFsGetFreeSize(vm::ptr<const char> path, vm::ptr<u32> block_size, vm::ptr<u64> block_count);
s32 cellFsGetDirectoryEntries(u32 fd, vm::ptr<CellFsDirectoryEntry> entries, u32 entries_size, vm::ptr<be_t<u32>> data_count); s32 cellFsGetDirectoryEntries(u32 fd, vm::ptr<CellFsDirectoryEntry> entries, u32 entries_size, vm::ptr<u32> data_count);
s32 cellFsStReadInit(u32 fd, vm::ptr<CellFsRingBuffer> ringbuf); s32 cellFsStReadInit(u32 fd, vm::ptr<CellFsRingBuffer> ringbuf);
s32 cellFsStReadFinish(u32 fd); s32 cellFsStReadFinish(u32 fd);
s32 cellFsStReadGetRingBuf(u32 fd, vm::ptr<CellFsRingBuffer> ringbuf); s32 cellFsStReadGetRingBuf(u32 fd, vm::ptr<CellFsRingBuffer> ringbuf);
s32 cellFsStReadGetStatus(u32 fd, vm::ptr<be_t<u64>> status); s32 cellFsStReadGetStatus(u32 fd, vm::ptr<u64> status);
s32 cellFsStReadGetRegid(u32 fd, vm::ptr<be_t<u64>> regid); s32 cellFsStReadGetRegid(u32 fd, vm::ptr<u64> regid);
s32 cellFsStReadStart(u32 fd, u64 offset, u64 size); s32 cellFsStReadStart(u32 fd, u64 offset, u64 size);
s32 cellFsStReadStop(u32 fd); s32 cellFsStReadStop(u32 fd);
s32 cellFsStRead(u32 fd, u32 buf_addr, u64 size, vm::ptr<be_t<u64>> rsize); s32 cellFsStRead(u32 fd, u32 buf_addr, u64 size, vm::ptr<u64> rsize);
s32 cellFsStReadGetCurrentAddr(u32 fd, vm::ptr<be_t<u32>> addr_addr, vm::ptr<be_t<u64>> size); s32 cellFsStReadGetCurrentAddr(u32 fd, vm::ptr<u32> addr_addr, vm::ptr<u64> size);
s32 cellFsStReadPutCurrentAddr(u32 fd, u32 addr_addr, u64 size); s32 cellFsStReadPutCurrentAddr(u32 fd, u32 addr_addr, u64 size);
s32 cellFsStReadWait(u32 fd, u64 size); s32 cellFsStReadWait(u32 fd, u64 size);
s32 cellFsStReadWaitCallback(u32 fd, u64 size, vm::ptr<void (*)(int xfd, u64 xsize)> func); s32 cellFsStReadWaitCallback(u32 fd, u64 size, vm::ptr<void (*)(int xfd, u64 xsize)> func);

View File

@ -9,7 +9,7 @@
SysCallBase sys_cond("sys_cond"); SysCallBase sys_cond("sys_cond");
s32 sys_cond_create(vm::ptr<be_t<u32>> cond_id, u32 mutex_id, vm::ptr<sys_cond_attribute> attr) s32 sys_cond_create(vm::ptr<u32> cond_id, u32 mutex_id, vm::ptr<sys_cond_attribute> attr)
{ {
sys_cond.Log("sys_cond_create(cond_id_addr=0x%x, mutex_id=%d, attr_addr=0x%x)", sys_cond.Log("sys_cond_create(cond_id_addr=0x%x, mutex_id=%d, attr_addr=0x%x)",
cond_id.addr(), mutex_id, attr.addr()); cond_id.addr(), mutex_id, attr.addr());
@ -80,9 +80,7 @@ s32 sys_cond_signal(u32 cond_id)
if (u32 target = (mutex->protocol == SYS_SYNC_PRIORITY ? cond->m_queue.pop_prio() : cond->m_queue.pop())) if (u32 target = (mutex->protocol == SYS_SYNC_PRIORITY ? cond->m_queue.pop_prio() : cond->m_queue.pop()))
{ {
//cond->signal_stamp = get_system_time();
cond->signal.lock(target); cond->signal.lock(target);
Emu.GetCPU().NotifyThread(target);
if (Emu.IsStopped()) if (Emu.IsStopped())
{ {
@ -108,9 +106,7 @@ s32 sys_cond_signal_all(u32 cond_id)
while (u32 target = (mutex->protocol == SYS_SYNC_PRIORITY ? cond->m_queue.pop_prio() : cond->m_queue.pop())) while (u32 target = (mutex->protocol == SYS_SYNC_PRIORITY ? cond->m_queue.pop_prio() : cond->m_queue.pop()))
{ {
cond->signaler = GetCurrentPPUThread().GetId(); cond->signaler = GetCurrentPPUThread().GetId();
//cond->signal_stamp = get_system_time();
cond->signal.lock(target); cond->signal.lock(target);
Emu.GetCPU().NotifyThread(target);
if (Emu.IsStopped()) if (Emu.IsStopped())
{ {
@ -147,9 +143,7 @@ s32 sys_cond_signal_to(u32 cond_id, u32 thread_id)
u32 target = thread_id; u32 target = thread_id;
{ {
//cond->signal_stamp = get_system_time();
cond->signal.lock(target); cond->signal.lock(target);
Emu.GetCPU().NotifyThread(target);
} }
if (Emu.IsStopped()) if (Emu.IsStopped())
@ -195,7 +189,6 @@ s32 sys_cond_wait(u32 cond_id, u64 timeout)
{ {
if (cond->signal.unlock(tid, tid) == SMR_OK) if (cond->signal.unlock(tid, tid) == SMR_OK)
{ {
//const u64 stamp2 = get_system_time();
if (SMutexResult res = mutex->m_mutex.trylock(tid)) if (SMutexResult res = mutex->m_mutex.trylock(tid))
{ {
if (res != SMR_FAILED) if (res != SMR_FAILED)
@ -215,14 +208,11 @@ s32 sys_cond_wait(u32 cond_id, u64 timeout)
} }
} }
mutex->recursive = 1; mutex->recursive = 1;
const volatile u64 stamp = cond->signal_stamp;
cond->signal.unlock(tid); cond->signal.unlock(tid);
Emu.GetCPU().NotifyThread(cond->signaler);
//ConLog.Write("sys_cond_wait(): signal latency %lld (minimum %lld)", get_system_time() - stamp, stamp2 - stamp);
return CELL_OK; return CELL_OK;
} }
SM_Sleep(); std::this_thread::sleep_for(std::chrono::milliseconds(1));
if (counter++ > max_counter) if (counter++ > max_counter)
{ {

View File

@ -32,7 +32,7 @@ struct Cond
}; };
// SysCalls // SysCalls
s32 sys_cond_create(vm::ptr<be_t<u32>> cond_id, u32 mutex_id, vm::ptr<sys_cond_attribute> attr); s32 sys_cond_create(vm::ptr<u32> cond_id, u32 mutex_id, vm::ptr<sys_cond_attribute> attr);
s32 sys_cond_destroy(u32 cond_id); s32 sys_cond_destroy(u32 cond_id);
s32 sys_cond_wait(u32 cond_id, u64 timeout); s32 sys_cond_wait(u32 cond_id, u64 timeout);
s32 sys_cond_signal(u32 cond_id); s32 sys_cond_signal(u32 cond_id);

View File

@ -27,7 +27,7 @@ u32 event_queue_create(u32 protocol, s32 type, u64 name_u64, u64 event_queue_key
return id; return id;
} }
s32 sys_event_queue_create(vm::ptr<be_t<u32>> equeue_id, vm::ptr<sys_event_queue_attr> attr, u64 event_queue_key, s32 size) s32 sys_event_queue_create(vm::ptr<u32> equeue_id, vm::ptr<sys_event_queue_attr> attr, u64 event_queue_key, s32 size)
{ {
sys_event.Warning("sys_event_queue_create(equeue_id_addr=0x%x, attr_addr=0x%x, event_queue_key=0x%llx, size=%d)", sys_event.Warning("sys_event_queue_create(equeue_id_addr=0x%x, attr_addr=0x%x, event_queue_key=0x%llx, size=%d)",
equeue_id.addr(), attr.addr(), event_queue_key, size); equeue_id.addr(), attr.addr(), event_queue_key, size);
@ -112,7 +112,7 @@ s32 sys_event_queue_destroy(u32 equeue_id, int mode)
return CELL_OK; return CELL_OK;
} }
s32 sys_event_queue_tryreceive(u32 equeue_id, vm::ptr<sys_event_data> event_array, s32 size, vm::ptr<be_t<u32>> number) s32 sys_event_queue_tryreceive(u32 equeue_id, vm::ptr<sys_event_data> event_array, s32 size, vm::ptr<u32> number)
{ {
sys_event.Todo("sys_event_queue_tryreceive(equeue_id=%d, event_array_addr=0x%x, size=%d, number_addr=0x%x)", sys_event.Todo("sys_event_queue_tryreceive(equeue_id=%d, event_array_addr=0x%x, size=%d, number_addr=0x%x)",
equeue_id, event_array.addr(), size, number.addr()); equeue_id, event_array.addr(), size, number.addr());
@ -246,7 +246,7 @@ u32 event_port_create(u64 name)
return id; return id;
} }
s32 sys_event_port_create(vm::ptr<be_t<u32>> eport_id, s32 port_type, u64 name) s32 sys_event_port_create(vm::ptr<u32> eport_id, s32 port_type, u64 name)
{ {
sys_event.Warning("sys_event_port_create(eport_id_addr=0x%x, port_type=0x%x, name=0x%llx)", sys_event.Warning("sys_event_port_create(eport_id_addr=0x%x, port_type=0x%x, name=0x%llx)",
eport_id.addr(), port_type, name); eport_id.addr(), port_type, name);

View File

@ -221,13 +221,13 @@ u32 event_port_create(u64 name);
u32 event_queue_create(u32 protocol, s32 type, u64 name_u64, u64 event_queue_key, s32 size); u32 event_queue_create(u32 protocol, s32 type, u64 name_u64, u64 event_queue_key, s32 size);
// SysCalls // SysCalls
s32 sys_event_queue_create(vm::ptr<be_t<u32>> equeue_id, vm::ptr<sys_event_queue_attr> attr, u64 event_queue_key, s32 size); s32 sys_event_queue_create(vm::ptr<u32> equeue_id, vm::ptr<sys_event_queue_attr> attr, u64 event_queue_key, s32 size);
s32 sys_event_queue_destroy(u32 equeue_id, s32 mode); s32 sys_event_queue_destroy(u32 equeue_id, s32 mode);
s32 sys_event_queue_receive(u32 equeue_id, vm::ptr<sys_event_data> dummy_event, u64 timeout); s32 sys_event_queue_receive(u32 equeue_id, vm::ptr<sys_event_data> dummy_event, u64 timeout);
s32 sys_event_queue_tryreceive(u32 equeue_id, vm::ptr<sys_event_data> event_array, s32 size, vm::ptr<be_t<u32>> number); s32 sys_event_queue_tryreceive(u32 equeue_id, vm::ptr<sys_event_data> event_array, s32 size, vm::ptr<u32> number);
s32 sys_event_queue_drain(u32 event_queue_id); s32 sys_event_queue_drain(u32 event_queue_id);
s32 sys_event_port_create(vm::ptr<be_t<u32>> eport_id, s32 port_type, u64 name); s32 sys_event_port_create(vm::ptr<u32> eport_id, s32 port_type, u64 name);
s32 sys_event_port_destroy(u32 eport_id); s32 sys_event_port_destroy(u32 eport_id);
s32 sys_event_port_connect_local(u32 event_port_id, u32 event_queue_id); s32 sys_event_port_connect_local(u32 event_port_id, u32 event_queue_id);
s32 sys_event_port_disconnect(u32 eport_id); s32 sys_event_port_disconnect(u32 eport_id);

View File

@ -37,7 +37,7 @@ u32 EventFlag::check()
return target; return target;
} }
s32 sys_event_flag_create(vm::ptr<be_t<u32>> eflag_id, vm::ptr<sys_event_flag_attr> attr, u64 init) s32 sys_event_flag_create(vm::ptr<u32> eflag_id, vm::ptr<sys_event_flag_attr> attr, u64 init)
{ {
sys_event_flag.Warning("sys_event_flag_create(eflag_id_addr=0x%x, attr_addr=0x%x, init=0x%llx)", sys_event_flag.Warning("sys_event_flag_create(eflag_id_addr=0x%x, attr_addr=0x%x, init=0x%llx)",
eflag_id.addr(), attr.addr(), init); eflag_id.addr(), attr.addr(), init);
@ -88,7 +88,7 @@ s32 sys_event_flag_destroy(u32 eflag_id)
return CELL_OK; return CELL_OK;
} }
s32 sys_event_flag_wait(u32 eflag_id, u64 bitptn, u32 mode, vm::ptr<be_t<u64>> result, u64 timeout) s32 sys_event_flag_wait(u32 eflag_id, u64 bitptn, u32 mode, vm::ptr<u64> result, u64 timeout)
{ {
sys_event_flag.Log("sys_event_flag_wait(eflag_id=%d, bitptn=0x%llx, mode=0x%x, result_addr=0x%x, timeout=%lld)", sys_event_flag.Log("sys_event_flag_wait(eflag_id=%d, bitptn=0x%llx, mode=0x%x, result_addr=0x%x, timeout=%lld)",
eflag_id, bitptn, mode, result.addr(), timeout); eflag_id, bitptn, mode, result.addr(), timeout);
@ -225,7 +225,7 @@ s32 sys_event_flag_wait(u32 eflag_id, u64 bitptn, u32 mode, vm::ptr<be_t<u64>> r
} }
} }
s32 sys_event_flag_trywait(u32 eflag_id, u64 bitptn, u32 mode, vm::ptr<be_t<u64>> result) s32 sys_event_flag_trywait(u32 eflag_id, u64 bitptn, u32 mode, vm::ptr<u64> result)
{ {
sys_event_flag.Log("sys_event_flag_trywait(eflag_id=%d, bitptn=0x%llx, mode=0x%x, result_addr=0x%x)", sys_event_flag.Log("sys_event_flag_trywait(eflag_id=%d, bitptn=0x%llx, mode=0x%x, result_addr=0x%x)",
eflag_id, bitptn, mode, result.addr()); eflag_id, bitptn, mode, result.addr());
@ -316,7 +316,7 @@ s32 sys_event_flag_clear(u32 eflag_id, u64 bitptn)
return CELL_OK; return CELL_OK;
} }
s32 sys_event_flag_cancel(u32 eflag_id, vm::ptr<be_t<u32>> num) s32 sys_event_flag_cancel(u32 eflag_id, vm::ptr<u32> num)
{ {
sys_event_flag.Log("sys_event_flag_cancel(eflag_id=%d, num_addr=0x%x)", eflag_id, num.addr()); sys_event_flag.Log("sys_event_flag_cancel(eflag_id=%d, num_addr=0x%x)", eflag_id, num.addr());
@ -354,7 +354,7 @@ s32 sys_event_flag_cancel(u32 eflag_id, vm::ptr<be_t<u32>> num)
return CELL_OK; return CELL_OK;
} }
s32 sys_event_flag_get(u32 eflag_id, vm::ptr<be_t<u64>> flags) s32 sys_event_flag_get(u32 eflag_id, vm::ptr<u64> flags)
{ {
sys_event_flag.Log("sys_event_flag_get(eflag_id=%d, flags_addr=0x%x)", eflag_id, flags.addr()); sys_event_flag.Log("sys_event_flag_get(eflag_id=%d, flags_addr=0x%x)", eflag_id, flags.addr());

View File

@ -52,11 +52,11 @@ struct EventFlag
u32 check(); u32 check();
}; };
s32 sys_event_flag_create(vm::ptr<be_t<u32>> eflag_id, vm::ptr<sys_event_flag_attr> attr, u64 init); s32 sys_event_flag_create(vm::ptr<u32> eflag_id, vm::ptr<sys_event_flag_attr> attr, u64 init);
s32 sys_event_flag_destroy(u32 eflag_id); s32 sys_event_flag_destroy(u32 eflag_id);
s32 sys_event_flag_wait(u32 eflag_id, u64 bitptn, u32 mode, vm::ptr<be_t<u64>> result, u64 timeout); s32 sys_event_flag_wait(u32 eflag_id, u64 bitptn, u32 mode, vm::ptr<u64> result, u64 timeout);
s32 sys_event_flag_trywait(u32 eflag_id, u64 bitptn, u32 mode, vm::ptr<be_t<u64>> result); s32 sys_event_flag_trywait(u32 eflag_id, u64 bitptn, u32 mode, vm::ptr<u64> result);
s32 sys_event_flag_set(u32 eflag_id, u64 bitptn); s32 sys_event_flag_set(u32 eflag_id, u64 bitptn);
s32 sys_event_flag_clear(u32 eflag_id, u64 bitptn); s32 sys_event_flag_clear(u32 eflag_id, u64 bitptn);
s32 sys_event_flag_cancel(u32 eflag_id, vm::ptr<be_t<u32>> num); s32 sys_event_flag_cancel(u32 eflag_id, vm::ptr<u32> num);
s32 sys_event_flag_get(u32 eflag_id, vm::ptr<be_t<u64>> flags); s32 sys_event_flag_get(u32 eflag_id, vm::ptr<u64> flags);

View File

@ -37,7 +37,7 @@ s32 sys_interrupt_tag_destroy(u32 intrtag)
return CELL_OK; return CELL_OK;
} }
s32 sys_interrupt_thread_establish(vm::ptr<be_t<u32>> ih, u32 intrtag, u64 intrthread, u64 arg) s32 sys_interrupt_thread_establish(vm::ptr<u32> ih, u32 intrtag, u64 intrthread, u64 arg)
{ {
sys_interrupt.Warning("sys_interrupt_thread_establish(ih_addr=0x%x, intrtag=%d, intrthread=%lld, arg=0x%llx)", ih.addr(), intrtag, intrthread, arg); sys_interrupt.Warning("sys_interrupt_thread_establish(ih_addr=0x%x, intrtag=%d, intrthread=%lld, arg=0x%llx)", ih.addr(), intrtag, intrthread, arg);

View File

@ -2,6 +2,6 @@
// SysCalls // SysCalls
s32 sys_interrupt_tag_destroy(u32 intrtag); s32 sys_interrupt_tag_destroy(u32 intrtag);
s32 sys_interrupt_thread_establish(vm::ptr<be_t<u32>> ih, u32 intrtag, u64 intrthread, u64 arg); s32 sys_interrupt_thread_establish(vm::ptr<u32> ih, u32 intrtag, u64 intrthread, u64 arg);
s32 sys_interrupt_thread_disestablish(u32 ih); s32 sys_interrupt_thread_disestablish(u32 ih);
void sys_interrupt_thread_eoi(); void sys_interrupt_thread_eoi();

View File

@ -108,7 +108,7 @@ s32 sys_memory_get_user_memory_size(vm::ptr<sys_memory_info_t> mem_info)
return CELL_OK; return CELL_OK;
} }
s32 sys_memory_container_create(vm::ptr<be_t<u32>> cid, u32 yield_size) s32 sys_memory_container_create(vm::ptr<u32> cid, u32 yield_size)
{ {
sys_memory.Warning("sys_memory_container_create(cid_addr=0x%x, yield_size=0x%x)", cid.addr(), yield_size); sys_memory.Warning("sys_memory_container_create(cid_addr=0x%x, yield_size=0x%x)", cid.addr(), yield_size);

View File

@ -57,6 +57,6 @@ s32 sys_memory_allocate_from_container(u32 size, u32 cid, u32 flags, u32 alloc_a
s32 sys_memory_free(u32 start_addr); s32 sys_memory_free(u32 start_addr);
s32 sys_memory_get_page_attribute(u32 addr, vm::ptr<sys_page_attr_t> attr); s32 sys_memory_get_page_attribute(u32 addr, vm::ptr<sys_page_attr_t> attr);
s32 sys_memory_get_user_memory_size(vm::ptr<sys_memory_info_t> mem_info); s32 sys_memory_get_user_memory_size(vm::ptr<sys_memory_info_t> mem_info);
s32 sys_memory_container_create(vm::ptr<be_t<u32>> cid, u32 yield_size); s32 sys_memory_container_create(vm::ptr<u32> cid, u32 yield_size);
s32 sys_memory_container_destroy(u32 cid); s32 sys_memory_container_destroy(u32 cid);
s32 sys_memory_container_get_size(vm::ptr<sys_memory_info_t> mem_info, u32 cid); s32 sys_memory_container_get_size(vm::ptr<sys_memory_info_t> mem_info, u32 cid);

View File

@ -53,7 +53,7 @@ s32 sys_mmapper_allocate_fixed_address()
return CELL_OK; return CELL_OK;
} }
s32 sys_mmapper_allocate_memory(u32 size, u64 flags, vm::ptr<be_t<u32>> mem_id) s32 sys_mmapper_allocate_memory(u32 size, u64 flags, vm::ptr<u32> mem_id)
{ {
sys_mmapper.Warning("sys_mmapper_allocate_memory(size=0x%x, flags=0x%llx, mem_id_addr=0x%x)", size, flags, mem_id.addr()); sys_mmapper.Warning("sys_mmapper_allocate_memory(size=0x%x, flags=0x%llx, mem_id_addr=0x%x)", size, flags, mem_id.addr());
@ -80,7 +80,7 @@ s32 sys_mmapper_allocate_memory(u32 size, u64 flags, vm::ptr<be_t<u32>> mem_id)
return CELL_OK; return CELL_OK;
} }
s32 sys_mmapper_allocate_memory_from_container(u32 size, u32 cid, u64 flags, vm::ptr<be_t<u32>> mem_id) s32 sys_mmapper_allocate_memory_from_container(u32 size, u32 cid, u64 flags, vm::ptr<u32> mem_id)
{ {
sys_mmapper.Warning("sys_mmapper_allocate_memory_from_container(size=0x%x, cid=%d, flags=0x%llx, mem_id_addr=0x%x)", sys_mmapper.Warning("sys_mmapper_allocate_memory_from_container(size=0x%x, cid=%d, flags=0x%llx, mem_id_addr=0x%x)",
size, cid, flags, mem_id.addr()); size, cid, flags, mem_id.addr());

View File

@ -22,8 +22,8 @@ struct mmapper_info
// SysCalls // SysCalls
s32 sys_mmapper_allocate_address(u32 size, u64 flags, u32 alignment, u32 alloc_addr); s32 sys_mmapper_allocate_address(u32 size, u64 flags, u32 alignment, u32 alloc_addr);
s32 sys_mmapper_allocate_fixed_address(); s32 sys_mmapper_allocate_fixed_address();
s32 sys_mmapper_allocate_memory(u32 size, u64 flags, vm::ptr<be_t<u32>> mem_id); s32 sys_mmapper_allocate_memory(u32 size, u64 flags, vm::ptr<u32> mem_id);
s32 sys_mmapper_allocate_memory_from_container(u32 size, u32 cid, u64 flags, vm::ptr<be_t<u32>> mem_id); s32 sys_mmapper_allocate_memory_from_container(u32 size, u32 cid, u64 flags, vm::ptr<u32> mem_id);
s32 sys_mmapper_change_address_access_right(u32 start_addr, u64 flags); s32 sys_mmapper_change_address_access_right(u32 start_addr, u64 flags);
s32 sys_mmapper_free_address(u32 start_addr); s32 sys_mmapper_free_address(u32 start_addr);
s32 sys_mmapper_free_memory(u32 mem_id); s32 sys_mmapper_free_memory(u32 mem_id);

View File

@ -26,7 +26,7 @@ Mutex::~Mutex()
m_queue.m_mutex.unlock(); m_queue.m_mutex.unlock();
} }
s32 sys_mutex_create(vm::ptr<be_t<u32>> mutex_id, vm::ptr<sys_mutex_attribute> attr) s32 sys_mutex_create(vm::ptr<u32> mutex_id, vm::ptr<sys_mutex_attribute> attr)
{ {
sys_mutex.Log("sys_mutex_create(mutex_id_addr=0x%x, attr_addr=0x%x)", mutex_id.addr(), attr.addr()); sys_mutex.Log("sys_mutex_create(mutex_id_addr=0x%x, attr_addr=0x%x)", mutex_id.addr(), attr.addr());

View File

@ -41,7 +41,7 @@ struct Mutex
}; };
// SysCalls // SysCalls
s32 sys_mutex_create(vm::ptr<be_t<u32>> mutex_id, vm::ptr<sys_mutex_attribute> attr); s32 sys_mutex_create(vm::ptr<u32> mutex_id, vm::ptr<sys_mutex_attribute> attr);
s32 sys_mutex_destroy(u32 mutex_id); s32 sys_mutex_destroy(u32 mutex_id);
s32 sys_mutex_lock(u32 mutex_id, u64 timeout); s32 sys_mutex_lock(u32 mutex_id, u64 timeout);
s32 sys_mutex_trylock(u32 mutex_id); s32 sys_mutex_trylock(u32 mutex_id);

View File

@ -34,7 +34,7 @@ void sys_ppu_thread_exit(PPUThread& CPU, u64 errorcode)
void sys_internal_ppu_thread_exit(PPUThread& CPU, u64 errorcode) void sys_internal_ppu_thread_exit(PPUThread& CPU, u64 errorcode)
{ {
sys_ppu_thread.Log("sys_internal_ppu_thread_exit(0x%llx)", errorcode); sys_ppu_thread.Warning("sys_internal_ppu_thread_exit(0x%llx)", errorcode);
ppu_thread_exit(CPU, errorcode); ppu_thread_exit(CPU, errorcode);
} }
@ -47,7 +47,7 @@ s32 sys_ppu_thread_yield()
return CELL_OK; return CELL_OK;
} }
s32 sys_ppu_thread_join(u64 thread_id, vm::ptr<be_t<u64>> vptr) s32 sys_ppu_thread_join(u64 thread_id, vm::ptr<u64> vptr)
{ {
sys_ppu_thread.Warning("sys_ppu_thread_join(thread_id=%lld, vptr_addr=0x%x)", thread_id, vptr.addr()); sys_ppu_thread.Warning("sys_ppu_thread_join(thread_id=%lld, vptr_addr=0x%x)", thread_id, vptr.addr());
@ -182,7 +182,7 @@ PPUThread* ppu_thread_create(u32 entry, u64 arg, s32 prio, u32 stacksize, bool i
return &new_thread; return &new_thread;
} }
s32 sys_ppu_thread_create(vm::ptr<be_t<u64>> thread_id, u32 entry, u64 arg, s32 prio, u32 stacksize, u64 flags, vm::ptr<const char> threadname) s32 sys_ppu_thread_create(vm::ptr<u64> thread_id, u32 entry, u64 arg, s32 prio, u32 stacksize, u64 flags, vm::ptr<const char> threadname)
{ {
sys_ppu_thread.Log("sys_ppu_thread_create(thread_id_addr=0x%x, entry=0x%x, arg=0x%llx, prio=%d, stacksize=0x%x, flags=0x%llx, threadname_addr=0x%x('%s'))", sys_ppu_thread.Log("sys_ppu_thread_create(thread_id_addr=0x%x, entry=0x%x, arg=0x%llx, prio=%d, stacksize=0x%x, flags=0x%llx, threadname_addr=0x%x('%s'))",
thread_id.addr(), entry, arg, prio, stacksize, flags, threadname.addr(), threadname ? threadname.get_ptr() : ""); thread_id.addr(), entry, arg, prio, stacksize, flags, threadname.addr(), threadname ? threadname.get_ptr() : "");
@ -223,7 +223,7 @@ void sys_ppu_thread_once(PPUThread& CPU, vm::ptr<atomic_t<u32>> once_ctrl, vm::p
} }
} }
s32 sys_ppu_thread_get_id(PPUThread& CPU, vm::ptr<be_t<u64>> thread_id) s32 sys_ppu_thread_get_id(PPUThread& CPU, vm::ptr<u64> thread_id)
{ {
sys_ppu_thread.Log("sys_ppu_thread_get_id(thread_id_addr=0x%x)", thread_id.addr()); sys_ppu_thread.Log("sys_ppu_thread_get_id(thread_id_addr=0x%x)", thread_id.addr());

View File

@ -21,7 +21,7 @@ PPUThread* ppu_thread_create(u32 entry, u64 arg, s32 prio, u32 stacksize, bool i
void sys_ppu_thread_exit(PPUThread& CPU, u64 errorcode); void sys_ppu_thread_exit(PPUThread& CPU, u64 errorcode);
void sys_internal_ppu_thread_exit(PPUThread& CPU, u64 errorcode); void sys_internal_ppu_thread_exit(PPUThread& CPU, u64 errorcode);
s32 sys_ppu_thread_yield(); s32 sys_ppu_thread_yield();
s32 sys_ppu_thread_join(u64 thread_id, vm::ptr<be_t<u64>> vptr); s32 sys_ppu_thread_join(u64 thread_id, vm::ptr<u64> vptr);
s32 sys_ppu_thread_detach(u64 thread_id); s32 sys_ppu_thread_detach(u64 thread_id);
void sys_ppu_thread_get_join_state(PPUThread& CPU, vm::ptr<s32> isjoinable); void sys_ppu_thread_get_join_state(PPUThread& CPU, vm::ptr<s32> isjoinable);
s32 sys_ppu_thread_set_priority(u64 thread_id, s32 prio); s32 sys_ppu_thread_set_priority(u64 thread_id, s32 prio);
@ -29,7 +29,7 @@ s32 sys_ppu_thread_get_priority(u64 thread_id, u32 prio_addr);
s32 sys_ppu_thread_get_stack_information(PPUThread& CPU, u32 info_addr); s32 sys_ppu_thread_get_stack_information(PPUThread& CPU, u32 info_addr);
s32 sys_ppu_thread_stop(u64 thread_id); s32 sys_ppu_thread_stop(u64 thread_id);
s32 sys_ppu_thread_restart(u64 thread_id); s32 sys_ppu_thread_restart(u64 thread_id);
s32 sys_ppu_thread_create(vm::ptr<be_t<u64>> thread_id, u32 entry, u64 arg, s32 prio, u32 stacksize, u64 flags, vm::ptr<const char> threadname); s32 sys_ppu_thread_create(vm::ptr<u64> thread_id, u32 entry, u64 arg, s32 prio, u32 stacksize, u64 flags, vm::ptr<const char> threadname);
void sys_ppu_thread_once(PPUThread& CPU, vm::ptr<atomic_t<u32>> once_ctrl, vm::ptr<void(*)()> init); void sys_ppu_thread_once(PPUThread& CPU, vm::ptr<atomic_t<u32>> once_ctrl, vm::ptr<void(*)()> init);
s32 sys_ppu_thread_get_id(PPUThread& CPU, vm::ptr<be_t<u64>> thread_id); s32 sys_ppu_thread_get_id(PPUThread& CPU, vm::ptr<u64> thread_id);
s32 sys_ppu_thread_rename(u64 thread_id, vm::ptr<const char> name); s32 sys_ppu_thread_rename(u64 thread_id, vm::ptr<const char> name);

View File

@ -134,7 +134,7 @@ void sys_game_process_exitspawn2(
return; return;
} }
s32 sys_process_get_number_of_object(u32 object, vm::ptr<be_t<u32>> nump) s32 sys_process_get_number_of_object(u32 object, vm::ptr<u32> nump)
{ {
sys_process.Warning("sys_process_get_number_of_object(object=%d, nump_addr=0x%x)", sys_process.Warning("sys_process_get_number_of_object(object=%d, nump_addr=0x%x)",
object, nump.addr()); object, nump.addr());
@ -169,7 +169,7 @@ s32 sys_process_get_number_of_object(u32 object, vm::ptr<be_t<u32>> nump)
return CELL_OK; return CELL_OK;
} }
s32 sys_process_get_id(u32 object, vm::ptr<be_t<u32>> buffer, u32 size, vm::ptr<be_t<u32>> set_size) s32 sys_process_get_id(u32 object, vm::ptr<u32> buffer, u32 size, vm::ptr<u32> set_size)
{ {
sys_process.Todo("sys_process_get_id(object=%d, buffer_addr=0x%x, size=%d, set_size_addr=0x%x)", sys_process.Todo("sys_process_get_id(object=%d, buffer_addr=0x%x, size=%d, set_size_addr=0x%x)",
object, buffer.addr(), size, set_size.addr()); object, buffer.addr(), size, set_size.addr());
@ -258,7 +258,7 @@ s32 process_get_sdk_version(u32 pid, s32& ver)
return CELL_OK; return CELL_OK;
} }
s32 sys_process_get_sdk_version(u32 pid, vm::ptr<be_t<s32>> version) s32 sys_process_get_sdk_version(u32 pid, vm::ptr<s32> version)
{ {
sys_process.Warning("sys_process_get_sdk_version(pid=%d, version_addr=0x%x)", pid, version.addr()); sys_process.Warning("sys_process_get_sdk_version(pid=%d, version_addr=0x%x)", pid, version.addr());
@ -281,7 +281,7 @@ s32 sys_process_kill(u32 pid)
return CELL_OK; return CELL_OK;
} }
s32 sys_process_wait_for_child(u32 pid, vm::ptr<be_t<u32>> status, u64 unk) s32 sys_process_wait_for_child(u32 pid, vm::ptr<u32> status, u64 unk)
{ {
sys_process.Todo("sys_process_wait_for_child(pid=%d, status_addr=0x%x, unk=0x%llx", sys_process.Todo("sys_process_wait_for_child(pid=%d, status_addr=0x%x, unk=0x%llx",
pid, status.addr(), unk); pid, status.addr(), unk);

View File

@ -31,15 +31,15 @@ s32 process_is_spu_lock_line_reservation_address(u32 addr, u64 flags);
// SysCalls // SysCalls
s32 sys_process_getpid(); s32 sys_process_getpid();
s32 sys_process_getppid(); s32 sys_process_getppid();
s32 sys_process_get_number_of_object(u32 object, vm::ptr<be_t<u32>> nump); s32 sys_process_get_number_of_object(u32 object, vm::ptr<u32> nump);
s32 sys_process_get_id(u32 object, vm::ptr<be_t<u32>> buffer, u32 size, vm::ptr<be_t<u32>> set_size); s32 sys_process_get_id(u32 object, vm::ptr<u32> buffer, u32 size, vm::ptr<u32> set_size);
s32 sys_process_get_paramsfo(vm::ptr<u8> buffer); s32 sys_process_get_paramsfo(vm::ptr<u8> buffer);
s32 sys_process_get_sdk_version(u32 pid, vm::ptr<be_t<s32>> version); s32 sys_process_get_sdk_version(u32 pid, vm::ptr<s32> version);
s32 sys_process_get_status(u64 unk); s32 sys_process_get_status(u64 unk);
s32 sys_process_is_spu_lock_line_reservation_address(u32 addr, u64 flags); s32 sys_process_is_spu_lock_line_reservation_address(u32 addr, u64 flags);
s32 sys_process_exit(s32 errorcode); s32 sys_process_exit(s32 errorcode);
s32 sys_process_kill(u32 pid); s32 sys_process_kill(u32 pid);
s32 sys_process_wait_for_child(u32 pid, vm::ptr<be_t<u32>> status, u64 unk); s32 sys_process_wait_for_child(u32 pid, vm::ptr<u32> status, u64 unk);
s32 sys_process_wait_for_child2(u64 unk1, u64 unk2, u64 unk3, u64 unk4, u64 unk5, u64 unk6); s32 sys_process_wait_for_child2(u64 unk1, u64 unk2, u64 unk3, u64 unk4, u64 unk5, u64 unk6);
s32 sys_process_detach_child(u64 unk); s32 sys_process_detach_child(u64 unk);
void sys_game_process_exitspawn(vm::ptr<const char> path, u32 argv_addr, u32 envp_addr, void sys_game_process_exitspawn(vm::ptr<const char> path, u32 argv_addr, u32 envp_addr,

View File

@ -61,7 +61,7 @@ s32 sys_prx_load_module_on_memcontainer_by_fd()
return CELL_OK; return CELL_OK;
} }
s32 sys_prx_start_module(s32 id, u32 args, u32 argp_addr, vm::ptr<be_t<u32>> modres, u64 flags, vm::ptr<sys_prx_start_module_option_t> pOpt) s32 sys_prx_start_module(s32 id, u32 args, u32 argp_addr, vm::ptr<u32> modres, u64 flags, vm::ptr<sys_prx_start_module_option_t> pOpt)
{ {
sys_prx.Todo("sys_prx_start_module(id=%d, args=%d, argp_addr=0x%x, modres_addr=0x%x, flags=0x%llx, pOpt=0x%x)", sys_prx.Todo("sys_prx_start_module(id=%d, args=%d, argp_addr=0x%x, modres_addr=0x%x, flags=0x%llx, pOpt=0x%x)",
id, args, argp_addr, modres.addr(), flags, pOpt.addr()); id, args, argp_addr, modres.addr(), flags, pOpt.addr());
@ -76,7 +76,7 @@ s32 sys_prx_start_module(s32 id, u32 args, u32 argp_addr, vm::ptr<be_t<u32>> mod
return CELL_OK; return CELL_OK;
} }
s32 sys_prx_stop_module(s32 id, u32 args, u32 argp_addr, vm::ptr<be_t<u32>> modres, u64 flags, vm::ptr<sys_prx_stop_module_option_t> pOpt) s32 sys_prx_stop_module(s32 id, u32 args, u32 argp_addr, vm::ptr<u32> modres, u64 flags, vm::ptr<sys_prx_stop_module_option_t> pOpt)
{ {
sys_prx.Todo("sys_prx_stop_module(id=%d, args=%d, argp_addr=0x%x, modres_addr=0x%x, flags=0x%llx, pOpt=0x%x)", sys_prx.Todo("sys_prx_stop_module(id=%d, args=%d, argp_addr=0x%x, modres_addr=0x%x, flags=0x%llx, pOpt=0x%x)",
id, args, argp_addr, modres.addr(), flags, pOpt.addr()); id, args, argp_addr, modres.addr(), flags, pOpt.addr());

View File

@ -69,8 +69,8 @@ s32 sys_prx_load_module(vm::ptr<const char> path, u64 flags, vm::ptr<sys_prx_loa
s32 sys_prx_load_module_on_memcontainer(); s32 sys_prx_load_module_on_memcontainer();
s32 sys_prx_load_module_by_fd(); s32 sys_prx_load_module_by_fd();
s32 sys_prx_load_module_on_memcontainer_by_fd(); s32 sys_prx_load_module_on_memcontainer_by_fd();
s32 sys_prx_start_module(s32 id, u32 args, u32 argp_addr, vm::ptr<be_t<u32>> modres, u64 flags, vm::ptr<sys_prx_start_module_option_t> pOpt); s32 sys_prx_start_module(s32 id, u32 args, u32 argp_addr, vm::ptr<u32> modres, u64 flags, vm::ptr<sys_prx_start_module_option_t> pOpt);
s32 sys_prx_stop_module(s32 id, u32 args, u32 argp_addr, vm::ptr<be_t<u32>> modres, u64 flags, vm::ptr<sys_prx_stop_module_option_t> pOpt); s32 sys_prx_stop_module(s32 id, u32 args, u32 argp_addr, vm::ptr<u32> modres, u64 flags, vm::ptr<sys_prx_stop_module_option_t> pOpt);
s32 sys_prx_unload_module(s32 id, u64 flags, vm::ptr<sys_prx_unload_module_option_t> pOpt); s32 sys_prx_unload_module(s32 id, u64 flags, vm::ptr<sys_prx_unload_module_option_t> pOpt);
s32 sys_prx_get_module_list(); s32 sys_prx_get_module_list();
s32 sys_prx_get_my_module_id(); s32 sys_prx_get_my_module_id();

View File

@ -29,7 +29,7 @@ s32 sys_rsx_device_close()
* @param a6 (IN): E.g. Immediate value passed in cellGcmSys is 16. * @param a6 (IN): E.g. Immediate value passed in cellGcmSys is 16.
* @param a7 (IN): E.g. Immediate value passed in cellGcmSys is 8. * @param a7 (IN): E.g. Immediate value passed in cellGcmSys is 8.
*/ */
s32 sys_rsx_memory_allocate(vm::ptr<be_t<u32>> mem_handle, vm::ptr<be_t<u32>> mem_addr, u32 size, u64 flags, u64 a5, u64 a6, u64 a7) s32 sys_rsx_memory_allocate(vm::ptr<u32> mem_handle, vm::ptr<u32> mem_addr, u32 size, u64 flags, u64 a5, u64 a6, u64 a7)
{ {
sys_rsx.Todo("sys_rsx_memory_allocate(mem_handle_addr=0x%x, local_mem_addr=0x%x, size=0x%x, flags=0x%x, a5=%d, a6=%d, a7=%d)", sys_rsx.Todo("sys_rsx_memory_allocate(mem_handle_addr=0x%x, local_mem_addr=0x%x, size=0x%x, flags=0x%x, a5=%d, a6=%d, a7=%d)",
mem_handle.addr(), mem_addr.addr(), size, flags, a5, a6, a7); mem_handle.addr(), mem_addr.addr(), size, flags, a5, a6, a7);
@ -55,7 +55,7 @@ s32 sys_rsx_memory_free(u32 mem_handle)
* @param mem_ctx (IN): mem_ctx given by sys_rsx_memory_allocate * @param mem_ctx (IN): mem_ctx given by sys_rsx_memory_allocate
* @param system_mode (IN): * @param system_mode (IN):
*/ */
s32 sys_rsx_context_allocate(vm::ptr<be_t<u32>> context_id, vm::ptr<be_t<u32>> lpar_dma_control, vm::ptr<be_t<u32>> lpar_driver_info, vm::ptr<be_t<u32>> lpar_reports, u64 mem_ctx, u64 system_mode) s32 sys_rsx_context_allocate(vm::ptr<u32> context_id, vm::ptr<u32> lpar_dma_control, vm::ptr<u32> lpar_driver_info, vm::ptr<u32> lpar_reports, u64 mem_ctx, u64 system_mode)
{ {
sys_rsx.Todo("sys_rsx_context_allocate(context_id_addr=0x%x, lpar_dma_control_addr=0x%x, lpar_driver_info_addr=0x%x, lpar_reports_addr=0x%x, mem_ctx=0x%x, system_mode=0x%x)", sys_rsx.Todo("sys_rsx_context_allocate(context_id_addr=0x%x, lpar_dma_control_addr=0x%x, lpar_driver_info_addr=0x%x, lpar_reports_addr=0x%x, mem_ctx=0x%x, system_mode=0x%x)",
context_id.addr(), lpar_dma_control.addr(), lpar_driver_info.addr(), lpar_reports.addr(), mem_ctx, system_mode); context_id.addr(), lpar_dma_control.addr(), lpar_driver_info.addr(), lpar_reports.addr(), mem_ctx, system_mode);
@ -170,7 +170,7 @@ s32 sys_rsx_context_attribute(s32 context_id, u32 package_id, u64 a3, u64 a4, u6
* @param a2 (OUT): Unused? * @param a2 (OUT): Unused?
* @param dev_id (IN): An immediate value and always 8. (cellGcmInitPerfMon uses 11, 10, 9, 7, 12 successively). * @param dev_id (IN): An immediate value and always 8. (cellGcmInitPerfMon uses 11, 10, 9, 7, 12 successively).
*/ */
s32 sys_rsx_device_map(vm::ptr<be_t<u32>> a1, vm::ptr<be_t<u32>> a2, u32 dev_id) s32 sys_rsx_device_map(vm::ptr<u32> a1, vm::ptr<u32> a2, u32 dev_id)
{ {
sys_rsx.Todo("sys_rsx_device_map(a1_addr=0x%x, a2_addr=0x%x, a3=%d)", a1.addr(), a2.addr(), dev_id); sys_rsx.Todo("sys_rsx_device_map(a1_addr=0x%x, a2_addr=0x%x, a3=%d)", a1.addr(), a2.addr(), dev_id);

View File

@ -3,13 +3,13 @@
// SysCalls // SysCalls
s32 sys_rsx_device_open(); s32 sys_rsx_device_open();
s32 sys_rsx_device_close(); s32 sys_rsx_device_close();
s32 sys_rsx_memory_allocate(vm::ptr<be_t<u32>> mem_handle, vm::ptr<be_t<u32>> mem_addr, u32 size, u64 flags, u64 a5, u64 a6, u64 a7); s32 sys_rsx_memory_allocate(vm::ptr<u32> mem_handle, vm::ptr<u32> mem_addr, u32 size, u64 flags, u64 a5, u64 a6, u64 a7);
s32 sys_rsx_memory_free(u32 mem_handle); s32 sys_rsx_memory_free(u32 mem_handle);
s32 sys_rsx_context_allocate(vm::ptr<be_t<u32>> context_id, vm::ptr<be_t<u32>> lpar_dma_control, vm::ptr<be_t<u32>> lpar_driver_info, vm::ptr<be_t<u32>> lpar_reports, u64 mem_ctx, u64 system_mode); s32 sys_rsx_context_allocate(vm::ptr<u32> context_id, vm::ptr<u32> lpar_dma_control, vm::ptr<u32> lpar_driver_info, vm::ptr<u32> lpar_reports, u64 mem_ctx, u64 system_mode);
s32 sys_rsx_context_free(u32 context_id); s32 sys_rsx_context_free(u32 context_id);
s32 sys_rsx_context_iomap(u32 context_id, u32 io, u32 ea, u32 size, u64 flags); s32 sys_rsx_context_iomap(u32 context_id, u32 io, u32 ea, u32 size, u64 flags);
s32 sys_rsx_context_iounmap(u32 context_id, u32 a2, u32 io_addr, u32 size); s32 sys_rsx_context_iounmap(u32 context_id, u32 a2, u32 io_addr, u32 size);
s32 sys_rsx_context_attribute(s32 context_id, u32 package_id, u64 a3, u64 a4, u64 a5, u64 a6); s32 sys_rsx_context_attribute(s32 context_id, u32 package_id, u64 a3, u64 a4, u64 a5, u64 a6);
s32 sys_rsx_device_map(vm::ptr<be_t<u32>> a1, vm::ptr<be_t<u32>> a2, u32 dev_id); s32 sys_rsx_device_map(vm::ptr<u32> a1, vm::ptr<u32> a2, u32 dev_id);
s32 sys_rsx_device_unmap(u32 dev_id); s32 sys_rsx_device_unmap(u32 dev_id);
s32 sys_rsx_attribute(); s32 sys_rsx_attribute();

View File

@ -9,7 +9,7 @@
SysCallBase sys_rwlock("sys_rwlock"); SysCallBase sys_rwlock("sys_rwlock");
s32 sys_rwlock_create(vm::ptr<be_t<u32>> rw_lock_id, vm::ptr<sys_rwlock_attribute_t> attr) s32 sys_rwlock_create(vm::ptr<u32> rw_lock_id, vm::ptr<sys_rwlock_attribute_t> attr)
{ {
sys_rwlock.Warning("sys_rwlock_create(rw_lock_id_addr=0x%x, attr_addr=0x%x)", rw_lock_id.addr(), attr.addr()); sys_rwlock.Warning("sys_rwlock_create(rw_lock_id_addr=0x%x, attr_addr=0x%x)", rw_lock_id.addr(), attr.addr());

View File

@ -150,7 +150,7 @@ struct RWLock
}; };
// SysCalls // SysCalls
s32 sys_rwlock_create(vm::ptr<be_t<u32>> rw_lock_id, vm::ptr<sys_rwlock_attribute_t> attr); s32 sys_rwlock_create(vm::ptr<u32> rw_lock_id, vm::ptr<sys_rwlock_attribute_t> attr);
s32 sys_rwlock_destroy(u32 rw_lock_id); s32 sys_rwlock_destroy(u32 rw_lock_id);
s32 sys_rwlock_rlock(u32 rw_lock_id, u64 timeout); s32 sys_rwlock_rlock(u32 rw_lock_id, u64 timeout);
s32 sys_rwlock_tryrlock(u32 rw_lock_id); s32 sys_rwlock_tryrlock(u32 rw_lock_id);

View File

@ -21,7 +21,7 @@ u32 semaphore_create(s32 initial_count, s32 max_count, u32 protocol, u64 name_u6
return id; return id;
} }
s32 sys_semaphore_create(vm::ptr<be_t<u32>> sem, vm::ptr<sys_semaphore_attribute> attr, s32 initial_count, s32 max_count) s32 sys_semaphore_create(vm::ptr<u32> sem, vm::ptr<sys_semaphore_attribute> attr, s32 initial_count, s32 max_count)
{ {
sys_semaphore.Warning("sys_semaphore_create(sem_addr=0x%x, attr_addr=0x%x, initial_count=%d, max_count=%d)", sys_semaphore.Warning("sys_semaphore_create(sem_addr=0x%x, attr_addr=0x%x, initial_count=%d, max_count=%d)",
sem.addr(), attr.addr(), initial_count, max_count); sem.addr(), attr.addr(), initial_count, max_count);
@ -119,11 +119,10 @@ s32 sys_semaphore_wait(u32 sem_id, u64 timeout)
continue; continue;
} }
sem->signal = 0; sem->signal = 0;
// TODO: notify signaler
return CELL_OK; return CELL_OK;
} }
SM_Sleep(); std::this_thread::sleep_for(std::chrono::milliseconds(1));
} }
} }
@ -182,7 +181,7 @@ s32 sys_semaphore_post(u32 sem_id, s32 count)
if (sem->signal && sem->m_queue.count()) if (sem->signal && sem->m_queue.count())
{ {
SM_Sleep(); std::this_thread::sleep_for(std::chrono::milliseconds(1));
continue; continue;
} }
@ -190,7 +189,6 @@ s32 sys_semaphore_post(u32 sem_id, s32 count)
{ {
count--; count--;
sem->signal = target; sem->signal = target;
Emu.GetCPU().NotifyThread(target);
} }
else else
{ {
@ -202,7 +200,7 @@ s32 sys_semaphore_post(u32 sem_id, s32 count)
return CELL_OK; return CELL_OK;
} }
s32 sys_semaphore_get_value(u32 sem_id, vm::ptr<be_t<s32>> count) s32 sys_semaphore_get_value(u32 sem_id, vm::ptr<s32> count)
{ {
sys_semaphore.Log("sys_semaphore_get_value(sem_id=%d, count_addr=0x%x)", sem_id, count.addr()); sys_semaphore.Log("sys_semaphore_get_value(sem_id=%d, count_addr=0x%x)", sem_id, count.addr());

View File

@ -41,9 +41,9 @@ struct Semaphore
u32 semaphore_create(s32 initial_count, s32 max_count, u32 protocol, u64 name_u64); u32 semaphore_create(s32 initial_count, s32 max_count, u32 protocol, u64 name_u64);
// SysCalls // SysCalls
s32 sys_semaphore_create(vm::ptr<be_t<u32>> sem, vm::ptr<sys_semaphore_attribute> attr, s32 initial_count, s32 max_count); s32 sys_semaphore_create(vm::ptr<u32> sem, vm::ptr<sys_semaphore_attribute> attr, s32 initial_count, s32 max_count);
s32 sys_semaphore_destroy(u32 sem_id); s32 sys_semaphore_destroy(u32 sem_id);
s32 sys_semaphore_wait(u32 sem_id, u64 timeout); s32 sys_semaphore_wait(u32 sem_id, u64 timeout);
s32 sys_semaphore_trywait(u32 sem_id); s32 sys_semaphore_trywait(u32 sem_id);
s32 sys_semaphore_post(u32 sem_id, s32 count); s32 sys_semaphore_post(u32 sem_id, s32 count);
s32 sys_semaphore_get_value(u32 sem_id, vm::ptr<be_t<s32>> count); s32 sys_semaphore_get_value(u32 sem_id, vm::ptr<s32> count);

View File

@ -106,7 +106,7 @@ SPUThread* spu_thread_initialize(SpuGroupInfo* group, u32 spu_num, sys_spu_image
return &new_thread; return &new_thread;
} }
s32 sys_spu_thread_initialize(vm::ptr<be_t<u32>> thread, u32 group, u32 spu_num, vm::ptr<sys_spu_image> img, vm::ptr<sys_spu_thread_attribute> attr, vm::ptr<sys_spu_thread_argument> arg) s32 sys_spu_thread_initialize(vm::ptr<u32> thread, u32 group, u32 spu_num, vm::ptr<sys_spu_image> img, vm::ptr<sys_spu_thread_attribute> attr, vm::ptr<sys_spu_thread_argument> arg)
{ {
sys_spu.Warning("sys_spu_thread_initialize(thread_addr=0x%x, group=0x%x, spu_num=%d, img_addr=0x%x, attr_addr=0x%x, arg_addr=0x%x)", sys_spu.Warning("sys_spu_thread_initialize(thread_addr=0x%x, group=0x%x, spu_num=%d, img_addr=0x%x, attr_addr=0x%x, arg_addr=0x%x)",
thread.addr(), group, spu_num, img.addr(), attr.addr(), arg.addr()); thread.addr(), group, spu_num, img.addr(), attr.addr(), arg.addr());
@ -161,7 +161,7 @@ s32 sys_spu_thread_set_argument(u32 id, vm::ptr<sys_spu_thread_argument> arg)
return CELL_OK; return CELL_OK;
} }
s32 sys_spu_thread_get_exit_status(u32 id, vm::ptr<be_t<u32>> status) s32 sys_spu_thread_get_exit_status(u32 id, vm::ptr<u32> status)
{ {
sys_spu.Warning("sys_spu_thread_get_exit_status(id=%d, status_addr=0x%x)", id, status.addr()); sys_spu.Warning("sys_spu_thread_get_exit_status(id=%d, status_addr=0x%x)", id, status.addr());
@ -451,7 +451,7 @@ SpuGroupInfo* spu_thread_group_create(const std::string& name, u32 num, s32 prio
return group; return group;
} }
s32 sys_spu_thread_group_create(vm::ptr<be_t<u32>> id, u32 num, s32 prio, vm::ptr<sys_spu_thread_group_attribute> attr) s32 sys_spu_thread_group_create(vm::ptr<u32> id, u32 num, s32 prio, vm::ptr<sys_spu_thread_group_attribute> attr)
{ {
sys_spu.Warning("sys_spu_thread_group_create(id_addr=0x%x, num=%d, prio=%d, attr_addr=0x%x)", sys_spu.Warning("sys_spu_thread_group_create(id_addr=0x%x, num=%d, prio=%d, attr_addr=0x%x)",
id.addr(), num, prio, attr.addr()); id.addr(), num, prio, attr.addr());
@ -465,7 +465,7 @@ s32 sys_spu_thread_group_create(vm::ptr<be_t<u32>> id, u32 num, s32 prio, vm::pt
return CELL_OK; return CELL_OK;
} }
s32 sys_spu_thread_group_join(u32 id, vm::ptr<be_t<u32>> cause, vm::ptr<be_t<u32>> status) s32 sys_spu_thread_group_join(u32 id, vm::ptr<u32> cause, vm::ptr<u32> status)
{ {
sys_spu.Warning("sys_spu_thread_group_join(id=%d, cause_addr=0x%x, status_addr=0x%x)", id, cause.addr(), status.addr()); sys_spu.Warning("sys_spu_thread_group_join(id=%d, cause_addr=0x%x, status_addr=0x%x)", id, cause.addr(), status.addr());
@ -518,7 +518,7 @@ s32 sys_spu_thread_group_join(u32 id, vm::ptr<be_t<u32>> cause, vm::ptr<be_t<u32
return CELL_OK; return CELL_OK;
} }
s32 sys_spu_thread_create(vm::ptr<be_t<u32>> thread_id, vm::ptr<be_t<u32>> entry, u64 arg, int prio, u32 stacksize, u64 flags, u32 threadname_addr) s32 sys_spu_thread_create(vm::ptr<u32> thread_id, vm::ptr<u32> entry, u64 arg, int prio, u32 stacksize, u64 flags, u32 threadname_addr)
{ {
sys_spu.Todo("sys_spu_thread_create(thread_id_addr=0x%x, entry_addr=0x%x, arg=0x%llx, prio=%d, stacksize=0x%x, flags=0x%llx, threadname_addr=0x%x", sys_spu.Todo("sys_spu_thread_create(thread_id_addr=0x%x, entry_addr=0x%x, arg=0x%llx, prio=%d, stacksize=0x%x, flags=0x%llx, threadname_addr=0x%x",
thread_id.addr(), entry.addr(), arg, prio, stacksize, flags, threadname_addr); thread_id.addr(), entry.addr(), arg, prio, stacksize, flags, threadname_addr);
@ -569,7 +569,7 @@ s32 sys_spu_thread_write_ls(u32 id, u32 address, u64 value, u32 type)
} }
} }
s32 sys_spu_thread_read_ls(u32 id, u32 address, vm::ptr<be_t<u64>> value, u32 type) s32 sys_spu_thread_read_ls(u32 id, u32 address, vm::ptr<u64> value, u32 type)
{ {
sys_spu.Log("sys_spu_thread_read_ls(id=%d, address=0x%x, value_addr=0x%x, type=0x%x)", sys_spu.Log("sys_spu_thread_read_ls(id=%d, address=0x%x, value_addr=0x%x, type=0x%x)",
id, address, value.addr(), type); id, address, value.addr(), type);
@ -638,7 +638,7 @@ s32 sys_spu_thread_set_spu_cfg(u32 id, u64 value)
return CELL_OK; return CELL_OK;
} }
s32 sys_spu_thread_get_spu_cfg(u32 id, vm::ptr<be_t<u64>> value) s32 sys_spu_thread_get_spu_cfg(u32 id, vm::ptr<u64> value)
{ {
sys_spu.Warning("sys_spu_thread_get_spu_cfg(id=%d, value_addr=0x%x)", id, value.addr()); sys_spu.Warning("sys_spu_thread_get_spu_cfg(id=%d, value_addr=0x%x)", id, value.addr());
@ -914,7 +914,7 @@ s32 sys_spu_thread_group_disconnect_event_all_threads(u32 id, u8 spup)
return CELL_OK; return CELL_OK;
} }
s32 sys_raw_spu_create(vm::ptr<be_t<u32>> id, u32 attr_addr) s32 sys_raw_spu_create(vm::ptr<u32> id, u32 attr_addr)
{ {
sys_spu.Warning("sys_raw_spu_create(id_addr=0x%x, attr_addr=0x%x)", id.addr(), attr_addr); sys_spu.Warning("sys_raw_spu_create(id_addr=0x%x, attr_addr=0x%x)", id.addr(), attr_addr);
@ -947,7 +947,7 @@ s32 sys_raw_spu_destroy(u32 id)
return CELL_OK; return CELL_OK;
} }
s32 sys_raw_spu_create_interrupt_tag(u32 id, u32 class_id, u32 hwthread, vm::ptr<be_t<u32>> intrtag) s32 sys_raw_spu_create_interrupt_tag(u32 id, u32 class_id, u32 hwthread, vm::ptr<u32> intrtag)
{ {
sys_spu.Warning("sys_raw_spu_create_interrupt_tag(id=%d, class_id=%d, hwthread=0x%x, intrtag_addr=0x%x)", id, class_id, hwthread, intrtag.addr()); sys_spu.Warning("sys_raw_spu_create_interrupt_tag(id=%d, class_id=%d, hwthread=0x%x, intrtag_addr=0x%x)", id, class_id, hwthread, intrtag.addr());
@ -993,7 +993,7 @@ s32 sys_raw_spu_set_int_mask(u32 id, u32 class_id, u64 mask)
return CELL_OK; return CELL_OK;
} }
s32 sys_raw_spu_get_int_mask(u32 id, u32 class_id, vm::ptr<be_t<u64>> mask) s32 sys_raw_spu_get_int_mask(u32 id, u32 class_id, vm::ptr<u64> mask)
{ {
sys_spu.Log("sys_raw_spu_get_int_mask(id=%d, class_id=%d, mask_addr=0x%x)", id, class_id, mask.addr()); sys_spu.Log("sys_raw_spu_get_int_mask(id=%d, class_id=%d, mask_addr=0x%x)", id, class_id, mask.addr());
@ -1031,7 +1031,7 @@ s32 sys_raw_spu_set_int_stat(u32 id, u32 class_id, u64 stat)
return CELL_OK; return CELL_OK;
} }
s32 sys_raw_spu_get_int_stat(u32 id, u32 class_id, vm::ptr<be_t<u64>> stat) s32 sys_raw_spu_get_int_stat(u32 id, u32 class_id, vm::ptr<u64> stat)
{ {
sys_spu.Log("sys_raw_spu_get_int_stat(id=%d, class_id=%d, stat_addr=0xx)", id, class_id, stat.addr()); sys_spu.Log("sys_raw_spu_get_int_stat(id=%d, class_id=%d, stat_addr=0xx)", id, class_id, stat.addr());
@ -1050,7 +1050,7 @@ s32 sys_raw_spu_get_int_stat(u32 id, u32 class_id, vm::ptr<be_t<u64>> stat)
return CELL_OK; return CELL_OK;
} }
s32 sys_raw_spu_read_puint_mb(u32 id, vm::ptr<be_t<u32>> value) s32 sys_raw_spu_read_puint_mb(u32 id, vm::ptr<u32> value)
{ {
sys_spu.Log("sys_raw_spu_read_puint_mb(id=%d, value_addr=0x%x)", id, value.addr()); sys_spu.Log("sys_raw_spu_read_puint_mb(id=%d, value_addr=0x%x)", id, value.addr());
@ -1080,7 +1080,7 @@ s32 sys_raw_spu_set_spu_cfg(u32 id, u32 value)
return CELL_OK; return CELL_OK;
} }
s32 sys_raw_spu_get_spu_cfg(u32 id, vm::ptr<be_t<u32>> value) s32 sys_raw_spu_get_spu_cfg(u32 id, vm::ptr<u32> value)
{ {
sys_spu.Log("sys_raw_spu_get_spu_afg(id=%d, value_addr=0x%x)", id, value.addr()); sys_spu.Log("sys_raw_spu_get_spu_afg(id=%d, value_addr=0x%x)", id, value.addr());

View File

@ -163,7 +163,7 @@ SPUThread* spu_thread_initialize(SpuGroupInfo* group, u32 spu_num, sys_spu_image
// SysCalls // SysCalls
s32 sys_spu_initialize(u32 max_usable_spu, u32 max_raw_spu); s32 sys_spu_initialize(u32 max_usable_spu, u32 max_raw_spu);
s32 sys_spu_image_open(vm::ptr<sys_spu_image> img, vm::ptr<const char> path); s32 sys_spu_image_open(vm::ptr<sys_spu_image> img, vm::ptr<const char> path);
s32 sys_spu_thread_initialize(vm::ptr<be_t<u32>> thread, u32 group, u32 spu_num, vm::ptr<sys_spu_image> img, vm::ptr<sys_spu_thread_attribute> attr, vm::ptr<sys_spu_thread_argument> arg); s32 sys_spu_thread_initialize(vm::ptr<u32> thread, u32 group, u32 spu_num, vm::ptr<sys_spu_image> img, vm::ptr<sys_spu_thread_attribute> attr, vm::ptr<sys_spu_thread_argument> arg);
s32 sys_spu_thread_set_argument(u32 id, vm::ptr<sys_spu_thread_argument> arg); s32 sys_spu_thread_set_argument(u32 id, vm::ptr<sys_spu_thread_argument> arg);
s32 sys_spu_thread_group_destroy(u32 id); s32 sys_spu_thread_group_destroy(u32 id);
s32 sys_spu_thread_group_start(u32 id); s32 sys_spu_thread_group_start(u32 id);
@ -171,32 +171,32 @@ s32 sys_spu_thread_group_suspend(u32 id);
s32 sys_spu_thread_group_resume(u32 id); s32 sys_spu_thread_group_resume(u32 id);
s32 sys_spu_thread_group_yield(u32 id); s32 sys_spu_thread_group_yield(u32 id);
s32 sys_spu_thread_group_terminate(u32 id, int value); s32 sys_spu_thread_group_terminate(u32 id, int value);
s32 sys_spu_thread_group_create(vm::ptr<be_t<u32>> id, u32 num, int prio, vm::ptr<sys_spu_thread_group_attribute> attr); s32 sys_spu_thread_group_create(vm::ptr<u32> id, u32 num, int prio, vm::ptr<sys_spu_thread_group_attribute> attr);
s32 sys_spu_thread_create(vm::ptr<be_t<u32>> thread_id, vm::ptr<be_t<u32>> entry, u64 arg, int prio, u32 stacksize, u64 flags, u32 threadname_addr); s32 sys_spu_thread_create(vm::ptr<u32> thread_id, vm::ptr<u32> entry, u64 arg, int prio, u32 stacksize, u64 flags, u32 threadname_addr);
s32 sys_spu_thread_group_join(u32 id, vm::ptr<be_t<u32>> cause, vm::ptr<be_t<u32>> status); s32 sys_spu_thread_group_join(u32 id, vm::ptr<u32> cause, vm::ptr<u32> status);
s32 sys_spu_thread_group_connect_event(u32 id, u32 eq, u32 et); s32 sys_spu_thread_group_connect_event(u32 id, u32 eq, u32 et);
s32 sys_spu_thread_group_disconnect_event(u32 id, u32 et); s32 sys_spu_thread_group_disconnect_event(u32 id, u32 et);
s32 sys_spu_thread_group_connect_event_all_threads(u32 id, u32 eq_id, u64 req, vm::ptr<u8> spup); s32 sys_spu_thread_group_connect_event_all_threads(u32 id, u32 eq_id, u64 req, vm::ptr<u8> spup);
s32 sys_spu_thread_group_disconnect_event_all_threads(u32 id, u8 spup); s32 sys_spu_thread_group_disconnect_event_all_threads(u32 id, u8 spup);
s32 sys_spu_thread_write_ls(u32 id, u32 address, u64 value, u32 type); s32 sys_spu_thread_write_ls(u32 id, u32 address, u64 value, u32 type);
s32 sys_spu_thread_read_ls(u32 id, u32 address, vm::ptr<be_t<u64>> value, u32 type); s32 sys_spu_thread_read_ls(u32 id, u32 address, vm::ptr<u64> value, u32 type);
s32 sys_spu_thread_write_spu_mb(u32 id, u32 value); s32 sys_spu_thread_write_spu_mb(u32 id, u32 value);
s32 sys_spu_thread_set_spu_cfg(u32 id, u64 value); s32 sys_spu_thread_set_spu_cfg(u32 id, u64 value);
s32 sys_spu_thread_get_spu_cfg(u32 id, vm::ptr<be_t<u64>> value); s32 sys_spu_thread_get_spu_cfg(u32 id, vm::ptr<u64> value);
s32 sys_spu_thread_write_snr(u32 id, u32 number, u32 value); s32 sys_spu_thread_write_snr(u32 id, u32 number, u32 value);
s32 sys_spu_thread_connect_event(u32 id, u32 eq, u32 et, u8 spup); s32 sys_spu_thread_connect_event(u32 id, u32 eq, u32 et, u8 spup);
s32 sys_spu_thread_disconnect_event(u32 id, u32 event_type, u8 spup); s32 sys_spu_thread_disconnect_event(u32 id, u32 event_type, u8 spup);
s32 sys_spu_thread_bind_queue(u32 id, u32 spuq, u32 spuq_num); s32 sys_spu_thread_bind_queue(u32 id, u32 spuq, u32 spuq_num);
s32 sys_spu_thread_unbind_queue(u32 id, u32 spuq_num); s32 sys_spu_thread_unbind_queue(u32 id, u32 spuq_num);
s32 sys_spu_thread_get_exit_status(u32 id, vm::ptr<be_t<u32>> status); s32 sys_spu_thread_get_exit_status(u32 id, vm::ptr<u32> status);
s32 sys_raw_spu_create(vm::ptr<be_t<u32>> id, u32 attr_addr); s32 sys_raw_spu_create(vm::ptr<u32> id, u32 attr_addr);
s32 sys_raw_spu_destroy(u32 id); s32 sys_raw_spu_destroy(u32 id);
s32 sys_raw_spu_create_interrupt_tag(u32 id, u32 class_id, u32 hwthread, vm::ptr<be_t<u32>> intrtag); s32 sys_raw_spu_create_interrupt_tag(u32 id, u32 class_id, u32 hwthread, vm::ptr<u32> intrtag);
s32 sys_raw_spu_set_int_mask(u32 id, u32 class_id, u64 mask); s32 sys_raw_spu_set_int_mask(u32 id, u32 class_id, u64 mask);
s32 sys_raw_spu_get_int_mask(u32 id, u32 class_id, vm::ptr<be_t<u64>> mask); s32 sys_raw_spu_get_int_mask(u32 id, u32 class_id, vm::ptr<u64> mask);
s32 sys_raw_spu_set_int_stat(u32 id, u32 class_id, u64 stat); s32 sys_raw_spu_set_int_stat(u32 id, u32 class_id, u64 stat);
s32 sys_raw_spu_get_int_stat(u32 id, u32 class_id, vm::ptr<be_t<u64>> stat); s32 sys_raw_spu_get_int_stat(u32 id, u32 class_id, vm::ptr<u64> stat);
s32 sys_raw_spu_read_puint_mb(u32 id, vm::ptr<be_t<u32>> value); s32 sys_raw_spu_read_puint_mb(u32 id, vm::ptr<u32> value);
s32 sys_raw_spu_set_spu_cfg(u32 id, u32 value); s32 sys_raw_spu_set_spu_cfg(u32 id, u32 value);
s32 sys_raw_spu_get_spu_cfg(u32 id, vm::ptr<be_t<u32>> value); s32 sys_raw_spu_get_spu_cfg(u32 id, vm::ptr<u32> value);

View File

@ -18,7 +18,7 @@
SysCallBase sys_time("sys_time"); SysCallBase sys_time("sys_time");
static const u64 timebase_frequency = /*79800000*/ 80000000; // 80 Mhz static const u64 timebase_frequency = /*79800000*/ 80000000; // 80 Mhz
extern int cellSysutilGetSystemParamInt(int id, vm::ptr<be_t<u32>> value); extern int cellSysutilGetSystemParamInt(int id, vm::ptr<u32> value);
// Auxiliary functions // Auxiliary functions
u64 get_time() u64 get_time()
@ -59,7 +59,7 @@ u64 get_system_time()
// Functions // Functions
s32 sys_time_get_timezone(vm::ptr<be_t<u32>> timezone, vm::ptr<be_t<u32>> summertime) s32 sys_time_get_timezone(vm::ptr<u32> timezone, vm::ptr<u32> summertime)
{ {
sys_time.Warning("sys_time_get_timezone(timezone_addr=0x%x, summertime_addr=0x%x)", timezone.addr(), summertime.addr()); sys_time.Warning("sys_time_get_timezone(timezone_addr=0x%x, summertime_addr=0x%x)", timezone.addr(), summertime.addr());

View File

@ -7,7 +7,7 @@ u64 get_time();
u64 get_system_time(); u64 get_system_time();
// SysCalls // SysCalls
s32 sys_time_get_timezone(vm::ptr<be_t<u32>> timezone, vm::ptr<be_t<u32>> summertime); s32 sys_time_get_timezone(vm::ptr<u32> timezone, vm::ptr<u32> summertime);
s32 sys_time_get_current_time(u32 sec_addr, u32 nsec_addr); s32 sys_time_get_current_time(u32 sec_addr, u32 nsec_addr);
s64 sys_time_get_system_time(); s64 sys_time_get_system_time();
u64 sys_time_get_timebase_frequency(); u64 sys_time_get_timebase_frequency();

View File

@ -8,7 +8,7 @@
SysCallBase sys_timer("sys_timer"); SysCallBase sys_timer("sys_timer");
s32 sys_timer_create(vm::ptr<be_t<u32>> timer_id) s32 sys_timer_create(vm::ptr<u32> timer_id)
{ {
sys_timer.Warning("sys_timer_create(timer_id_addr=0x%x)", timer_id.addr()); sys_timer.Warning("sys_timer_create(timer_id_addr=0x%x)", timer_id.addr());

View File

@ -19,7 +19,7 @@ struct timer
sys_timer_information_t timer_information_t; sys_timer_information_t timer_information_t;
}; };
s32 sys_timer_create(vm::ptr<be_t<u32>> timer_id); s32 sys_timer_create(vm::ptr<u32> timer_id);
s32 sys_timer_destroy(u32 timer_id); s32 sys_timer_destroy(u32 timer_id);
s32 sys_timer_get_information(u32 timer_id, vm::ptr<sys_timer_information_t> info); s32 sys_timer_get_information(u32 timer_id, vm::ptr<sys_timer_information_t> info);
s32 sys_timer_start(u32 timer_id, s64 basetime, u64 period); s32 sys_timer_start(u32 timer_id, s64 basetime, u64 period);

View File

@ -340,14 +340,14 @@ void Emulator::Load()
m_rsx_callback = (u32)Memory.MainMem.AllocAlign(4 * 4) + 4; m_rsx_callback = (u32)Memory.MainMem.AllocAlign(4 * 4) + 4;
vm::write32(m_rsx_callback - 4, m_rsx_callback); vm::write32(m_rsx_callback - 4, m_rsx_callback);
auto callback_data = vm::ptr<be_t<u32>>::make(m_rsx_callback); auto callback_data = vm::ptr<u32>::make(m_rsx_callback);
callback_data[0] = ADDI(11, 0, 0x3ff); callback_data[0] = ADDI(11, 0, 0x3ff);
callback_data[1] = SC(2); callback_data[1] = SC(2);
callback_data[2] = BCLR(0x10 | 0x04, 0, 0, 0); callback_data[2] = BCLR(0x10 | 0x04, 0, 0, 0);
m_ppu_thr_exit = (u32)Memory.MainMem.AllocAlign(4 * 4); m_ppu_thr_exit = (u32)Memory.MainMem.AllocAlign(4 * 4);
auto ppu_thr_exit_data = vm::ptr<be_t<u32>>::make(m_ppu_thr_exit); auto ppu_thr_exit_data = vm::ptr<u32>::make(m_ppu_thr_exit);
//ppu_thr_exit_data += ADDI(3, 0, 0); // why it kills return value (GPR[3]) ? //ppu_thr_exit_data += ADDI(3, 0, 0); // why it kills return value (GPR[3]) ?
ppu_thr_exit_data[0] = ADDI(11, 0, 41); ppu_thr_exit_data[0] = ADDI(11, 0, 41);
ppu_thr_exit_data[1] = SC(2); ppu_thr_exit_data[1] = SC(2);
@ -355,7 +355,7 @@ void Emulator::Load()
m_ppu_thr_stop = (u32)Memory.MainMem.AllocAlign(2 * 4); m_ppu_thr_stop = (u32)Memory.MainMem.AllocAlign(2 * 4);
auto ppu_thr_stop_data = vm::ptr<be_t<u32>>::make(m_ppu_thr_stop); auto ppu_thr_stop_data = vm::ptr<u32>::make(m_ppu_thr_stop);
ppu_thr_stop_data[0] = SC(4); ppu_thr_stop_data[0] = SC(4);
ppu_thr_stop_data[1] = BCLR(0x10 | 0x04, 0, 0, 0); ppu_thr_stop_data[1] = BCLR(0x10 | 0x04, 0, 0, 0);

View File

@ -831,7 +831,7 @@ wxString RSXDebugger::DisAsmCommand(u32 cmd, u32 count, u32 currentAddr, u32 ioA
} }
else if(!(cmd & (CELL_GCM_METHOD_FLAG_JUMP | CELL_GCM_METHOD_FLAG_CALL)) && cmd != CELL_GCM_METHOD_FLAG_RETURN) else if(!(cmd & (CELL_GCM_METHOD_FLAG_JUMP | CELL_GCM_METHOD_FLAG_CALL)) && cmd != CELL_GCM_METHOD_FLAG_RETURN)
{ {
auto args = vm::ptr<be_t<u32>>::make(currentAddr + 4); auto args = vm::ptr<u32>::make(currentAddr + 4);
u32 index = 0; u32 index = 0;
switch(cmd & 0x3ffff) switch(cmd & 0x3ffff)

View File

@ -470,11 +470,11 @@ bool ELF64Loader::LoadPhdrData(u64 offset)
#endif #endif
vm::write32(stub.s_text + i*4, (u32)tbl + i*8); vm::write32(stub.s_text + i*4, (u32)tbl + i*8);
auto out_tbl = vm::ptr<be_t<u32>>::make((u32)tbl + i * 8); auto out_tbl = vm::ptr<u32>::make((u32)tbl + i * 8);
out_tbl[0] = (u32)dst + i*section; out_tbl[0] = (u32)dst + i*section;
out_tbl[1] = Emu.GetModuleManager().GetFuncNumById(nid); out_tbl[1] = Emu.GetModuleManager().GetFuncNumById(nid);
auto out_dst = vm::ptr<be_t<u32>>::make((u32)dst + i * section); auto out_dst = vm::ptr<u32>::make((u32)dst + i * section);
out_dst[0] = OR(11, 2, 2, 0); out_dst[0] = OR(11, 2, 2, 0);
out_dst[1] = SC(2); out_dst[1] = SC(2);
out_dst[2] = BLR(); out_dst[2] = BLR();

23
rpcs3/cellMic.h Normal file
View File

@ -0,0 +1,23 @@
#pragma once
// Error Codes
enum
{
CELL_MICIN_ERROR_ALREADY_INIT = 0x80140101,
CELL_MICIN_ERROR_SYSTEM = 0x80140102,
CELL_MICIN_ERROR_NOT_INIT = 0x80140103,
CELL_MICIN_ERROR_PARAM = 0x80140104,
CELL_MICIN_ERROR_PORT_FULL = 0x80140105,
CELL_MICIN_ERROR_ALREADY_OPEN = 0x80140106,
CELL_MICIN_ERROR_NOT_OPEN = 0x80140107,
CELL_MICIN_ERROR_NOT_RUN = 0x80140108,
CELL_MICIN_ERROR_TRANS_EVENT = 0x80140109,
CELL_MICIN_ERROR_OPEN = 0x8014010a,
CELL_MICIN_ERROR_SHAREDMEMORY = 0x8014010b,
CELL_MICIN_ERROR_MUTEX = 0x8014010c,
CELL_MICIN_ERROR_EVENT_QUEUE = 0x8014010d,
CELL_MICIN_ERROR_DEVICE_NOT_FOUND = 0x8014010e,
CELL_MICIN_ERROR_SYSTEM_NOT_FOUND = 0x8014010e,
CELL_MICIN_ERROR_FATAL = 0x8014010f,
CELL_MICIN_ERROR_DEVICE_NOT_SUPPORT = 0x80140110,
};

View File

@ -246,6 +246,7 @@
<ClInclude Include="..\Utilities\StrFmt.h" /> <ClInclude Include="..\Utilities\StrFmt.h" />
<ClInclude Include="..\Utilities\Thread.h" /> <ClInclude Include="..\Utilities\Thread.h" />
<ClInclude Include="..\Utilities\Timer.h" /> <ClInclude Include="..\Utilities\Timer.h" />
<ClInclude Include="cellMic.h" />
<ClInclude Include="Crypto\aes.h" /> <ClInclude Include="Crypto\aes.h" />
<ClInclude Include="Crypto\ec.h" /> <ClInclude Include="Crypto\ec.h" />
<ClInclude Include="Crypto\key_vault.h" /> <ClInclude Include="Crypto\key_vault.h" />

View File

@ -422,9 +422,6 @@
<ClCompile Include="Emu\SysCalls\Modules\cellLv2dbg.cpp"> <ClCompile Include="Emu\SysCalls\Modules\cellLv2dbg.cpp">
<Filter>Emu\SysCalls\currently_unused</Filter> <Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellMic.cpp">
<Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellMusicDecode.cpp"> <ClCompile Include="Emu\SysCalls\Modules\cellMusicDecode.cpp">
<Filter>Emu\SysCalls\currently_unused</Filter> <Filter>Emu\SysCalls\currently_unused</Filter>
</ClCompile> </ClCompile>
@ -626,6 +623,9 @@
<ClCompile Include="Crypto\ec.cpp"> <ClCompile Include="Crypto\ec.cpp">
<Filter>Crypto</Filter> <Filter>Crypto</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellMic.cpp">
<Filter>Emu\SysCalls\Modules</Filter>
</ClCompile>
<ClCompile Include="Emu\Cell\PPULLVMRecompiler.cpp"> <ClCompile Include="Emu\Cell\PPULLVMRecompiler.cpp">
<Filter>Emu\Cell</Filter> <Filter>Emu\Cell</Filter>
</ClCompile> </ClCompile>
@ -1237,6 +1237,9 @@
<ClInclude Include="Crypto\ec.h"> <ClInclude Include="Crypto\ec.h">
<Filter>Crypto</Filter> <Filter>Crypto</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="cellMic.h">
<Filter>Emu\SysCalls\Modules</Filter>
</ClInclude>
<ClInclude Include="Emu\Cell\PPULLVMRecompiler.h"> <ClInclude Include="Emu\Cell\PPULLVMRecompiler.h">
<Filter>Emu\Cell</Filter> <Filter>Emu\Cell</Filter>
</ClInclude> </ClInclude>