This commit is contained in:
Nekotekina 2015-10-14 22:34:26 +03:00
parent a974ee009e
commit ec0005195d
3 changed files with 28 additions and 11 deletions

View file

@ -11,9 +11,6 @@
#include "Emu/SysCalls/lv2/sys_time.h" #include "Emu/SysCalls/lv2/sys_time.h"
#include "Utilities/types.h" #include "Utilities/types.h"
#include <chrono>
using namespace std::chrono_literals;
extern "C" extern "C"
{ {
@ -342,7 +339,7 @@ namespace rsx
namespace nv3089 namespace nv3089
{ {
force_inline void image_in(u32 arg) never_inline void image_in(u32 arg)
{ {
const u16 width = method_registers[NV3089_IMAGE_IN_SIZE]; const u16 width = method_registers[NV3089_IMAGE_IN_SIZE];
const u16 height = method_registers[NV3089_IMAGE_IN_SIZE] >> 16; const u16 height = method_registers[NV3089_IMAGE_IN_SIZE] >> 16;
@ -384,7 +381,10 @@ namespace rsx
} }
if (!dst_dma) if (!dst_dma)
{
LOG_ERROR(RSX, "dst_dma not set");
return; return;
}
LOG_ERROR(RSX, "NV3089_IMAGE_IN_SIZE: src = 0x%x, dst = 0x%x", src_offset, dst_offset); LOG_ERROR(RSX, "NV3089_IMAGE_IN_SIZE: src = 0x%x, dst = 0x%x", src_offset, dst_offset);
@ -440,9 +440,9 @@ namespace rsx
pixels_src = swizzled_pixels; pixels_src = swizzled_pixels;
} }
LOG_WARNING(RSX, "NV3089_IMAGE_IN_SIZE: w=%d, h=%d, pitch=%d, offset=0x%x, inX=%f, inY=%f, scaleX=%f, scaleY=%f", LOG_WARNING(RSX, "NV3089_IMAGE_IN_SIZE: SIZE=0x%08x, pitch=0x%x, offset=0x%x, scaleX=%f, scaleY=%f, CLIP_SIZE=0x%08x, OUT_SIZE=0x%08x",
width, height, pitch, src_offset, double(u) / 16, double(v) / 16, double(1 << 20) / (method_registers[NV3089_DS_DX]), method_registers[NV3089_IMAGE_IN_SIZE], pitch, src_offset, double(1 << 20) / (method_registers[NV3089_DS_DX]), double(1 << 20) / (method_registers[NV3089_DT_DY]),
double(1 << 20) / (method_registers[NV3089_DT_DY])); method_registers[NV3089_CLIP_SIZE], method_registers[NV3089_IMAGE_OUT_SIZE]);
if (in_bpp != out_bpp && width != out_w && height != out_h) if (in_bpp != out_bpp && width != out_w && height != out_h)
{ {
@ -586,6 +586,21 @@ namespace rsx
rsx->timer_sync.Start(); rsx->timer_sync.Start();
} }
void user_command(thread* rsx, u32 arg)
{
if (rsx->user_handler)
{
Emu.GetCallbackManager().Async([func = rsx->user_handler, arg](PPUThread& ppu)
{
func(ppu, arg);
});
}
else
{
throw EXCEPTION("User handler not set");
}
}
struct __rsx_methods_t struct __rsx_methods_t
{ {
using rsx_impl_method_t = void(*)(u32); using rsx_impl_method_t = void(*)(u32);
@ -707,6 +722,7 @@ namespace rsx
// custom methods // custom methods
bind_cpu_only<GCM_FLIP_COMMAND, flip_command>(); bind_cpu_only<GCM_FLIP_COMMAND, flip_command>();
bind_cpu_only<GCM_SET_USER_COMMAND, user_command>();
} }
} __rsx_methods; } __rsx_methods;
@ -763,7 +779,7 @@ namespace rsx
res = (u32)RSXIOMem.RealAddr(offset); // TODO: Error Check? res = (u32)RSXIOMem.RealAddr(offset); // TODO: Error Check?
if (res == 0) if (res == 0)
{ {
throw fmt::format("GetAddress(offset=0x%x, location=0x%x): RSXIO memory not mapped", offset, location); throw EXCEPTION("GetAddress(offset=0x%x, location=0x%x): RSXIO memory not mapped", offset, location);
} }
//if (Emu.GetGSManager().GetRender().strict_ordering[offset >> 20]) //if (Emu.GetGSManager().GetRender().strict_ordering[offset >> 20])

View file

@ -15,13 +15,13 @@ class CallbackManager
std::shared_ptr<PPUThread> m_cb_thread; std::shared_ptr<PPUThread> m_cb_thread;
public: public:
// register checked callback (accepts CPUThread&, returns s32) // Register checked callback
void Register(check_cb_t func); void Register(check_cb_t func);
// register async callback, called in callback thread (accepts CPUThread&) // Register async callback, called in callback thread
void Async(async_cb_t func); void Async(async_cb_t func);
// get one registered callback // Get one registered callback
check_cb_t Check(); check_cb_t Check();
void Init(); void Init();

View file

@ -41,6 +41,7 @@
#include <forward_list> #include <forward_list>
#include <typeindex> #include <typeindex>
#include <future> #include <future>
#include <chrono>
using namespace std::string_literals; using namespace std::string_literals;
using namespace std::chrono_literals; using namespace std::chrono_literals;