Merge pull request #46 from krofna

This commit is contained in:
Alexandro Sánchez Bach 2014-02-21 17:13:57 +01:00
parent 17b877e448
commit e7a721a1fb
15 changed files with 60 additions and 18 deletions

View File

@ -10,4 +10,5 @@
#define Sleep(x) usleep(x * 1000)
#define mkdir(x) mkdir(x, 0777)
#define INFINITE 0xFFFFFFFF
#define _CRT_ALIGN(x) __attribute__((aligned(x)))
#endif

View File

@ -11,7 +11,12 @@ if (CMAKE_COMPILER_IS_GNUCXX)
add_definitions(-fpermissive) # TODO: remove me
endif()
find_package(wxWidgets)
add_definitions(-DGL_GLEXT_PROTOTYPES)
add_definitions(-DGLX_GLXEXT_PROTOTYPES)
find_package(wxWidgets COMPONENTS core base net aui gl REQUIRED)
find_package(OpenGL REQUIRED)
find_package(ZLIB REQUIRED)
include("${wxWidgets_USE_FILE}")
@ -27,11 +32,15 @@ ${CMAKE_SOURCE_DIR}/..
file(
GLOB_RECURSE
RPCS3_SRC
${CMAKE_SOURCE_DIR}/rpcs3.cpp
${CMAKE_SOURCE_DIR}/AppConnector.cpp
${CMAKE_SOURCE_DIR}/Ini.cpp
${CMAKE_SOURCE_DIR}/Emu/*
${CMAKE_SOURCE_DIR}/Gui/*
${CMAKE_SOURCE_DIR}/Loader/*
${CMAKE_SOURCE_DIR}/../Utilities/*
${CMAKE_SOURCE_DIR}/../scetool/scetool.cpp
)
add_executable(rpcs3 ${RPCS3_SRC})
target_link_libraries(rpcs3 ${wxWidgets_LIBRARIES})
target_link_libraries(rpcs3 ${wxWidgets_LIBRARIES} ${OPENGL_LIBRARIES} ${ZLIB_LIBRARIES})

View File

@ -158,7 +158,7 @@ struct DMAC
u32 queue_pos;
u32 proxy_pos;
long queue_lock;
long proxy_lock;
volatile std::atomic<int> proxy_lock;
bool ProcessCmd(u32 cmd, u32 tag, u32 lsa, u64 ea, u32 size)
{
@ -193,7 +193,7 @@ struct DMAC
return MFC_PPU_DMA_QUEUE_FULL;
}
/* while (_InterlockedExchange(&proxy_lock, 1));
/* while (std::atomic_exchange(&proxy_lock, 1));
_mm_lfence();
DMAC_Proxy& p = proxy[proxy_pos];
p.cmd = cmd;
@ -212,7 +212,7 @@ struct DMAC
void ClearCmd()
{
while (_InterlockedExchange(&proxy_lock, 1));
while (std::atomic_exchange(&proxy_lock, 1));
_mm_lfence();
memcpy(proxy, proxy + 1, --proxy_pos * sizeof(DMAC_Proxy));
_mm_sfence();
@ -298,4 +298,4 @@ struct MFC
MFC_QStatus.SetValue(mask);
}
}
};
};

View File

@ -652,7 +652,12 @@ void GLGSRender::OnInitThread()
glEnable(GL_TEXTURE_2D);
glEnable(GL_SCISSOR_TEST);
#ifdef _WIN32
glSwapInterval(Ini.GSVSyncEnable.GetValue() ? 1 : 0);
#else
if (GLXDrawable drawable = glXGetCurrentDrawable())
glXSwapIntervalEXT(glXGetCurrentDisplay(), drawable, Ini.GSVSyncEnable.GetValue() ? 1 : 0);
#endif
}
void GLGSRender::OnExitThread()
@ -961,7 +966,7 @@ void GLGSRender::ExecCMD()
if(m_set_depth_bounds)
{
//ConLog.Warning("glDepthBounds(%f, %f)", m_depth_bounds_min, m_depth_bounds_max);
glDepthBounds(m_depth_bounds_min, m_depth_bounds_max);
glDepthBoundsEXT(m_depth_bounds_min, m_depth_bounds_max);
checkForGlError("glDepthBounds");
}

View File

@ -78,7 +78,7 @@ OPENGL_PROC(PFNGLPROGRAMUNIFORM1FPROC, ProgramUniform1f);
OPENGL_PROC(PFNGLPROGRAMUNIFORM4FPROC, ProgramUniform4f);
OPENGL_PROC(PFNGLUNIFORMMATRIX4FVPROC, UniformMatrix4fv);
OPENGL_PROC(PFNGLUSEPROGRAMPROC, UseProgram);
OPENGL_PROC2(PFNGLDEPTHBOUNDSEXTPROC, DepthBounds, glDepthBoundsEXT);
OPENGL_PROC2(PFNGLDEPTHBOUNDSEXTPROC, DepthBoundsEXT, glDepthBoundsEXT);
OPENGL_PROC(PFNGLSTENCILOPSEPARATEPROC, StencilOpSeparate);
OPENGL_PROC(PFNGLSTENCILFUNCSEPARATEPROC, StencilFuncSeparate);
OPENGL_PROC(PFNGLSTENCILMASKSEPARATEPROC, StencilMaskSeparate);

View File

@ -3,18 +3,22 @@
void InitProcTable()
{
#ifdef _WIN32
#define OPENGL_PROC(p, n) OPENGL_PROC2(p, n, gl##n)
#define OPENGL_PROC2(p, n, tn) /*if(!gl##n)*/ if(!(gl##n = (p)wglGetProcAddress(#tn))) ConLog.Error("OpenGL: initialization of " #tn " failed.")
#include "GLProcTable.tbl"
#undef OPENGL_PROC
#undef OPENGL_PROC2
#endif
}
#ifdef _WIN32
#define OPENGL_PROC(p, n) p gl##n = nullptr
#define OPENGL_PROC2(p, n, tn) OPENGL_PROC(p, n)
#include "GLProcTable.tbl"
#undef OPENGL_PROC
#undef OPENGL_PROC2
#endif
OpenGL::OpenGL()
{
@ -29,18 +33,22 @@ OpenGL::~OpenGL()
void OpenGL::Init()
{
#ifdef _WIN32
#define OPENGL_PROC(p, n) OPENGL_PROC2(p, n, gl##n)
#define OPENGL_PROC2(p, n, tn) if(!(n = (p)wglGetProcAddress(#tn))) ConLog.Error("OpenGL: initialization of " #tn " failed.")
#include "GLProcTable.tbl"
#undef OPENGL_PROC
#undef OPENGL_PROC2
#endif
}
void OpenGL::Close()
{
#ifdef _WIN32
#define OPENGL_PROC(p, n) n = nullptr
#define OPENGL_PROC2(p, n, tn) OPENGL_PROC(p, n)
#include "GLProcTable.tbl"
#undef OPENGL_PROC
#undef OPENGL_PROC2
#endif
}

View File

@ -4,7 +4,6 @@
#ifdef _WIN32
typedef BOOL (WINAPI* PFNWGLSWAPINTERVALEXTPROC) (int interval);
#endif
#define OPENGL_PROC(p, n) extern p gl##n
#define OPENGL_PROC2(p, n, tn) OPENGL_PROC(p, n)
@ -12,6 +11,11 @@ typedef BOOL (WINAPI* PFNWGLSWAPINTERVALEXTPROC) (int interval);
#undef OPENGL_PROC
#undef OPENGL_PROC2
#else
#include <GL/glx.h>
#include <GL/glxext.h>
#endif
void InitProcTable();
struct OpenGL

View File

@ -44,7 +44,7 @@ int cellPngDecOpen(u32 mainHandle, mem32_t subHandle, mem_ptr_t<CellPngDecSrc> s
// Get size of file
MemoryAllocator<CellFsStat> sb; // Alloc a CellFsStat struct
ret = cellFsFstat(current_subHandle->fd, sb);
ret = cellFsFstat(current_subHandle->fd, sb.GetAddr());
if(ret != CELL_OK) return ret;
current_subHandle->fileSize = sb->st_size; // Get CellFsStat.st_size
break;

View File

@ -190,7 +190,7 @@ void Emulator::Load()
if(IsSelf(m_path.ToStdString()))
{
std::string self_path = m_path;
std::string self_path = m_path.mb_str();
std::string elf_path = wxFileName(m_path).GetPath().c_str();
if(wxFileName(m_path).GetFullName().CmpNoCase("EBOOT.BIN") == 0)

View File

@ -127,8 +127,10 @@ CompilerELF::CompilerELF(wxWindow* parent)
" b exit, 0, 0\n"
);
#ifdef _WIN32
::SendMessage((HWND)hex_list->GetHWND(), WM_VSCROLL, SB_BOTTOM, 0);
::SendMessage((HWND)asm_list->GetHWND(), WM_VSCROLL, SB_BOTTOM, 0);
#endif
}
CompilerELF::~CompilerELF()
@ -318,6 +320,7 @@ void CompilerELF::OnScroll(wxScrollWinEvent& event)
dst = hex_list;
}
#ifdef _WIN32
if(!m_disable_scroll && src && dst && event.GetOrientation() == wxVERTICAL)
{
s64 kind = -1;
@ -364,6 +367,7 @@ void CompilerELF::OnScroll(wxScrollWinEvent& event)
m_disable_scroll = false;
}
}
#endif
event.Skip();
}

