Merge pull request #939 from raven02/patch-10

FP: Implement LIT instruction
This commit is contained in:
B1ackDaemon 2014-12-29 02:55:22 +02:00
commit 325dd0308b
4 changed files with 33 additions and 46 deletions

View File

@ -455,7 +455,7 @@ void GLFragmentDecompilerThread::Task()
case RSX_FP_OPCODE_EX2: SetDst("exp2($0)"); break;
case RSX_FP_OPCODE_FLR: SetDst("floor($0)"); break;
case RSX_FP_OPCODE_FRC: SetDst("fract($0)"); break;
case RSX_FP_OPCODE_LIT: LOG_ERROR(RSX, "Unimplemented SCB instruction: LIT"); break;
case RSX_FP_OPCODE_LIT: SetDst("vec4(1.0, $0.x, ($0.x > 0.0 ? exp($0.w * log2($0.y)) : 0.0), 1.0)"); break;
case RSX_FP_OPCODE_LIF: SetDst("vec4(1.0, $0.y, ($0.y > 0 ? pow(2.0, $0.w) : 0.0), 1.0)"); break;
case RSX_FP_OPCODE_LRP: LOG_ERROR(RSX, "Unimplemented SCB instruction: LRP"); break; // TODO: Is this in the right category?
case RSX_FP_OPCODE_LG2: SetDst("log2($0)"); break;
@ -670,7 +670,10 @@ void GLShaderProgram::DecompileAsync(RSXShaderProgram& prog)
void GLShaderProgram::Compile()
{
if (m_id) glDeleteShader(m_id);
if (m_id)
{
glDeleteShader(m_id);
}
m_id = glCreateShader(GL_FRAGMENT_SHADER);

View File

@ -562,7 +562,9 @@ void GLVertexDecompilerThread::Task()
m_instr_count++;
if (i < m_data.size())
{
LOG_ERROR(RSX, "Program end before buffer end.");
}
break;
}
@ -635,6 +637,7 @@ void GLVertexDecompilerThread::Task()
AddCode("}");
}
break;
/* This triggers opengl driver lost connection error code 7
case RSX_SCA_OPCODE_BRI: // works differently (BRI o[1].x(TR) L0;)
{
uint jump_position;
@ -666,6 +669,7 @@ void GLVertexDecompilerThread::Task()
AddCode("}");
}
break;
*/
case RSX_SCA_OPCODE_CAL:
// works same as BRI
AddCode("$ifcond $f(); //CAL");
@ -739,17 +743,6 @@ void GLVertexDecompilerThread::Task()
Emu.Pause();
break;
}
if (d3.end)
{
m_instr_count++;
if (i < m_data.size())
{
LOG_ERROR(RSX, "Program end before buffer end.");
}
break;
}
}
if (is_has_BRA || !m_jump_lvls.empty())
@ -829,7 +822,10 @@ void GLVertexProgram::DecompileAsync(RSXVertexProgram& prog)
void GLVertexProgram::Compile()
{
if (id) glDeleteShader(id);
if (id)
{
glDeleteShader(id);
}
id = glCreateShader(GL_VERTEX_SHADER);

View File

@ -1801,7 +1801,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const
case CELL_GCM_ZCULL_STATS2:
case CELL_GCM_ZCULL_STATS3:
value = 0;
LOG_ERROR(RSX, "NV4097_GET_REPORT: Unimplemented type %d", type);
LOG_WARNING(RSX, "NV4097_GET_REPORT: Unimplemented type %d", type);
break;
default:

View File

@ -87,8 +87,6 @@ void Emulator::Init()
m_modules_init[0]->Init();
m_modules_init.erase(m_modules_init.begin());
}
//if(m_memory_viewer) m_memory_viewer->Close();
//m_memory_viewer = new MemoryViewerPanel(wxGetApp().m_MainFrame);
}
void Emulator::SetPath(const std::string& path, const std::string& elf_path)
@ -141,7 +139,7 @@ void Emulator::CheckStatus()
//if (IsAllStoped)
//{
// //ConLog.Warning("all stoped!");
// //LOG_WARNING(GENERAL, "all stoped!");
// Pause(); //Stop();
//}
}
@ -222,7 +220,7 @@ void Emulator::Load()
LOG_NOTICE(LOADER, "%s -> %s", GetVFS().m_devices[i]->GetPs3Path().c_str(), GetVFS().m_devices[i]->GetLocalPath().c_str());
}
LOG_NOTICE(LOADER, " ");//used to be skip_line
LOG_NOTICE(LOADER, " "); //used to be skip_line
vfsFile sfo("/app_home/../PARAM.SFO");
PSFLoader psf(sfo);
psf.Load(false);
@ -246,16 +244,16 @@ void Emulator::Load()
Emu.GetVFS().Mount("/dev_bdvd/", bdvd, new vfsDeviceLocalFile());
LOG_NOTICE(LOADER, "/dev_bdvd/ remounted into %s", bdvd.c_str());
}
LOG_NOTICE(LOADER, " ");//used to be skip_line
LOG_NOTICE(LOADER, " "); //used to be skip_line
if(m_elf_path.empty())
if (m_elf_path.empty())
{
GetVFS().GetDeviceLocal(m_path, m_elf_path);
}
vfsFile f(m_elf_path);
if(!f.IsOpened())
if (!f.IsOpened())
{
LOG_ERROR(LOADER, "Elf not found! (%s - %s)", m_path.c_str(), m_elf_path.c_str());
return;
@ -299,37 +297,31 @@ void Emulator::Load()
void Emulator::Run()
{
if(!IsReady())
if (!IsReady())
{
Load();
if(!IsReady()) return;
}
if(IsRunning()) Stop();
if(IsPaused())
if (IsRunning()) Stop();
if (IsPaused())
{
Resume();
return;
}
SendDbgCommand(DID_START_EMU);
//ConLog.Write("run...");
m_status = Running;
//if(m_memory_viewer && m_memory_viewer->exit) safe_delete(m_memory_viewer);
//m_memory_viewer->SetPC(loader.GetEntry());
//m_memory_viewer->Show();
//m_memory_viewer->ShowPC();
GetCPU().Exec();
SendDbgCommand(DID_STARTED_EMU);
}
void Emulator::Pause()
{
if(!IsRunning()) return;
//ConLog.Write("pause...");
if (!IsRunning()) return;
SendDbgCommand(DID_PAUSE_EMU);
if (InterlockedCompareExchange((volatile u32*)&m_status, Paused, Running) == Running)
@ -340,21 +332,19 @@ void Emulator::Pause()
void Emulator::Resume()
{
if(!IsPaused()) return;
//ConLog.Write("resume...");
if (!IsPaused()) return;
SendDbgCommand(DID_RESUME_EMU);
m_status = Running;
CheckStatus();
//if(IsRunning() && Ini.CPUDecoderMode.GetValue() != 1) GetCPU().Exec();
SendDbgCommand(DID_RESUMED_EMU);
}
void Emulator::Stop()
{
if(IsStopped()) return;
//ConLog.Write("shutdown...");
SendDbgCommand(DID_STOP_EMU);
m_status = Stopped;
@ -396,7 +386,6 @@ void Emulator::Stop()
CurGameInfo.Reset();
Memory.Close();
//if(m_memory_viewer && m_memory_viewer->IsShown()) m_memory_viewer->Hide();
SendDbgCommand(DID_STOPPED_EMU);
}
@ -409,12 +398,12 @@ void Emulator::SavePoints(const std::string& path)
f << bpdb_version << break_count << marked_count;
if(break_count)
if (break_count)
{
f.write(reinterpret_cast<char*>(&m_break_points[0]), sizeof(u64) * break_count);
}
if(marked_count)
if (marked_count)
{
f.write(reinterpret_cast<char*>(&m_marked_points[0]), sizeof(u64) * marked_count);
}
@ -435,20 +424,19 @@ void Emulator::LoadPoints(const std::string& path)
u16 version;
f >> version >> break_count >> marked_count;
if(version != bpdb_version ||
(sizeof(u16) + break_count * sizeof(u64) + sizeof(u32) + marked_count * sizeof(u64) + sizeof(u32)) != length)
if (version != bpdb_version || (sizeof(u16) + break_count * sizeof(u64) + sizeof(u32) + marked_count * sizeof(u64) + sizeof(u32)) != length)
{
LOG_ERROR(LOADER, "'%s' is broken", path.c_str());
return;
}
if(break_count > 0)
if (break_count > 0)
{
m_break_points.resize(break_count);
f.read(reinterpret_cast<char*>(&m_break_points[0]), sizeof(u64) * break_count);
}
if(marked_count > 0)
if (marked_count > 0)
{
m_marked_points.resize(marked_count);
f.read(reinterpret_cast<char*>(&m_marked_points[0]), sizeof(u64) * marked_count);