Implement console_write and GetHomeDataExportPath

This commit is contained in:
Raul Tambre 2015-09-10 17:30:14 +03:00
parent cd7fbae583
commit ea376e7751
12 changed files with 173 additions and 112 deletions

View file

@ -289,6 +289,9 @@ template<typename T> std::string FragmentProgramDecompiler::GetSRC(T src)
ret += AddConst();
break;
case 3: // ??? Used by a few games, what is it?
LOG_ERROR(RSX, "Src type 3 used, please report this to a developer.");
default:
LOG_ERROR(RSX, "Bad src type %d", u32{ src.reg_type });
Emu.Pause();
@ -315,7 +318,10 @@ std::string FragmentProgramDecompiler::BuildCode()
{
//main += fmt::format("\tgl_FragColor = %c0;\n", m_ctrl & 0x40 ? 'r' : 'h');
if (m_ctrl & 0xe) main += m_ctrl & 0x40 ? "\tgl_FragDepth = r1.z;\n" : "\tgl_FragDepth = h2.z;\n";
if (m_ctrl & 0xe)
{
main += m_ctrl & 0x40 ? "\tgl_FragDepth = r1.z;\n" : "\tgl_FragDepth = h0.z;\n";
}
std::stringstream OS;
insertHeader(OS);

View file

@ -282,6 +282,14 @@ enum
CELL_GCM_CONTEXT_DMA_NOTIFY_MAIN_0 = 0x6660420F,
};
// User Clip Values
enum
{
CELL_GCM_USER_CLIP_PLANE_DISABLE = 0,
CELL_GCM_USER_CLIP_PLANE_ENABLE_LT = 1,
CELL_GCM_USER_CLIP_PLANE_ENABLE_GE = 2,
};
struct CellGcmControl
{
atomic_be_t<u32> put;
@ -1440,9 +1448,10 @@ static const std::string GetMethodName(const u32 id)
{ NV4097_SET_TRANSFORM_BRANCH_BITS, "NV4097_SET_TRANSFORM_BRANCH_BITS" }
};
for(auto& s: METHOD_NAME_LIST) {
for (auto& s: METHOD_NAME_LIST)
{
if (s.id == id)
return "CELL_GCM_" + s.name;
return s.name;
}
return fmt::format("unknown/illegal method [0x%08x]", id);

View file

@ -300,7 +300,7 @@ s32 cellFontGetRenderCharGlyphMetrics(vm::ptr<CellFont> font, u32 code, vm::ptr<
s32 cellFontRenderCharGlyphImage(vm::ptr<CellFont> font, u32 code, vm::ptr<CellFontRenderSurface> surface, float x, float y, vm::ptr<CellFontGlyphMetrics> metrics, vm::ptr<CellFontImageTransInfo> transInfo)
{
cellFont.Log("cellFontRenderCharGlyphImage(font=*0x%x, code=0x%x, surface=*0x%x, x=%f, y=%f, metrics=*0x%x, trans=*0x%x)", font, code, surface, x, y, metrics, transInfo);
cellFont.Notice("cellFontRenderCharGlyphImage(font=*0x%x, code=0x%x, surface=*0x%x, x=%f, y=%f, metrics=*0x%x, trans=*0x%x)", font, code, surface, x, y, metrics, transInfo);
if (!font->renderer_addr)
{
@ -374,7 +374,7 @@ s32 cellFontGetEffectSlant(vm::ptr<CellFont> font, vm::ptr<float> slantParam)
s32 cellFontGetFontIdCode(vm::ptr<CellFont> font, u32 code, vm::ptr<u32> fontId, vm::ptr<u32> fontCode)
{
cellFont.Todo("cellFontGetFontIdCode(font=*0x%x, code=0x%x, fontId=*0x%x, fontCode=*0x%x)", font, code, fontId, fontCode);
cellFont.Todo("cellFontGetFontIdCode(font=*0x%x, code=%d, fontId=*0x%x, fontCode=*0x%x)", font, code, fontId, fontCode);
// TODO: ?
return CELL_OK;

View file

@ -789,7 +789,6 @@ s32 sdata_unpack(const std::string& packed_file, const std::string& unpacked_fil
cellFs.Warning("cellFsSdataOpen: Compressed SDATA files are not supported yet.");
return CELL_EFSSPECIFIC;
}
// SDATA file is NOT compressed
else
{
@ -826,7 +825,7 @@ s32 sdata_unpack(const std::string& packed_file, const std::string& unpacked_fil
s32 cellFsSdataOpen(PPUThread& ppu, vm::cptr<char> path, s32 flags, vm::ptr<u32> fd, vm::cptr<void> arg, u64 size)
{
cellFs.Log("cellFsSdataOpen(path=*0x%x, flags=%#o, fd=*0x%x, arg=*0x%x, size=0x%llx)", path, flags, fd, arg, size);
cellFs.Notice("cellFsSdataOpen(path=*0x%x, flags=%#o, fd=*0x%x, arg=*0x%x, size=0x%llx)", path, flags, fd, arg, size);
if (flags != CELL_FS_O_RDONLY)
{

View file

@ -11,9 +11,13 @@ s32 cellGameSetExitParam()
throw EXCEPTION("");
}
s32 cellGameGetHomeDataExportPath()
s32 cellGameGetHomeDataExportPath(vm::ptr<char> exportPath)
{
throw EXCEPTION("");
cellGameExec.Warning("cellGameGetHomeDataExportPath(exportPath=0x%x)", exportPath);
// TODO: PlayStation home is defunct.
return CELL_GAME_ERROR_NOAPP;
}
s32 cellGameGetHomePath()

View file

@ -432,7 +432,8 @@ s32 cellGcmSetDisplayBuffer(u32 id, u32 offset, u32 pitch, u32 width, u32 height
{
cellGcmSys.Log("cellGcmSetDisplayBuffer(id=0x%x,offset=0x%x,pitch=%d,width=%d,height=%d)", id, offset, width ? pitch / width : pitch, width, height);
if (id > 7) {
if (id > 7)
{
cellGcmSys.Error("cellGcmSetDisplayBuffer: CELL_EINVAL");
return CELL_EINVAL;
}
@ -444,7 +445,8 @@ s32 cellGcmSetDisplayBuffer(u32 id, u32 offset, u32 pitch, u32 width, u32 height
buffers[id].width = width;
buffers[id].height = height;
if (id + 1 > Emu.GetGSManager().GetRender().m_gcm_buffers_count) {
if (id + 1 > Emu.GetGSManager().GetRender().m_gcm_buffers_count)
{
Emu.GetGSManager().GetRender().m_gcm_buffers_count = id + 1;
}

View file

@ -12,7 +12,7 @@
extern Module cellL10n;
//translate code id to code name. some codepage may has another name.
// Translate code id to code name. some codepage may has another name.
// If this makes your compilation fail, try replace the string code with one in "iconv -l"
bool _L10nCodeParse(s32 code, std::string& retCode)
{
@ -77,7 +77,7 @@ bool _L10nCodeParse(s32 code, std::string& retCode)
}
}
//translate code id to code name.
// Translate code id to code name.
// If this makes your compilation fail, try replace the string code with one in "iconv -l"
bool _L10nCodeParse(s32 code, u32& retCode)
{

View file

@ -11,8 +11,16 @@ extern Module sys_io;
s32 cellMouseInit(u32 max_connect)
{
sys_io.Warning("cellMouseInit(max_connect=%d)", max_connect);
if(Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_ALREADY_INITIALIZED;
if(max_connect > 7) return CELL_MOUSE_ERROR_INVALID_PARAMETER;
if (Emu.GetMouseManager().IsInited())
{
return CELL_MOUSE_ERROR_ALREADY_INITIALIZED;
}
if (max_connect > 7)
{
return CELL_MOUSE_ERROR_INVALID_PARAMETER;
}
Emu.GetMouseManager().Init(max_connect);
return CELL_OK;
@ -22,8 +30,16 @@ s32 cellMouseInit(u32 max_connect)
s32 cellMouseClearBuf(u32 port_no)
{
sys_io.Log("cellMouseClearBuf(port_no=%d)", port_no);
if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED;
if(port_no >= Emu.GetMouseManager().GetMice().size()) return CELL_MOUSE_ERROR_INVALID_PARAMETER;
if (!Emu.GetMouseManager().IsInited())
{
return CELL_MOUSE_ERROR_UNINITIALIZED;
}
if (port_no >= Emu.GetMouseManager().GetMice().size())
{
return CELL_MOUSE_ERROR_INVALID_PARAMETER;
}
//?
@ -33,7 +49,12 @@ s32 cellMouseClearBuf(u32 port_no)
s32 cellMouseEnd()
{
sys_io.Log("cellMouseEnd()");
if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED;
if (!Emu.GetMouseManager().IsInited())
{
return CELL_MOUSE_ERROR_UNINITIALIZED;
}
Emu.GetMouseManager().Close();
return CELL_OK;
}
@ -41,7 +62,11 @@ s32 cellMouseEnd()
s32 cellMouseGetInfo(vm::ptr<CellMouseInfo> info)
{
sys_io.Log("cellMouseGetInfo(info=*0x%x)", info);
if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED;
if (!Emu.GetMouseManager().IsInited())
{
return CELL_MOUSE_ERROR_UNINITIALIZED;
}
const MouseInfo& current_info = Emu.GetMouseManager().GetInfo();
info->max_connect = current_info.max_connect;
@ -57,8 +82,15 @@ s32 cellMouseGetInfo(vm::ptr<CellMouseInfo> info)
s32 cellMouseInfoTabletMode(u32 port_no, vm::ptr<CellMouseInfoTablet> info)
{
sys_io.Log("cellMouseInfoTabletMode(port_no=%d, info=*0x%x)", port_no, info);
if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED;
if(port_no >= Emu.GetMouseManager().GetMice().size()) return CELL_MOUSE_ERROR_INVALID_PARAMETER;
if (!Emu.GetMouseManager().IsInited())
{
return CELL_MOUSE_ERROR_UNINITIALIZED;
}
if (port_no >= Emu.GetMouseManager().GetMice().size())
{
return CELL_MOUSE_ERROR_INVALID_PARAMETER;
}
info->is_supported = 0; // Unimplemented: (0=Tablet mode is not supported)
info->mode = 1; // Unimplemented: (1=Mouse mode)
@ -69,8 +101,14 @@ s32 cellMouseInfoTabletMode(u32 port_no, vm::ptr<CellMouseInfoTablet> info)
s32 cellMouseGetData(u32 port_no, vm::ptr<CellMouseData> data)
{
sys_io.Log("cellMouseGetData(port_no=%d, data=*0x%x)", port_no, data);
if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED;
if(port_no >= Emu.GetMouseManager().GetMice().size()) return CELL_MOUSE_ERROR_NO_DEVICE;
if (!Emu.GetMouseManager().IsInited())
{
return CELL_MOUSE_ERROR_UNINITIALIZED;
}
if (port_no >= Emu.GetMouseManager().GetMice().size())
{
return CELL_MOUSE_ERROR_NO_DEVICE;
}
MouseData& current_data = Emu.GetMouseManager().GetData(port_no);
data->update = current_data.update;

View file

@ -51,7 +51,7 @@ s32 cellVideoOutGetResolution(u32 resolutionId, vm::ptr<CellVideoOutResolution>
s32 cellVideoOutConfigure(u32 videoOut, vm::ptr<CellVideoOutConfiguration> config, vm::ptr<CellVideoOutOption> option, u32 waitForEvent)
{
cellSysutil.Warning("cellVideoOutConfigure(videoOut=%d, config=*0x%x, option=*0x%x, waitForEvent=0x%x)", videoOut, config, option, waitForEvent);
cellSysutil.Warning("cellVideoOutConfigure(videoOut=%d, config=*0x%x, option=*0x%x, waitForEvent=%d)", videoOut, config, option, waitForEvent);
switch (videoOut)
{

View file

@ -145,9 +145,12 @@ s32 console_putc()
throw EXCEPTION("");
}
s32 console_write()
void console_write(vm::ptr<char> data, u32 len)
{
throw EXCEPTION("");
sysPrxForUser.Warning("console_write(data=*0x%x, len=%d)", data, len);
sysPrxForUser.Warning("*** data='%s'", data.get_ptr());
LOG_NOTICE(TTY, "%s", data.get_ptr());
}