View File

@ -268,7 +268,9 @@ void LogFrame::Task()
m_log.SetColumnWidth(0, -1); // crashes on exit
m_log.SetColumnWidth(1, -1);
#ifdef _WIN32
::SendMessage((HWND)m_log.GetHWND(), WM_VSCROLL, SB_BOTTOM, 0);
#endif
}
LogBuffer.Flush();

View File

@ -571,7 +571,7 @@ void RSXDebugger::GetSettings()
LIST_SETTINGS_ADD("Alpha func", !(render.m_set_alpha_func) ? "(none)" : wxString::Format("0x%x (%s)",
render.m_alpha_func,
ParseGCMEnum(render.m_alpha_func, CELL_GCM_ENUM).wx_str()));
ParseGCMEnum(render.m_alpha_func, CELL_GCM_ENUM)));
LIST_SETTINGS_ADD("Blend color", !(render.m_set_blend_color) ? "(none)" : wxString::Format("R:%d, G:%d, B:%d, A:%d",
render.m_blend_color_r,
render.m_blend_color_g,
@ -591,10 +591,10 @@ void RSXDebugger::GetSettings()
LIST_SETTINGS_ADD("Depth bounds", wxString::Format("Min:%f, Max:%f", render.m_depth_bounds_min, render.m_depth_bounds_max));
LIST_SETTINGS_ADD("Depth func", !(render.m_set_depth_func) ? "(none)" : wxString::Format("0x%x (%s)",
render.m_depth_func,
ParseGCMEnum(render.m_depth_func, CELL_GCM_ENUM).wx_str()));
ParseGCMEnum(render.m_depth_func, CELL_GCM_ENUM)));
LIST_SETTINGS_ADD("Draw mode", wxString::Format("%d (%s)",
render.m_draw_mode,
ParseGCMEnum(render.m_draw_mode, CELL_GCM_PRIMITIVE_ENUM).wx_str()));
ParseGCMEnum(render.m_draw_mode, CELL_GCM_PRIMITIVE_ENUM)));
LIST_SETTINGS_ADD("Scissor", wxString::Format("X:%d, Y:%d, W:%d, H:%d",
render.m_scissor_x,
render.m_scissor_y,
@ -602,7 +602,7 @@ void RSXDebugger::GetSettings()
render.m_scissor_h));
LIST_SETTINGS_ADD("Stencil func", !(render.m_set_stencil_func) ? "(none)" : wxString::Format("0x%x (%s)",
render.m_stencil_func,
ParseGCMEnum(render.m_stencil_func, CELL_GCM_ENUM).wx_str()));
ParseGCMEnum(render.m_stencil_func, CELL_GCM_ENUM)));
LIST_SETTINGS_ADD("Surface Pitch A", wxString::Format("0x%x", render.m_surface_pitch_a));
LIST_SETTINGS_ADD("Surface Pitch B", wxString::Format("0x%x", render.m_surface_pitch_b));
LIST_SETTINGS_ADD("Surface Pitch C", wxString::Format("0x%x", render.m_surface_pitch_c));
@ -692,7 +692,7 @@ void RSXDebugger::OnSelectTexture(wxListEvent& event)
UpdateInformation();
}
wxString RSXDebugger::ParseGCMEnum(u32 value, u32 type)
const char* RSXDebugger::ParseGCMEnum(u32 value, u32 type)
{
switch(type)
{

View File

@ -79,7 +79,7 @@ public:
virtual void SetPrograms(wxListEvent& event);
virtual void OnSelectTexture(wxListEvent& event);
wxString ParseGCMEnum(u32 value, u32 type);
const char* ParseGCMEnum(u32 value, u32 type);
wxString DisAsmCommand(u32 cmd, u32 count, u32 currentAddr, u32 ioAddr);

View File

@ -1,7 +1,9 @@
#include "stdafx.h"
#include "Ini.h"
#ifdef _WIN32
#include <wx/msw/iniconf.h>
#endif
Inis Ini;
@ -148,9 +150,13 @@ static wxString WindowInfoToString(const WindowInfo wind)
//Ini
Ini::Ini()
{
#ifdef _WIN32
m_Config = new wxIniConfig( wxEmptyString, wxEmptyString,
wxGetCwd() + "\\rpcs3.ini",
wxEmptyString, wxCONFIG_USE_LOCAL_FILE );
#else
m_Config = new wxConfig("rpcs3");
#endif
}
void Ini::Save(wxString key, int value)
@ -211,4 +217,4 @@ wxString Ini::Load(wxString key, const wxString& def_value)
WindowInfo Ini::Load(wxString key, const WindowInfo& def_value)
{
return StringToWindowInfo(m_Config->Read(key, WindowInfoToString(def_value)));
}
}

View File

@ -2,7 +2,10 @@
#include "rpcs3.h"
#include "Ini.h"
#include "Emu/System.h"
#ifdef _WIN32
#include <wx/msw/wrapwin.h>
#endif
const wxEventType wxEVT_DBG_COMMAND = wxNewEventType();