mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-21 03:55:32 +00:00
Merge branch 'master' into nastys-patch-16
This commit is contained in:
commit
60d0632ccf
3 changed files with 37 additions and 36 deletions
|
@ -129,9 +129,9 @@ error_code sys_memory_allocate(cpu_thread& cpu, u64 size, u64 flags, vm::ptr<u32
|
|||
return {CELL_ENOMEM, dct.size - dct.used};
|
||||
}
|
||||
|
||||
if (const auto area = reserve_map(size, align))
|
||||
if (const auto area = reserve_map(static_cast<u32>(size), align))
|
||||
{
|
||||
if (const u32 addr = area->alloc(size, nullptr, align))
|
||||
if (const u32 addr = area->alloc(static_cast<u32>(size), nullptr, align))
|
||||
{
|
||||
ensure(!g_fxo->get<sys_memory_address_table>().addrs[addr >> 16].exchange(&dct));
|
||||
|
||||
|
@ -139,7 +139,7 @@ error_code sys_memory_allocate(cpu_thread& cpu, u64 size, u64 flags, vm::ptr<u32
|
|||
{
|
||||
sys_memory.notice("sys_memory_allocate(): Allocated 0x%x address (size=0x%x)", addr, size);
|
||||
|
||||
vm::lock_sudo(addr, size);
|
||||
vm::lock_sudo(addr, static_cast<u32>(size));
|
||||
cpu.check_state();
|
||||
*alloc_addr = addr;
|
||||
return CELL_OK;
|
||||
|
|
|
@ -494,6 +494,7 @@ int main(int argc, char** argv)
|
|||
}
|
||||
|
||||
const std::string lock_name = fs::get_cache_dir() + "RPCS3.buf";
|
||||
const std::string log_name = fs::get_cache_dir() + "RPCS3.log";
|
||||
|
||||
static fs::file instance_lock;
|
||||
|
||||
|
@ -512,19 +513,19 @@ int main(int argc, char** argv)
|
|||
{
|
||||
if (fs::exists(lock_name))
|
||||
{
|
||||
report_fatal_error("Another instance of RPCS3 is running.\nClose it or kill its process, if necessary.");
|
||||
report_fatal_error(fmt::format("Another instance of RPCS3 is running.\nClose it or kill its process, if necessary.\n'%s' still exists.", lock_name));
|
||||
}
|
||||
|
||||
report_fatal_error("Cannot create RPCS3.log (access denied)."
|
||||
report_fatal_error(fmt::format("Cannot create '%s' or '%s' (access denied).\n"
|
||||
#ifdef _WIN32
|
||||
"\nNote that RPCS3 cannot be installed in Program Files or similar directories with limited permissions."
|
||||
"Note that RPCS3 cannot be installed in Program Files or similar directories with limited permissions."
|
||||
#else
|
||||
"\nPlease, check RPCS3 permissions in '~/.config/rpcs3'."
|
||||
"Please, check RPCS3 permissions."
|
||||
#endif
|
||||
);
|
||||
, log_name, lock_name));
|
||||
}
|
||||
|
||||
report_fatal_error(fmt::format("Cannot create RPCS3.log (error %s)", fs::g_tls_error));
|
||||
report_fatal_error(fmt::format("Cannot create'%s' or '%s' (error=%s)", log_name, lock_name, fs::g_tls_error));
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -568,7 +569,7 @@ int main(int argc, char** argv)
|
|||
}
|
||||
|
||||
// Limit log size to ~25% of free space
|
||||
log_file = logs::make_file_listener(fs::get_cache_dir() + "RPCS3.log", stats.avail_free / 4);
|
||||
log_file = logs::make_file_listener(log_name, stats.avail_free / 4);
|
||||
}
|
||||
|
||||
static std::unique_ptr<logs::listener> fatal_listener = std::make_unique<fatal_error_listener>();
|
||||
|
|
|
@ -451,47 +451,47 @@ void logs::message::broadcast(const char* fmt, const fmt_type_info* sup, ...) co
|
|||
logs::file_writer::file_writer(const std::string& name, u64 max_size)
|
||||
: m_max_size(max_size)
|
||||
{
|
||||
if (!name.empty() && max_size)
|
||||
if (name.empty() || !max_size)
|
||||
{
|
||||
// Initialize ringbuffer
|
||||
m_fptr = std::make_unique<uchar[]>(s_log_size);
|
||||
return;
|
||||
}
|
||||
|
||||
// Actual log file (allowed to fail)
|
||||
if (!m_fout.open(name, fs::rewrite))
|
||||
{
|
||||
fprintf(stderr, "Log file open failed: %s (error %d)\n", name.c_str(), errno);
|
||||
}
|
||||
// Initialize ringbuffer
|
||||
m_fptr = std::make_unique<uchar[]>(s_log_size);
|
||||
|
||||
// Compressed log, make it inaccessible (foolproof)
|
||||
if (m_fout2.open(name + ".gz", fs::rewrite + fs::unread))
|
||||
{
|
||||
// Actual log file (allowed to fail)
|
||||
if (!m_fout.open(name, fs::rewrite))
|
||||
{
|
||||
fprintf(stderr, "Log file open failed: %s (error %d)\n", name.c_str(), errno);
|
||||
}
|
||||
|
||||
// Compressed log, make it inaccessible (foolproof)
|
||||
if (m_fout2.open(name + ".gz", fs::rewrite + fs::unread))
|
||||
{
|
||||
#ifndef _MSC_VER
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||
#endif
|
||||
if (deflateInit2(&m_zs, 9, Z_DEFLATED, 16 + 15, 9, Z_DEFAULT_STRATEGY) != Z_OK)
|
||||
if (deflateInit2(&m_zs, 9, Z_DEFLATED, 16 + 15, 9, Z_DEFAULT_STRATEGY) != Z_OK)
|
||||
#ifndef _MSC_VER
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
m_fout2.close();
|
||||
}
|
||||
|
||||
if (!m_fout2)
|
||||
{
|
||||
fprintf(stderr, "Log file open failed: %s.gz (error %d)\n", name.c_str(), errno);
|
||||
m_fout2.close();
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_fout2)
|
||||
{
|
||||
fprintf(stderr, "Log file open failed: %s.gz (error %d)\n", name.c_str(), errno);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
// Autodelete compressed log file
|
||||
FILE_DISPOSITION_INFO disp;
|
||||
disp.DeleteFileW = true;
|
||||
SetFileInformationByHandle(m_fout2.get_handle(), FileDispositionInfo, &disp, sizeof(disp));
|
||||
// Autodelete compressed log file
|
||||
FILE_DISPOSITION_INFO disp{};
|
||||
disp.DeleteFileW = true;
|
||||
SetFileInformationByHandle(m_fout2.get_handle(), FileDispositionInfo, &disp, sizeof(disp));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_writer = std::thread([this]()
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue