mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-06-07 03:03:15 +00:00
Merge branch 'main' into miscFixes6
This commit is contained in:
commit
25e95c959a
49 changed files with 974 additions and 371 deletions
|
@ -59,9 +59,11 @@ int PS4_SYSV_ABI sceImeDialogGetStatus() {
|
|||
return g_ime_dlg_status;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceImeDialogInit(const OrbisImeDialogParam* param,
|
||||
const OrbisImeParamExtended* extended) {
|
||||
int PS4_SYSV_ABI sceImeDialogInit(OrbisImeDialogParam* param, OrbisImeParamExtended* extended) {
|
||||
LOG_ERROR(Lib_ImeDialog, "(STUBBED) called");
|
||||
const std::wstring_view text = L"shadPS4";
|
||||
param->maxTextLength = text.size();
|
||||
std::memcpy(param->inputTextBuffer, text.data(), text.size() * sizeof(wchar_t));
|
||||
g_ime_dlg_status = OrbisImeDialogStatus::ORBIS_IME_DIALOG_STATUS_RUNNING;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
|
|
@ -174,8 +174,7 @@ int PS4_SYSV_ABI sceImeDialogGetPanelSize();
|
|||
int PS4_SYSV_ABI sceImeDialogGetPanelSizeExtended();
|
||||
int PS4_SYSV_ABI sceImeDialogGetResult(OrbisImeDialogResult* result);
|
||||
/*OrbisImeDialogStatus*/ int PS4_SYSV_ABI sceImeDialogGetStatus();
|
||||
int PS4_SYSV_ABI sceImeDialogInit(const OrbisImeDialogParam* param,
|
||||
const OrbisImeParamExtended* extended);
|
||||
int PS4_SYSV_ABI sceImeDialogInit(OrbisImeDialogParam* param, OrbisImeParamExtended* extended);
|
||||
int PS4_SYSV_ABI sceImeDialogInitInternal();
|
||||
int PS4_SYSV_ABI sceImeDialogInitInternal2();
|
||||
int PS4_SYSV_ABI sceImeDialogInitInternal3();
|
||||
|
|
|
@ -346,7 +346,8 @@ s32 PS4_SYSV_ABI sceGnmAddEqEvent(SceKernelEqueue eq, u64 id, void* udata) {
|
|||
EqueueEvent kernel_event{};
|
||||
kernel_event.event.ident = id;
|
||||
kernel_event.event.filter = SceKernelEvent::Filter::GraphicsCore;
|
||||
kernel_event.event.flags = SceKernelEvent::Flags::Add;
|
||||
// The library only sets EV_ADD but it is suspected the kernel driver forces EV_CLEAR
|
||||
kernel_event.event.flags = SceKernelEvent::Flags::Clear;
|
||||
kernel_event.event.fflags = 0;
|
||||
kernel_event.event.data = id;
|
||||
kernel_event.event.udata = udata;
|
||||
|
@ -649,6 +650,7 @@ s32 PS4_SYSV_ABI sceGnmDrawIndexIndirect(u32* cmdbuf, u32 size, u32 data_offset,
|
|||
cmdbuf[2] = instance_vgpr_offset == 0 ? 0 : (instance_vgpr_offset & 0xffffu) + sgpr_offset;
|
||||
cmdbuf[3] = 0;
|
||||
|
||||
cmdbuf += 4;
|
||||
WriteTrailingNop<3>(cmdbuf);
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
@ -704,6 +706,7 @@ s32 PS4_SYSV_ABI sceGnmDrawIndirect(u32* cmdbuf, u32 size, u32 data_offset, u32
|
|||
cmdbuf[2] = instance_vgpr_offset == 0 ? 0 : (instance_vgpr_offset & 0xffffu) + sgpr_offset;
|
||||
cmdbuf[3] = 2; // auto index
|
||||
|
||||
cmdbuf += 4;
|
||||
WriteTrailingNop<3>(cmdbuf);
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
@ -1409,9 +1412,8 @@ s32 PS4_SYSV_ABI sceGnmSetEmbeddedPsShader(u32* cmdbuf, u32 size, u32 shader_id,
|
|||
// repeat set shader functionality here as it is trivial.
|
||||
cmdbuf = PM4CmdSetData::SetShReg(cmdbuf, 8u, ps_regs[0],
|
||||
0u); // SPI_SHADER_PGM_LO_PS/SPI_SHADER_PGM_HI_PS
|
||||
cmdbuf =
|
||||
PM4CmdSetData::SetShReg(cmdbuf, 10u, ps_regs[2],
|
||||
ps_regs[3]); // SPI_SHADER_USER_DATA_PS_4/SPI_SHADER_USER_DATA_PS_5
|
||||
cmdbuf = PM4CmdSetData::SetShReg(cmdbuf, 10u, ps_regs[2],
|
||||
ps_regs[3]); // SPI_SHADER_PGM_RSRC1_PS/SPI_SHADER_PGM_RSRC2_PS
|
||||
cmdbuf = PM4CmdSetData::SetContextReg(cmdbuf, 0x1c4u, ps_regs[4],
|
||||
ps_regs[5]); // SPI_SHADER_Z_FORMAT/SPI_SHADER_COL_FORMAT
|
||||
cmdbuf = PM4CmdSetData::SetContextReg(cmdbuf, 0x1b3u, ps_regs[6],
|
||||
|
@ -1468,18 +1470,44 @@ s32 PS4_SYSV_ABI sceGnmSetEmbeddedVsShader(u32* cmdbuf, u32 size, u32 shader_id,
|
|||
// pointer to a stack memory, so the check will likely fail. To workaround it we will
|
||||
// repeat set shader functionality here as it is trivial.
|
||||
cmdbuf = PM4CmdSetData::SetShReg(cmdbuf, 0x48u, vs_regs[0], vs_regs[1]); // SPI_SHADER_PGM_LO_VS
|
||||
cmdbuf =
|
||||
PM4CmdSetData::SetShReg(cmdbuf, 0x4au, vs_regs[2], vs_regs[3]); // SPI_SHADER_PGM_RSRC1_VS
|
||||
cmdbuf = PM4CmdSetData::SetContextReg(cmdbuf, 0x207u, vs_regs[6]); // PA_CL_VS_OUT_CNTL
|
||||
cmdbuf = PM4CmdSetData::SetContextReg(cmdbuf, 0x1b1u, vs_regs[4]); // SPI_VS_OUT_CONFIG
|
||||
cmdbuf = PM4CmdSetData::SetContextReg(cmdbuf, 0x1c3u, vs_regs[5]); // SPI_SHADER_POS_FORMAT
|
||||
cmdbuf = PM4CmdSetData::SetShReg(cmdbuf, 0x4au, vs_regs[2],
|
||||
vs_regs[3]); // SPI_SHADER_PGM_RSRC1_VS/SPI_SHADER_PGM_RSRC2_VS
|
||||
cmdbuf = PM4CmdSetData::SetContextReg(cmdbuf, 0x207u, vs_regs[6]); // PA_CL_VS_OUT_CNTL
|
||||
cmdbuf = PM4CmdSetData::SetContextReg(cmdbuf, 0x1b1u, vs_regs[4]); // SPI_VS_OUT_CONFIG
|
||||
cmdbuf = PM4CmdSetData::SetContextReg(cmdbuf, 0x1c3u, vs_regs[5]); // SPI_SHADER_POS_FORMAT
|
||||
|
||||
WriteTrailingNop<11>(cmdbuf);
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceGnmSetEsShader() {
|
||||
LOG_ERROR(Lib_GnmDriver, "(STUBBED) called");
|
||||
s32 PS4_SYSV_ABI sceGnmSetEsShader(u32* cmdbuf, u32 size, const u32* es_regs, u32 shader_modifier) {
|
||||
LOG_TRACE(Lib_GnmDriver, "called");
|
||||
|
||||
if (!cmdbuf || size < 0x14) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!es_regs) {
|
||||
LOG_ERROR(Lib_GnmDriver, "Null pointer passed as argument");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (shader_modifier & 0xfcfffc3f) {
|
||||
LOG_ERROR(Lib_GnmDriver, "Invalid modifier mask");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (es_regs[1] != 0) {
|
||||
LOG_ERROR(Lib_GnmDriver, "Invalid shader address");
|
||||
return -1;
|
||||
}
|
||||
|
||||
const u32 var =
|
||||
shader_modifier == 0 ? es_regs[2] : ((es_regs[2] & 0xfcfffc3f) | shader_modifier);
|
||||
cmdbuf = PM4CmdSetData::SetShReg(cmdbuf, 0xc8u, es_regs[0], 0u); // SPI_SHADER_PGM_LO_ES
|
||||
cmdbuf = PM4CmdSetData::SetShReg(cmdbuf, 0xcau, var, es_regs[3]); // SPI_SHADER_PGM_RSRC1_ES
|
||||
|
||||
WriteTrailingNop<11>(cmdbuf);
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
|
@ -1488,18 +1516,93 @@ int PS4_SYSV_ABI sceGnmSetGsRingSizes() {
|
|||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceGnmSetGsShader() {
|
||||
LOG_ERROR(Lib_GnmDriver, "(STUBBED) called");
|
||||
s32 PS4_SYSV_ABI sceGnmSetGsShader(u32* cmdbuf, u32 size, const u32* gs_regs) {
|
||||
LOG_TRACE(Lib_GnmDriver, "called");
|
||||
|
||||
if (!cmdbuf || size < 0x1d) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!gs_regs) {
|
||||
LOG_ERROR(Lib_GnmDriver, "Null pointer passed as argument");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (gs_regs[1] != 0) {
|
||||
LOG_ERROR(Lib_GnmDriver, "Invalid shader address");
|
||||
return -1;
|
||||
}
|
||||
|
||||
cmdbuf = PM4CmdSetData::SetShReg(cmdbuf, 0x88u, gs_regs[0], 0u); // SPI_SHADER_PGM_LO_GS
|
||||
cmdbuf = PM4CmdSetData::SetShReg(cmdbuf, 0x8au, gs_regs[2],
|
||||
gs_regs[3]); // SPI_SHADER_PGM_RSRC1_GS/SPI_SHADER_PGM_RSRC2_GS
|
||||
cmdbuf = PM4CmdSetData::SetContextReg(cmdbuf, 0x2e5u, gs_regs[4]); // VGT_STRMOUT_CONFIG
|
||||
cmdbuf = PM4CmdSetData::SetContextReg(cmdbuf, 0x29bu, gs_regs[5]); // VGT_GS_OUT_PRIM_TYPE
|
||||
cmdbuf = PM4CmdSetData::SetContextReg(cmdbuf, 0x2e4u, gs_regs[6]); // VGT_GS_INSTANCE_CNT
|
||||
|
||||
WriteTrailingNop<11>(cmdbuf);
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceGnmSetHsShader() {
|
||||
LOG_ERROR(Lib_GnmDriver, "(STUBBED) called");
|
||||
s32 PS4_SYSV_ABI sceGnmSetHsShader(u32* cmdbuf, u32 size, const u32* hs_regs, u32 param4) {
|
||||
LOG_TRACE(Lib_GnmDriver, "called");
|
||||
|
||||
if (!cmdbuf || size < 0x1E) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!hs_regs) {
|
||||
LOG_ERROR(Lib_GnmDriver, "Null pointer passed as argument");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (hs_regs[1] != 0) {
|
||||
LOG_ERROR(Lib_GnmDriver, "Invalid shader address");
|
||||
return -1;
|
||||
}
|
||||
|
||||
cmdbuf = PM4CmdSetData::SetShReg(cmdbuf, 0x108u, hs_regs[0], 0u); // SPI_SHADER_PGM_LO_HS
|
||||
cmdbuf = PM4CmdSetData::SetShReg(cmdbuf, 0x10au, hs_regs[2],
|
||||
hs_regs[3]); // SPI_SHADER_PGM_RSRC1_HS/SPI_SHADER_PGM_RSRC2_HS
|
||||
cmdbuf = PM4CmdSetData::SetContextReg(cmdbuf, 0x286u, hs_regs[5],
|
||||
hs_regs[5]); // VGT_HOS_MAX_TESS_LEVEL
|
||||
cmdbuf = PM4CmdSetData::SetContextReg(cmdbuf, 0x2dbu, hs_regs[4]); // VGT_TF_PARAM
|
||||
cmdbuf = PM4CmdSetData::SetContextReg(cmdbuf, 0x2d6u, param4); // VGT_LS_HS_CONFIG
|
||||
|
||||
WriteTrailingNop<11>(cmdbuf);
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceGnmSetLsShader() {
|
||||
LOG_ERROR(Lib_GnmDriver, "(STUBBED) called");
|
||||
s32 PS4_SYSV_ABI sceGnmSetLsShader(u32* cmdbuf, u32 size, const u32* ls_regs, u32 shader_modifier) {
|
||||
LOG_TRACE(Lib_GnmDriver, "called");
|
||||
|
||||
if (!cmdbuf || size < 0x17) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!ls_regs) {
|
||||
LOG_ERROR(Lib_GnmDriver, "Null pointer passed as argument");
|
||||
return -1;
|
||||
}
|
||||
|
||||
const auto modifier_mask = ((shader_modifier & 0xfffffc3f) == 0) ? 0xfffffc3f : 0xfcfffc3f;
|
||||
if (shader_modifier & modifier_mask) {
|
||||
LOG_ERROR(Lib_GnmDriver, "Invalid modifier mask");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ls_regs[1] != 0) {
|
||||
LOG_ERROR(Lib_GnmDriver, "Invalid shader address");
|
||||
return -1;
|
||||
}
|
||||
|
||||
const u32 var =
|
||||
shader_modifier == 0 ? ls_regs[2] : ((ls_regs[2] & modifier_mask) | shader_modifier);
|
||||
cmdbuf = PM4CmdSetData::SetShReg(cmdbuf, 0x148u, ls_regs[0], 0u); // SPI_SHADER_PGM_LO_LS
|
||||
cmdbuf = PM4CmdSetData::SetShReg(cmdbuf, 0x14bu, ls_regs[3]); // SPI_SHADER_PGM_RSRC2_LS
|
||||
cmdbuf = PM4CmdSetData::SetShReg(cmdbuf, 0x14au, var, ls_regs[3]); // SPI_SHADER_PGM_RSRC1_LS
|
||||
|
||||
WriteTrailingNop<11>(cmdbuf);
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
|
@ -1523,9 +1626,9 @@ s32 PS4_SYSV_ABI sceGnmSetPsShader(u32* cmdbuf, u32 size, const u32* ps_regs) {
|
|||
|
||||
cmdbuf = PM4CmdSetData::SetShReg(cmdbuf, 8u, ps_regs[0],
|
||||
0u); // SPI_SHADER_PGM_LO_PS/SPI_SHADER_PGM_HI_PS
|
||||
cmdbuf = PM4CmdSetData::SetShReg(
|
||||
cmdbuf, 10u, ps_regs[2],
|
||||
ps_regs[3]); // SPI_SHADER_USER_DATA_PS_4/SPI_SHADER_USER_DATA_PS_5
|
||||
cmdbuf =
|
||||
PM4CmdSetData::SetShReg(cmdbuf, 10u, ps_regs[2],
|
||||
ps_regs[3]); // SPI_SHADER_PGM_RSRC1_PS/SPI_SHADER_PGM_RSRC2_PS
|
||||
cmdbuf = PM4CmdSetData::SetContextReg(
|
||||
cmdbuf, 0x1c4u, ps_regs[4], ps_regs[5]); // SPI_SHADER_Z_FORMAT/SPI_SHADER_COL_FORMAT
|
||||
cmdbuf = PM4CmdSetData::SetContextReg(cmdbuf, 0x1b3u, ps_regs[6],
|
||||
|
@ -1561,9 +1664,9 @@ s32 PS4_SYSV_ABI sceGnmSetPsShader350(u32* cmdbuf, u32 size, const u32* ps_regs)
|
|||
|
||||
cmdbuf = PM4CmdSetData::SetShReg(cmdbuf, 8u, ps_regs[0],
|
||||
0u); // SPI_SHADER_PGM_LO_PS/SPI_SHADER_PGM_HI_PS
|
||||
cmdbuf = PM4CmdSetData::SetShReg(
|
||||
cmdbuf, 10u, ps_regs[2],
|
||||
ps_regs[3]); // SPI_SHADER_USER_DATA_PS_4/SPI_SHADER_USER_DATA_PS_5
|
||||
cmdbuf =
|
||||
PM4CmdSetData::SetShReg(cmdbuf, 10u, ps_regs[2],
|
||||
ps_regs[3]); // SPI_SHADER_PGM_RSRC1_PS/SPI_SHADER_PGM_RSRC2_PS
|
||||
cmdbuf = PM4CmdSetData::SetContextReg(
|
||||
cmdbuf, 0x1c4u, ps_regs[4], ps_regs[5]); // SPI_SHADER_Z_FORMAT/SPI_SHADER_COL_FORMAT
|
||||
cmdbuf = PM4CmdSetData::SetContextReg(cmdbuf, 0x1b3u, ps_regs[6],
|
||||
|
@ -2052,8 +2155,34 @@ int PS4_SYSV_ABI sceGnmUnregisterResource() {
|
|||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceGnmUpdateGsShader() {
|
||||
LOG_ERROR(Lib_GnmDriver, "(STUBBED) called");
|
||||
s32 PS4_SYSV_ABI sceGnmUpdateGsShader(u32* cmdbuf, u32 size, const u32* gs_regs) {
|
||||
LOG_TRACE(Lib_GnmDriver, "called");
|
||||
|
||||
if (!cmdbuf || size < 0x1d) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!gs_regs) {
|
||||
LOG_ERROR(Lib_GnmDriver, "Null pointer passed as argument");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (gs_regs[1] != 0) {
|
||||
LOG_ERROR(Lib_GnmDriver, "Invalid shader address");
|
||||
return -1;
|
||||
}
|
||||
|
||||
cmdbuf = PM4CmdSetData::SetShReg(cmdbuf, 0x88u, gs_regs[0], 0u); // SPI_SHADER_PGM_LO_GS
|
||||
cmdbuf = PM4CmdSetData::SetShReg(cmdbuf, 0x8au, gs_regs[2],
|
||||
gs_regs[3]); // SPI_SHADER_PGM_RSRC1_GS/SPI_SHADER_PGM_RSRC2_GS
|
||||
cmdbuf = WritePacket<PM4ItOpcode::Nop>(cmdbuf, PM4ShaderType::ShaderGraphics, 0xc01e02e5u,
|
||||
gs_regs[4]);
|
||||
cmdbuf = WritePacket<PM4ItOpcode::Nop>(cmdbuf, PM4ShaderType::ShaderGraphics, 0xc01e029bu,
|
||||
gs_regs[5]);
|
||||
cmdbuf = WritePacket<PM4ItOpcode::Nop>(cmdbuf, PM4ShaderType::ShaderGraphics, 0xc01e02e4u,
|
||||
gs_regs[6]);
|
||||
|
||||
WriteTrailingNop<11>(cmdbuf);
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
|
@ -2082,9 +2211,9 @@ s32 PS4_SYSV_ABI sceGnmUpdatePsShader(u32* cmdbuf, u32 size, const u32* ps_regs)
|
|||
|
||||
cmdbuf = PM4CmdSetData::SetShReg(cmdbuf, 8u, ps_regs[0],
|
||||
0u); // SPI_SHADER_PGM_LO_PS/SPI_SHADER_PGM_HI_PS
|
||||
cmdbuf = PM4CmdSetData::SetShReg(
|
||||
cmdbuf, 10u, ps_regs[2],
|
||||
ps_regs[3]); // SPI_SHADER_USER_DATA_PS_4/SPI_SHADER_USER_DATA_PS_5
|
||||
cmdbuf =
|
||||
PM4CmdSetData::SetShReg(cmdbuf, 10u, ps_regs[2],
|
||||
ps_regs[3]); // SPI_SHADER_PGM_RSRC1_PS/SPI_SHADER_PGM_RSRC2_PS
|
||||
cmdbuf = WritePacket<PM4ItOpcode::Nop>(
|
||||
cmdbuf, PM4ShaderType::ShaderGraphics, 0xc01e01c4u, ps_regs[4],
|
||||
ps_regs[5]); // SPI_SHADER_Z_FORMAT/SPI_SHADER_COL_FORMAT update
|
||||
|
@ -2127,9 +2256,9 @@ s32 PS4_SYSV_ABI sceGnmUpdatePsShader350(u32* cmdbuf, u32 size, const u32* ps_re
|
|||
|
||||
cmdbuf = PM4CmdSetData::SetShReg(cmdbuf, 8u, ps_regs[0],
|
||||
0u); // SPI_SHADER_PGM_LO_PS/SPI_SHADER_PGM_HI_PS
|
||||
cmdbuf = PM4CmdSetData::SetShReg(
|
||||
cmdbuf, 10u, ps_regs[2],
|
||||
ps_regs[3]); // SPI_SHADER_USER_DATA_PS_4/SPI_SHADER_USER_DATA_PS_5
|
||||
cmdbuf =
|
||||
PM4CmdSetData::SetShReg(cmdbuf, 10u, ps_regs[2],
|
||||
ps_regs[3]); // SPI_SHADER_PGM_RSRC1_PS/SPI_SHADER_PGM_RSRC2_PS
|
||||
cmdbuf = WritePacket<PM4ItOpcode::Nop>(
|
||||
cmdbuf, PM4ShaderType::ShaderGraphics, 0xc01e01c4u, ps_regs[4],
|
||||
ps_regs[5]); // SPI_SHADER_Z_FORMAT/SPI_SHADER_COL_FORMAT update
|
||||
|
@ -2173,7 +2302,8 @@ s32 PS4_SYSV_ABI sceGnmUpdateVsShader(u32* cmdbuf, u32 size, const u32* vs_regs,
|
|||
return -1;
|
||||
}
|
||||
|
||||
const u32 var = shader_modifier == 0 ? vs_regs[2] : (vs_regs[2] & 0xfcfffc3f | shader_modifier);
|
||||
const u32 var =
|
||||
shader_modifier == 0 ? vs_regs[2] : ((vs_regs[2] & 0xfcfffc3f) | shader_modifier);
|
||||
cmdbuf = PM4CmdSetData::SetShReg(cmdbuf, 0x48u, vs_regs[0], 0u); // SPI_SHADER_PGM_LO_VS
|
||||
cmdbuf = PM4CmdSetData::SetShReg(cmdbuf, 0x4au, var, vs_regs[3]); // SPI_SHADER_PGM_RSRC1_VS
|
||||
cmdbuf = WritePacket<PM4ItOpcode::Nop>(cmdbuf, PM4ShaderType::ShaderGraphics, 0xc01e0207u,
|
||||
|
|
|
@ -149,11 +149,11 @@ s32 PS4_SYSV_ABI sceGnmSetCsShaderWithModifier(u32* cmdbuf, u32 size, const u32*
|
|||
s32 PS4_SYSV_ABI sceGnmSetEmbeddedPsShader(u32* cmdbuf, u32 size, u32 shader_id,
|
||||
u32 shader_modifier);
|
||||
s32 PS4_SYSV_ABI sceGnmSetEmbeddedVsShader(u32* cmdbuf, u32 size, u32 shader_id, u32 modifier);
|
||||
int PS4_SYSV_ABI sceGnmSetEsShader();
|
||||
s32 PS4_SYSV_ABI sceGnmSetEsShader(u32* cmdbuf, u32 size, const u32* es_regs, u32 shader_modifier);
|
||||
int PS4_SYSV_ABI sceGnmSetGsRingSizes();
|
||||
int PS4_SYSV_ABI sceGnmSetGsShader();
|
||||
int PS4_SYSV_ABI sceGnmSetHsShader();
|
||||
int PS4_SYSV_ABI sceGnmSetLsShader();
|
||||
s32 PS4_SYSV_ABI sceGnmSetGsShader(u32* cmdbuf, u32 size, const u32* gs_regs);
|
||||
s32 PS4_SYSV_ABI sceGnmSetHsShader(u32* cmdbuf, u32 size, const u32* hs_regs, u32 param4);
|
||||
s32 PS4_SYSV_ABI sceGnmSetLsShader(u32* cmdbuf, u32 size, const u32* ls_regs, u32 shader_modifier);
|
||||
s32 PS4_SYSV_ABI sceGnmSetPsShader(u32* cmdbuf, u32 size, const u32* ps_regs);
|
||||
s32 PS4_SYSV_ABI sceGnmSetPsShader350(u32* cmdbuf, u32 size, const u32* ps_regs);
|
||||
int PS4_SYSV_ABI sceGnmSetResourceRegistrationUserMemory();
|
||||
|
@ -216,7 +216,7 @@ int PS4_SYSV_ABI sceGnmUnmapComputeQueue();
|
|||
int PS4_SYSV_ABI sceGnmUnregisterAllResourcesForOwner();
|
||||
int PS4_SYSV_ABI sceGnmUnregisterOwnerAndResources();
|
||||
int PS4_SYSV_ABI sceGnmUnregisterResource();
|
||||
int PS4_SYSV_ABI sceGnmUpdateGsShader();
|
||||
s32 PS4_SYSV_ABI sceGnmUpdateGsShader(u32* cmdbuf, u32 size, const u32* gs_regs);
|
||||
int PS4_SYSV_ABI sceGnmUpdateHsShader();
|
||||
s32 PS4_SYSV_ABI sceGnmUpdatePsShader(u32* cmdbuf, u32 size, const u32* ps_regs);
|
||||
s32 PS4_SYSV_ABI sceGnmUpdatePsShader350(u32* cmdbuf, u32 size, const u32* ps_regs);
|
||||
|
|
|
@ -73,7 +73,12 @@ int EventFlagInternal::Wait(u64 bits, WaitMode wait_mode, ClearMode clear_mode,
|
|||
|
||||
int EventFlagInternal::Poll(u64 bits, WaitMode wait_mode, ClearMode clear_mode, u64* result) {
|
||||
u32 micros = 0;
|
||||
return Wait(bits, wait_mode, clear_mode, result, µs);
|
||||
auto ret = Wait(bits, wait_mode, clear_mode, result, µs);
|
||||
if (ret == ORBIS_KERNEL_ERROR_ETIMEDOUT) {
|
||||
// Poll returns EBUSY instead.
|
||||
ret = ORBIS_KERNEL_ERROR_EBUSY;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void EventFlagInternal::Set(u64 bits) {
|
||||
|
|
|
@ -94,7 +94,7 @@ int EqueueInternal::GetTriggeredEvents(SceKernelEvent* ev, int num) {
|
|||
|
||||
for (auto& event : m_events) {
|
||||
if (event.IsTriggered()) {
|
||||
if (ev->flags & SceKernelEvent::Flags::Clear) {
|
||||
if (event.event.flags & SceKernelEvent::Flags::Clear) {
|
||||
event.Reset();
|
||||
}
|
||||
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/kernel/event_queues.h"
|
||||
|
||||
#include <boost/asio/placeholders.hpp>
|
||||
|
||||
namespace Libraries::Kernel {
|
||||
|
||||
extern boost::asio::io_context io_context;
|
||||
|
@ -136,8 +134,7 @@ s32 PS4_SYSV_ABI sceKernelAddHRTimerEvent(SceKernelEqueue eq, int id, timespec*
|
|||
event.timer = std::make_unique<boost::asio::steady_timer>(
|
||||
io_context, std::chrono::microseconds(total_us - HrTimerSpinlockThresholdUs));
|
||||
|
||||
event.timer->async_wait(
|
||||
std::bind(SmallTimerCallback, boost::asio::placeholders::error, eq, event.event));
|
||||
event.timer->async_wait(std::bind(SmallTimerCallback, std::placeholders::_1, eq, event.event));
|
||||
|
||||
if (!eq->AddEvent(event)) {
|
||||
return ORBIS_KERNEL_ERROR_ENOMEM;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
namespace Libraries::Kernel {
|
||||
|
||||
std::vector<Core::FileSys::DirEntry> GetDirectoryEntries(const std::string& path) {
|
||||
std::vector<Core::FileSys::DirEntry> GetDirectoryEntries(const std::filesystem::path& path) {
|
||||
std::vector<Core::FileSys::DirEntry> files;
|
||||
for (const auto& entry : std::filesystem::directory_iterator(path)) {
|
||||
auto& dir_entry = files.emplace_back();
|
||||
|
@ -58,7 +58,7 @@ int PS4_SYSV_ABI sceKernelOpen(const char* path, int flags, u16 mode) {
|
|||
if (directory) {
|
||||
file->is_directory = true;
|
||||
file->m_guest_name = path;
|
||||
file->m_host_name = mnt->GetHostDirectory(file->m_guest_name);
|
||||
file->m_host_name = mnt->GetHostPath(file->m_guest_name);
|
||||
if (!std::filesystem::is_directory(file->m_host_name)) { // directory doesn't exist
|
||||
h->DeleteHandle(handle);
|
||||
return ORBIS_KERNEL_ERROR_ENOTDIR;
|
||||
|
@ -72,7 +72,7 @@ int PS4_SYSV_ABI sceKernelOpen(const char* path, int flags, u16 mode) {
|
|||
}
|
||||
} else {
|
||||
file->m_guest_name = path;
|
||||
file->m_host_name = mnt->GetHostFile(file->m_guest_name);
|
||||
file->m_host_name = mnt->GetHostPath(file->m_guest_name);
|
||||
int e = 0;
|
||||
if (read) {
|
||||
e = file->f.Open(file->m_host_name, Common::FS::FileAccessMode::Read);
|
||||
|
@ -165,8 +165,7 @@ int PS4_SYSV_ABI sceKernelUnlink(const char* path) {
|
|||
auto* h = Common::Singleton<Core::FileSys::HandleTable>::Instance();
|
||||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||
|
||||
std::string host_path = mnt->GetHostFile(path);
|
||||
|
||||
const auto host_path = mnt->GetHostPath(path);
|
||||
if (host_path.empty()) {
|
||||
return SCE_KERNEL_ERROR_EACCES;
|
||||
}
|
||||
|
@ -175,7 +174,7 @@ int PS4_SYSV_ABI sceKernelUnlink(const char* path) {
|
|||
return SCE_KERNEL_ERROR_EPERM;
|
||||
}
|
||||
|
||||
auto* file = h->getFile(host_path);
|
||||
auto* file = h->GetFile(host_path);
|
||||
if (file != nullptr) {
|
||||
file->f.Unlink();
|
||||
}
|
||||
|
@ -250,7 +249,7 @@ int PS4_SYSV_ABI sceKernelMkdir(const char* path, u16 mode) {
|
|||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||
std::string dir_name = mnt->GetHostFile(path);
|
||||
const auto dir_name = mnt->GetHostPath(path);
|
||||
if (std::filesystem::exists(dir_name)) {
|
||||
return SCE_KERNEL_ERROR_EEXIST;
|
||||
}
|
||||
|
@ -279,7 +278,7 @@ int PS4_SYSV_ABI posix_mkdir(const char* path, u16 mode) {
|
|||
int PS4_SYSV_ABI sceKernelStat(const char* path, OrbisKernelStat* sb) {
|
||||
LOG_INFO(Kernel_Fs, "(PARTIAL) path = {}", path);
|
||||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||
const auto& path_name = mnt->GetHostFile(path);
|
||||
const auto path_name = mnt->GetHostPath(path);
|
||||
std::memset(sb, 0, sizeof(OrbisKernelStat));
|
||||
const bool is_dir = std::filesystem::is_directory(path_name);
|
||||
const bool is_file = std::filesystem::is_regular_file(path_name);
|
||||
|
@ -314,7 +313,7 @@ int PS4_SYSV_ABI posix_stat(const char* path, OrbisKernelStat* sb) {
|
|||
|
||||
int PS4_SYSV_ABI sceKernelCheckReachability(const char* path) {
|
||||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||
std::string path_name = mnt->GetHostFile(path);
|
||||
const auto path_name = mnt->GetHostPath(path);
|
||||
if (!std::filesystem::exists(path_name)) {
|
||||
return SCE_KERNEL_ERROR_ENOENT;
|
||||
}
|
||||
|
|
|
@ -222,7 +222,7 @@ s32 PS4_SYSV_ABI sceKernelLoadStartModule(const char* moduleFileName, size_t arg
|
|||
}
|
||||
|
||||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||
const auto path = mnt->GetHostFile(moduleFileName);
|
||||
const auto path = mnt->GetHostPath(moduleFileName);
|
||||
|
||||
// Load PRX module and relocate any modules that import it.
|
||||
auto* linker = Common::Singleton<Core::Linker>::Instance();
|
||||
|
|
|
@ -318,7 +318,8 @@ int PS4_SYSV_ABI scePthreadAttrGetstackaddr(const ScePthreadAttr* attr, void** s
|
|||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
int result = pthread_attr_getstackaddr(&(*attr)->pth_attr, stack_addr);
|
||||
size_t stack_size = 0;
|
||||
int result = pthread_attr_getstack(&(*attr)->pth_attr, stack_addr, &stack_size);
|
||||
|
||||
return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
@ -340,7 +341,10 @@ int PS4_SYSV_ABI scePthreadAttrSetstackaddr(ScePthreadAttr* attr, void* addr) {
|
|||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
int result = pthread_attr_setstackaddr(&(*attr)->pth_attr, addr);
|
||||
size_t stack_size = 0;
|
||||
pthread_attr_getstacksize(&(*attr)->pth_attr, &stack_size);
|
||||
|
||||
int result = pthread_attr_setstack(&(*attr)->pth_attr, addr, stack_size);
|
||||
|
||||
return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
@ -831,6 +835,10 @@ int PS4_SYSV_ABI posix_pthread_mutexattr_destroy(ScePthreadMutexattr* attr) {
|
|||
return result;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI posix_pthread_once(pthread_once_t* once_control, void (*init_routine)(void)) {
|
||||
return pthread_once(once_control, init_routine);
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI posix_pthread_mutexattr_setprotocol(ScePthreadMutexattr* attr, int protocol) {
|
||||
int result = scePthreadMutexattrSetprotocol(attr, protocol);
|
||||
LOG_INFO(Kernel_Pthread, "redirect to scePthreadMutexattrSetprotocol: result = {}", result);
|
||||
|
@ -1002,17 +1010,7 @@ ScePthread PThreadPool::Create() {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef _WIN64
|
||||
auto* ret = new PthreadInternal{};
|
||||
#else
|
||||
// TODO: Linux specific hack
|
||||
static u8* hint_address = reinterpret_cast<u8*>(0x7FFFFC000ULL);
|
||||
auto* ret = reinterpret_cast<PthreadInternal*>(
|
||||
mmap(hint_address, sizeof(PthreadInternal), PROT_READ | PROT_WRITE,
|
||||
MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0));
|
||||
hint_address += Common::AlignUp(sizeof(PthreadInternal), 4_KB);
|
||||
#endif
|
||||
|
||||
ret->is_free = false;
|
||||
ret->is_detached = false;
|
||||
ret->is_almost_done = false;
|
||||
|
@ -1443,6 +1441,7 @@ void pthreadSymbolsRegister(Core::Loader::SymbolsResolver* sym) {
|
|||
posix_pthread_condattr_destroy);
|
||||
LIB_FUNCTION("EjllaAqAPZo", "libScePosix", 1, "libkernel", 1, 1,
|
||||
posix_pthread_condattr_setclock);
|
||||
LIB_FUNCTION("Z4QosVuAsA0", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_once);
|
||||
|
||||
// openorbis weird functions
|
||||
LIB_FUNCTION("7H0iTOciTLo", "libkernel", 1, "libkernel", 1, 1, posix_pthread_mutex_lock);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/assert.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "common/singleton.h"
|
||||
#include "core/file_sys/fs.h"
|
||||
#include "core/libraries/libc/libc_stdio.h"
|
||||
|
@ -10,11 +10,12 @@ namespace Libraries::LibC {
|
|||
|
||||
std::FILE* PS4_SYSV_ABI ps4_fopen(const char* filename, const char* mode) {
|
||||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||
FILE* f = std::fopen(mnt->GetHostFile(filename).c_str(), mode);
|
||||
const auto host_path = mnt->GetHostPath(filename).string();
|
||||
FILE* f = std::fopen(host_path.c_str(), mode);
|
||||
if (f != nullptr) {
|
||||
LOG_INFO(Lib_LibC, "fopen = {}", mnt->GetHostFile(filename).c_str());
|
||||
LOG_INFO(Lib_LibC, "fopen = {}", host_path);
|
||||
} else {
|
||||
LOG_INFO(Lib_LibC, "fopen can't open = {}", mnt->GetHostFile(filename).c_str());
|
||||
LOG_INFO(Lib_LibC, "fopen can't open = {}", host_path);
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
#include "error_codes.h"
|
||||
|
||||
namespace Libraries::SaveData {
|
||||
static std::string g_mount_point = "/savedata0"; // temp mount point (todo)
|
||||
|
||||
static constexpr std::string_view g_mount_point = "/savedata0"; // temp mount point (todo)
|
||||
std::string game_serial;
|
||||
|
||||
int PS4_SYSV_ABI sceSaveDataAbort() {
|
||||
|
@ -50,11 +51,11 @@ int PS4_SYSV_ABI sceSaveDataChangeInternal() {
|
|||
|
||||
int PS4_SYSV_ABI sceSaveDataCheckBackupData(const OrbisSaveDataCheckBackupData* check) {
|
||||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||
std::string mount_dir = mnt->GetHostFile(check->dirName->data);
|
||||
const auto mount_dir = mnt->GetHostPath(check->dirName->data);
|
||||
if (!std::filesystem::exists(mount_dir)) {
|
||||
return ORBIS_SAVE_DATA_ERROR_NOT_FOUND;
|
||||
}
|
||||
LOG_INFO(Lib_SaveData, "called = {}", mount_dir);
|
||||
LOG_INFO(Lib_SaveData, "called = {}", mount_dir.string());
|
||||
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
@ -344,14 +345,14 @@ int PS4_SYSV_ABI sceSaveDataGetSaveDataMemory2(OrbisSaveDataMemoryGet2* getParam
|
|||
return false;
|
||||
}
|
||||
file.Seek(getParam->data->offset);
|
||||
size_t nbytes = file.ReadRaw<u8>(getParam->data->buf, getParam->data->bufSize);
|
||||
file.ReadRaw<u8>(getParam->data->buf, getParam->data->bufSize);
|
||||
LOG_INFO(Lib_SaveData, "called: bufSize = {}, offset = {}", getParam->data->bufSize,
|
||||
getParam->data->offset);
|
||||
}
|
||||
|
||||
if (getParam->param != nullptr) {
|
||||
Common::FS::IOFile file1(mount_dir / "param.txt", Common::FS::FileAccessMode::Read);
|
||||
size_t nbytes = file1.ReadRaw<u8>(getParam->param, sizeof(OrbisSaveDataParam));
|
||||
Common::FS::IOFile file(mount_dir / "param.txt", Common::FS::FileAccessMode::Read);
|
||||
file.ReadRaw<u8>(getParam->param, sizeof(OrbisSaveDataParam));
|
||||
}
|
||||
|
||||
return ORBIS_OK;
|
||||
|
@ -421,13 +422,13 @@ int PS4_SYSV_ABI sceSaveDataIsMounted() {
|
|||
int PS4_SYSV_ABI sceSaveDataLoadIcon(const OrbisSaveDataMountPoint* mountPoint,
|
||||
OrbisSaveDataIcon* icon) {
|
||||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||
std::string mount_dir = mnt->GetHostFile(mountPoint->data);
|
||||
LOG_INFO(Lib_SaveData, "called: dir = {}", mount_dir);
|
||||
const auto mount_dir = mnt->GetHostPath(mountPoint->data);
|
||||
LOG_INFO(Lib_SaveData, "called: dir = {}", mount_dir.string());
|
||||
|
||||
if (icon != nullptr) {
|
||||
Common::FS::IOFile file(mount_dir + "/save_data.png", Common::FS::FileAccessMode::Read);
|
||||
Common::FS::IOFile file(mount_dir / "save_data.png", Common::FS::FileAccessMode::Read);
|
||||
icon->bufSize = file.GetSize();
|
||||
size_t nbytes = file.ReadRaw<u8>(icon->buf, icon->bufSize);
|
||||
file.ReadRaw<u8>(icon->buf, icon->bufSize);
|
||||
}
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
@ -436,6 +437,7 @@ s32 saveDataMount(u32 user_id, char* dir_name, u32 mount_mode,
|
|||
OrbisSaveDataMountResult* mount_result) {
|
||||
const auto& mount_dir = Common::FS::GetUserPath(Common::FS::PathType::SaveDataDir) /
|
||||
std::to_string(user_id) / game_serial / dir_name;
|
||||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||
switch (mount_mode) {
|
||||
case ORBIS_SAVE_DATA_MOUNT_MODE_RDONLY:
|
||||
case ORBIS_SAVE_DATA_MOUNT_MODE_RDWR:
|
||||
|
@ -444,9 +446,8 @@ s32 saveDataMount(u32 user_id, char* dir_name, u32 mount_mode,
|
|||
if (!std::filesystem::exists(mount_dir)) {
|
||||
return ORBIS_SAVE_DATA_ERROR_NOT_FOUND;
|
||||
}
|
||||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||
mount_result->mount_status = 0;
|
||||
std::strncpy(mount_result->mount_point.data, g_mount_point.c_str(), 16);
|
||||
g_mount_point.copy(mount_result->mount_point.data, 16);
|
||||
mnt->Mount(mount_dir, mount_result->mount_point.data);
|
||||
} break;
|
||||
case ORBIS_SAVE_DATA_MOUNT_MODE_CREATE:
|
||||
|
@ -458,16 +459,15 @@ s32 saveDataMount(u32 user_id, char* dir_name, u32 mount_mode,
|
|||
ORBIS_SAVE_DATA_MOUNT_MODE_COPY_ICON:
|
||||
case ORBIS_SAVE_DATA_MOUNT_MODE_CREATE | ORBIS_SAVE_DATA_MOUNT_MODE_DESTRUCT_OFF |
|
||||
ORBIS_SAVE_DATA_MOUNT_MODE_COPY_ICON: {
|
||||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||
if (std::filesystem::exists(mount_dir)) {
|
||||
std::strncpy(mount_result->mount_point.data, g_mount_point.c_str(), 16);
|
||||
g_mount_point.copy(mount_result->mount_point.data, 16);
|
||||
mnt->Mount(mount_dir, mount_result->mount_point.data);
|
||||
mount_result->required_blocks = 0;
|
||||
mount_result->mount_status = 0;
|
||||
return ORBIS_SAVE_DATA_ERROR_EXISTS;
|
||||
}
|
||||
if (std::filesystem::create_directories(mount_dir)) {
|
||||
std::strncpy(mount_result->mount_point.data, g_mount_point.c_str(), 16);
|
||||
g_mount_point.copy(mount_result->mount_point.data, 16);
|
||||
mnt->Mount(mount_dir, mount_result->mount_point.data);
|
||||
mount_result->mount_status = 1;
|
||||
}
|
||||
|
@ -478,8 +478,7 @@ s32 saveDataMount(u32 user_id, char* dir_name, u32 mount_mode,
|
|||
if (!std::filesystem::exists(mount_dir)) {
|
||||
std::filesystem::create_directories(mount_dir);
|
||||
}
|
||||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||
std::strncpy(mount_result->mount_point.data, g_mount_point.c_str(), 16);
|
||||
g_mount_point.copy(mount_result->mount_point.data, 16);
|
||||
mnt->Mount(mount_dir, mount_result->mount_point.data);
|
||||
mount_result->mount_status = 1;
|
||||
} break;
|
||||
|
@ -561,12 +560,12 @@ int PS4_SYSV_ABI sceSaveDataRestoreLoadSaveDataMemory() {
|
|||
int PS4_SYSV_ABI sceSaveDataSaveIcon(const OrbisSaveDataMountPoint* mountPoint,
|
||||
const OrbisSaveDataIcon* icon) {
|
||||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||
std::string mount_dir = mnt->GetHostFile(mountPoint->data);
|
||||
LOG_INFO(Lib_SaveData, "called = {}", mount_dir);
|
||||
const auto mount_dir = mnt->GetHostPath(mountPoint->data);
|
||||
LOG_INFO(Lib_SaveData, "called = {}", mount_dir.string());
|
||||
|
||||
if (icon != nullptr) {
|
||||
Common::FS::IOFile file(mount_dir + "/save_data.png", Common::FS::FileAccessMode::Write);
|
||||
file.WriteRaw<u8>((void*)icon->buf, icon->bufSize);
|
||||
Common::FS::IOFile file(mount_dir / "save_data.png", Common::FS::FileAccessMode::Write);
|
||||
file.WriteRaw<u8>(icon->buf, icon->bufSize);
|
||||
}
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
@ -585,12 +584,13 @@ int PS4_SYSV_ABI sceSaveDataSetParam(const OrbisSaveDataMountPoint* mountPoint,
|
|||
OrbisSaveDataParamType paramType, const void* paramBuf,
|
||||
size_t paramBufSize) {
|
||||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||
std::string mount_dir = mnt->GetHostFile(mountPoint->data);
|
||||
LOG_INFO(Lib_SaveData, "called = {}, mountPoint->data = {}", mount_dir, mountPoint->data);
|
||||
const auto mount_dir = mnt->GetHostPath(mountPoint->data);
|
||||
LOG_INFO(Lib_SaveData, "called = {}, mountPoint->data = {}", mount_dir.string(),
|
||||
mountPoint->data);
|
||||
|
||||
if (paramBuf != nullptr) {
|
||||
Common::FS::IOFile file(mount_dir + "/param.txt", Common::FS::FileAccessMode::Write);
|
||||
file.WriteRaw<u8>((void*)paramBuf, paramBufSize);
|
||||
Common::FS::IOFile file(mount_dir / "param.txt", Common::FS::FileAccessMode::Write);
|
||||
file.WriteRaw<u8>(paramBuf, paramBufSize);
|
||||
}
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
@ -738,24 +738,23 @@ int PS4_SYSV_ABI sceSaveDataUmountSys() {
|
|||
int PS4_SYSV_ABI sceSaveDataUmountWithBackup(const OrbisSaveDataMountPoint* mountPoint) {
|
||||
LOG_ERROR(Lib_SaveData, "called = {}", std::string(mountPoint->data));
|
||||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||
std::string mount_dir = mnt->GetHostFile(mountPoint->data);
|
||||
const auto mount_dir = mnt->GetHostPath(mountPoint->data);
|
||||
if (!std::filesystem::exists(mount_dir)) {
|
||||
return ORBIS_SAVE_DATA_ERROR_NOT_FOUND;
|
||||
} else {
|
||||
std::filesystem::path mnt_dir(mount_dir);
|
||||
std::filesystem::create_directories(mnt_dir.parent_path() / "backup");
|
||||
|
||||
for (const auto& entry : std::filesystem::recursive_directory_iterator(mnt_dir)) {
|
||||
const auto& path = entry.path();
|
||||
std::filesystem::path target_path = mnt_dir.parent_path() / "backup";
|
||||
|
||||
if (std::filesystem::is_regular_file(path)) {
|
||||
std::filesystem::copy(path, target_path,
|
||||
std::filesystem::copy_options::overwrite_existing);
|
||||
}
|
||||
}
|
||||
mnt->Unmount(mount_dir, mountPoint->data);
|
||||
}
|
||||
|
||||
std::filesystem::create_directories(mount_dir.parent_path() / "backup");
|
||||
|
||||
for (const auto& entry : std::filesystem::recursive_directory_iterator(mount_dir)) {
|
||||
const auto& path = entry.path();
|
||||
const auto target_path = mount_dir.parent_path() / "backup";
|
||||
if (std::filesystem::is_regular_file(path)) {
|
||||
std::filesystem::copy(path, target_path,
|
||||
std::filesystem::copy_options::overwrite_existing);
|
||||
}
|
||||
}
|
||||
|
||||
mnt->Unmount(mount_dir, mountPoint->data);
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,13 +50,16 @@ s32 PS4_SYSV_ABI sceVideoOutAddFlipEvent(Kernel::SceKernelEqueue eq, s32 handle,
|
|||
Kernel::EqueueEvent event{};
|
||||
event.event.ident = SCE_VIDEO_OUT_EVENT_FLIP;
|
||||
event.event.filter = Kernel::SceKernelEvent::Filter::VideoOut;
|
||||
// The library only sets EV_ADD but kernel driver forces EV_CLEAR
|
||||
event.event.flags = Kernel::SceKernelEvent::Flags::Clear;
|
||||
event.event.udata = udata;
|
||||
event.event.fflags = 0;
|
||||
event.event.data = 0;
|
||||
event.data = port;
|
||||
eq->AddEvent(event);
|
||||
|
||||
port->flip_events.push_back(eq);
|
||||
return eq->AddEvent(event);
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
s32 PS4_SYSV_ABI sceVideoOutAddVblankEvent(Kernel::SceKernelEqueue eq, s32 handle, void* udata) {
|
||||
|
@ -74,13 +77,16 @@ s32 PS4_SYSV_ABI sceVideoOutAddVblankEvent(Kernel::SceKernelEqueue eq, s32 handl
|
|||
Kernel::EqueueEvent event{};
|
||||
event.event.ident = SCE_VIDEO_OUT_EVENT_VBLANK;
|
||||
event.event.filter = Kernel::SceKernelEvent::Filter::VideoOut;
|
||||
// The library only sets EV_ADD but kernel driver forces EV_CLEAR
|
||||
event.event.flags = Kernel::SceKernelEvent::Flags::Clear;
|
||||
event.event.udata = udata;
|
||||
event.event.fflags = 0;
|
||||
event.event.data = 0;
|
||||
event.data = port;
|
||||
eq->AddEvent(event);
|
||||
|
||||
port->vblank_events.push_back(eq);
|
||||
return eq->AddEvent(event);
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
s32 PS4_SYSV_ABI sceVideoOutRegisterBuffers(s32 handle, s32 startIndex, void* const* addresses,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue