diff --git a/miniwin/CMakeLists.txt b/miniwin/CMakeLists.txt index 52a8cdf9..4a759240 100644 --- a/miniwin/CMakeLists.txt +++ b/miniwin/CMakeLists.txt @@ -69,6 +69,7 @@ if(VITA) SceGxm_stub SceRazorCapture_stub SceRazorHud_stub + taihen_stub ) list(APPEND GRAPHICS_BACKENDS USE_GXM) list(REMOVE_ITEM GRAPHICS_BACKENDS USE_SOFTWARE_RENDER USE_SDL_GPU) diff --git a/miniwin/src/d3drm/backends/gxm/renderer.cpp b/miniwin/src/d3drm/backends/gxm/renderer.cpp index a0f98770..ba8fc0d6 100644 --- a/miniwin/src/d3drm/backends/gxm/renderer.cpp +++ b/miniwin/src/d3drm/backends/gxm/renderer.cpp @@ -78,20 +78,57 @@ static void display_callback(const void* callback_data) sceDisplayWaitSetFrameBuf(); } +#include + +static int load_skprx(const char* name) +{ + int modid = taiLoadKernelModule(name, 0, nullptr); + if(modid < 0) { + sceClibPrintf("%s load: 0x%08x\n", name, modid); + return modid; + } + int status; + int ret = taiStartKernelModule(modid, 0, nullptr, 0, nullptr, &status); + if(ret < 0) { + sceClibPrintf("%s start: 0x%08x\n", name, ret); + } + return ret; +} + +static int load_suprx(const char* name) +{ + int modid = _sceKernelLoadModule(name, 0, nullptr); + if(modid < 0) { + sceClibPrintf("%s load: 0x%08x\n", name, modid); + return modid; + } + int status; + int ret = sceKernelStartModule(modid, 0, nullptr, 0, nullptr, &status); + if(ret < 0) { + sceClibPrintf("%s start: 0x%08x\n", name, ret); + } + return ret; +} + +static const bool extra_debug = false; + static void load_razor() { - int status; - int mod_id = _sceKernelLoadModule("app0:librazorcapture_es4.suprx", 0, nullptr); - if (!SCE_ERR(sceKernelStartModule, mod_id, 0, nullptr, 0, nullptr, &status)) { + if(load_suprx("app0:librazorcapture_es4.suprx") >= 0) { with_razor = true; } - /* - int mod_id_hud = _sceKernelLoadModule("app0:librazorhud_es4.suprx", 0, nullptr); - if (!SCE_ERR(sceKernelStartModule, mod_id_hud, 0, nullptr, 0, nullptr, &status)) { - with_razor_hud = true; + if(extra_debug) { + load_skprx("ux0:app/LEGO00001/syslibtrace.skprx"); + load_skprx("ux0:app/LEGO00001/pamgr.skprx"); + + if(load_suprx("app0:libperf.suprx") >= 0) { + } + + if(load_suprx("app0:librazorhud_es4.suprx") >= 0) { + with_razor_hud = true; + } } - */ if (with_razor) { sceRazorGpuCaptureEnableSalvage("ux0:data/gpu_crash.sgx"); @@ -777,7 +814,7 @@ void copySurfaceToGxm(DirectDrawSurfaceImpl* surface, uint8_t* textureData, size } } -Uint32 GXMRenderer::GetTextureId(IDirect3DRMTexture* iTexture) +Uint32 GXMRenderer::GetTextureId(IDirect3DRMTexture* iTexture, bool isUi) { auto texture = static_cast(iTexture); auto surface = static_cast(texture->m_surface); @@ -984,25 +1021,6 @@ Uint32 GXMRenderer::GetMeshId(IDirect3DRMMesh* mesh, const MeshGroup* meshGroup) return (Uint32) (m_meshes.size() - 1); } -void GXMRenderer::GetDesc(D3DDEVICEDESC* halDesc, D3DDEVICEDESC* helDesc) -{ - halDesc->dcmColorModel = D3DCOLORMODEL::RGB; - halDesc->dwFlags = D3DDD_DEVICEZBUFFERBITDEPTH; - halDesc->dwDeviceZBufferBitDepth = DDBD_16; - halDesc->dwDeviceZBufferBitDepth |= DDBD_32; - helDesc->dwDeviceRenderBitDepth = DDBD_32; - halDesc->dpcTriCaps.dwTextureCaps = D3DPTEXTURECAPS_PERSPECTIVE; - halDesc->dpcTriCaps.dwShadeCaps = D3DPSHADECAPS_ALPHAFLATBLEND; - halDesc->dpcTriCaps.dwTextureFilterCaps = D3DPTFILTERCAPS_LINEAR; - - memset(helDesc, 0, sizeof(D3DDEVICEDESC)); -} - -const char* GXMRenderer::GetName() -{ - return "GXM"; -} - bool razor_triggered = false; bool razor_live_started = false; bool razor_display_enabled = true; diff --git a/miniwin/src/internal/d3drmrenderer_gxm.h b/miniwin/src/internal/d3drmrenderer_gxm.h index b343e3f3..a2c06cdd 100644 --- a/miniwin/src/internal/d3drmrenderer_gxm.h +++ b/miniwin/src/internal/d3drmrenderer_gxm.h @@ -105,10 +105,8 @@ class GXMRenderer : public Direct3DRMRenderer { void PushLights(const SceneLight* lightsArray, size_t count) override; void SetProjection(const D3DRMMATRIX4D& projection, D3DVALUE front, D3DVALUE back) override; void SetFrustumPlanes(const Plane* frustumPlanes) override; - Uint32 GetTextureId(IDirect3DRMTexture* texture) override; + Uint32 GetTextureId(IDirect3DRMTexture* texture, bool isUi) override; Uint32 GetMeshId(IDirect3DRMMesh* mesh, const MeshGroup* meshGroup) override; - void GetDesc(D3DDEVICEDESC* halDesc, D3DDEVICEDESC* helDesc) override; - const char* GetName() override; HRESULT BeginFrame() override; void EnableTransparency() override; void SubmitDraw( @@ -222,9 +220,18 @@ class GXMRenderer : public Direct3DRMRenderer { inline static void GXMRenderer_EnumDevice(LPD3DENUMDEVICESCALLBACK cb, void* ctx) { - Direct3DRMRenderer* device = new GXMRenderer(1); - if (device) { - EnumDevice(cb, ctx, device, GXM_GUID); - delete device; - } + D3DDEVICEDESC halDesc = {}; + halDesc.dcmColorModel = D3DCOLORMODEL::RGB; + halDesc.dwFlags = D3DDD_DEVICEZBUFFERBITDEPTH; + halDesc.dwDeviceZBufferBitDepth = DDBD_16; + halDesc.dwDeviceZBufferBitDepth |= DDBD_32; + halDesc.dpcTriCaps.dwTextureCaps = D3DPTEXTURECAPS_PERSPECTIVE; + halDesc.dpcTriCaps.dwShadeCaps = D3DPSHADECAPS_ALPHAFLATBLEND; + halDesc.dpcTriCaps.dwTextureFilterCaps = D3DPTFILTERCAPS_LINEAR; + + D3DDEVICEDESC helDesc = {}; + helDesc.dwDeviceRenderBitDepth = DDBD_32; + + EnumDevice(cb, ctx, "GXM HAL", &halDesc, &helDesc, GXM_GUID); } +