This commit is contained in:
Zangetsu38 2016-04-18 01:08:57 +02:00
parent 6ab39ae75d
commit d819878aba
25 changed files with 194 additions and 33 deletions

@ -1 +1 @@
Subproject commit 64d375f52e2011964e196710ca78b0d4d68b20d0
Subproject commit 1f321cf93d5dfc065857f96ac03c7e0762fb9efa

@ -1 +1 @@
Subproject commit 2921e0c54a95264a6fd193c79c814f2869ef9a2d
Subproject commit f042e407a9dfa803f493143f4665c4bbd3a3b5f1

View file

@ -95,7 +95,8 @@ s32 cellAudioOutSetDeviceMode()
s32 cellAudioInSetDeviceMode()
{
fmt::throw_exception("Unimplemented" HERE);
UNIMPLEMENTED_FUNC(cellAvconfExt);
return -1;
}
s32 cellAudioInRegisterDevice()

View file

@ -554,7 +554,7 @@ s32 cellFontExtend(u32 a1, u32 a2, u32 a3)
//Something happens
}
//Something happens?
return CELL_OK;
return -1;
}
s32 cellFontRenderCharGlyphImageVertical()
@ -587,7 +587,8 @@ s32 cellFontGraphicsGetDrawType()
s32 cellFontGetKerning()
{
fmt::throw_exception("Unimplemented" HERE);
UNIMPLEMENTED_FUNC(cellFont);
return CELL_OK;
}
s32 cellFontGetRenderScaledKerning()
@ -622,7 +623,8 @@ s32 cellFontGetEffectWeight()
s32 cellFontGetScalePixel()
{
fmt::throw_exception("Unimplemented" HERE);
UNIMPLEMENTED_FUNC(cellFont);
return CELL_OK;
}
s32 cellFontClearFileCache()
@ -637,7 +639,8 @@ s32 cellFontAdjustFontScaling()
s32 cellFontSetupRenderScalePoint()
{
fmt::throw_exception("Unimplemented" HERE);
UNIMPLEMENTED_FUNC(cellFont);
return CELL_OK;
}
s32 cellFontGlyphGetVerticalShift()

View file

@ -892,7 +892,8 @@ s32 cellFsChangeFileSizeByFdWithoutAllocation()
s32 cellFsSetDiscReadRetrySetting()
{
fmt::throw_exception("Unimplemented" HERE);
UNIMPLEMENTED_FUNC(cellFs);
return CELL_OK;
}
s32 cellFsRegisterConversionCallback()

View file

@ -191,13 +191,15 @@ s32 cellHddGameSetSystemVer()
s32 cellHddGameExitBroken()
{
fmt::throw_exception("Unimplemented" HERE);
UNIMPLEMENTED_FUNC(cellGame);
return CELL_OK;
}
s32 cellGameDataGetSizeKB()
{
fmt::throw_exception("Unimplemented" HERE);
UNIMPLEMENTED_FUNC(cellGame);
return CELL_OK;
}
s32 cellGameDataSetSystemVer()

View file

@ -10,9 +10,110 @@
extern logs::channel cellSysutil;
s32 cellMsgDialogOpen()
s32 cellMsgDialogOpen(u32 type, vm::cptr<char> msgString, vm::ptr<CellMsgDialogCallback> callback, vm::ptr<void> userData, vm::ptr<void> extParam)
{
fmt::throw_exception("Unimplemented" HERE);
cellSysutil.warning("cellMsgDialogOpen(type=0x%x, msgString=%s, callback=*0x%x, userData=*0x%x, extParam=*0x%x)", type, msgString, callback, userData, extParam);
if (!msgString || std::strlen(msgString.get_ptr()) >= 0x200 || type & -0x33f8)
{
return CELL_MSGDIALOG_ERROR_PARAM;
}
const MsgDialogType _type = { type };
switch (_type.button_type.unshifted())
{
case CELL_MSGDIALOG_TYPE_BUTTON_TYPE_NONE:
{
if (_type.default_cursor || _type.progress_bar_count > 2)
{
return CELL_MSGDIALOG_ERROR_PARAM;
}
break;
}
case CELL_MSGDIALOG_TYPE_BUTTON_TYPE_YESNO:
{
if (_type.default_cursor > 1 || _type.progress_bar_count)
{
return CELL_MSGDIALOG_ERROR_PARAM;
}
break;
}
case CELL_MSGDIALOG_TYPE_BUTTON_TYPE_OK:
{
if (_type.default_cursor || _type.progress_bar_count)
{
return CELL_MSGDIALOG_ERROR_PARAM;
}
break;
}
default: return CELL_MSGDIALOG_ERROR_PARAM;
}
const auto dlg = fxm::import<MsgDialogBase>(Emu.GetCallbacks().get_msg_dialog);
if (!dlg)
{
return CELL_SYSUTIL_ERROR_BUSY;
}
if (_type.se_mute_on)
{
// TODO
}
if (_type.se_normal)
{
cellSysutil.warning(msgString.get_ptr());
}
else
{
cellSysutil.error(msgString.get_ptr());
}
dlg->type = _type;
dlg->on_close = [callback, userData, wptr = std::weak_ptr<MsgDialogBase>(dlg)](s32 status)
{
const auto dlg = wptr.lock();
if (dlg && dlg->state.compare_and_swap_test(MsgDialogState::Open, MsgDialogState::Close))
{
if (callback)
{
sysutil_register_cb([=](ppu_thread& ppu) -> s32
{
callback(ppu, status, userData);
return CELL_OK;
});
}
fxm::remove<MsgDialogBase>();
}
};
atomic_t<bool> result(false);
// Run asynchronously in GUI thread
Emu.CallAfter([&]()
{
dlg->Create(msgString.get_ptr());
result = true;
});
while (!result)
{
CHECK_EMU_STATUS;
std::this_thread::sleep_for(1ms);
}
return CELL_OK;
}
s32 cellMsgDialogOpen2(u32 type, vm::cptr<char> msgString, vm::ptr<CellMsgDialogCallback> callback, vm::ptr<void> userData, vm::ptr<void> extParam)

View file

@ -139,7 +139,8 @@ s32 cellNetCtlGetNatInfo(vm::ptr<CellNetCtlNatInfo> natInfo)
s32 cellGameUpdateInit()
{
fmt::throw_exception("Unimplemented" HERE);
UNIMPLEMENTED_FUNC(cellNetCtl);
return CELL_OK;
}
s32 cellGameUpdateTerm()

View file

@ -15,7 +15,8 @@ s32 cellOskDialogUnloadAsync()
s32 cellOskDialogGetSize()
{
fmt::throw_exception("Unimplemented" HERE);
UNIMPLEMENTED_FUNC(cellOskDialog);
return CELL_OK;
}
s32 cellOskDialogAbort()

View file

@ -484,6 +484,11 @@ s32 cellVdecDecodeAu(u32 handle, CellVdecDecodeMode mode, vm::cptr<CellVdecAuInf
return CELL_VDEC_ERROR_ARG;
}
if (mode == CELL_VDEC_DEC_MODE_B_SKIP || !vdec)
{
return CELL_VDEC_ERROR_BUSY;
}
if (mode != CELL_VDEC_DEC_MODE_NORMAL)
{
fmt::throw_exception("Unsupported decoding mode (%d)" HERE, (s32)mode);
@ -555,7 +560,7 @@ s32 cellVdecGetPicture(u32 handle, vm::cptr<CellVdecPicFormat> format, vm::ptr<u
if (format->colorMatrixType != CELL_VDEC_COLOR_MATRIX_TYPE_BT709)
{
fmt::throw_exception("Unknown colorMatrixType (%d)" HERE, format->colorMatrixType);
LOG_ERROR(HLE, "Unknown colorMatrixType (%d)" HERE, format->colorMatrixType);
}
if (alpha_plane)

View file

@ -234,7 +234,8 @@ s32 sceNpMatching2SetSignalingOptParam()
s32 sceNpMatching2RegisterContextCallback()
{
fmt::throw_exception("Unimplemented" HERE);
UNIMPLEMENTED_FUNC(sceNp2);
return CELL_OK;
}
s32 sceNpMatching2SendRoomChatMessage()
@ -274,7 +275,8 @@ s32 sceNpMatching2GrantRoomOwner()
s32 sceNpMatching2CreateContext()
{
fmt::throw_exception("Unimplemented" HERE);
UNIMPLEMENTED_FUNC(sceNp2);
return CELL_OK;
}
s32 sceNpMatching2GetSignalingOptParamLocal()
@ -324,12 +326,14 @@ s32 sceNpMatching2DeleteServerContext()
s32 sceNpMatching2SetDefaultRequestOptParam()
{
fmt::throw_exception("Unimplemented" HERE);
UNIMPLEMENTED_FUNC(sceNp2);
return CELL_OK;
}
s32 sceNpMatching2RegisterRoomEventCallback()
{
fmt::throw_exception("Unimplemented" HERE);
UNIMPLEMENTED_FUNC(sceNp2);
return CELL_OK;
}
s32 sceNpMatching2GetRoomPasswordLocal()
@ -379,7 +383,8 @@ s32 sceNpMatching2SetLobbyMemberDataInternal()
s32 sceNpMatching2RegisterRoomMessageCallback()
{
fmt::throw_exception("Unimplemented" HERE);
UNIMPLEMENTED_FUNC(sceNp2);
return CELL_OK;
}

View file

@ -176,6 +176,12 @@ s32 console_write(vm::ptr<char> data, u32 len)
return CELL_OK;
}
s32 sysPrxForUser_B5D5F64E()
{
UNIMPLEMENTED_FUNC(sysPrxForUser);
return CELL_OK;
}
extern void sysPrxForUser_sys_lwmutex_init();
extern void sysPrxForUser_sys_lwcond_init();
@ -223,4 +229,5 @@ DECLARE(ppu_module_manager::sysPrxForUser)("sysPrxForUser", []()
REG_FUNC(sysPrxForUser, console_getc);
REG_FUNC(sysPrxForUser, console_putc);
REG_FUNC(sysPrxForUser, console_write);
REG_FNID(sysPrxForUser, 0xB5D5F64E, sysPrxForUser_B5D5F64E);
});

View file

@ -354,7 +354,8 @@ s32 _sys_vsprintf()
s32 _sys_qsort()
{
fmt::throw_exception("Unimplemented" HERE);
UNIMPLEMENTED_FUNC(sysPrxForUser);
return CELL_OK;
}
void sysPrxForUser_sys_libc_init()

View file

@ -20,7 +20,8 @@ struct memory_pool_t
s32 sys_mempool_allocate_block()
{
fmt::throw_exception("Unimplemented" HERE);
UNIMPLEMENTED_FUNC(sysPrxForUser);
return CELL_OK;
}
s32 sys_mempool_create(vm::ptr<sys_mempool_t> mempool, vm::ptr<void> chunk, const u64 chunk_size, const u64 block_size, const u64 ralignment)

View file

@ -103,12 +103,14 @@ void sys_ppu_thread_once(ppu_thread& ppu, vm::ptr<atomic_be_t<u32>> once_ctrl, v
s32 sys_ppu_thread_register_atexit()
{
fmt::throw_exception("Unimplemented" HERE);
UNIMPLEMENTED_FUNC(sysPrxForUser);
return CELL_OK;
}
s32 sys_ppu_thread_unregister_atexit()
{
fmt::throw_exception("Unimplemented" HERE);
UNIMPLEMENTED_FUNC(sysPrxForUser);
return CELL_OK;
}
void sysPrxForUser_sys_ppu_thread_init()

View file

@ -292,12 +292,15 @@ const g_ppu_scale_table;
bool ppu_interpreter::MFVSCR(ppu_thread& ppu, ppu_opcode_t op)
{
fmt::throw_exception<std::logic_error>("MFVSCR instruction at 0x%x (%s)", ppu.cia, Emu.GetTitleID());
ppu.vr[op.vd].clear();
ppu.vr[op.vd]._u32[0] = ppu.vscr.vscr;
return true;
}
bool ppu_interpreter::MTVSCR(ppu_thread& ppu, ppu_opcode_t op)
{
LOG_WARNING(PPU, "MTVSCR");
ppu.vscr.vscr = ppu.vr[op.vb]._u32[0];
ppu.vscr.X = ppu.vscr.Y = 0;
return true;
}

View file

@ -16,6 +16,18 @@ enum class ppu_cmd : u32
hle_call, // Execute function by index (arg)
};
union VSCRhdr
{
u32 vscr;
struct
{
u32 sat : 1;
u32 X : 15;
u32 nj : 1;
u32 Y : 15;
};
};
class ppu_thread : public cpu_thread
{
public:
@ -34,6 +46,7 @@ public:
u64 gpr[32] = {}; // General-Purpose Registers
f64 fpr[32] = {}; // Floating Point Registers
v128 vr[32] = {}; // Vector Registers
VSCRhdr vscr{}; // Vector Status and Control Register
alignas(16) bool cr[32] = {}; // Condition Registers (abstract representation)

View file

@ -917,7 +917,7 @@ void spu_recompiler::BISL(spu_opcode_t op)
void spu_recompiler::IRET(spu_opcode_t op)
{
fmt::throw_exception("Unimplemented instruction" HERE);
LOG_ERROR(SPU, "Unimplemented instruction" HERE);
}
void spu_recompiler::BISLED(spu_opcode_t op)

View file

@ -495,7 +495,7 @@ void SPUThread::process_mfc_cmd(u32 cmd)
return;
}
fmt::throw_exception("Unknown command %s (cmd=0x%x, lsa=0x%x, ea=0x%llx, tag=0x%x, size=0x%x)" HERE,
LOG_ERROR(SPU, "Unknown command %s (cmd=0x%x, lsa=0x%x, ea=0x%llx, tag=0x%x, size=0x%x)" HERE,
get_mfc_cmd_name(cmd), cmd, ch_mfc_args.lsa, ch_mfc_args.ea, ch_mfc_args.tag, ch_mfc_args.size);
}
@ -1119,7 +1119,7 @@ bool SPUThread::set_ch_value(u32 ch, u32 value)
}
}
fmt::throw_exception("Unknown/illegal channel (ch=%d [%s], value=0x%x)" HERE, ch, ch < 128 ? spu_ch_name[ch] : "???", value);
LOG_ERROR(SPU, "Unknown/illegal channel (ch=%d [%s], value=0x%x)" HERE, ch, ch < 128 ? spu_ch_name[ch] : "???", value);
}
bool SPUThread::stop_and_signal(u32 code)

