Merge pull request #1481 from tambry/racoon

Implement _sys_memmove, minor fixes
This commit is contained in:
Ivan 2016-02-25 17:22:55 +03:00
commit a7fbd6c9a9
4 changed files with 33 additions and 15 deletions

View File

@ -22,8 +22,7 @@
static void report_fatal_error(const std::string& msg) static void report_fatal_error(const std::string& msg)
{ {
#ifdef _WIN32 #ifdef _WIN32
const auto& text = msg + "\n\nPlease report this error to the developers. Press (Ctrl+C) to copy this message."; MessageBoxA(0, msg.c_str(), "Fatal error", MB_ICONERROR); // TODO: unicode message
MessageBoxA(0, text.c_str(), "Fatal error", MB_ICONERROR); // TODO: unicode message
#else #else
std::printf("Fatal error: %s\nPlease report this error to the developers.\n", msg.c_str()); std::printf("Fatal error: %s\nPlease report this error to the developers.\n", msg.c_str());
#endif #endif
@ -1195,6 +1194,23 @@ static LONG exception_filter(PEXCEPTION_POINTERS pExp)
// TODO: print registers and the callstack // TODO: print registers and the callstack
// Exception specific messages
if (pExp->ExceptionRecord->ExceptionCode == EXCEPTION_ACCESS_VIOLATION)
{
msg += "\n\nAn internal access violation has occured."
"\nPlease only report this error to the developers, if you're an advanced user and have obtained a stack trace.";
}
else if (pExp->ExceptionRecord->ExceptionCode == EXCEPTION_ILLEGAL_INSTRUCTION)
{
msg += "\n\nAn internal illegal instruction exception has occured."
"\nRPCS3 requires a modern x86-64 CPU that supports SSSE3 (and SSE4.1 for PPU LLVM recompiler)."
"\nPlease make sure that your CPU supports these extensions.";
}
else
{
msg += "\n\nAn unknown internal exception has occured. Please report this to the developers.\nYou can press (Ctrl+C) to copy this message.";
}
// Report fatal error // Report fatal error
report_fatal_error(msg); report_fatal_error(msg);
return EXCEPTION_CONTINUE_SEARCH; return EXCEPTION_CONTINUE_SEARCH;
@ -1232,6 +1248,8 @@ static void signal_handler(int sig, siginfo_t* info, void* uct)
const u64 addr64 = (u64)info->si_addr - (u64)vm::base(0); const u64 addr64 = (u64)info->si_addr - (u64)vm::base(0);
const auto cause = is_writing ? "writing" : "reading"; const auto cause = is_writing ? "writing" : "reading";
// TODO: Exception specific informative messages
if (addr64 < 0x100000000ull && thread_ctrl::get_current()) if (addr64 < 0x100000000ull && thread_ctrl::get_current())
{ {
// Try to process access violation // Try to process access violation
@ -1358,7 +1376,7 @@ void named_thread_t::start()
} }
catch (const std::exception& e) catch (const std::exception& e)
{ {
LOG_FATAL(GENERAL, "Exception: %s\nPlease report this to the developers.", e.what()); LOG_FATAL(GENERAL, "Exception: %s", e.what());
Emu.Pause(); Emu.Pause();
} }
catch (EmulationStopped) catch (EmulationStopped)

View File

@ -1146,9 +1146,10 @@ s32 SJIStoEUCJP()
throw EXCEPTION(""); throw EXCEPTION("");
} }
s32 UTF8stoUTF16s() s32 UTF8stoUTF16s(vm::cptr<void> src, vm::cptr<s32> src_len, vm::ptr<void> dst, vm::ptr<s32> dst_len)
{ {
throw EXCEPTION(""); cellL10n.warning("UTF8stoUTF16s(src=*0x%x, src_len=*0x%x, dst=*0x%x, dst_len=*0x%x)", src, src_len, dst, dst_len);
return _L10nConvertStr(L10N_UTF8, src, src_len, L10N_UTF16, dst, dst_len);
} }
s32 SJISstoUCS2s(vm::cptr<void> src, vm::cptr<s32> src_len, vm::ptr<void> dst, vm::ptr<s32> dst_len) s32 SJISstoUCS2s(vm::cptr<void> src, vm::cptr<s32> src_len, vm::ptr<void> dst, vm::ptr<s32> dst_len)

View File

@ -591,10 +591,11 @@ s32 pngDecodeData(PPUThread& ppu, PHandle handle, PStream stream, vm::ptr<u8> da
// Check if the outputWidthByte is smaller than the intended output length of a line. For example an image might be in RGB, but we need to output 4 components, so we need to perform alpha padding. // Check if the outputWidthByte is smaller than the intended output length of a line. For example an image might be in RGB, but we need to output 4 components, so we need to perform alpha padding.
else if (stream->out_param.outputWidthByte < (stream->out_param.outputWidth * stream->out_param.outputComponents)) else if (stream->out_param.outputWidthByte < (stream->out_param.outputWidth * stream->out_param.outputComponents))
{ {
// Not sure what to do, when a fixed alpha value isn't specified. // Not sure what to do, when a fixed alpha value isn't specified, but specifying full opaque seems to cause no issues currently. Logging this just in case.
if (!stream->fixed_alpha) if (!stream->fixed_alpha)
{ {
throw EXCEPTION("Fixed alpha not specified for padding."); cellPngDec.error("Fixed alpha not specified for padding. Please notify a developer of this.");
stream->fixed_alpha_colour = 255;
} }
// We need to fill alpha (before or after, depending on the output colour format) using the fixed alpha value passed by the game. // We need to fill alpha (before or after, depending on the output colour format) using the fixed alpha value passed by the game.
@ -646,12 +647,6 @@ s32 pngDecodeData(PPUThread& ppu, PHandle handle, PStream stream, vm::ptr<u8> da
// Check if we need to flip the image or leave empty space at the end of a line // Check if we need to flip the image or leave empty space at the end of a line
if ((bytes_per_line > stream->out_param.outputWidthByte) || flip) if ((bytes_per_line > stream->out_param.outputWidthByte) || flip)
{ {
// Flipping is untested
if (flip)
{
throw EXCEPTION("Flipping is not yet supported.");
}
// Get how many bytes per line we need to output - bytesPerLine is total amount of bytes per line, rest is unused and the game can do as it pleases. // Get how many bytes per line we need to output - bytesPerLine is total amount of bytes per line, rest is unused and the game can do as it pleases.
const u32 line_size = std::min(bytes_per_line, stream->out_param.outputWidth * 4); const u32 line_size = std::min(bytes_per_line, stream->out_param.outputWidth * 4);

View File

@ -191,9 +191,13 @@ s32 _sys_memchr()
throw EXCEPTION(""); throw EXCEPTION("");
} }
s32 _sys_memmove() vm::ptr<void> _sys_memmove(vm::ptr<void> dst, vm::cptr<void> src, u32 size)
{ {
throw EXCEPTION(""); sysPrxForUser.trace("_sys_memmove(dst=*0x%x, src=*0x%x, size=%d)", dst, src, size);
memmove(dst.get_ptr(), src.get_ptr(), size);
return dst;
} }
s64 _sys_strlen(vm::cptr<char> str) s64 _sys_strlen(vm::cptr<char> str)