Merge pull request #781 from Nekotekina/master

wxRemoval©
This commit is contained in:
B1ackDaemon 2014-08-30 13:19:00 +03:00
commit d99ae7b21c
116 changed files with 2356 additions and 1064 deletions

View file

@ -1,10 +1,5 @@
#pragma once
#include <algorithm>
using std::min;
using std::max;
#define re16(val) _byteswap_ushort(val)
#define re32(val) _byteswap_ulong(val)
#define re64(val) _byteswap_uint64(val)

View file

@ -34,7 +34,6 @@ void strcpy_trunc(char (&dst)[size], const std::string& src)
#define _byteswap_ushort(x) __builtin_bswap16(x)
#define _byteswap_ulong(x) __builtin_bswap32(x)
#define _byteswap_uint64(x) __builtin_bswap64(x)
#define mkdir(x) mkdir(x, 0777)
#define INFINITE 0xFFFFFFFF
#define _CRT_ALIGN(x) __attribute__((aligned(x)))
#define InterlockedCompareExchange(ptr,new_val,old_val) __sync_val_compare_and_swap(ptr,old_val,new_val)
@ -83,3 +82,14 @@ int clock_gettime(int foo, struct timespec *ts);
#define DWORD int32_t
#endif
#ifndef InterlockedCompareExchange
static __forceinline uint32_t InterlockedCompareExchange(volatile uint32_t* dest, uint32_t exch, uint32_t comp)
{
return _InterlockedCompareExchange((volatile long*)dest, exch, comp);
}
static __forceinline uint64_t InterlockedCompareExchange(volatile uint64_t* dest, uint64_t exch, uint64_t comp)
{
return _InterlockedCompareExchange64((volatile long long*)dest, exch, comp);
}
#endif

View file

@ -3,15 +3,7 @@
#include "Log.h"
#include "rMsgBox.h"
#include <iostream>
#include <string>
#include <cinttypes>
#include <memory>
#include <vector>
#include <mutex>
#include <condition_variable>
#include <thread>
#include <set>
#include <array>
#include "Thread.h"
#include "rFile.h"

View file

@ -1,11 +1,4 @@
#pragma once
#include <iostream>
#include <string>
#include <cinttypes>
#include <memory>
#include <vector>
#include <mutex>
#include <set>
#include <array>
#include "Utilities/MTRingbuffer.h"

View file

@ -1,8 +1,4 @@
#pragma once
#include <thread>
#include <array>
#include <mutex>
#include <algorithm>
//Simple non-resizable FIFO Ringbuffer that can be simultaneously be read from and written to
//if we ever get to use boost please replace this with boost::circular_buffer, there's no reason

View file

@ -1,4 +1,4 @@
#include <stdafx.h>
#include "stdafx.h"
#include "Emu/System.h"
#include "Emu/CPU/CPUThread.h"

View file

@ -1,7 +1,5 @@
#pragma once
#include <atomic>
bool SM_IsAborted();
void SM_Sleep();
size_t SM_GetCurrentThreadId();

View file

@ -1,8 +1,5 @@
#pragma once
#include <mutex>
#include <condition_variable>
class SSemaphore
{
const u32 m_max;

View file

@ -1,5 +1,6 @@
#include "stdafx.h"
#include "StrFmt.h"
#include <wx/string.h>
extern const std::string fmt::placeholder = "???";
@ -14,7 +15,11 @@ std::string fmt::FormatV(const char *fmt, va_list args)
for (;;)
{
std::vector<char> buffptr(length);
#if !defined(_MSC_VER)
size_t printlen = vsnprintf(buffptr.data(), length, fmt, args);
#else
size_t printlen = vsnprintf_s(buffptr.data(), length, length - 1, fmt, args);
#endif
if (printlen < length)
{
str = std::string(buffptr.data(), printlen);

View file

@ -1,10 +1,5 @@
#pragma once
#include <string>
#include <vector>
#include <ostream>
#include <sstream>
#include <cstdio>
#include <functional>
class wxString;
#if defined(_MSC_VER)
#define snprintf _snprintf
@ -117,10 +112,14 @@ namespace fmt{
for (;;)
{
std::vector<char> buffptr(length);
#if !defined(_MSC_VER)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wformat-security"
size_t printlen = snprintf(buffptr.data(), length, fmt.c_str(), std::forward<Args>(parameters)...);
#pragma clang diagnostic pop
#else
size_t printlen = _snprintf_s(buffptr.data(), length, length - 1, fmt.c_str(), std::forward<Args>(parameters)...);
#endif
if (printlen < length)
{
str = string(buffptr.data(), printlen);

View file

@ -1,9 +1,4 @@
#pragma once
#include <functional>
#include <thread>
#include <mutex>
#include <atomic>
#include <condition_variable>
static std::thread::id main_thread;

View file

@ -1,9 +1,13 @@
#include "stdafx.h"
#include "Log.h"
#include <wx/dir.h>
#include <wx/file.h>
#include <wx/filename.h>
#include "rFile.h"
#ifdef _WIN32
#include <Windows.h>
// Maybe in StrFmt?
std::wstring ConvertUTF8ToWString(const std::string &source) {
int len = (int)source.size();
@ -62,7 +66,11 @@ bool rIsDir(const std::string &filename) {
bool rMkdir(const std::string &dir)
{
return !mkdir(dir.c_str());
#ifdef _WIN32
return !_mkdir(dir.c_str());
#else
return !mkdir(dir.c_str(), 0777);
#endif
}
bool rMkpath(const std::string &path)
@ -79,7 +87,11 @@ bool rMkpath(const std::string &path)
start = pos;
if(dir.size() == 0)
continue;
if((ret = mkdir(dir.c_str())) && errno != EEXIST){
#ifdef _WIN32
if((ret = _mkdir(dir.c_str())) && errno != EEXIST){
#else
if((ret = mkdir(dir.c_str(), 0777)) && errno != EEXIST){
#endif
return !ret;
}
if (pos >= path.length())

View file

@ -1,7 +1,5 @@
#pragma once
#include <string>
struct FileInfo {
std::string name;
std::string fullName;

View file

@ -1,4 +1,5 @@
#include "stdafx.h"
#include <wx/msgdlg.h>
#include "rMsgBox.h"
#ifndef QT_UI

View file

@ -1,4 +1,5 @@
#include "stdafx.h"
#include <wx/image.h>
#ifndef _WIN32
#include <dirent.h>
@ -47,7 +48,7 @@ std::string rPlatform::getConfigDir()
else // Just in case
dir = "./config";
dir = dir + "/rpcs3/";
mkdir(dir.c_str());
mkdir(dir.c_str(), 0777);
#endif
}
return dir;

View file

@ -1,6 +1,4 @@
#pragma once
#include <vector>
#include <string>
struct rPlatform
{

View file

@ -1,7 +1,4 @@
#include "stdafx.h"
#include <memory>
#include "Utilities/rXml.h"
#include <wx/xml/xml.h>

View file

@ -1,5 +1,4 @@
#pragma once
#include <algorithm>
#include "CPUInstrTable.h"
#pragma warning( disable : 4800 )

View file

@ -286,8 +286,6 @@ void _se_translator(unsigned int u, EXCEPTION_POINTERS* pExp)
if (u == EXCEPTION_ACCESS_VIOLATION && addr < 0x100000000)
{
// TODO: allow recovering from a page fault
//GetCurrentPPUThread().Stop();
Emu.Pause();
throw fmt::Format("Access violation: addr = 0x%x (last_syscall=0x%llx (%s))",
(u32)addr, (u64)GetCurrentCPUThread()->m_last_syscall, SysCalls::GetHLEFuncName((u64)GetCurrentCPUThread()->m_last_syscall).c_str());
}
@ -364,10 +362,12 @@ void CPUThread::Task()
catch (const std::string& e)
{
LOG_ERROR(GENERAL, "Exception: %s", e.c_str());
Emu.Pause();
}
catch (const char* e)
{
LOG_ERROR(GENERAL, "Exception: %s", e);
Emu.Pause();
}
for (auto& v : trace) LOG_NOTICE(PPU, "PC = 0x%llx", v);

View file

@ -1,7 +1,5 @@
#pragma once
#include <mutex>
class CPUThread;
class RawSPUThread;
enum CPUThreadType : unsigned char;

View file

@ -64,24 +64,22 @@ private:
void SysCall()
{
CPU.m_last_syscall = CPU.GPR[11];
SysCalls::DoSyscall(CPU.GPR[11]);
const u64 sc = CPU.GPR[11];
const u64 old_sc = CPU.m_last_syscall;
CPU.m_last_syscall = sc;
SysCalls::DoSyscall(sc);
if(Ini.HLELogging.GetValue())
{
LOG_WARNING(PPU, "SysCall[0x%llx ('%s')] done with code [0x%llx]! #pc: 0x%llx", CPU.GPR[11], SysCalls::GetHLEFuncName(CPU.GPR[11]).c_str(), CPU.GPR[3], CPU.PC);
LOG_WARNING(PPU, "SysCall[0x%llx ('%s')] done with code [0x%llx]! #pc: 0x%llx",
sc, SysCalls::GetHLEFuncName(sc).c_str(), CPU.GPR[3], CPU.PC);
}
/*else if ((s64)CPU.GPR[3] < 0) // probably, error code
{
LOG_ERROR(PPU, "SysCall[0x%llx] done with code [0x%llx]! #pc: 0x%llx", CPU.GPR[11], CPU.GPR[3], CPU.PC);
if(CPU.GPR[11] > 1024)
SysCalls::DoFunc(CPU.GPR[11]);
}*/
#ifdef HLE_CALL_DEBUG
LOG_NOTICE(PPU, "SysCall[%lld] done with code [0x%llx]! #pc: 0x%llx", CPU.GPR[11], CPU.GPR[3], CPU.PC);
LOG_NOTICE(PPU, "SysCall[%lld] done with code [0x%llx]! #pc: 0x%llx", sc, CPU.GPR[3], CPU.PC);
#endif
CPU.m_last_syscall = 0;
CPU.m_last_syscall = old_sc;
}
void NULL_OP()
@ -773,10 +771,10 @@ private:
{
float result = CPU.VPR[vb]._f[w] * nScale;
if (result > INT_MAX)
CPU.VPR[vd]._s32[w] = (int)INT_MAX;
else if (result < INT_MIN)
CPU.VPR[vd]._s32[w] = (int)INT_MIN;
if (result > S32_MAX)
CPU.VPR[vd]._s32[w] = (int)S32_MAX;
else if (result < S32_MIN)
CPU.VPR[vd]._s32[w] = (int)S32_MIN;
else // C rounding = Round towards 0
CPU.VPR[vd]._s32[w] = (int)result;
}
@ -790,8 +788,8 @@ private:
// C rounding = Round towards 0
s64 result = (s64)(CPU.VPR[vb]._f[w] * nScale);
if (result > UINT_MAX)
CPU.VPR[vd]._u32[w] = (u32)UINT_MAX;
if (result > U32_MAX)
CPU.VPR[vd]._u32[w] = (u32)U32_MAX;
else if (result < 0)
CPU.VPR[vd]._u32[w] = 0;
else
@ -1063,14 +1061,14 @@ private:
result += CPU.VPR[vc]._s32[w];
if (result > INT_MAX)
if (result > S32_MAX)
{
saturated = INT_MAX;
saturated = S32_MAX;
CPU.VSCR.SAT = 1;
}
else if (result < INT_MIN)
else if (result < S32_MIN)
{
saturated = INT_MIN;
saturated = S32_MIN;
CPU.VSCR.SAT = 1;
}
else
@ -1123,9 +1121,9 @@ private:
result += CPU.VPR[vc]._u32[w];
if (result > UINT_MAX)
if (result > U32_MAX)
{
saturated = UINT_MAX;
saturated = U32_MAX;
CPU.VSCR.SAT = 1;
}
else

View file

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "stdafx_gui.h"
#include "PPUProgramCompiler.h"
#include "Utilities/rFile.h"

View file

@ -1,5 +1,4 @@
#pragma once
#include <vector>
#include "PPUInstrTable.h"
#include "Loader/ELF64.h"

View file

@ -10,11 +10,6 @@
#include "Emu/Cell/PPUDecoder.h"
#include "Emu/Cell/PPUInterpreter.h"
#include <thread>
#include <cmath>
//extern gcmInfo gcm_info;
PPUThread& GetCurrentPPUThread()
{
PPCThread* thread = GetCurrentPPCThread();

View file

@ -1,6 +1,5 @@
#pragma once
#include "Emu/Cell/PPCThread.h"
#include <cmath>
enum
{

View file

@ -11,7 +11,6 @@
#include "Emu/SysCalls/lv2/sys_spu.h"
#include "Emu/SysCalls/lv2/sys_event_flag.h"
#include "Emu/SysCalls/lv2/sys_time.h"
#include "Emu/Event.h"
#include "Emu/Cell/SPUDisAsm.h"
#include "Emu/Cell/SPUThread.h"
@ -424,7 +423,7 @@ void SPUThread::EnqMfcCmd(MFCReg& MFCArgs)
{
if (buf[i] != R_DATA[i])
{
if (InterlockedCompareExchange64((volatile long long*)(Memory + (ea + i * 8)), buf[i], R_DATA[i]) != R_DATA[i])
if (InterlockedCompareExchange((volatile u64*)(Memory + (ea + i * 8)), buf[i], R_DATA[i]) != R_DATA[i])
{
m_events |= SPU_EVENT_LR;
MFCArgs.AtomicStat.PushUncond(MFC_PUTLLC_FAILURE);
@ -494,6 +493,7 @@ bool SPUThread::CheckEvents()
{
// checks events:
// SPU_EVENT_LR:
if (R_ADDR)
{
for (u32 i = 0; i < 16; i++)
{
@ -949,11 +949,14 @@ void SPUThread::ReadChannel(SPU_GPR_hdr& r, u32 ch)
void SPUThread::StopAndSignal(u32 code)
{
SetExitStatus(code); // exit code (not status)
// TODO: process interrupts for RawSPU
switch (code)
{
case 0x110: /* ===== sys_spu_thread_receive_event ===== */
case 0x110:
{
/* ===== sys_spu_thread_receive_event ===== */
u32 spuq = 0;
if (!SPU.Out_MBox.Pop(spuq))
{
@ -1027,22 +1030,60 @@ void SPUThread::StopAndSignal(u32 code)
return;
}
}
}
break;
}
case 0x101:
{
/* ===== sys_spu_thread_group_exit ===== */
if (!group)
{
LOG_ERROR(Log::SPU, "sys_spu_thread_group_exit(): group not set");
break;
}
else if (!SPU.Out_MBox.GetCount())
{
LOG_ERROR(Log::SPU, "sys_spu_thread_group_exit(): Out_MBox is empty");
}
else if (Ini.HLELogging.GetValue())
{
LOG_NOTICE(Log::SPU, "sys_spu_thread_group_exit(status=0x%x)", SPU.Out_MBox.GetValue());
}
group->m_group_exit = true;
group->m_exit_status = SPU.Out_MBox.GetValue();
for (auto& v : group->list)
{
if (CPUThread* t = Emu.GetCPU().GetThread(v))
{
t->Stop();
}
}
break;
}
case 0x102:
{
/* ===== sys_spu_thread_exit ===== */
if (!SPU.Out_MBox.GetCount())
{
LOG_ERROR(Log::SPU, "sys_spu_thread_exit (no status, code 0x102)");
LOG_ERROR(Log::SPU, "sys_spu_thread_exit(): Out_MBox is empty");
}
else if (Ini.HLELogging.GetValue())
{
// the real exit status
LOG_NOTICE(Log::SPU, "sys_spu_thread_exit (status=0x%x)", SPU.Out_MBox.GetValue());
LOG_NOTICE(Log::SPU, "sys_spu_thread_exit(status=0x%x)", SPU.Out_MBox.GetValue());
}
SPU.Status.SetValue(SPU_STATUS_STOPPED_BY_STOP);
Stop();
break;
}
default:
{
if (!SPU.Out_MBox.GetCount())
{
LOG_ERROR(Log::SPU, "Unknown STOP code: 0x%x (no message)", code);
@ -1051,8 +1092,8 @@ void SPUThread::StopAndSignal(u32 code)
{
LOG_ERROR(Log::SPU, "Unknown STOP code: 0x%x (message=0x%x)", code, SPU.Out_MBox.GetValue());
}
SPU.Status.SetValue(SPU_STATUS_STOPPED_BY_STOP);
Stop();
break;
}
}
}

View file

@ -2,7 +2,6 @@
#include "PPCThread.h"
#include "Emu/Event.h"
#include "MFC.h"
#include <mutex>
enum SPUchannels
{

View file

@ -1,12 +1,12 @@
#include "stdafx.h"
#include <memory>
#include "VFS.h"
#include "vfsDirBase.h"
#include "Emu/HDD/HDD.h"
#include "vfsDeviceLocalFile.h"
#include "Ini.h"
#undef CreateFile // TODO: what's wrong with it?
int sort_devices(const void* _a, const void* _b)
{
const vfsDevice& a = **(const vfsDevice**)_a;

View file

@ -1,5 +1,4 @@
#include "stdafx.h"
#include <algorithm>
#include "vfsDevice.h"
#include "Utilities/rFile.h"

View file

@ -1,5 +1,4 @@
#pragma once
#include <mutex>
struct vfsFileBase;
class vfsDirBase;

View file

@ -1,5 +1,4 @@
#pragma once
#include <memory>
#include "vfsDirBase.h"
class vfsDir : public vfsDirBase

View file

@ -1,5 +1,4 @@
#pragma once
#include <memory>
#include "vfsFileBase.h"
class vfsFile : public vfsFileBase

View file

@ -1,5 +1,4 @@
#pragma once
#include <algorithm>
#include "Emu/FS/vfsDevice.h"
#include "Emu/FS/vfsLocalFile.h"

View file

@ -1,7 +1,5 @@
#pragma once
#include <mutex>
#include <unordered_map>
#include <set>
#define rID_ANY -1 // was wxID_ANY

View file

@ -1,6 +1,4 @@
#pragma once
#include <memory>
#include "KeyboardHandler.h"
class KeyboardManager
@ -18,8 +16,8 @@ public:
std::vector<Keyboard>& GetKeyboards() { return m_keyboard_handler->GetKeyboards(); }
KbInfo& GetInfo() { return m_keyboard_handler->GetInfo(); }
std::vector<KbButton>& GetButtons(const u32 keyboard) { return m_keyboard_handler->GetButtons(keyboard); }
CellKbData& GetData(const u32 keyboard) { return m_keyboard_handler->GetData(keyboard); }
CellKbConfig& GetConfig(const u32 keyboard) { return m_keyboard_handler->GetConfig(keyboard); }
KbData& GetData(const u32 keyboard) { return m_keyboard_handler->GetData(keyboard); }
KbConfig& GetConfig(const u32 keyboard) { return m_keyboard_handler->GetConfig(keyboard); }
bool IsInited() const { return m_inited; }
};

View file

@ -1,7 +1,5 @@
#pragma once
#include <vector>
extern u16 cellKbCnvRawCode(u32 arrange, u32 mkey, u32 led, u16 rawcode); // (TODO: Can it be problematic to place SysCalls in middle of nowhere?)
enum KbPortStatus
@ -191,26 +189,25 @@ enum CellKbMappingType
CELL_KB_MAPPING_PORTUGUESE_BRAZIL,
};
static const u32 CELL_KB_MAX_KEYBOARDS = 127;
static const u32 CELL_KB_MAX_PORT_NUM = 7;
static const u32 CELL_KB_MAX_KEYCODES = 62;
static const u32 KB_MAX_KEYBOARDS = 127;
static const u32 KB_MAX_KEYCODES = 62;
struct KbInfo
{
u32 max_connect;
u32 now_connect;
u32 info;
u8 status[CELL_KB_MAX_KEYBOARDS];
u8 status[KB_MAX_KEYBOARDS];
};
struct CellKbData
struct KbData
{
u32 led;
u32 mkey;
s32 len;
u16 keycode[CELL_KB_MAX_KEYCODES];
u16 keycode[KB_MAX_KEYCODES];
CellKbData()
KbData()
: led(0)
, mkey(0)
, len(0)
@ -218,13 +215,13 @@ struct CellKbData
}
};
struct CellKbConfig
struct KbConfig
{
u32 arrange;
u32 read_mode;
u32 code_type;
CellKbConfig()
KbConfig()
: arrange(CELL_KB_MAPPING_106)
, read_mode(CELL_KB_RMODE_INPUTCHAR)
, code_type(CELL_KB_CODETYPE_ASCII)
@ -248,8 +245,8 @@ struct KbButton
struct Keyboard
{
CellKbData m_data;
CellKbConfig m_config;
KbData m_data;
KbConfig m_config;
std::vector<KbButton> m_buttons;
Keyboard()
@ -278,8 +275,8 @@ public:
if(button.m_keyCode != code)
continue;
CellKbData& data = keyboard.m_data;
CellKbConfig& config = keyboard.m_config;
KbData& data = keyboard.m_data;
KbConfig& config = keyboard.m_config;
if (pressed)
{
@ -305,7 +302,7 @@ public:
{
kcode = cellKbCnvRawCode(config.arrange, data.mkey, data.led, button.m_outKeyCode);
}
data.keycode[data.len % CELL_KB_MAX_KEYCODES] = kcode;
data.keycode[data.len % KB_MAX_KEYCODES] = kcode;
data.len++;
}
}
@ -327,6 +324,6 @@ public:
KbInfo& GetInfo() { return m_info; }
std::vector<Keyboard>& GetKeyboards() { return m_keyboards; }
std::vector<KbButton>& GetButtons(const u32 keyboard) { return m_keyboards[keyboard].m_buttons; }
CellKbData& GetData(const u32 keyboard) { return m_keyboards[keyboard].m_data; }
CellKbConfig& GetConfig(const u32 keyboard) { return m_keyboards[keyboard].m_config; }
KbData& GetData(const u32 keyboard) { return m_keyboards[keyboard].m_data; }
KbConfig& GetConfig(const u32 keyboard) { return m_keyboards[keyboard].m_config; }
};

View file

@ -1,6 +1,4 @@
#pragma once
#include <memory>
#include "MouseHandler.h"
class MouseManager
@ -17,8 +15,8 @@ public:
std::vector<Mouse>& GetMice() { return m_mouse_handler->GetMice(); }
MouseInfo& GetInfo() { return m_mouse_handler->GetInfo(); }
CellMouseData& GetData(const u32 mouse) { return m_mouse_handler->GetData(mouse); }
CellMouseRawData& GetRawData(const u32 mouse) { return m_mouse_handler->GetRawData(mouse); }
MouseData& GetData(const u32 mouse) { return m_mouse_handler->GetData(mouse); }
MouseRawData& GetRawData(const u32 mouse) { return m_mouse_handler->GetRawData(mouse); }
bool IsInited() const { return m_inited; }
};

View file

@ -1,7 +1,5 @@
#pragma once
#include <vector>
enum MousePortStatus
{
CELL_MOUSE_STATUS_DISCONNECTED = 0x00000000,
@ -26,32 +24,32 @@ enum MouseButtonCodes
CELL_MOUSE_BUTTON_8 = 0x00000080,
};
static const u32 CELL_MAX_MICE = 127;
static const u32 CELL_MOUSE_MAX_DATA_LIST_NUM = 8;
static const u32 CELL_MOUSE_MAX_CODES = 64;
static const u32 MAX_MICE = 127;
static const u32 MOUSE_MAX_DATA_LIST_NUM = 8;
static const u32 MOUSE_MAX_CODES = 64;
struct MouseInfo
{
u32 max_connect;
u32 now_connect;
u32 info;
u16 vendor_id[CELL_MAX_MICE];
u16 product_id[CELL_MAX_MICE];
u8 status[CELL_MAX_MICE];
u16 vendor_id[MAX_MICE];
u16 product_id[MAX_MICE];
u8 status[MAX_MICE];
};
struct CellMouseRawData
struct MouseRawData
{
s32 len;
u8 data[CELL_MOUSE_MAX_CODES];
u8 data[MOUSE_MAX_CODES];
CellMouseRawData()
MouseRawData()
: len(0)
{
}
};
struct CellMouseData
struct MouseData
{
u8 update;
u8 buttons;
@ -60,7 +58,7 @@ struct CellMouseData
s8 wheel;
s8 tilt; // (TODO)
CellMouseData()
MouseData()
: update(0)
, buttons(0)
, x_axis(0)
@ -71,12 +69,12 @@ struct CellMouseData
}
};
struct CellMouseDataList
struct MouseDataList
{
u32 list_num;
CellMouseData list[CELL_MOUSE_MAX_DATA_LIST_NUM];
MouseData list[MOUSE_MAX_DATA_LIST_NUM];
CellMouseDataList()
MouseDataList()
: list_num(0)
{
}
@ -87,8 +85,8 @@ struct Mouse
s16 x_pos;
s16 y_pos;
CellMouseData m_data;
CellMouseRawData m_rawdata;
MouseData m_data;
MouseRawData m_rawdata;
Mouse()
: m_data()
@ -113,7 +111,7 @@ public:
{
if (m_info.status[p] == CELL_MOUSE_STATUS_CONNECTED)
{
CellMouseData& data = GetData(p);
MouseData& data = GetData(p);
data.update = CELL_MOUSE_DATA_UPDATE;
if (pressed) data.buttons |= button;
else data.buttons &= ~button;
@ -127,7 +125,7 @@ public:
{
if (m_info.status[p] == CELL_MOUSE_STATUS_CONNECTED)
{
CellMouseData& data = GetData(p);
MouseData& data = GetData(p);
data.update = CELL_MOUSE_DATA_UPDATE;
data.wheel = rotation/120; //120=event.GetWheelDelta()
}
@ -140,7 +138,7 @@ public:
{
if (m_info.status[p] == CELL_MOUSE_STATUS_CONNECTED)
{
CellMouseData& data = GetData(p);
MouseData& data = GetData(p);
data.update = CELL_MOUSE_DATA_UPDATE;
data.x_axis += x_pos_new - m_mice[p].x_pos;
data.y_axis += y_pos_new - m_mice[p].y_pos;
@ -157,6 +155,6 @@ public:
MouseInfo& GetInfo() { return m_info; }
std::vector<Mouse>& GetMice() { return m_mice; }
CellMouseData& GetData(const u32 mouse) { return m_mice[mouse].m_data; }
CellMouseRawData& GetRawData(const u32 mouse) { return m_mice[mouse].m_rawdata; }
MouseData& GetData(const u32 mouse) { return m_mice[mouse].m_data; }
MouseRawData& GetRawData(const u32 mouse) { return m_mice[mouse].m_rawdata; }
};

View file

@ -1,6 +1,4 @@
#pragma once
#include <memory>
#include "PadHandler.h"
class PadManager

View file

@ -1,7 +1,5 @@
#pragma once
#include <vector>
enum PortStatus
{
CELL_PAD_STATUS_DISCONNECTED = 0x00000000,

View file

@ -1,7 +1,4 @@
#pragma once
#include <algorithm>
#include <vector>
#include "Emu/Io/KeyboardHandler.h"
class WindowsKeyboardHandler final

View file

@ -1,6 +1,4 @@
#pragma once
#include <algorithm>
#include "Emu/Io/MouseHandler.h"
class WindowsMouseHandler final

View file

@ -1,6 +1,4 @@
#pragma once
#include <algorithm>
#include "Emu/Io/PadHandler.h"
class WindowsPadHandler final

View file

@ -1,9 +1,7 @@
#include "stdafx.h"
#include "stdafx_gui.h"
#if defined (_WIN32)
#include <algorithm>
#include "Utilities/Log.h"
#include "XInputPadHandler.h"
#include <cstring>
namespace {
const DWORD THREAD_TIMEOUT = 1000;

View file

@ -1,12 +1,12 @@
#include "stdafx.h"
#include <atomic>
#include "Utilities/Log.h"
#include "Memory.h"
#include "Emu/System.h"
#include "Memory.h"
#ifndef _WIN32
#include <sys/mman.h>
#else
#include <Windows.h>
#endif
/* OS X uses MAP_ANON instead of MAP_ANONYMOUS */
@ -36,6 +36,7 @@ void MemoryBase::RegisterPages(u64 addr, u32 size)
if (m_pages[i])
{
LOG_ERROR(MEMORY, "Page already registered (addr=0x%llx)", i * 4096);
Emu.Pause();
}
m_pages[i] = 1; // TODO: define page parameters
}
@ -56,6 +57,7 @@ void MemoryBase::UnregisterPages(u64 addr, u32 size)
if (!m_pages[i])
{
LOG_ERROR(MEMORY, "Page not registered (addr=0x%llx)", i * 4096);
Emu.Pause();
}
m_pages[i] = 0; // TODO: define page parameters
}

View file

@ -365,7 +365,7 @@ public:
template<typename T> void WriteString(const T addr, const std::string& str)
{
strcpy((char*)GetMemFromAddr<T>(addr), str.c_str());
memcpy(GetMemFromAddr<T>(addr), str.c_str(), str.size());
}
u32 GetUserMemTotalSize()
@ -745,39 +745,6 @@ public:
}
};
class mem_class_t
{
u32 m_addr;
public:
mem_class_t(u32 addr) : m_addr(addr)
{
}
mem_class_t() : m_addr(0)
{
}
template<typename T> u32 operator += (T right)
{
mem_t<T>& m((mem_t<T>&)*this);
m = right;
m_addr += sizeof(T);
return m_addr;
}
template<typename T> operator T()
{
mem_t<T>& m((mem_t<T>&)*this);
const T ret = m;
m_addr += sizeof(T);
return ret;
}
u64 GetAddr() const { return m_addr; }
void SetAddr(const u64 addr) { m_addr = addr; }
};
template<typename T>
struct _func_arg
{

View file

@ -2,9 +2,7 @@
#define PAGE_4K(x) (x + 4095) & ~(4095)
#include <memory>
#include <mutex>
#include <emmintrin.h>
//#include <emmintrin.h>
struct MemInfo
{

View file

@ -4,6 +4,7 @@
#endif
#ifdef _WIN32
#include <Windows.h>
#include "GL/gl.h"
#include "GL/glext.h"
typedef BOOL (WINAPI* PFNWGLSWAPINTERVALEXTPROC) (int interval);

View file

@ -2155,7 +2155,7 @@ void RSXThread::Task()
});
vblank.detach();
while(!TestDestroy())
while(!TestDestroy()) try
{
if (Emu.IsStopped())
{
@ -2246,6 +2246,16 @@ void RSXThread::Task()
m_ctrl->get = get + (count + 1) * 4;
//memset(Memory.GetMemFromAddr(p.m_ioAddress + get), 0, (count + 1) * 4);
}
catch (const std::string& e)
{
LOG_ERROR(RSX, "Exception: %s", e.c_str());
Emu.Pause();
}
catch (const char* e)
{
LOG_ERROR(RSX, "Exception: %s", e);
Emu.Pause();
}
while (!is_vblank_stopped)
{
@ -2278,11 +2288,17 @@ void RSXThread::Init(const u32 ioAddress, const u32 ioSize, const u32 ctrlAddres
u32 RSXThread::ReadIO32(u32 addr)
{
u32 value;
Memory.RSXIOMem.Read32(Memory.RSXIOMem.GetStartAddr() + addr, &value);
if (!Memory.RSXIOMem.Read32(Memory.RSXIOMem.GetStartAddr() + addr, &value))
{
throw fmt::Format("%s(rsxio_addr=0x%x): RSXIO memory not mapped", __FUNCTION__, addr);
}
return value;
}
void RSXThread::WriteIO32(u32 addr, u32 value)
{
Memory.RSXIOMem.Write32(Memory.RSXIOMem.GetStartAddr() + addr, value);
if (!Memory.RSXIOMem.Write32(Memory.RSXIOMem.GetStartAddr() + addr, value))
{
throw fmt::Format("%s(rsxio_addr=0x%x): RSXIO memory not mapped", __FUNCTION__, addr);
}
}

View file

@ -6,7 +6,6 @@
#include "Emu/SysCalls/Callback.h"
#include <stack>
#include <set> // For tracking a list of used gcm commands
#include "Utilities/SSemaphore.h"
#include "Utilities/Thread.h"

View file

@ -9,6 +9,8 @@ extern void cellAudio_init();
extern Module *cellAudio;
extern void cellDmux_init();
extern Module *cellDmux;
extern void cellFiber_init();
extern Module *cellFiber;
extern void cellFont_init();
extern void cellFont_load();
extern void cellFont_unload();
@ -48,8 +50,11 @@ extern Module *cellSail;
extern void cellSpurs_init();
extern Module *cellSpurs;
extern void cellSync_init();
extern void cellSync_load();
extern Module *cellSpursJq;
extern void cellSpursJq_init();
extern Module *cellSync;
extern void cellSync2_init();
extern Module *cellSync2;
extern void cellSysmodule_init();
extern Module *cellSysmodule;
extern void cellSysutil_init();
@ -222,6 +227,8 @@ void ModuleManager::init()
m_mod_init.emplace_back(0x0011, cellAudio_init);
cellDmux = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back(0x0007, cellDmux_init);
cellFiber = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back(0x0043, cellFiber_init);
cellFont = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back(0x0019, cellFont_init, cellFont_load, cellFont_unload);
cellFontFT = static_cast <Module*>(&(m_mod_init.back())) + 1;
@ -252,8 +259,12 @@ void ModuleManager::init()
m_mod_init.emplace_back("cellSail", cellSail_init);
cellSpurs = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back(0x000a, cellSpurs_init);
cellSpursJq = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back(0x0050, cellSpursJq_init);
cellSync = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back("cellSync", cellSync_init, cellSync_load, nullptr);
m_mod_init.emplace_back("cellSync", cellSync_init);
cellSync2 = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back(0x0055, cellSync2_init);
cellSysutil = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back(0x0015, cellSysutil_init);
cellSysutilAp = static_cast <Module*>(&(m_mod_init.back())) + 1;

View file

@ -1,9 +1,9 @@
#include "stdafx.h"
#include "Emu/Memory/Memory.h"
#include "Emu/System.h"
#include "Emu/SysCalls/Modules.h"
#include "Emu/SysCalls/Static.h"
#include "Crypto/sha1.h"
#include <mutex>
#include "ModuleManager.h"
u32 getFunctionId(const char* name)
@ -187,4 +187,68 @@ IdManager& Module::GetIdManager() const
void Module::PushNewFuncSub(SFunc* func)
{
Emu.GetSFuncManager().push_back(func);
}
void fix_import(Module* module, u32 func, u32 addr)
{
Memory.Write32(addr + 0x0, 0x3d600000 | (func >> 16)); /* lis r11, (func_id >> 16) */
Memory.Write32(addr + 0x4, 0x616b0000 | (func & 0xffff)); /* ori r11, (func_id & 0xffff) */
Memory.Write32(addr + 0x8, 0x60000000); /* nop */
// leave rtoc saving at 0xC
Memory.Write64(addr + 0x10, 0x440000024e800020ull); /* sc + blr */
Memory.Write64(addr + 0x18, 0x6000000060000000ull); /* nop + nop */
module->Load(func);
}
void fix_relocs(Module* module, u32 lib, u32 start, u32 end, u32 seg2)
{
// start of table:
// addr = (u64) addr - seg2, (u32) 1, (u32) 1, (u64) ptr
// addr = (u64) addr - seg2, (u32) 0x101, (u32) 1, (u64) ptr - seg2 (???)
// addr = (u64) addr, (u32) 0x100, (u32) 1, (u64) ptr - seg2 (???)
// addr = (u64) addr, (u32) 0, (u32) 1, (u64) ptr (???)
for (u32 i = lib + start; i < lib + end; i += 24)
{
u64 addr = Memory.Read64(i);
const u64 flag = Memory.Read64(i + 8);
if (flag == 0x10100000001ull)
{
addr = addr + seg2 + lib;
u32 value = Memory.Read32(addr);
assert(value == Memory.Read64(i + 16) + seg2);
Memory.Write32(addr, value + lib);
}
else if (flag == 0x100000001ull)
{
addr = addr + seg2 + lib;
u32 value = Memory.Read32(addr);
assert(value == Memory.Read64(i + 16));
Memory.Write32(addr, value + lib);
}
else if (flag == 0x10000000001ull)
{
addr = addr + lib;
u32 value = Memory.Read32(addr);
assert(value == Memory.Read64(i + 16) + seg2);
Memory.Write32(addr, value + lib);
}
else if (flag == 1)
{
addr = addr + lib;
u32 value = Memory.Read32(addr);
assert(value == Memory.Read64(i + 16));
Memory.Write32(addr, value + lib);
}
else if (flag == 0x10000000004ull || flag == 0x10000000006ull)
{
// seems to be instruction modifiers for imports (done in other way in FIX_IMPORT)
}
else
{
module->Notice("fix_relocs(): 0x%x : 0x%llx", i - lib, flag);
}
}
}

View file

@ -162,6 +162,12 @@ __forceinline void Module::AddFuncSub(const char group[8], const u64 ops[], cons
PushNewFuncSub(sf);
}
void fix_import(Module* module, u32 func, u32 addr);
#define FIX_IMPORT(module, func, addr) fix_import(module, getFunctionId(#func), addr)
void fix_relocs(Module* module, u32 lib, u32 start, u32 end, u32 seg2);
#define REG_SUB(module, group, name, ...) \
static const u64 name ## _table[] = {__VA_ARGS__ , 0}; \
module->AddFuncSub(group, name ## _table, #name, name)

View file

@ -4,21 +4,10 @@
#include "Emu/SysCalls/Modules.h"
#include "Emu/Io/Keyboard.h"
#include "SC_Keyboard.h"
extern Module *sys_io;
enum CELL_KB_ERROR_CODE
{
CELL_KB_ERROR_FATAL = 0x80121001,
CELL_KB_ERROR_INVALID_PARAMETER = 0x80121002,
CELL_KB_ERROR_ALREADY_INITIALIZED = 0x80121003,
CELL_KB_ERROR_UNINITIALIZED = 0x80121004,
CELL_KB_ERROR_RESOURCE_ALLOCATION_FAILED = 0x80121005,
CELL_KB_ERROR_READ_FAILED = 0x80121006,
CELL_KB_ERROR_NO_DEVICE = 0x80121007,
CELL_KB_ERROR_SYS_SETTING_FAILED = 0x80121008,
};
int cellKbInit(u32 max_connect)
{
sys_io->Warning("cellKbInit(max_connect=%d)", max_connect);
@ -96,24 +85,24 @@ u16 cellKbCnvRawCode(u32 arrange, u32 mkey, u32 led, u16 rawcode)
return 0x0000;
}
int cellKbGetInfo(mem_class_t info)
int cellKbGetInfo(mem_ptr_t<CellKbInfo> info)
{
sys_io->Log("cellKbGetInfo(info_addr=0x%x)", info.GetAddr());
if(!Emu.GetKeyboardManager().IsInited()) return CELL_KB_ERROR_UNINITIALIZED;
const KbInfo& current_info = Emu.GetKeyboardManager().GetInfo();
info += current_info.max_connect;
info += current_info.now_connect;
info += current_info.info;
info->max_connect = current_info.max_connect;
info->now_connect = current_info.now_connect;
info->info = current_info.info;
for(u32 i=0; i<CELL_KB_MAX_KEYBOARDS; i++)
{
info += current_info.status[i];
info->status[i] = current_info.status[i];
}
return CELL_OK;
}
int cellKbRead(u32 port_no, mem_class_t data)
int cellKbRead(u32 port_no, mem_ptr_t<CellKbData> data)
{
sys_io->Log("cellKbRead(port_no=%d,info_addr=0x%x)", port_no, data.GetAddr());
@ -121,13 +110,13 @@ int cellKbRead(u32 port_no, mem_class_t data)
if(!Emu.GetKeyboardManager().IsInited()) return CELL_KB_ERROR_UNINITIALIZED;
if(port_no >= keyboards.size()) return CELL_KB_ERROR_INVALID_PARAMETER;
CellKbData& current_data = Emu.GetKeyboardManager().GetData(port_no);
data += current_data.led;
data += current_data.mkey;
data += std::min((u32)current_data.len, CELL_KB_MAX_KEYCODES);
KbData& current_data = Emu.GetKeyboardManager().GetData(port_no);
data->led = current_data.led;
data->mkey = current_data.mkey;
data->len = std::min((u32)current_data.len, CELL_KB_MAX_KEYCODES);
for(s32 i=0; i<current_data.len; i++)
{
data += current_data.keycode[i];
data->keycode[i] = current_data.keycode[i];
}
current_data.len = 0;
@ -140,7 +129,7 @@ int cellKbSetCodeType(u32 port_no, u32 type)
sys_io->Log("cellKbSetCodeType(port_no=%d,type=%d)", port_no, type);
if(!Emu.GetKeyboardManager().IsInited()) return CELL_KB_ERROR_UNINITIALIZED;
CellKbConfig& current_config = Emu.GetKeyboardManager().GetConfig(port_no);
KbConfig& current_config = Emu.GetKeyboardManager().GetConfig(port_no);
current_config.code_type = type;
return CELL_OK;
}
@ -156,21 +145,21 @@ int cellKbSetReadMode(u32 port_no, u32 rmode)
sys_io->Log("cellKbSetReadMode(port_no=%d,rmode=%d)", port_no, rmode);
if(!Emu.GetKeyboardManager().IsInited()) return CELL_KB_ERROR_UNINITIALIZED;
CellKbConfig& current_config = Emu.GetKeyboardManager().GetConfig(port_no);
KbConfig& current_config = Emu.GetKeyboardManager().GetConfig(port_no);
current_config.read_mode = rmode;
return CELL_OK;
}
int cellKbGetConfiguration(u32 port_no, mem_class_t config)
int cellKbGetConfiguration(u32 port_no, mem_ptr_t<CellKbConfig> config)
{
sys_io->Log("cellKbGetConfiguration(port_no=%d,config_addr=0x%x)", port_no, config.GetAddr());
if(!Emu.GetKeyboardManager().IsInited()) return CELL_KB_ERROR_UNINITIALIZED;
const CellKbConfig& current_config = Emu.GetKeyboardManager().GetConfig(port_no);
config += current_config.arrange;
config += current_config.read_mode;
config += current_config.code_type;
const KbConfig& current_config = Emu.GetKeyboardManager().GetConfig(port_no);
config->arrange = current_config.arrange;
config->read_mode = current_config.read_mode;
config->code_type = current_config.code_type;
return CELL_OK;
}

View file

@ -0,0 +1,51 @@
#pragma once
enum CELL_KB_ERROR_CODE
{
CELL_KB_ERROR_FATAL = 0x80121001,
CELL_KB_ERROR_INVALID_PARAMETER = 0x80121002,
CELL_KB_ERROR_ALREADY_INITIALIZED = 0x80121003,
CELL_KB_ERROR_UNINITIALIZED = 0x80121004,
CELL_KB_ERROR_RESOURCE_ALLOCATION_FAILED = 0x80121005,
CELL_KB_ERROR_READ_FAILED = 0x80121006,
CELL_KB_ERROR_NO_DEVICE = 0x80121007,
CELL_KB_ERROR_SYS_SETTING_FAILED = 0x80121008,
};
static const u32 CELL_KB_MAX_KEYBOARDS = 127;
struct CellKbInfo
{
be_t<u32> max_connect;
be_t<u32> now_connect;
be_t<u32> info;
u8 status[CELL_KB_MAX_KEYBOARDS];
};
static const u32 CELL_KB_MAX_KEYCODES = 62;
struct CellKbData
{
be_t<u32> led;
be_t<u32> mkey;
be_t<s32> len;
be_t<u16> keycode[CELL_KB_MAX_KEYCODES];
};
struct CellKbConfig
{
be_t<u32> arrange;
be_t<u32> read_mode;
be_t<u32> code_type;
};
int cellKbInit(u32 max_connect);
int cellKbEnd();
int cellKbClearBuf(u32 port_no);
u16 cellKbCnvRawCode(u32 arrange, u32 mkey, u32 led, u16 rawcode);
int cellKbGetInfo(mem_ptr_t<CellKbInfo> info);
int cellKbRead(u32 port_no, mem_ptr_t<CellKbData> data);
int cellKbSetCodeType(u32 port_no, u32 type);
int cellKbSetLEDStatus(u32 port_no, u8 led);
int cellKbSetReadMode(u32 port_no, u32 rmode);
int cellKbGetConfiguration(u32 port_no, mem_ptr_t<CellKbConfig> config);

View file

@ -4,21 +4,10 @@
#include "Emu/SysCalls/Modules.h"
#include "Emu/Io/Mouse.h"
#include "SC_Mouse.h"
extern Module *sys_io;
enum CELL_MOUSE_ERROR_CODE
{
CELL_MOUSE_ERROR_FATAL = 0x80121201,
CELL_MOUSE_ERROR_INVALID_PARAMETER = 0x80121202,
CELL_MOUSE_ERROR_ALREADY_INITIALIZED = 0x80121203,
CELL_MOUSE_ERROR_UNINITIALIZED = 0x80121204,
CELL_MOUSE_ERROR_RESOURCE_ALLOCATION_FAILED = 0x80121205,
CELL_MOUSE_ERROR_DATA_READ_FAILED = 0x80121206,
CELL_MOUSE_ERROR_NO_DEVICE = 0x80121207,
CELL_MOUSE_ERROR_SYS_SETTING_FAILED = 0x80121208,
};
int cellMouseInit(u32 max_connect)
{
sys_io->Warning("cellMouseInit(max_connect=%d)", max_connect);
@ -49,47 +38,47 @@ int cellMouseEnd()
return CELL_OK;
}
int cellMouseGetInfo(mem_class_t info)
int cellMouseGetInfo(mem_ptr_t<CellMouseInfo> info)
{
sys_io->Log("cellMouseGetInfo(info_addr=0x%x)", info.GetAddr());
if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED;
const MouseInfo& current_info = Emu.GetMouseManager().GetInfo();
info += current_info.max_connect;
info += current_info.now_connect;
info += current_info.info;
for(u32 i=0; i<CELL_MAX_MICE; i++) info += current_info.vendor_id[i];
for(u32 i=0; i<CELL_MAX_MICE; i++) info += current_info.product_id[i];
for(u32 i=0; i<CELL_MAX_MICE; i++) info += current_info.status[i];
info->max_connect = current_info.max_connect;
info->now_connect = current_info.now_connect;
info->info = current_info.info;
for(u32 i=0; i<CELL_MAX_MICE; i++) info->vendor_id[i] = current_info.vendor_id[i];
for(u32 i=0; i<CELL_MAX_MICE; i++) info->product_id[i] = current_info.product_id[i];
for(u32 i=0; i<CELL_MAX_MICE; i++) info->status[i] = current_info.status[i];
return CELL_OK;
}
int cellMouseInfoTabletMode(u32 port_no, mem_class_t info)
int cellMouseInfoTabletMode(u32 port_no, mem_ptr_t<CellMouseInfoTablet> info)
{
sys_io->Log("cellMouseInfoTabletMode(port_no=%d,info_addr=0x%x)", port_no, info.GetAddr());
if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED;
if(port_no >= Emu.GetMouseManager().GetMice().size()) return CELL_MOUSE_ERROR_INVALID_PARAMETER;
info += 0; // Unimplemented: (0=Tablet mode is not supported)
info += 1; // Unimplemented: (1=Mouse mode)
info->is_supported = 0; // Unimplemented: (0=Tablet mode is not supported)
info->mode = 1; // Unimplemented: (1=Mouse mode)
return CELL_OK;
}
int cellMouseGetData(u32 port_no, mem_class_t data)
int cellMouseGetData(u32 port_no, mem_ptr_t<CellMouseData> data)
{
sys_io->Log("cellMouseGetData(port_no=%d,data_addr=0x%x)", port_no, data.GetAddr());
if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED;
if(port_no >= Emu.GetMouseManager().GetMice().size()) return CELL_MOUSE_ERROR_NO_DEVICE;
CellMouseData& current_data = Emu.GetMouseManager().GetData(port_no);
data += current_data.update;
data += current_data.buttons;
data += current_data.x_axis;
data += current_data.y_axis;
data += current_data.wheel;
data += current_data.tilt;
MouseData& current_data = Emu.GetMouseManager().GetData(port_no);
data->update = current_data.update;
data->buttons = current_data.buttons;
data->x_axis = current_data.x_axis;
data->y_axis = current_data.y_axis;
data->wheel = current_data.wheel;
data->tilt = current_data.tilt;
current_data.update = CELL_MOUSE_DATA_NON;
current_data.x_axis = 0;
@ -99,7 +88,7 @@ int cellMouseGetData(u32 port_no, mem_class_t data)
return CELL_OK;
}
int cellMouseGetDataList(u32 port_no, mem_class_t data)
int cellMouseGetDataList(u32 port_no, mem_ptr_t<CellMouseDataList> data)
{
UNIMPLEMENTED_FUNC(sys_io);
@ -113,14 +102,14 @@ int cellMouseSetTabletMode(u32 port_no, u32 mode)
return CELL_OK;
}
int cellMouseGetTabletDataList(u32 port_no, mem_class_t data)
int cellMouseGetTabletDataList(u32 port_no, u32 data_addr)
{
UNIMPLEMENTED_FUNC(sys_io);
return CELL_OK;
}
int cellMouseGetRawData(u32 port_no, mem_class_t data)
int cellMouseGetRawData(u32 port_no, u32 data_addr)
{
UNIMPLEMENTED_FUNC(sys_io);

View file

@ -0,0 +1,62 @@
#pragma once
enum CELL_MOUSE_ERROR_CODE
{
CELL_MOUSE_ERROR_FATAL = 0x80121201,
CELL_MOUSE_ERROR_INVALID_PARAMETER = 0x80121202,
CELL_MOUSE_ERROR_ALREADY_INITIALIZED = 0x80121203,
CELL_MOUSE_ERROR_UNINITIALIZED = 0x80121204,
CELL_MOUSE_ERROR_RESOURCE_ALLOCATION_FAILED = 0x80121205,
CELL_MOUSE_ERROR_DATA_READ_FAILED = 0x80121206,
CELL_MOUSE_ERROR_NO_DEVICE = 0x80121207,
CELL_MOUSE_ERROR_SYS_SETTING_FAILED = 0x80121208,
};
static const u32 CELL_MAX_MICE = 127;
struct CellMouseInfo
{
be_t<u32> max_connect;
be_t<u32> now_connect;
be_t<u32> info;
be_t<u16> vendor_id[CELL_MAX_MICE];
be_t<u16> product_id[CELL_MAX_MICE];
u8 status[CELL_MAX_MICE];
};
struct CellMouseInfoTablet
{
be_t<u32> is_supported;
be_t<u32> mode;
};
struct CellMouseData
{
u8 update;
u8 buttons;
s8 x_axis;
s8 y_axis;
s8 wheel;
s8 tilt;
};
static const u32 CELL_MOUSE_MAX_DATA_LIST_NUM = 8;
struct CellMouseDataList
{
be_t<u32> list_num;
CellMouseData list[CELL_MOUSE_MAX_DATA_LIST_NUM];
};
static const u32 CELL_MOUSE_MAX_CODES = 64;
int cellMouseInit(u32 max_connect);
int cellMouseClearBuf(u32 port_no);
int cellMouseEnd();
int cellMouseGetInfo(mem_ptr_t<CellMouseInfo> info);
int cellMouseInfoTabletMode(u32 port_no, mem_ptr_t<CellMouseInfoTablet> info);
int cellMouseGetData(u32 port_no, mem_ptr_t<CellMouseData> data);
int cellMouseGetDataList(u32 port_no, mem_ptr_t<CellMouseDataList> data);
int cellMouseSetTabletMode(u32 port_no, u32 mode);
int cellMouseGetTabletDataList(u32 port_no, u32 data_addr);
int cellMouseGetRawData(u32 port_no, u32 data_addr);

View file

@ -1,24 +1,13 @@
#include "stdafx.h"
#if 0
#include "Emu/Memory/Memory.h"
#include "Emu/System.h"
#include "Emu/SysCalls/Modules.h"
void cellFiber_init();
Module cellFiber(0x0043, cellFiber_init);
#include "cellFiber.h"
// Return Codes
enum
{
CELL_FIBER_ERROR_AGAIN = 0x80760001,
CELL_FIBER_ERROR_INVAL = 0x80760002,
CELL_FIBER_ERROR_NOMEM = 0x80760004,
CELL_FIBER_ERROR_DEADLK = 0x80760008,
CELL_FIBER_ERROR_PERM = 0x80760009,
CELL_FIBER_ERROR_BUSY = 0x8076000A,
CELL_FIBER_ERROR_ABORT = 0x8076000C,
CELL_FIBER_ERROR_STAT = 0x8076000F,
CELL_FIBER_ERROR_ALIGN = 0x80760010,
CELL_FIBER_ERROR_NULL_POINTER = 0x80760011,
CELL_FIBER_ERROR_NOSYSINIT = 0x80760020,
};
//void cellFiber_init();
//Module cellFiber(0x0043, cellFiber_init);
Module* cellFiber = nullptr;
int _cellFiberPpuInitialize()
{
@ -92,10 +81,12 @@ int cellFiberPpuJoinFiber()
return CELL_OK;
}
int cellFiberPpuSelf()
u32 cellFiberPpuSelf()
{
UNIMPLEMENTED_FUNC(cellFiber);
return CELL_OK;
cellFiber->Log("cellFiberPpuSelf() -> nullptr"); // TODO
// returns fiber structure (zero for simple PPU thread)
return 0;
}
int cellFiberPpuSendSignal()
@ -304,58 +295,57 @@ int cellFiberPpuUtilWorkerControlInitializeWithAttribute()
void cellFiber_init()
{
cellFiber.AddFunc(0x55870804, _cellFiberPpuInitialize);
cellFiber->AddFunc(0x55870804, _cellFiberPpuInitialize);
cellFiber.AddFunc(0x9e25c72d, _cellFiberPpuSchedulerAttributeInitialize);
cellFiber.AddFunc(0xee3b604d, cellFiberPpuInitializeScheduler);
cellFiber.AddFunc(0x8b6baa01, cellFiberPpuFinalizeScheduler);
cellFiber.AddFunc(0x12b1acf0, cellFiberPpuRunFibers);
cellFiber.AddFunc(0xf6c6900c, cellFiberPpuCheckFlags);
cellFiber.AddFunc(0xe492a675, cellFiberPpuHasRunnableFiber);
cellFiber->AddFunc(0x9e25c72d, _cellFiberPpuSchedulerAttributeInitialize);
cellFiber->AddFunc(0xee3b604d, cellFiberPpuInitializeScheduler);
cellFiber->AddFunc(0x8b6baa01, cellFiberPpuFinalizeScheduler);
cellFiber->AddFunc(0x12b1acf0, cellFiberPpuRunFibers);
cellFiber->AddFunc(0xf6c6900c, cellFiberPpuCheckFlags);
cellFiber->AddFunc(0xe492a675, cellFiberPpuHasRunnableFiber);
cellFiber.AddFunc(0xc11f8056, _cellFiberPpuAttributeInitialize);
cellFiber.AddFunc(0x7c2f4034, cellFiberPpuCreateFiber);
cellFiber.AddFunc(0xfa8d5f95, cellFiberPpuExit);
cellFiber.AddFunc(0x0c44f441, cellFiberPpuYield);
cellFiber.AddFunc(0xa6004249, cellFiberPpuJoinFiber);
cellFiber.AddFunc(0x5d9a7034, cellFiberPpuSelf);
cellFiber.AddFunc(0x8afb8356, cellFiberPpuSendSignal);
cellFiber.AddFunc(0x6c164b3b, cellFiberPpuWaitSignal);
cellFiber.AddFunc(0xa4599cf3, cellFiberPpuWaitFlag);
cellFiber.AddFunc(0xb0594b2d, cellFiberPpuGetScheduler);
cellFiber.AddFunc(0xfbf5fe40, cellFiberPpuSetPriority);
cellFiber.AddFunc(0xf3e81219, cellFiberPpuCheckStackLimit);
cellFiber->AddFunc(0xc11f8056, _cellFiberPpuAttributeInitialize);
cellFiber->AddFunc(0x7c2f4034, cellFiberPpuCreateFiber);
cellFiber->AddFunc(0xfa8d5f95, cellFiberPpuExit);
cellFiber->AddFunc(0x0c44f441, cellFiberPpuYield);
cellFiber->AddFunc(0xa6004249, cellFiberPpuJoinFiber);
cellFiber->AddFunc(0x5d9a7034, cellFiberPpuSelf);
cellFiber->AddFunc(0x8afb8356, cellFiberPpuSendSignal);
cellFiber->AddFunc(0x6c164b3b, cellFiberPpuWaitSignal);
cellFiber->AddFunc(0xa4599cf3, cellFiberPpuWaitFlag);
cellFiber->AddFunc(0xb0594b2d, cellFiberPpuGetScheduler);
cellFiber->AddFunc(0xfbf5fe40, cellFiberPpuSetPriority);
cellFiber->AddFunc(0xf3e81219, cellFiberPpuCheckStackLimit);
cellFiber.AddFunc(0x31252ec3, _cellFiberPpuContextAttributeInitialize);
cellFiber.AddFunc(0x72086315, cellFiberPpuContextInitialize);
cellFiber.AddFunc(0xb3a48079, cellFiberPpuContextFinalize);
cellFiber.AddFunc(0xaba1c563, cellFiberPpuContextRun);
cellFiber.AddFunc(0xd0066b17, cellFiberPpuContextSwitch);
cellFiber.AddFunc(0x34a81091, cellFiberPpuContextSelf);
cellFiber.AddFunc(0x01036193, cellFiberPpuContextReturnToThread);
cellFiber.AddFunc(0xb90c871b, cellFiberPpuContextCheckStackLimit);
cellFiber->AddFunc(0x31252ec3, _cellFiberPpuContextAttributeInitialize);
cellFiber->AddFunc(0x72086315, cellFiberPpuContextInitialize);
cellFiber->AddFunc(0xb3a48079, cellFiberPpuContextFinalize);
cellFiber->AddFunc(0xaba1c563, cellFiberPpuContextRun);
cellFiber->AddFunc(0xd0066b17, cellFiberPpuContextSwitch);
cellFiber->AddFunc(0x34a81091, cellFiberPpuContextSelf);
cellFiber->AddFunc(0x01036193, cellFiberPpuContextReturnToThread);
cellFiber->AddFunc(0xb90c871b, cellFiberPpuContextCheckStackLimit);
cellFiber.AddFunc(0x081c98be, cellFiberPpuContextRunScheduler);
cellFiber.AddFunc(0x0a25b6c8, cellFiberPpuContextEnterScheduler);
cellFiber->AddFunc(0x081c98be, cellFiberPpuContextRunScheduler);
cellFiber->AddFunc(0x0a25b6c8, cellFiberPpuContextEnterScheduler);
cellFiber.AddFunc(0xbf9cd933, cellFiberPpuSchedulerTraceInitialize);
cellFiber.AddFunc(0x3860a12a, cellFiberPpuSchedulerTraceFinalize);
cellFiber.AddFunc(0xadedbebf, cellFiberPpuSchedulerTraceStart);
cellFiber.AddFunc(0xe665f9a9, cellFiberPpuSchedulerTraceStop);
cellFiber->AddFunc(0xbf9cd933, cellFiberPpuSchedulerTraceInitialize);
cellFiber->AddFunc(0x3860a12a, cellFiberPpuSchedulerTraceFinalize);
cellFiber->AddFunc(0xadedbebf, cellFiberPpuSchedulerTraceStart);
cellFiber->AddFunc(0xe665f9a9, cellFiberPpuSchedulerTraceStop);
cellFiber.AddFunc(0x68ba4568, _cellFiberPpuUtilWorkerControlAttributeInitialize);
cellFiber.AddFunc(0x1e7a247a, cellFiberPpuUtilWorkerControlRunFibers);
cellFiber.AddFunc(0x3204b146, cellFiberPpuUtilWorkerControlInitialize);
cellFiber.AddFunc(0x392c5aa5, cellFiberPpuUtilWorkerControlSetPollingMode);
cellFiber.AddFunc(0x3b417f82, cellFiberPpuUtilWorkerControlJoinFiber);
cellFiber.AddFunc(0x4fc86b2c, cellFiberPpuUtilWorkerControlDisconnectEventQueue);
cellFiber.AddFunc(0x5d3992dd, cellFiberPpuUtilWorkerControlSendSignal);
cellFiber.AddFunc(0x62a20f0d, cellFiberPpuUtilWorkerControlConnectEventQueueToSpurs);
cellFiber.AddFunc(0xa27c95ca, cellFiberPpuUtilWorkerControlFinalize);
cellFiber.AddFunc(0xbabf714b, cellFiberPpuUtilWorkerControlWakeup);
cellFiber.AddFunc(0xbfca88d3, cellFiberPpuUtilWorkerControlCreateFiber);
cellFiber.AddFunc(0xc04e2438, cellFiberPpuUtilWorkerControlShutdown);
cellFiber.AddFunc(0xea6dc1ad, cellFiberPpuUtilWorkerControlCheckFlags);
cellFiber.AddFunc(0xf2ccad4f, cellFiberPpuUtilWorkerControlInitializeWithAttribute);
cellFiber->AddFunc(0x68ba4568, _cellFiberPpuUtilWorkerControlAttributeInitialize);
cellFiber->AddFunc(0x1e7a247a, cellFiberPpuUtilWorkerControlRunFibers);
cellFiber->AddFunc(0x3204b146, cellFiberPpuUtilWorkerControlInitialize);
cellFiber->AddFunc(0x392c5aa5, cellFiberPpuUtilWorkerControlSetPollingMode);
cellFiber->AddFunc(0x3b417f82, cellFiberPpuUtilWorkerControlJoinFiber);
cellFiber->AddFunc(0x4fc86b2c, cellFiberPpuUtilWorkerControlDisconnectEventQueue);
cellFiber->AddFunc(0x5d3992dd, cellFiberPpuUtilWorkerControlSendSignal);
cellFiber->AddFunc(0x62a20f0d, cellFiberPpuUtilWorkerControlConnectEventQueueToSpurs);
cellFiber->AddFunc(0xa27c95ca, cellFiberPpuUtilWorkerControlFinalize);
cellFiber->AddFunc(0xbabf714b, cellFiberPpuUtilWorkerControlWakeup);
cellFiber->AddFunc(0xbfca88d3, cellFiberPpuUtilWorkerControlCreateFiber);
cellFiber->AddFunc(0xc04e2438, cellFiberPpuUtilWorkerControlShutdown);
cellFiber->AddFunc(0xea6dc1ad, cellFiberPpuUtilWorkerControlCheckFlags);
cellFiber->AddFunc(0xf2ccad4f, cellFiberPpuUtilWorkerControlInitializeWithAttribute);
}
#endif

View file

@ -0,0 +1,17 @@
#pragma once
// Return Codes
enum
{
CELL_FIBER_ERROR_AGAIN = 0x80760001,
CELL_FIBER_ERROR_INVAL = 0x80760002,
CELL_FIBER_ERROR_NOMEM = 0x80760004,
CELL_FIBER_ERROR_DEADLK = 0x80760008,
CELL_FIBER_ERROR_PERM = 0x80760009,
CELL_FIBER_ERROR_BUSY = 0x8076000A,
CELL_FIBER_ERROR_ABORT = 0x8076000C,
CELL_FIBER_ERROR_STAT = 0x8076000F,
CELL_FIBER_ERROR_ALIGN = 0x80760010,
CELL_FIBER_ERROR_NULL_POINTER = 0x80760011,
CELL_FIBER_ERROR_NOSYSINIT = 0x80760020,
};

View file

@ -19,20 +19,53 @@ enum MsgDialogState
};
std::atomic<MsgDialogState> g_msg_dialog_state(msgDialogNone);
wxDialog* g_msg_dialog = nullptr;
wxGauge* m_gauge1 = nullptr;
wxGauge* m_gauge2 = nullptr;
wxStaticText* m_text1 = nullptr;
wxStaticText* m_text2 = nullptr;
u64 m_wait_until;
u64 g_msg_dialog_wait_until;
u32 g_msg_dialog_progress_bar_count;
MsgDialogCreateCb MsgDialogCreate = nullptr;
MsgDialogDestroyCb MsgDialogDestroy = nullptr;
MsgDialogProgressBarSetMsgCb MsgDialogProgressBarSetMsg = nullptr;
MsgDialogProgressBarResetCb MsgDialogProgressBarReset = nullptr;
MsgDialogProgressBarIncCb MsgDialogProgressBarInc = nullptr;
void SetMsgDialogCreateCallback(MsgDialogCreateCb cb)
{
MsgDialogCreate = cb;
}
void SetMsgDialogDestroyCallback(MsgDialogDestroyCb cb)
{
MsgDialogDestroy = cb;
}
void SetMsgDialogProgressBarSetMsgCallback(MsgDialogProgressBarSetMsgCb cb)
{
MsgDialogProgressBarSetMsg = cb;
}
void SetMsgDialogProgressBarResetCallback(MsgDialogProgressBarResetCb cb)
{
MsgDialogProgressBarReset = cb;
}
void SetMsgDialogProgressBarIncCallback(MsgDialogProgressBarIncCb cb)
{
MsgDialogProgressBarInc = cb;
}
void MsgDialogClose()
{
g_msg_dialog_state = msgDialogClose;
g_msg_dialog_wait_until = get_system_time();
}
int cellMsgDialogOpen2(u32 type, mem_list_ptr_t<u8> msgString, mem_func_ptr_t<CellMsgDialogCallback> callback, u32 userData, u32 extParam)
{
cellSysutil->Warning("cellMsgDialogOpen2(type=0x%x, msgString_addr=0x%x, callback_addr=0x%x, userData=0x%x, extParam=0x%x)",
type, msgString.GetAddr(), callback.GetAddr(), userData, extParam);
//type |= CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE;
//type |= CELL_MSGDIALOG_TYPE_BUTTON_TYPE_YESNO;
//type |= CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE | CELL_MSGDIALOG_TYPE_BG_INVISIBLE;
//type |= CELL_MSGDIALOG_TYPE_BUTTON_TYPE_YESNO | CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NO;
MsgDialogState old = msgDialogNone;
if (!g_msg_dialog_state.compare_exchange_strong(old, msgDialogOpen))
@ -40,6 +73,15 @@ int cellMsgDialogOpen2(u32 type, mem_list_ptr_t<u8> msgString, mem_func_ptr_t<Ce
return CELL_SYSUTIL_ERROR_BUSY;
}
g_msg_dialog_wait_until = get_system_time() + 31536000000000ull; // some big value
switch (type & CELL_MSGDIALOG_TYPE_PROGRESSBAR)
{
case CELL_MSGDIALOG_TYPE_PROGRESSBAR_DOUBLE: g_msg_dialog_progress_bar_count = 2; break;
case CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE: g_msg_dialog_progress_bar_count = 1; break;
default: g_msg_dialog_progress_bar_count = 0; break; // ???
}
thread t("MsgDialog thread", [=]()
{
switch (type & CELL_MSGDIALOG_TYPE_SE_TYPE)
@ -54,124 +96,12 @@ int cellMsgDialogOpen2(u32 type, mem_list_ptr_t<u8> msgString, mem_func_ptr_t<Ce
case CELL_MSGDIALOG_TYPE_SE_MUTE_ON: break;
}
switch (type & CELL_MSGDIALOG_TYPE_BG) // TODO
{
case CELL_MSGDIALOG_TYPE_BG_INVISIBLE: break;
case CELL_MSGDIALOG_TYPE_BG_VISIBLE: break;
}
switch (type & CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR) // TODO
{
case CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NO: break;
default: break;
}
u64 status = CELL_MSGDIALOG_BUTTON_NONE;
volatile bool m_signal = false;
CallAfter([&]()
{
wxWindow* parent = nullptr; // TODO: align it better
m_gauge1 = nullptr;
m_gauge2 = nullptr;
m_text1 = nullptr;
m_text2 = nullptr;
wxButton* m_button_ok = nullptr;
wxButton* m_button_yes = nullptr;
wxButton* m_button_no = nullptr;
g_msg_dialog = new wxDialog(parent, wxID_ANY, type & CELL_MSGDIALOG_TYPE_SE_TYPE ? "" : "Error", wxDefaultPosition, wxDefaultSize);
g_msg_dialog->SetExtraStyle(g_msg_dialog->GetExtraStyle() | wxWS_EX_TRANSIENT);
wxSizer* sizer1 = new wxBoxSizer(wxVERTICAL);
wxStaticText* m_text = new wxStaticText(g_msg_dialog, wxID_ANY, wxString(msgString.GetString(), wxConvUTF8));
sizer1->Add(m_text, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT | wxTOP, 16);
switch (type & CELL_MSGDIALOG_TYPE_PROGRESSBAR)
{
case CELL_MSGDIALOG_TYPE_PROGRESSBAR_DOUBLE:
m_gauge2 = new wxGauge(g_msg_dialog, wxID_ANY, 100, wxDefaultPosition, wxSize(300, -1), wxGA_HORIZONTAL | wxGA_SMOOTH);
m_text2 = new wxStaticText(g_msg_dialog, wxID_ANY, "");
m_text2->SetAutoLayout(true);
case CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE:
m_gauge1 = new wxGauge(g_msg_dialog, wxID_ANY, 100, wxDefaultPosition, wxSize(300, -1), wxGA_HORIZONTAL | wxGA_SMOOTH);
m_text1 = new wxStaticText(g_msg_dialog, wxID_ANY, "");
m_text1->SetAutoLayout(true);
case CELL_MSGDIALOG_TYPE_PROGRESSBAR_NONE:
break;
}
if (m_gauge1)
{
sizer1->Add(m_text1, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT | wxTOP, 8);
sizer1->Add(m_gauge1, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT, 16);
m_gauge1->SetValue(0);
}
if (m_gauge2)
{
sizer1->Add(m_text2, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT | wxTOP, 8);
sizer1->Add(m_gauge2, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT, 16);
m_gauge2->SetValue(0);
}
wxBoxSizer* buttons = new wxBoxSizer(wxHORIZONTAL);
switch (type & CELL_MSGDIALOG_TYPE_BUTTON_TYPE)
{
case CELL_MSGDIALOG_TYPE_BUTTON_TYPE_NONE:
break;
case CELL_MSGDIALOG_TYPE_BUTTON_TYPE_YESNO:
m_button_yes = new wxButton(g_msg_dialog, wxID_YES);
buttons->Add(m_button_yes, 0, wxALIGN_CENTER_HORIZONTAL | wxRIGHT, 8);
m_button_no = new wxButton(g_msg_dialog, wxID_NO);
buttons->Add(m_button_no, 0, wxALIGN_CENTER_HORIZONTAL, 16);
sizer1->Add(buttons, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT | wxTOP, 16);
break;
case CELL_MSGDIALOG_TYPE_BUTTON_TYPE_OK:
m_button_ok = new wxButton(g_msg_dialog, wxID_OK);
buttons->Add(m_button_ok, 0, wxALIGN_CENTER_HORIZONTAL, 16);
sizer1->Add(buttons, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT | wxTOP, 16);
break;
}
sizer1->AddSpacer(16);
g_msg_dialog->SetSizerAndFit(sizer1);
g_msg_dialog->Centre(wxBOTH);
g_msg_dialog->Show();
g_msg_dialog->Enable();
g_msg_dialog->Bind(wxEVT_BUTTON, [&](wxCommandEvent& event)
{
status = (event.GetId() == wxID_NO) ? CELL_MSGDIALOG_BUTTON_NO : CELL_MSGDIALOG_BUTTON_YES /* OK */;
g_msg_dialog->Hide();
m_wait_until = get_system_time();
g_msg_dialog_state = msgDialogClose;
});
g_msg_dialog->Bind(wxEVT_CLOSE_WINDOW, [&](wxCloseEvent& event)
{
if (type & CELL_MSGDIALOG_TYPE_DISABLE_CANCEL)
{
}
else
{
status = CELL_MSGDIALOG_BUTTON_ESCAPE;
g_msg_dialog->Hide();
m_wait_until = get_system_time();
g_msg_dialog_state = msgDialogClose;
}
});
MsgDialogCreate(type, (char*)msgString.GetPtr(), status);
m_signal = true;
});
@ -181,7 +111,7 @@ int cellMsgDialogOpen2(u32 type, mem_list_ptr_t<u8> msgString, mem_func_ptr_t<Ce
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
while (g_msg_dialog_state == msgDialogOpen || get_system_time() < m_wait_until)
while (g_msg_dialog_state == msgDialogOpen || (s64)(get_system_time() - g_msg_dialog_wait_until) < 0)
{
if (Emu.IsStopped())
{
@ -196,8 +126,7 @@ int cellMsgDialogOpen2(u32 type, mem_list_ptr_t<u8> msgString, mem_func_ptr_t<Ce
CallAfter([&]()
{
delete g_msg_dialog;
g_msg_dialog = nullptr;
MsgDialogDestroy();
});
g_msg_dialog_state = msgDialogNone;
@ -324,7 +253,7 @@ int cellMsgDialogClose(float delay)
}
if (delay < 0.0f) delay = 0.0f;
m_wait_until = get_system_time() + (u64)(delay * 1000);
g_msg_dialog_wait_until = get_system_time() + (u64)(delay * 1000);
return CELL_OK;
}
@ -345,7 +274,7 @@ int cellMsgDialogAbort()
}
}
m_wait_until = get_system_time();
g_msg_dialog_wait_until = get_system_time();
return CELL_OK;
}
@ -359,7 +288,7 @@ int cellMsgDialogProgressBarSetMsg(u32 progressBarIndex, mem_list_ptr_t<u8> msgS
return CELL_MSGDIALOG_ERROR_DIALOG_NOT_OPENED;
}
if (progressBarIndex >= (m_gauge1 ? 1u : 0u) + (m_gauge2 ? 1u : 0u))
if (progressBarIndex >= g_msg_dialog_progress_bar_count)
{
return CELL_MSGDIALOG_ERROR_PARAM;
}
@ -368,13 +297,7 @@ int cellMsgDialogProgressBarSetMsg(u32 progressBarIndex, mem_list_ptr_t<u8> msgS
CallAfter([text, progressBarIndex]()
{
if (g_msg_dialog && !Emu.IsStopped())
{
if (progressBarIndex == 0 && m_text1) m_text1->SetLabelText(fmt::FromUTF8(text));
if (progressBarIndex == 1 && m_text2) m_text2->SetLabelText(fmt::FromUTF8(text));
g_msg_dialog->Layout();
g_msg_dialog->Fit();
}
MsgDialogProgressBarSetMsg(progressBarIndex, text.c_str());
});
return CELL_OK;
}
@ -388,18 +311,14 @@ int cellMsgDialogProgressBarReset(u32 progressBarIndex)
return CELL_MSGDIALOG_ERROR_DIALOG_NOT_OPENED;
}
if (progressBarIndex >= (m_gauge1 ? 1u : 0u) + (m_gauge2 ? 1u : 0u))
if (progressBarIndex >= g_msg_dialog_progress_bar_count)
{
return CELL_MSGDIALOG_ERROR_PARAM;
}
CallAfter([=]()
{
if (g_msg_dialog)
{
if (progressBarIndex == 0 && m_gauge1) m_gauge1->SetValue(0);
if (progressBarIndex == 1 && m_gauge2) m_gauge2->SetValue(0);
}
MsgDialogProgressBarReset(progressBarIndex);
});
return CELL_OK;
}
@ -413,18 +332,14 @@ int cellMsgDialogProgressBarInc(u32 progressBarIndex, u32 delta)
return CELL_MSGDIALOG_ERROR_DIALOG_NOT_OPENED;
}
if (progressBarIndex >= (m_gauge1 ? 1u : 0u) + (m_gauge2 ? 1u : 0u))
if (progressBarIndex >= g_msg_dialog_progress_bar_count)
{
return CELL_MSGDIALOG_ERROR_PARAM;
}
CallAfter([=]()
{
if (g_msg_dialog)
{
if (progressBarIndex == 0 && m_gauge1) m_gauge1->SetValue(m_gauge1->GetValue() + delta);
if (progressBarIndex == 1 && m_gauge2) m_gauge2->SetValue(m_gauge2->GetValue() + delta);
}
MsgDialogProgressBarInc(progressBarIndex, delta);
});
return CELL_OK;
}

View file

@ -88,4 +88,18 @@ int cellMsgDialogProgressBarSetMsg(u32 progressBarIndex, mem_list_ptr_t<u8> msgS
int cellMsgDialogProgressBarReset(u32 progressBarIndex);
int cellMsgDialogProgressBarInc(u32 progressBarIndex, u32 delta);
int cellMsgDialogClose(float delay);
int cellMsgDialogAbort();
int cellMsgDialogAbort();
typedef void(*MsgDialogCreateCb)(u32 type, const char* msg, u64& status);
typedef void(*MsgDialogDestroyCb)();
typedef void(*MsgDialogProgressBarSetMsgCb)(u32 progressBarIndex, const char* msg);
typedef void(*MsgDialogProgressBarResetCb)(u32 progressBarIndex);
typedef void(*MsgDialogProgressBarIncCb)(u32 progressBarIndex, u32 delta);
void SetMsgDialogCreateCallback(MsgDialogCreateCb cb);
void SetMsgDialogDestroyCallback(MsgDialogDestroyCb cb);
void SetMsgDialogProgressBarSetMsgCallback(MsgDialogProgressBarSetMsgCb cb);
void SetMsgDialogProgressBarResetCallback(MsgDialogProgressBarResetCb cb);
void SetMsgDialogProgressBarIncCallback(MsgDialogProgressBarIncCb cb);
void MsgDialogClose();

View file

@ -29,7 +29,7 @@ int cellNetCtlGetState(mem32_t state)
return CELL_OK;
}
int cellNetCtlAddHandler(mem_ptr_t<cellNetCtlHandler> handler, mem32_t arg, s32 hid)
int cellNetCtlAddHandler(mem_func_ptr_t<cellNetCtlHandler> handler, mem32_t arg, s32 hid)
{
cellNetCtl->Todo("cellNetCtlAddHandler(handler_addr=0x%x, arg_addr=0x%x, hid=%x)", handler.GetAddr(), arg.GetAddr(), hid);

View file

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

View file

@ -14,7 +14,8 @@ static const float
PICTURE_SIZE = (1.0f),
UV_DELTA_PS = (1.f / 8.f),
UV_DELTA_LB = (1.f / 6.f),
XY_DELTA_LB = (1.f / 8.f);
XY_DELTA_LB = (1.f / 8.f),
PI = 3.1415926535897932384626433832795;
void BuildupVertexBufferNR()
{
@ -1112,10 +1113,10 @@ u16 FloatToHalf(float val)
static void blackman(float window[])
{
const float x0 = ((1.f * 2.f*M_PI) / 5.f) - M_PI;
const float x1 = ((2.f * 2.f*M_PI) / 5.f) - M_PI;
const float x2 = ((3.f * 2.f*M_PI) / 5.f) - M_PI;
const float x3 = ((4.f * 2.f*M_PI) / 5.f) - M_PI;
const float x0 = ((1.f * 2.f*PI) / 5.f) - PI;
const float x1 = ((2.f * 2.f*PI) / 5.f) - PI;
const float x2 = ((3.f * 2.f*PI) / 5.f) - PI;
const float x3 = ((4.f * 2.f*PI) / 5.f) - PI;
const float a0 = 0.42f + (0.50f * cosf(x0)) + (0.08f * cosf(2.f*x0));
const float a1 = 0.42f + (0.50f * cosf(x1)) + (0.08f * cosf(2.f*x1));
@ -1133,7 +1134,7 @@ int CreateInterlaceTable(u32 ea_addr, float srcH, float dstH, CellRescTableEleme
float phi[4], transient[4];
float y_fraction;
float bandwidth = 0.5f / (srcH / dstH);
float phi_b = 2.f * M_PI * bandwidth;
float phi_b = 2.f * PI * bandwidth;
float window[4];
mem16_ptr_t buf16(ea_addr);
mem32_ptr_t buf32(ea_addr);

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,800 @@
#include "stdafx.h"
#include "Emu/Memory/Memory.h"
#include "Emu/System.h"
#include "Emu/SysCalls/Modules.h"
#include "cellSpurs.h"
#include "cellSpursJq.h"
Module* cellSpursJq = nullptr;
#ifdef PRX_DEBUG
#include "prx_libspurs_jq.h"
u32 libspurs_jq;
u32 libspurs_jq_rtoc;
#endif
s64 cellSpursJobQueueAttributeInitialize()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x000010, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJobQueueAttributeSetMaxGrab()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x000058, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJobQueueAttributeSetSubmitWithEntryLock()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x000098, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJobQueueAttributeSetDoBusyWaiting()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0000BC, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJobQueueAttributeSetIsHaltOnError()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0000E0, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJobQueueAttributeSetIsJobTypeMemoryCheck()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x000104, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJobQueueAttributeSetMaxSizeJobDescriptor()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x000128, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJobQueueAttributeSetGrabParameters()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x000178, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJobQueueSetWaitingMode()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0001C8, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursShutdownJobQueue()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0002F0, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 _cellSpursCreateJobQueueWithJobDescriptorPool()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0003CC, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 _cellSpursCreateJobQueue()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x000CA8, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJoinJobQueue()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x000CF0, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 _cellSpursJobQueuePushJobListBody()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x001B24, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 _cellSpursJobQueuePushJobBody2()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x001BF0, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 _cellSpursJobQueuePushJob2Body()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x001CD0, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 _cellSpursJobQueuePushAndReleaseJobBody()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x001DC8, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 _cellSpursJobQueuePushJobBody()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x001EC8, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 _cellSpursJobQueuePushBody()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x001F90, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 _cellSpursJobQueueAllocateJobDescriptorBody()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x002434, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 _cellSpursJobQueuePushSync()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x002498, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 _cellSpursJobQueuePushFlush()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x002528, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJobQueueGetSpurs()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x002598, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJobQueueGetHandleCount()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0025C4, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJobQueueGetError()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x002600, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJobQueueGetMaxSizeJobDescriptor()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x002668, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursGetJobQueueId()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0026A4, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJobQueueGetSuspendedJobSize()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x002700, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJobQueueClose()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x002D70, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJobQueueOpen()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x002E50, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJobQueueSemaphoreTryAcquire()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003370, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJobQueueSemaphoreAcquire()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003378, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJobQueueSemaphoreInitialize()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003380, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJobQueueSendSignal()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0033E0, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJobQueuePortGetJobQueue()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x00354C, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 _cellSpursJobQueuePortPushSync()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003554, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 _cellSpursJobQueuePortPushFlush()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0035C0, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 _cellSpursJobQueuePortPushJobListBody()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003624, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 _cellSpursJobQueuePortPushJobBody()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003A88, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 _cellSpursJobQueuePortPushJobBody2()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003A94, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 _cellSpursJobQueuePortPushBody()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003A98, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJobQueuePortTrySync()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003C38, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJobQueuePortSync()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003C40, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJobQueuePortInitialize()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003C48, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJobQueuePortInitializeWithDescriptorBuffer()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003D78, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJobQueuePortFinalize()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x003E40, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 _cellSpursJobQueuePortCopyPushJobBody()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x004280, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 _cellSpursJobQueuePortCopyPushJobBody2()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x00428C, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 _cellSpursJobQueuePortCopyPushBody()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x004290, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJobQueuePort2GetJobQueue()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0042A4, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJobQueuePort2PushSync()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0042AC, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJobQueuePort2PushFlush()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x004330, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 _cellSpursJobQueuePort2PushJobListBody()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0043B0, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJobQueuePort2Sync()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0045AC, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJobQueuePort2Create()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0046C4, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJobQueuePort2Destroy()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x0047E4, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJobQueuePort2AllocateJobDescriptor()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x004928, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 _cellSpursJobQueuePort2PushAndReleaseJobBody()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x004D94, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 _cellSpursJobQueuePort2CopyPushJobBody()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x004DD0, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 _cellSpursJobQueuePort2PushJobBody()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x004E0C, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJobQueueSetExceptionEventHandler()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x004E48, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
s64 cellSpursJobQueueUnsetExceptionEventHandler()
{
#ifdef PRX_DEBUG
cellSpursJq->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libspurs_jq + 0x004EC0, libspurs_jq_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSpursJq);
return CELL_OK;
#endif
}
void cellSpursJq_init()
{
REG_FUNC(cellSpursJq, cellSpursJobQueueAttributeInitialize);
REG_FUNC(cellSpursJq, cellSpursJobQueueAttributeSetMaxGrab);
REG_FUNC(cellSpursJq, cellSpursJobQueueAttributeSetSubmitWithEntryLock);
REG_FUNC(cellSpursJq, cellSpursJobQueueAttributeSetDoBusyWaiting);
REG_FUNC(cellSpursJq, cellSpursJobQueueAttributeSetIsHaltOnError);
REG_FUNC(cellSpursJq, cellSpursJobQueueAttributeSetIsJobTypeMemoryCheck);
REG_FUNC(cellSpursJq, cellSpursJobQueueAttributeSetMaxSizeJobDescriptor);
REG_FUNC(cellSpursJq, cellSpursJobQueueAttributeSetGrabParameters);
REG_FUNC(cellSpursJq, cellSpursJobQueueSetWaitingMode);
REG_FUNC(cellSpursJq, cellSpursShutdownJobQueue);
REG_FUNC(cellSpursJq, _cellSpursCreateJobQueueWithJobDescriptorPool);
REG_FUNC(cellSpursJq, _cellSpursCreateJobQueue);
REG_FUNC(cellSpursJq, cellSpursJoinJobQueue);
REG_FUNC(cellSpursJq, _cellSpursJobQueuePushJobListBody);
REG_FUNC(cellSpursJq, _cellSpursJobQueuePushJobBody2);
REG_FUNC(cellSpursJq, _cellSpursJobQueuePushJob2Body);
REG_FUNC(cellSpursJq, _cellSpursJobQueuePushAndReleaseJobBody);
REG_FUNC(cellSpursJq, _cellSpursJobQueuePushJobBody);
REG_FUNC(cellSpursJq, _cellSpursJobQueuePushBody);
REG_FUNC(cellSpursJq, _cellSpursJobQueueAllocateJobDescriptorBody);
REG_FUNC(cellSpursJq, _cellSpursJobQueuePushSync);
REG_FUNC(cellSpursJq, _cellSpursJobQueuePushFlush);
REG_FUNC(cellSpursJq, cellSpursJobQueueGetSpurs);
REG_FUNC(cellSpursJq, cellSpursJobQueueGetHandleCount);
REG_FUNC(cellSpursJq, cellSpursJobQueueGetError);
REG_FUNC(cellSpursJq, cellSpursJobQueueGetMaxSizeJobDescriptor);
REG_FUNC(cellSpursJq, cellSpursGetJobQueueId);
REG_FUNC(cellSpursJq, cellSpursJobQueueGetSuspendedJobSize);
REG_FUNC(cellSpursJq, cellSpursJobQueueClose);
REG_FUNC(cellSpursJq, cellSpursJobQueueOpen);
REG_FUNC(cellSpursJq, cellSpursJobQueueSemaphoreTryAcquire);
REG_FUNC(cellSpursJq, cellSpursJobQueueSemaphoreAcquire);
REG_FUNC(cellSpursJq, cellSpursJobQueueSemaphoreInitialize);
REG_FUNC(cellSpursJq, cellSpursJobQueueSendSignal);
REG_FUNC(cellSpursJq, cellSpursJobQueuePortGetJobQueue);
REG_FUNC(cellSpursJq, _cellSpursJobQueuePortPushSync);
REG_FUNC(cellSpursJq, _cellSpursJobQueuePortPushFlush);
REG_FUNC(cellSpursJq, _cellSpursJobQueuePortPushJobListBody);
REG_FUNC(cellSpursJq, _cellSpursJobQueuePortPushJobBody);
REG_FUNC(cellSpursJq, _cellSpursJobQueuePortPushJobBody2);
REG_FUNC(cellSpursJq, _cellSpursJobQueuePortPushBody);
REG_FUNC(cellSpursJq, cellSpursJobQueuePortTrySync);
REG_FUNC(cellSpursJq, cellSpursJobQueuePortSync);
REG_FUNC(cellSpursJq, cellSpursJobQueuePortInitialize);
REG_FUNC(cellSpursJq, cellSpursJobQueuePortInitializeWithDescriptorBuffer);
REG_FUNC(cellSpursJq, cellSpursJobQueuePortFinalize);
REG_FUNC(cellSpursJq, _cellSpursJobQueuePortCopyPushJobBody);
REG_FUNC(cellSpursJq, _cellSpursJobQueuePortCopyPushJobBody2);
REG_FUNC(cellSpursJq, _cellSpursJobQueuePortCopyPushBody);
REG_FUNC(cellSpursJq, cellSpursJobQueuePort2GetJobQueue);
REG_FUNC(cellSpursJq, cellSpursJobQueuePort2PushSync);
REG_FUNC(cellSpursJq, cellSpursJobQueuePort2PushFlush);
REG_FUNC(cellSpursJq, _cellSpursJobQueuePort2PushJobListBody);
REG_FUNC(cellSpursJq, cellSpursJobQueuePort2Sync);
REG_FUNC(cellSpursJq, cellSpursJobQueuePort2Create);
REG_FUNC(cellSpursJq, cellSpursJobQueuePort2Destroy);
REG_FUNC(cellSpursJq, cellSpursJobQueuePort2AllocateJobDescriptor);
REG_FUNC(cellSpursJq, _cellSpursJobQueuePort2PushAndReleaseJobBody);
REG_FUNC(cellSpursJq, _cellSpursJobQueuePort2CopyPushJobBody);
REG_FUNC(cellSpursJq, _cellSpursJobQueuePort2PushJobBody);
REG_FUNC(cellSpursJq, cellSpursJobQueueSetExceptionEventHandler);
REG_FUNC(cellSpursJq, cellSpursJobQueueUnsetExceptionEventHandler);
#ifdef PRX_DEBUG
CallAfter([]()
{
libspurs_jq = Memory.PRXMem.AllocAlign(sizeof(libspurs_jq_data), 4096);
memcpy(Memory + libspurs_jq, libspurs_jq_data, sizeof(libspurs_jq_data));
libspurs_jq_rtoc = libspurs_jq + 0x17E80;
extern Module* sysPrxForUser;
extern Module* cellSpurs;
extern Module* cellFiber;
FIX_IMPORT(cellSpurs, cellSpursSendWorkloadSignal , libspurs_jq + 0x6728);
FIX_IMPORT(cellSpurs, cellSpursWorkloadAttributeSetName , libspurs_jq + 0x6748);
FIX_IMPORT(cellSpurs, cellSpursRemoveWorkload , libspurs_jq + 0x6768);
FIX_IMPORT(cellSpurs, cellSpursWaitForWorkloadShutdown , libspurs_jq + 0x6788);
FIX_IMPORT(cellSpurs, cellSpursWakeUp , libspurs_jq + 0x67A8);
FIX_IMPORT(cellSpurs, cellSpursShutdownWorkload , libspurs_jq + 0x67C8);
FIX_IMPORT(cellSpurs, cellSpursAddWorkloadWithAttribute , libspurs_jq + 0x67E8);
FIX_IMPORT(cellSpurs, cellSpursSetExceptionEventHandler , libspurs_jq + 0x6808);
FIX_IMPORT(cellSpurs, _cellSpursWorkloadAttributeInitialize , libspurs_jq + 0x6828);
FIX_IMPORT(cellFiber, cellFiberPpuSelf , libspurs_jq + 0x6848);
FIX_IMPORT(cellFiber, cellFiberPpuWaitSignal , libspurs_jq + 0x6868);
FIX_IMPORT(sysPrxForUser, _sys_strncmp , libspurs_jq + 0x6888);
FIX_IMPORT(sysPrxForUser, _sys_snprintf , libspurs_jq + 0x68A8);
FIX_IMPORT(sysPrxForUser, sys_lwcond_destroy , libspurs_jq + 0x68C8);
FIX_IMPORT(sysPrxForUser, sys_lwmutex_create , libspurs_jq + 0x68E8);
FIX_IMPORT(sysPrxForUser, _sys_memset , libspurs_jq + 0x6908);
FIX_IMPORT(sysPrxForUser, _sys_printf , libspurs_jq + 0x6928);
fix_import(sysPrxForUser, 0x9FB6228E , libspurs_jq + 0x6948);
FIX_IMPORT(sysPrxForUser, sys_lwmutex_destroy , libspurs_jq + 0x6968);
FIX_IMPORT(sysPrxForUser, sys_lwcond_create , libspurs_jq + 0x6988);
fix_import(sysPrxForUser, 0xE75C40F2 , libspurs_jq + 0x69A8);
fix_relocs(cellSpursJq, libspurs_jq, 0xFF70, 0x12370, 0xED00);
});
#endif
}

View file

@ -0,0 +1,2 @@
#pragma once

View file

@ -14,22 +14,7 @@ Module *cellSync = nullptr;
#ifdef PRX_DEBUG
#include "prx_libsre.h"
u32 libsre;
u32 libsre_rtoc;
void fix_import(Module* module, u32 func, u32 addr)
{
Memory.Write32(addr + 0x0, 0x3d600000 | (func >> 16)); /* lis r11, (func_id >> 16) */
Memory.Write32(addr + 0x4, 0x616b0000 | (func & 0xffff)); /* ori r11, (func_id & 0xffff) */
Memory.Write32(addr + 0x8, 0x60000000); /* nop */
// leave rtoc saving at 0xC
Memory.Write64(addr + 0x10, 0x440000024e800020ull); /* sc + blr */
Memory.Write64(addr + 0x18, 0x6000000060000000ull); /* nop + nop */
module->Load(func);
}
#define FIX_IMPORT(module, func, addr) fix_import(module, getFunctionId(#func), addr)
u32 libsre_rtoc;
#endif
s32 syncMutexInitialize(mem_ptr_t<CellSyncMutex> mutex)
@ -2217,10 +2202,7 @@ void cellSync_init()
cellSync->AddFunc(0xe1bc7add, _cellSyncLFQueuePopBody);
cellSync->AddFunc(0xe9bf2110, _cellSyncLFQueueGetPushPointer);
cellSync->AddFunc(0xfe74e8e7, _cellSyncLFQueueCompletePopPointer);
}
void cellSync_load()
{
#ifdef PRX_DEBUG
CallAfter([]()
{
@ -2264,58 +2246,7 @@ void cellSync_load()
FIX_IMPORT(sysPrxForUser, _sys_vprintf , libsre + 0x1D97C);
FIX_IMPORT(sysPrxForUser, _sys_memcmp , libsre + 0x1D99C);
const u32 seg2 = 0x2DF00;
// start of table:
// addr = (u64) addr - seg2, (u32) 1, (u32) 1, (u64) ptr
// addr = (u64) addr - seg2, (u32) 0x101, (u32) 1, (u64) ptr - seg2 (???)
// addr = (u64) addr, (u32) 0x100, (u32) 1, (u64) ptr - seg2 (???)
// addr = (u64) addr, (u32) 0, (u32) 1, (u64) ptr (???)
for (u32 i = libsre + 0x31EE0; i < libsre + 0x3A4F0; i += 24)
{
u64 addr = Memory.Read64(i);
const u64 flag = Memory.Read64(i + 8);
if (flag == 0x10100000001ull)
{
addr = addr + seg2 + libsre;
u32 value = Memory.Read32(addr);
assert(value == Memory.Read64(i + 16) + seg2);
Memory.Write32(addr, value + libsre);
}
else if (flag == 0x100000001ull)
{
addr = addr + seg2 + libsre;
u32 value = Memory.Read32(addr);
assert(value == Memory.Read64(i + 16));
Memory.Write32(addr, value + libsre);
}
else if (flag == 0x10000000001ull)
{
addr = addr + libsre;
u32 value = Memory.Read32(addr);
assert(value == Memory.Read64(i + 16) + seg2);
Memory.Write32(addr, value + libsre);
}
else if (flag == 1)
{
addr = addr + libsre;
u32 value = Memory.Read32(addr);
assert(value == Memory.Read64(i + 16));
Memory.Write32(addr, value + libsre);
}
else if (flag == 0x10000000004ull || flag == 0x10000000006ull)
{
// seems to be instruction modifiers for imports (done in other way in FIX_IMPORT)
}
else
{
cellSync->Notice("libsre: 0x%x : 0x%llx", i - libsre, flag);
}
}
fix_relocs(cellSync, libsre, 0x31EE0, 0x3A4F0, 0x2DF00);
});
#endif
}
#undef PRX_DEBUG
#undef FIX_IMPORT
}

View file

@ -1,254 +1,438 @@
#include "stdafx.h"
#if 0
#include "Emu/Memory/Memory.h"
#include "Emu/System.h"
#include "Emu/SysCalls/Modules.h"
void cellSync2_init();
Module cellSync2(0x0055, cellSync2_init);
#include "cellSync2.h"
// Return Codes
enum
{
CELL_SYNC2_ERROR_AGAIN = 0x80410C01,
CELL_SYNC2_ERROR_INVAL = 0x80410C02,
CELL_SYNC2_ERROR_NOMEM = 0x80410C04,
CELL_SYNC2_ERROR_DEADLK = 0x80410C08,
CELL_SYNC2_ERROR_PERM = 0x80410C09,
CELL_SYNC2_ERROR_BUSY = 0x80410C0A,
CELL_SYNC2_ERROR_STAT = 0x80410C0F,
CELL_SYNC2_ERROR_ALIGN = 0x80410C10,
CELL_SYNC2_ERROR_NULL_POINTER = 0x80410C11,
CELL_SYNC2_ERROR_NOT_SUPPORTED_THREAD = 0x80410C12,
CELL_SYNC2_ERROR_NO_NOTIFIER = 0x80410C13,
CELL_SYNC2_ERROR_NO_SPU_CONTEXT_STORAGE = 0x80410C14,
};
//void cellSync2_init();
//Module cellSync2(0x0055, cellSync2_init);
Module* cellSync2 = nullptr;
#ifdef PRX_DEBUG
#include "prx_libsync2.h"
u32 libsync2;
u32 libsync2_rtoc;
#endif
int _cellSync2MutexAttributeInitialize()
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x16A0, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
return CELL_OK;
#endif
}
int cellSync2MutexEstimateBufferSize()
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0xC3C, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
return CELL_OK;
#endif
}
int cellSync2MutexInitialize()
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x1584, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
return CELL_OK;
#endif
}
int cellSync2MutexFinalize()
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x142C, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
return CELL_OK;
#endif
}
int cellSync2MutexLock()
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x1734, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
return CELL_OK;
#endif
}
int cellSync2MutexTryLock()
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x1A2C, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
return CELL_OK;
#endif
}
int cellSync2MutexUnlock()
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x186C, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
return CELL_OK;
#endif
}
int _cellSync2CondAttributeInitialize()
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x26DC, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
return CELL_OK;
#endif
}
int cellSync2CondEstimateBufferSize()
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x1B90, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
return CELL_OK;
#endif
}
int cellSync2CondInitialize()
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x25DC, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
return CELL_OK;
#endif
}
int cellSync2CondFinalize()
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x23E0, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
return CELL_OK;
#endif
}
int cellSync2CondWait()
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x283C, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
return CELL_OK;
#endif
}
int cellSync2CondSignal()
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x2768, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
return CELL_OK;
#endif
}
int cellSync2CondSignalAll()
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x2910, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
return CELL_OK;
#endif
}
int _cellSync2SemaphoreAttributeInitialize()
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x5644, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
return CELL_OK;
#endif
}
int cellSync2SemaphoreEstimateBufferSize()
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x4AC4, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
return CELL_OK;
#endif
}
int cellSync2SemaphoreInitialize()
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x54E0, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
return CELL_OK;
#endif
}
int cellSync2SemaphoreFinalize()
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x52F0, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
return CELL_OK;
#endif
}
int cellSync2SemaphoreAcquire()
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x57A4, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
return CELL_OK;
#endif
}
int cellSync2SemaphoreTryAcquire()
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x56D8, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
return CELL_OK;
#endif
}
int cellSync2SemaphoreRelease()
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x5870, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
return CELL_OK;
#endif
}
int cellSync2SemaphoreGetCount()
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x4B4C, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
return CELL_OK;
#endif
}
int _cellSync2QueueAttributeInitialize()
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x3C5C, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
return CELL_OK;
#endif
}
int cellSync2QueueEstimateBufferSize()
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x2A98, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
return CELL_OK;
#endif
}
int cellSync2QueueInitialize()
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x3F98, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
return CELL_OK;
#endif
}
int cellSync2QueueFinalize()
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x3C28, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
return CELL_OK;
#endif
}
int cellSync2QueuePush()
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x478C, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
return CELL_OK;
#endif
}
int cellSync2QueueTryPush()
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x4680, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
return CELL_OK;
#endif
}
int cellSync2QueuePop()
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x4974, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
return CELL_OK;
#endif
}
int cellSync2QueueTryPop()
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x4880, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
return CELL_OK;
#endif
}
int cellSync2QueueGetSize()
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x2C00, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
return CELL_OK;
#endif
}
int cellSync2QueueGetDepth()
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x2B90, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
return CELL_OK;
#endif
}
void cellSync2_init()
{
cellSync2.AddFunc(0x55836e73, _cellSync2MutexAttributeInitialize);
cellSync2.AddFunc(0xd51bfae7, cellSync2MutexEstimateBufferSize);
cellSync2.AddFunc(0xeb81a467, cellSync2MutexInitialize);
cellSync2.AddFunc(0x27f2d61c, cellSync2MutexFinalize);
cellSync2.AddFunc(0xa400d82e, cellSync2MutexLock);
cellSync2.AddFunc(0xa69c749c, cellSync2MutexTryLock);
cellSync2.AddFunc(0x0080fe88, cellSync2MutexUnlock);
cellSync2->AddFunc(0x55836e73, _cellSync2MutexAttributeInitialize);
cellSync2->AddFunc(0xd51bfae7, cellSync2MutexEstimateBufferSize);
cellSync2->AddFunc(0xeb81a467, cellSync2MutexInitialize);
cellSync2->AddFunc(0x27f2d61c, cellSync2MutexFinalize);
cellSync2->AddFunc(0xa400d82e, cellSync2MutexLock);
cellSync2->AddFunc(0xa69c749c, cellSync2MutexTryLock);
cellSync2->AddFunc(0x0080fe88, cellSync2MutexUnlock);
cellSync2.AddFunc(0xdf3c532a, _cellSync2CondAttributeInitialize);
cellSync2.AddFunc(0x5b1e4d7a, cellSync2CondEstimateBufferSize);
cellSync2.AddFunc(0x58be9a0f, cellSync2CondInitialize);
cellSync2.AddFunc(0x63062249, cellSync2CondFinalize);
cellSync2.AddFunc(0xbc96d751, cellSync2CondWait);
cellSync2.AddFunc(0x871af804, cellSync2CondSignal);
cellSync2.AddFunc(0x8aae07c2, cellSync2CondSignalAll);
cellSync2->AddFunc(0xdf3c532a, _cellSync2CondAttributeInitialize);
cellSync2->AddFunc(0x5b1e4d7a, cellSync2CondEstimateBufferSize);
cellSync2->AddFunc(0x58be9a0f, cellSync2CondInitialize);
cellSync2->AddFunc(0x63062249, cellSync2CondFinalize);
cellSync2->AddFunc(0xbc96d751, cellSync2CondWait);
cellSync2->AddFunc(0x871af804, cellSync2CondSignal);
cellSync2->AddFunc(0x8aae07c2, cellSync2CondSignalAll);
cellSync2.AddFunc(0x2d77fe17, _cellSync2SemaphoreAttributeInitialize);
cellSync2.AddFunc(0x74c2780f, cellSync2SemaphoreEstimateBufferSize);
cellSync2.AddFunc(0xc5dee254, cellSync2SemaphoreInitialize);
cellSync2.AddFunc(0x164843a7, cellSync2SemaphoreFinalize);
cellSync2.AddFunc(0xd1b0d146, cellSync2SemaphoreAcquire);
cellSync2.AddFunc(0x5e4b0f87, cellSync2SemaphoreTryAcquire);
cellSync2.AddFunc(0x0c2983ac, cellSync2SemaphoreRelease);
cellSync2.AddFunc(0x4e2ee031, cellSync2SemaphoreGetCount);
cellSync2->AddFunc(0x2d77fe17, _cellSync2SemaphoreAttributeInitialize);
cellSync2->AddFunc(0x74c2780f, cellSync2SemaphoreEstimateBufferSize);
cellSync2->AddFunc(0xc5dee254, cellSync2SemaphoreInitialize);
cellSync2->AddFunc(0x164843a7, cellSync2SemaphoreFinalize);
cellSync2->AddFunc(0xd1b0d146, cellSync2SemaphoreAcquire);
cellSync2->AddFunc(0x5e4b0f87, cellSync2SemaphoreTryAcquire);
cellSync2->AddFunc(0x0c2983ac, cellSync2SemaphoreRelease);
cellSync2->AddFunc(0x4e2ee031, cellSync2SemaphoreGetCount);
cellSync2.AddFunc(0x5e00d433, _cellSync2QueueAttributeInitialize);
cellSync2.AddFunc(0xc08cc0f9, cellSync2QueueEstimateBufferSize);
cellSync2.AddFunc(0xf125e044, cellSync2QueueInitialize);
cellSync2.AddFunc(0x6af85cdf, cellSync2QueueFinalize);
cellSync2.AddFunc(0x7d967d91, cellSync2QueuePush);
cellSync2.AddFunc(0x7fd479fe, cellSync2QueueTryPush);
cellSync2.AddFunc(0xd83ab0c9, cellSync2QueuePop);
cellSync2.AddFunc(0x0c9a0ea9, cellSync2QueueTryPop);
cellSync2.AddFunc(0x12f0a27d, cellSync2QueueGetSize);
cellSync2.AddFunc(0xf0e1471c, cellSync2QueueGetDepth);
}
cellSync2->AddFunc(0x5e00d433, _cellSync2QueueAttributeInitialize);
cellSync2->AddFunc(0xc08cc0f9, cellSync2QueueEstimateBufferSize);
cellSync2->AddFunc(0xf125e044, cellSync2QueueInitialize);
cellSync2->AddFunc(0x6af85cdf, cellSync2QueueFinalize);
cellSync2->AddFunc(0x7d967d91, cellSync2QueuePush);
cellSync2->AddFunc(0x7fd479fe, cellSync2QueueTryPush);
cellSync2->AddFunc(0xd83ab0c9, cellSync2QueuePop);
cellSync2->AddFunc(0x0c9a0ea9, cellSync2QueueTryPop);
cellSync2->AddFunc(0x12f0a27d, cellSync2QueueGetSize);
cellSync2->AddFunc(0xf0e1471c, cellSync2QueueGetDepth);
#ifdef PRX_DEBUG
CallAfter([]()
{
libsync2 = Memory.PRXMem.AllocAlign(sizeof(libsync2_data), 4096);
memcpy(Memory + libsync2, libsync2_data, sizeof(libsync2_data));
libsync2_rtoc = libsync2 + 0xF280;
extern Module* sysPrxForUser;
extern Module* cellSpurs;
extern Module* cellSpursJq;
extern Module* cellFiber;
FIX_IMPORT(cellSpurs, _cellSpursSendSignal , libsync2 + 0x61F0);
FIX_IMPORT(cellSpursJq, cellSpursJobQueueSendSignal , libsync2 + 0x6210);
FIX_IMPORT(cellFiber, cellFiberPpuUtilWorkerControlSendSignal , libsync2 + 0x6230);
FIX_IMPORT(cellFiber, cellFiberPpuSelf , libsync2 + 0x6250);
FIX_IMPORT(cellFiber, cellFiberPpuWaitSignal , libsync2 + 0x6270);
FIX_IMPORT(sysPrxForUser, sys_lwmutex_lock , libsync2 + 0x6290);
FIX_IMPORT(sysPrxForUser, sys_lwmutex_unlock , libsync2 + 0x62B0);
FIX_IMPORT(sysPrxForUser, sys_lwmutex_create , libsync2 + 0x62D0);
FIX_IMPORT(sysPrxForUser, sys_ppu_thread_get_id , libsync2 + 0x62F0);
FIX_IMPORT(sysPrxForUser, _sys_memset , libsync2 + 0x6310);
FIX_IMPORT(sysPrxForUser, _sys_printf , libsync2 + 0x6330);
fix_import(sysPrxForUser, 0x9FB6228E , libsync2 + 0x6350);
FIX_IMPORT(sysPrxForUser, sys_lwmutex_destroy , libsync2 + 0x6370);
FIX_IMPORT(sysPrxForUser, _sys_strncpy , libsync2 + 0x6390);
fix_relocs(cellSync2, libsync2, 0x73A0, 0x95A0, 0x6B90);
});
#endif
}

View file

@ -0,0 +1,18 @@
#pragma once
// Return Codes
enum
{
CELL_SYNC2_ERROR_AGAIN = 0x80410C01,
CELL_SYNC2_ERROR_INVAL = 0x80410C02,
CELL_SYNC2_ERROR_NOMEM = 0x80410C04,
CELL_SYNC2_ERROR_DEADLK = 0x80410C08,
CELL_SYNC2_ERROR_PERM = 0x80410C09,
CELL_SYNC2_ERROR_BUSY = 0x80410C0A,
CELL_SYNC2_ERROR_STAT = 0x80410C0F,
CELL_SYNC2_ERROR_ALIGN = 0x80410C10,
CELL_SYNC2_ERROR_NULL_POINTER = 0x80410C11,
CELL_SYNC2_ERROR_NOT_SUPPORTED_THREAD = 0x80410C12,
CELL_SYNC2_ERROR_NO_NOTIFIER = 0x80410C13,
CELL_SYNC2_ERROR_NO_SPU_CONTEXT_STORAGE = 0x80410C14,
};

View file

@ -8,7 +8,6 @@
#include "Emu/FS/vfsDir.h"
#include "Loader/PSF.h"
#include "cellSysutil_SaveData.h"
#include <algorithm>
extern Module *cellSysutil;

View file

@ -13,8 +13,6 @@
#include "Emu/SysCalls/lv2/sys_time.h"
#include "sceNp.h"
#include "sceNpTrophy.h"
#include <algorithm>
#include <memory>
//void sceNpTrophy_unload();
//void sceNpTrophy_init();
@ -163,7 +161,7 @@ int sceNpTrophyRegisterContext(u32 context, u32 handle, mem_func_ptr_t<SceNpTrop
const size_t kTargetBufferLength = 31;
char target[kTargetBufferLength+1];
target[kTargetBufferLength] = 0;
snprintf(target, kTargetBufferLength, "TROP_%02d.SFM", Ini.SysLanguage.GetValue());
strcpy_trunc(target, fmt::Format("TROP_%02d.SFM", Ini.SysLanguage.GetValue()));
if (trp.ContainsEntry(target)) {
trp.RemoveEntry("TROPCONF.SFM");
@ -180,7 +178,7 @@ int sceNpTrophyRegisterContext(u32 context, u32 handle, mem_func_ptr_t<SceNpTrop
// Discard unnecessary TROP_XX.SFM files
for (int i=0; i<=18; i++) {
snprintf(target, kTargetBufferLength, "TROP_%02d.SFM", i);
strcpy_trunc(target, fmt::Format("TROP_%02d.SFM", i));
if (i != Ini.SysLanguage.GetValue())
trp.RemoveEntry(target);
}

View file

@ -2,6 +2,9 @@
#include "Emu/Memory/Memory.h"
#include "Emu/SysCalls/Modules.h"
#include "SC_Keyboard.h"
#include "SC_Mouse.h"
//void sys_io_init();
//Module sys_io(0x0017, sys_io_init);
Module *sys_io = nullptr;
@ -22,30 +25,6 @@ extern int cellPadSetPressMode(u32 port_no, u32 mode);
extern int cellPadSetSensorMode(u32 port_no, u32 mode);
extern int cellPadGetCapabilityInfo(u32 port_no, mem32_t info_addr);
//cellKb
extern int cellKbInit(u32 max_connect);
extern int cellKbEnd();
extern int cellKbClearBuf(u32 port_no);
extern u16 cellKbCnvRawCode(u32 arrange, u32 mkey, u32 led, u16 rawcode);
extern int cellKbGetInfo(mem_class_t info);
extern int cellKbRead(u32 port_no, mem_class_t data);
extern int cellKbSetCodeType(u32 port_no, u32 type);
extern int cellKbSetLEDStatus(u32 port_no, u8 led);
extern int cellKbSetReadMode(u32 port_no, u32 rmode);
extern int cellKbGetConfiguration(u32 port_no, mem_class_t config);
//cellMouse
extern int cellMouseInit(u32 max_connect);
extern int cellMouseClearBuf(u32 port_no);
extern int cellMouseEnd();
extern int cellMouseGetInfo(mem_class_t info);
extern int cellMouseInfoTabletMode(u32 port_no, mem_class_t info);
extern int cellMouseGetData(u32 port_no, mem_class_t data);
extern int cellMouseGetDataList(u32 port_no, mem_class_t data);
extern int cellMouseSetTabletMode(u32 port_no, u32 mode);
extern int cellMouseGetTabletDataList(u32 port_no, mem_class_t data);
extern int cellMouseGetRawData(u32 port_no, mem_class_t data);
void sys_io_init()
{
sys_io->AddFunc(0x1cf98800, cellPadInit);

View file

@ -11,6 +11,7 @@ extern "C"
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
}
#endif

View file

@ -23,26 +23,46 @@ namespace detail
template<typename T, int g_count, int f_count, int v_count>
struct bind_arg<T, ARG_GENERAL, g_count, f_count, v_count>
{
static __forceinline T func(PPUThread& CPU) { return (T&)CPU.GPR[g_count + 2]; }
static_assert(sizeof(T) <= 8, "Wrong argument type for ARG_GENERAL");
static __forceinline T func(PPUThread& CPU)
{
return (T&)CPU.GPR[g_count + 2];
}
};
template<typename T, int g_count, int f_count, int v_count>
struct bind_arg<T, ARG_FLOAT, g_count, f_count, v_count>
{
static __forceinline T func(PPUThread& CPU) { return (T&)CPU.FPR[f_count]; }
static_assert(sizeof(T) <= 8, "Wrong argument type for ARG_FLOAT");
static __forceinline T func(PPUThread& CPU)
{
return (T&)CPU.FPR[f_count];
}
};
template<typename T, int g_count, int f_count, int v_count>
struct bind_arg<T, ARG_VECTOR, g_count, f_count, v_count>
{
static_assert(v_count == 0, "ARG_VECTOR not supported");
static __forceinline T func(PPUThread& CPU) { return T(); }
static_assert(sizeof(T) == 16, "Wrong argument type for ARG_VECTOR");
static __forceinline T func(PPUThread& CPU)
{
return (T&)CPU.VPR[v_count + 1]._u128;
}
};
template<typename T, int g_count, int f_count, int v_count>
struct bind_arg<T, ARG_STACK, g_count, f_count, v_count>
{
static __forceinline T func(PPUThread& CPU) { return CPU.GetStackArg(8 + std::max(g_count - 8, 0) + std::max(f_count - 12, 0)); }
static_assert(sizeof(T) <= 8 && v_count <= 12, "Wrong argument type for ARG_STACK");
static __forceinline T func(PPUThread& CPU)
{
const u64 res = CPU.GetStackArg(8 + std::max(g_count - 8, 0) + std::max(f_count - 12, 0));
return (T&)res;
}
};
template<typename T>
@ -96,16 +116,16 @@ namespace detail
template<int g_count, int f_count, int v_count, typename T, typename... A>
static __forceinline std::tuple<T, A...> iterate(PPUThread& CPU)
{
static_assert(!std::is_pointer<T>::value, "Invalid function argument type: pointer");
// TODO: check calculations
const bind_arg_type t = std::is_floating_point<T>::value
const bool is_float = std::is_floating_point<T>::value;
const bind_arg_type t = is_float
? ((f_count >= 12) ? ARG_STACK : ARG_FLOAT)
: ((g_count >= 8) ? ARG_STACK : ARG_GENERAL);
const int g = g_count + (std::is_floating_point<T>::value ? 0 : 1);
const int f = f_count + (std::is_floating_point<T>::value ? 1 : 0);
const int v = v_count; // TODO: vector arguments support (if possible)
static_assert(!v_count, "ARG_VECTOR not supported");
static_assert(!std::is_pointer<T>::value, "Invalid function argument type: pointer");
return std::tuple_cat<std::tuple<T>, std::tuple<A...>>(std::tuple<T>(bind_arg<T, t, g, f, v>::func(CPU)), iterate<g, f, v, A...>(CPU));
const int g = g_count + (is_float ? 0 : 1);
const int f = f_count + (is_float ? 1 : 0);
const int v = v_count; // TODO: vector argument support (if possible)
return std::tuple_cat(std::tuple<T>(bind_arg<T, t, g, f, v>::func(CPU)), iterate<g, f, v, A...>(CPU));
}
template<typename RT, typename... TA>

View file

@ -91,10 +91,9 @@ s32 sys_memory_get_page_attribute(u32 addr, mem_ptr_t<sys_page_attr_t> attr)
sys_memory.Warning("sys_memory_get_page_attribute(addr=0x%x, attr_addr=0x%x)", addr, attr.GetAddr());
// TODO: Implement per thread page attribute setting.
attr->attribute = 0;
attr->page_size = 0;
attr->access_right = 0;
attr->pad = 0;
attr->attribute = 0x40000ull; // SYS_MEMORY_PROT_READ_WRITE
attr->access_right = 0xFull; // SYS_MEMORY_ACCESS_RIGHT_ANY
attr->page_size = 4096;
return CELL_OK;
}

View file

@ -24,10 +24,10 @@ struct sys_memory_info_t
struct sys_page_attr_t
{
u64 attribute;
u64 access_right;
u32 page_size;
u32 pad;
be_t<u64> attribute;
be_t<u64> access_right;
be_t<u32> page_size;
be_t<u32> pad;
};
struct MemoryContainerInfo

View file

@ -3,7 +3,6 @@
#include "Emu/System.h"
#include "Emu/SysCalls/SysCalls.h"
#include <thread>
#include "sys_spinlock.h"
SysCallBase sys_spinlock("sys_spinlock");

View file

@ -1,7 +1,5 @@
#pragma once
#include <atomic>
// SysCalls
void sys_spinlock_initialize(mem_ptr_t<std::atomic<be_t<u32>>> lock);
void sys_spinlock_lock(mem_ptr_t<std::atomic<be_t<u32>>> lock);

View file

@ -8,7 +8,6 @@
#include "Emu/FS/vfsFile.h"
#include "Loader/ELF.h"
#include "sys_spu.h"
#include <atomic>
static SysCallBase sys_spu("sys_spu");
@ -387,6 +386,7 @@ s32 sys_spu_thread_group_terminate(u32 id, int value)
{
if (CPUThread* t = Emu.GetCPU().GetThread(group_info->list[i]))
{
((SPUThread*)t)->SPU.Status.SetValue(SPU_STATUS_STOPPED);
t->Stop();
}
}
@ -435,15 +435,17 @@ s32 sys_spu_thread_group_join(u32 id, mem32_t cause, mem32_t status)
return CELL_EBUSY;
}
if (cause.GetAddr()) cause = SYS_SPU_THREAD_GROUP_JOIN_ALL_THREADS_EXIT;
if (status.GetAddr()) status = 0; //unspecified because of ALL_THREADS_EXIT
bool all_threads_exit = true;
for (u32 i = 0; i < group_info->list.size(); i++)
{
while (CPUThread* t = Emu.GetCPU().GetThread(group_info->list[i]))
{
if (!t->IsRunning())
{
if (((SPUThread*)t)->SPU.Status.GetValue() != SPU_STATUS_STOPPED_BY_STOP)
{
all_threads_exit = false;
}
break;
}
if (Emu.IsStopped())
@ -455,6 +457,17 @@ s32 sys_spu_thread_group_join(u32 id, mem32_t cause, mem32_t status)
}
}
if (cause.GetAddr())
{
cause = group_info->m_group_exit
? SYS_SPU_THREAD_GROUP_JOIN_GROUP_EXIT
: (all_threads_exit
? SYS_SPU_THREAD_GROUP_JOIN_ALL_THREADS_EXIT
: SYS_SPU_THREAD_GROUP_JOIN_TERMINATED);
}
if (status.GetAddr()) status = group_info->m_exit_status;
group_info->m_state = SPU_THREAD_GROUP_STATUS_INITIALIZED;
group_info->lock = 0; // release lock TODO: this LOCK may be replaced.
return CELL_OK;

View file

@ -1,7 +1,5 @@
#pragma once
#include <atomic>
enum
{
SYS_SPU_THREAD_GROUP_TYPE_NORMAL = 0x00,
@ -89,21 +87,24 @@ struct SpuGroupInfo
int m_ct;
u32 m_count;
int m_state; //SPU Thread Group State.
int m_exit_status;
u32 m_exit_status;
bool m_group_exit;
SpuGroupInfo(const std::string& name, u32 num, int prio, int type, u32 ct)
SpuGroupInfo(const std::string& name, u32 num, int prio, int type, u32 ct)
: m_name(name)
, m_prio(prio)
, m_type(type)
, m_ct(ct)
, lock(0)
, m_count(num)
, m_state(0)
, m_exit_status(0)
, m_group_exit(false)
{
m_state = SPU_THREAD_GROUP_STATUS_NOT_INITIALIZED; //Before all the nums done, it is not initialized.
list.resize(256);
for (auto& v : list) v = 0;
m_state = SPU_THREAD_GROUP_STATUS_INITIALIZED; //Then Ready to Start. Cause Reference use New i can only place this here.
m_exit_status = 0;
}
};

View file

@ -10,6 +10,9 @@
#include "Emu/System.h"
#include "Emu/SysCalls/SysCalls.h"
#ifdef _WIN32
#include <Windows.h>
#endif
#include "sys_time.h"
SysCallBase sys_time("sys_time");

View file

@ -4,7 +4,6 @@
#include "Emu/SysCalls/SysCalls.h"
#include "Emu/Event.h"
#include <thread>
#include "sys_timer.h"
SysCallBase sys_timer("sys_timer");

View file

@ -422,7 +422,7 @@ void Emulator::Pause()
//ConLog.Write("pause...");
SendDbgCommand(DID_PAUSE_EMU);
if (InterlockedCompareExchange((volatile unsigned long*)&m_status, Paused, Running) == Running)
if (InterlockedCompareExchange((volatile u32*)&m_status, Paused, Running) == Running)
{
SendDbgCommand(DID_PAUSED_EMU);
}

View file

@ -1,8 +1,4 @@
#pragma once
#include <atomic>
#include <memory>
#include <vector>
#include "Loader/Loader.h"
enum Status
@ -90,6 +86,8 @@ class Emulator
std::vector<u64> m_break_points;
std::vector<u64> m_marked_points;
std::recursive_mutex m_core_mutex;
CPUThreadManager* m_thread_manager;
PadManager* m_pad_manager;
KeyboardManager* m_keyboard_manager;
@ -120,6 +118,8 @@ public:
void SetPath(const std::string& path, const std::string& elf_path = "");
void SetTitleID(const std::string& id);
std::recursive_mutex& GetCoreMutex() { return m_core_mutex; }
CPUThreadManager& GetCPU() { return *m_thread_manager; }
PadManager& GetPadManager() { return *m_pad_manager; }
KeyboardManager& GetKeyboardManager() { return *m_keyboard_manager; }
@ -175,6 +175,8 @@ public:
__forceinline bool IsReady() const { return m_status == Ready; }
};
#define LV2_LOCK(x) std::lock_guard<std::recursive_mutex> x(Emu.GetCoreMutex())
extern Emulator Emu;
typedef void(*CallAfterCbType)(std::function<void()> func);