View file

@ -129,7 +129,18 @@ error_code sys_fs_open(vm::cptr<char> path, s32 flags, vm::ptr<u32> fd, s32 mode
fmt::throw_exception("sys_fs_open(%s): Invalid or unimplemented flags: %#o" HERE, path, flags);
}
fs::file file(local_path, open_mode);
const char *path_ptr = path.get_ptr();
if (strstr(path.get_ptr(), "/dev_hdd0") &&
strncmp(path.get_ptr(), "/dev_hdd0", 9))
{
path_ptr = strstr(path_ptr, "/dev_hdd0");
LOG_ERROR(HLE, "Path contains device root path but not at the start!");
LOG_ERROR(HLE, "Path given is (%s), modified to (%s)", path.get_ptr(), path_ptr);
}
fs::file file(local_path, open_mode);
if (!file)
{

View file

@ -372,7 +372,7 @@ namespace vm
if (!size || (size | addr) % 4096)
{
fmt::throw_exception("Invalid arguments (addr=0x%x, size=0x%x)" HERE, addr, size);
LOG_ERROR(MEMORY, "Invalid arguments (addr=0x%x, size=0x%x)" HERE, addr, size);
}
const u8 flags_inv = flags_set & flags_clear;

View file

@ -61,7 +61,7 @@ public:
template<int Alignement>
size_t alloc(size_t size)
{
if (!can_alloc<Alignement>(size)) fmt::throw_exception("Working buffer not big enough" HERE);
if (!can_alloc<Alignement>(size)) LOG_ERROR(RSX, "Working buffer not big enough" HERE);
size_t alloc_size = align(size, Alignement);
size_t aligned_put_pos = align(m_put_pos, Alignement);
if (aligned_put_pos + alloc_size < m_size)

View file

@ -966,6 +966,7 @@ rsx::blit_engine::context_dma rsx::blit_engine::to_context_dma(u32 in)
{
switch (in)
{
case CELL_GCM_CONTEXT_DMA_MEMORY_HOST_BUFFER: return rsx::blit_engine::context_dma::memory_host_buffer; //Killzone 2
case CELL_GCM_CONTEXT_DMA_TO_MEMORY_GET_REPORT: return rsx::blit_engine::context_dma::to_memory_get_report;
case CELL_GCM_CONTEXT_DMA_REPORT_LOCATION_MAIN: return rsx::blit_engine::context_dma::report_location_main;
}

View file

@ -374,6 +374,7 @@ namespace rsx
enum class context_dma : u8
{
memory_host_buffer,
to_memory_get_report,
report_location_main,
};

View file

@ -31,7 +31,7 @@ namespace rsx
[[noreturn]] void invalid_method(thread*, u32 _reg, u32 arg)
{
fmt::throw_exception("Invalid RSX method 0x%x (arg=0x%x)" HERE, _reg << 2, arg);
LOG_ERROR( RSX, "Invalid RSX method 0x%x (arg=0x%x)" HERE, _reg << 2, arg);
}
template<typename Type> struct vertex_data_type_from_element_type;
@ -285,6 +285,7 @@ namespace rsx
switch (report_dma)
{
case blit_engine::context_dma::memory_host_buffer: location = CELL_GCM_LOCATION_MAIN; break;
case blit_engine::context_dma::to_memory_get_report: location = CELL_GCM_LOCATION_LOCAL; break;
case blit_engine::context_dma::report_location_main: location = CELL_GCM_LOCATION_MAIN; break;
default: