1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-21 18:22:33 +01:00
/dev_bdvd/, rap file loading fix
This commit is contained in:
Nekotekina 2016-01-14 15:56:26 +03:00
parent 74ec128e62
commit 8464ab6a23
6 changed files with 92 additions and 95 deletions

View File

@ -1,10 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug - LLVM|x64">
<Configuration>Debug - LLVM</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug - MemLeak|x64">
<Configuration>Debug - MemLeak</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release - LLVM|x64">
<Configuration>Release - LLVM</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
@ -71,64 +83,42 @@
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<PropertyGroup Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\rpcs3_default.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="..\rpcs3_debug.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug - MemLeak|x64'" Label="PropertySheets">
<Import Project="..\rpcs3_debug.props" />
<Import Project="..\rpcs3_memleak.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'" Label="PropertySheets">
<Import Project="..\rpcs3_debug.props" />
<Import Project="..\rpcs3_llvm.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="..\rpcs3_release.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'" Label="PropertySheets">
<Import Project="..\rpcs3_release.props" />
<Import Project="..\rpcs3_llvm.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)lib\$(Configuration)-$(Platform)\</OutDir>
<IntDir>
</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)lib\$(Configuration)-$(Platform)\</OutDir>
<IntDir>
</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ItemDefinitionGroup>
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>false</SDLCheck>
<PreprocessorDefinitions>ASMJIT_STATIC;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PreprocessorDefinitions>ASMJIT_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>false</SDLCheck>
<PreprocessorDefinitions>ASMJIT_STATIC;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View File

@ -820,7 +820,6 @@ int DecryptEDAT(const std::string& input_file_name, const std::string& output_fi
// Prepare the files.
fs::file input(input_file_name);
fs::file output(output_file_name, fom::rewrite);
fs::file rap(rap_file_name);
// Set keys (RIF and DEVKLIC).
unsigned char rifkey[0x10];
@ -879,8 +878,10 @@ int DecryptEDAT(const std::string& input_file_name, const std::string& output_fi
}
// Read the RAP file, if provided.
if (rap)
if (rap_file_name.size())
{
fs::file rap(rap_file_name);
unsigned char rapkey[0x10];
memset(rapkey, 0, 0x10);

View File

@ -75,7 +75,7 @@ s32 npDrmIsAvailable(u32 k_licensee_addr, vm::cptr<char> drm_path)
std::string pf_str("00000001"); // TODO: Allow multiple profiles. Use default for now.
std::string rap_path("/dev_hdd0/home/" + pf_str + "/exdata/");
// Search dev_usb000 for a compatible RAP file.
// Search for a compatible RAP file.
for (const auto entry : vfsDir(rap_path))
{
if (entry->name.find(titleID) != std::string::npos)
@ -88,13 +88,19 @@ s32 npDrmIsAvailable(u32 k_licensee_addr, vm::cptr<char> drm_path)
if (rap_path.back() == '/')
{
sceNp.warning("npDrmIsAvailable(): Can't find RAP file for '%s' (titleID='%s')", drm_path.get_ptr(), titleID);
rap_path.clear();
}
// Decrypt this EDAT using the supplied k_licensee and matching RAP file.
std::string enc_drm_path_local, dec_drm_path_local, rap_path_local;
Emu.GetVFS().GetDevice(enc_drm_path, enc_drm_path_local);
Emu.GetVFS().GetDevice(dec_drm_path, dec_drm_path_local);
Emu.GetVFS().GetDevice(rap_path, rap_path_local);
if (rap_path.size())
{
Emu.GetVFS().GetDevice(rap_path, rap_path_local);
}
if (DecryptEDAT(enc_drm_path_local, dec_drm_path_local, 8, rap_path_local, k_licensee, false) >= 0)
{

View File

@ -218,7 +218,7 @@ void Emulator::Load()
if (dir_list.size() >= 2 && dir_list.back() == "USRDIR" && *(dir_list.end() - 2) == "PS3_GAME")
{
// mount detected /dev_bdvd/ directory
Emu.GetVFS().Mount("/dev_bdvd/", elf_dir.substr(0, elf_dir.length() - 17), new vfsDeviceLocalFile());
Emu.GetVFS().Mount("/dev_bdvd/", elf_dir.substr(0, elf_dir.length() - 16), new vfsDeviceLocalFile());
}
}

View File

@ -27,12 +27,10 @@ LogFrame::LogFrame(wxWindow* parent)
m_log_file.open(fs::get_config_dir() + "RPCS3.log", fom::read | fom::create);
m_tty_file.open(fs::get_config_dir() + "TTY.log", fom::read | fom::create);
// Check for updates every ~10 ms
m_timer.Start(10);
m_tty->SetBackgroundColour(wxColour("Black"));
m_log->SetBackgroundColour(wxColour("Black"));
m_tty->SetFont(wxFont(8, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
m_tty->SetDefaultStyle(wxColour(255, 255, 255));
m_tabs.AddPage(m_log, "Log");
m_tabs.AddPage(m_tty, "TTY");
@ -46,6 +44,9 @@ LogFrame::LogFrame(wxWindow* parent)
Bind(wxEVT_MENU, &LogFrame::OnContextMenu, this, id_log_copy);
Show();
// Check for updates every ~10 ms
m_timer.Start(10);
}
LogFrame::~LogFrame()
@ -101,42 +102,42 @@ void LogFrame::OnContextMenu(wxCommandEvent& event)
void LogFrame::OnTimer(wxTimerEvent& event)
{
char buf[8192];
const auto stamp0 = std::chrono::high_resolution_clock::now();
char buf[4096];
// Get UTF-8 string from file
auto get_utf8 = [&](const fs::file& file, u64 size) -> wxString
{
// Bruteforce valid UTF-8 (TODO)
for (u64 read = file.read(buf, size); read; read--)
size = file.read(buf, size);
for (u64 i = 0; i < size; i++)
{
wxString text = wxString::FromUTF8(buf, read);
if (!text.empty())
// Get UTF-8 sequence length (no real validation performed)
const u64 tail =
(buf[i] & 0xF0) == 0xF0 ? 3 :
(buf[i] & 0xE0) == 0xE0 ? 2 :
(buf[i] & 0xC0) == 0xC0 ? 1 : 0;
if (i + tail >= size)
{
file.seek(read - size, fs::seek_cur);
return text;
file.seek(i - size, fs::seek_cur);
return wxString::FromUTF8(buf, i);
}
}
return{};
return wxString::FromUTF8(buf, size);
};
const auto stamp0 = std::chrono::high_resolution_clock::now();
// Check TTY logs
while (const u64 size = std::min<u64>(sizeof(buf), _log::g_tty_file.size() - m_tty_file.seek(0, fs::seek_cur)))
{
const wxString& text = get_utf8(m_tty_file, size);
if (text.size())
{
m_tty->SetDefaultStyle(wxColour(255, 255, 255));
m_tty->AppendText(text);
}
m_tty->AppendText(text);
// Limit processing time
if (std::chrono::high_resolution_clock::now() >= stamp0 + 4ms)
{
break;
}
if (std::chrono::high_resolution_clock::now() >= stamp0 + 4ms || text.empty()) break;
}
const auto stamp1 = std::chrono::high_resolution_clock::now();
@ -146,16 +147,27 @@ void LogFrame::OnTimer(wxTimerEvent& event)
{
const wxString& text = get_utf8(m_log_file, size);
std::size_t start = 0, pos = 0;
// Append text if necessary
auto flush_logs = [&](u64 start, u64 pos)
{
if (pos != start && m_level <= rpcs3::config.misc.log.level.value())
{
m_log->SetDefaultStyle(m_color);
m_log->AppendText(text.substr(start, pos - start));
}
};
for (; pos < text.size(); pos++)
// Parse log level formatting
for (std::size_t start = 0, pos = 0;; pos++)
{
if (text[pos] == L'·')
{
if (text.size() - pos <= 3)
{
// Cannot get log string: abort
// Cannot get log formatting: abort
m_log_file.seek(0 - text.substr(pos).ToUTF8().length(), fs::seek_cur);
flush_logs(start, pos);
break;
}
@ -177,34 +189,22 @@ void LogFrame::OnTimer(wxTimerEvent& event)
default: continue;
}
if (pos != start && m_level <= rpcs3::config.misc.log.level.value())
{
m_log->SetDefaultStyle(m_color);
m_log->AppendText(text.substr(start, pos - start));
}
flush_logs(start, pos);
start = pos + 3;
m_level = level;
m_color = color;
}
}
}
if (pos != start && m_level <= rpcs3::config.misc.log.level.value())
{
m_log->SetDefaultStyle(m_color);
m_log->AppendText(text.substr(start, pos - start));
}
if (m_log->GetLastPosition() > 1024 * 1024)
{
m_log->Remove(0, m_log->GetLastPosition() - 512 * 1024);
if (pos >= text.size())
{
flush_logs(start, pos);
break;
}
}
// Limit processing time
if (std::chrono::high_resolution_clock::now() >= stamp1 + 3ms)
{
break;
}
if (std::chrono::high_resolution_clock::now() >= stamp1 + 3ms || text.empty()) break;
}
}

View File

@ -3,6 +3,7 @@
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<IncludePath>.\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);..\llvm\include;..\llvm_build\include;$(UniversalCRT_IncludePath);..\minidx12\Include;..\glm;..\GSL\include</IncludePath>
<OutDir>$(SolutionDir)lib\$(Configuration)-$(Platform)\</OutDir>
<LibraryPath>$(SolutionDir)lib\$(Configuration)-$(Platform)\;$(UniversalCRT_LibraryPath_x64);$(LibraryPath)</LibraryPath>
<IntDir>$(SolutionDir)tmp\$(ProjectName)-$(Configuration)-$(Platform)\</IntDir>
@ -13,7 +14,6 @@
</Lib>
<ClCompile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<AdditionalIncludeDirectories>.\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);..\llvm\include;..\llvm_build\include;$(UniversalCRT_IncludePath);..\minidx12\Include;..\glm;..\GSL\include</AdditionalIncludeDirectories>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>false</SDLCheck>
<RuntimeTypeInfo>true</RuntimeTypeInfo>