View file

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "stdafx_gui.h"
#include "Emu/System.h"
#include "AutoPauseManager.h"
#include <iomanip>

View file

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "stdafx_gui.h"
#include "Utilities/rMsgBox.h"
#include "Emu/Cell/PPUProgramCompiler.h"

View file

@ -1,11 +1,8 @@
#include "stdafx.h"
#include "stdafx_gui.h"
#include <wx/listctrl.h>
#include <wx/clipbrd.h>
#include <fstream>
#include <vector>
#include <mutex>
#include <atomic>
#include "Ini.h"
#include "Utilities/Log.h"

View file

@ -1,6 +1,5 @@
#pragma once
#include <wx/dataobj.h>
#include <memory>
namespace Log
{

View file

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "stdafx_gui.h"
#include <wx/statline.h>
#include "Emu/Memory/Memory.h"

View file

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "stdafx_gui.h"
#include "Utilities/Log.h"
#include "Emu/Memory/Memory.h"
#include "Emu/System.h"

View file

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "stdafx_gui.h"
#include "GLGSFrame.h"
#include "Utilities/Timer.h"

View file

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "stdafx_gui.h"
#include "GSFrame.h"
#include "Emu/System.h"
#include "Emu/RSX/sysutil_video.h"

View file

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "stdafx_gui.h"
#include "Utilities/AutoPause.h"
#include "Utilities/Log.h"
#include "Utilities/rFile.h"

View file

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "stdafx_gui.h"
#include "Utilities/Log.h"
#include "Emu/Memory/Memory.h"
#include "Emu/System.h"

View file

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "stdafx_gui.h"
#include "Utilities/Log.h"
#include "Emu/Memory/Memory.h"
#include "Emu/System.h"

View file

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "stdafx_gui.h"
#include "Utilities/Log.h"
#include "Emu/Memory/Memory.h"
#include "Emu/System.h"

View file

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "stdafx_gui.h"
#include "Utilities/Log.h"
#include "Emu/Memory/Memory.h"

163
rpcs3/Gui/MsgDialog.cpp Normal file
View file

@ -0,0 +1,163 @@
#include "stdafx_gui.h"
#include "Emu/Memory/Memory.h"
#include "Emu/SysCalls/lv2/sys_time.h"
#include "Emu/SysCalls/Modules/cellMsgDialog.h"
#include "MsgDialog.h"
wxDialog* m_dialog = nullptr;
wxGauge* m_gauge1 = nullptr;
wxGauge* m_gauge2 = nullptr;
wxStaticText* m_text1 = nullptr;
wxStaticText* m_text2 = nullptr;
void MsgDialogCreate(u32 type, const char* msg, u64& status)
{
wxWindow* parent = nullptr; // TODO: align it better
m_gauge1 = nullptr;
m_gauge2 = nullptr;
m_text1 = nullptr;
m_text2 = nullptr;
wxButton* m_button_ok = nullptr;
wxButton* m_button_yes = nullptr;
wxButton* m_button_no = nullptr;
m_dialog = new wxDialog(parent, wxID_ANY, type & CELL_MSGDIALOG_TYPE_SE_TYPE ? "" : "Error", wxDefaultPosition, wxDefaultSize);
m_dialog->SetExtraStyle(m_dialog->GetExtraStyle() | wxWS_EX_TRANSIENT);
m_dialog->SetTransparent(127 + (type & CELL_MSGDIALOG_TYPE_BG) * (128 / CELL_MSGDIALOG_TYPE_BG_INVISIBLE));
wxSizer* sizer1 = new wxBoxSizer(wxVERTICAL);
wxStaticText* m_text = new wxStaticText(m_dialog, wxID_ANY, wxString(msg, wxConvUTF8));
sizer1->Add(m_text, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT | wxTOP, 16);
switch (type & CELL_MSGDIALOG_TYPE_PROGRESSBAR)
{
case CELL_MSGDIALOG_TYPE_PROGRESSBAR_DOUBLE:
m_gauge2 = new wxGauge(m_dialog, wxID_ANY, 100, wxDefaultPosition, wxSize(300, -1), wxGA_HORIZONTAL | wxGA_SMOOTH);
m_text2 = new wxStaticText(m_dialog, wxID_ANY, "");
m_text2->SetAutoLayout(true);
case CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE:
m_gauge1 = new wxGauge(m_dialog, wxID_ANY, 100, wxDefaultPosition, wxSize(300, -1), wxGA_HORIZONTAL | wxGA_SMOOTH);
m_text1 = new wxStaticText(m_dialog, wxID_ANY, "");
m_text1->SetAutoLayout(true);
default: // ???
break;
}
if (m_gauge1)
{
sizer1->Add(m_text1, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT | wxTOP, 8);
sizer1->Add(m_gauge1, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT, 16);
m_gauge1->SetValue(0);
}
if (m_gauge2)
{
sizer1->Add(m_text2, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT | wxTOP, 8);
sizer1->Add(m_gauge2, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT, 16);
m_gauge2->SetValue(0);
}
wxBoxSizer* buttons = new wxBoxSizer(wxHORIZONTAL);
switch (type & CELL_MSGDIALOG_TYPE_BUTTON_TYPE)
{
case CELL_MSGDIALOG_TYPE_BUTTON_TYPE_NONE:
break;
case CELL_MSGDIALOG_TYPE_BUTTON_TYPE_YESNO:
m_button_yes = new wxButton(m_dialog, wxID_YES);
buttons->Add(m_button_yes, 0, wxALIGN_CENTER_HORIZONTAL | wxRIGHT, 8);
m_button_no = new wxButton(m_dialog, wxID_NO);
buttons->Add(m_button_no, 0, wxALIGN_CENTER_HORIZONTAL, 16);
if ((type & CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR) == CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NO)
{
m_button_no->SetFocus();
}
else
{
m_button_yes->SetFocus();
}
sizer1->Add(buttons, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT | wxTOP, 16);
break;
case CELL_MSGDIALOG_TYPE_BUTTON_TYPE_OK:
m_button_ok = new wxButton(m_dialog, wxID_OK);
buttons->Add(m_button_ok, 0, wxALIGN_CENTER_HORIZONTAL, 16);
if ((type & CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR) == CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_OK)
{
m_button_ok->SetFocus();
}
sizer1->Add(buttons, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT | wxTOP, 16);
break;
}
sizer1->AddSpacer(16);
m_dialog->SetSizerAndFit(sizer1);
m_dialog->Centre(wxBOTH);
m_dialog->Show();
m_dialog->Enable();
m_dialog->Bind(wxEVT_BUTTON, [&](wxCommandEvent& event)
{
status = (event.GetId() == wxID_NO) ? CELL_MSGDIALOG_BUTTON_NO : CELL_MSGDIALOG_BUTTON_YES /* OK */;
m_dialog->Hide();
MsgDialogClose();
});
m_dialog->Bind(wxEVT_CLOSE_WINDOW, [&](wxCloseEvent& event)
{
if (type & CELL_MSGDIALOG_TYPE_DISABLE_CANCEL)
{
}
else
{
status = CELL_MSGDIALOG_BUTTON_ESCAPE;
m_dialog->Hide();
MsgDialogClose();
}
});
}
void MsgDialogDestroy()
{
delete m_dialog;
m_dialog = nullptr;
}
void MsgDialogProgressBarSetMsg(u32 index, const char* msg)
{
if (m_dialog)
{
if (index == 0 && m_text1) m_text1->SetLabelText(wxString(msg, wxConvUTF8));
if (index == 1 && m_text2) m_text2->SetLabelText(wxString(msg, wxConvUTF8));
m_dialog->Layout();
m_dialog->Fit();
}
}
void MsgDialogProgressBarReset(u32 index)
{
if (m_dialog)
{
if (index == 0 && m_gauge1) m_gauge1->SetValue(0);
if (index == 1 && m_gauge2) m_gauge2->SetValue(0);
}
}
void MsgDialogProgressBarInc(u32 index, u32 delta)
{
if (m_dialog)
{
if (index == 0 && m_gauge1) m_gauge1->SetValue(m_gauge1->GetValue() + delta);
if (index == 1 && m_gauge2) m_gauge2->SetValue(m_gauge2->GetValue() + delta);
}
}

7
rpcs3/Gui/MsgDialog.h Normal file
View file

@ -0,0 +1,7 @@
#pragma once
void MsgDialogCreate(u32 type, const char* msg, u64& status);
void MsgDialogDestroy();
void MsgDialogProgressBarSetMsg(u32 index, const char* msg);
void MsgDialogProgressBarReset(u32 index);
void MsgDialogProgressBarInc(u32 index, u32 delta);

Some files were not shown because too many files have changed in this diff Show more