diff --git a/Source/Render/DCSurface.cpp b/Source/Render/DCSurface.cpp index b17520ee..a490a2cf 100644 --- a/Source/Render/DCSurface.cpp +++ b/Source/Render/DCSurface.cpp @@ -10,6 +10,73 @@ std::shared_ptr AcquireBackBufferSurface(CRenderSystemBase* system) { return system ? system->BackBufferSurface() : std::shared_ptr{}; } +// FUNCTION: fn_02274 +CRenderer* RenderSystemHolder::CreateRenderer() { + return this->system ? this->system->CreateRenderer() : nullptr; +} + + + + +// FUNCTION: fn_02278 +HRESULT RenderSystemHolder::Close() { + return this->system ? this->system->Close() : static_cast(0x8000000E); +} + + +// FUNCTION: fn_02280 +void RenderSystemHolder::UpdateOption() { + if (this->system) { + this->system->UpdateOption(); + } +} + +// FUNCTION: fn_02281 +void RenderSystemHolder::RestoreDisplayMode() { + if (this->system) { + this->system->RestoreDisplayMode(); + } +} + +// FUNCTION: fn_02282 +void RenderSystemHolder::PrepareErrorDialog() { + if (this->system) { + this->system->PrepareErrorDialog(); + } +} + +// FUNCTION: fn_02285 +std::int32_t RenderSystemHolder::Backend() const { + return this->system ? this->system->Backend() : -1; +} + + +// FUNCTION: fn_02287 +CTexture* RenderSystemHolder::BackBufferTexture() const { + return this->system ? this->system->BackBufferTexture() : nullptr; +} + +// FUNCTION: fn_02288 +std::uint32_t RenderSystemHolder::Height() const { + return this->system ? this->system->Height() : 0; +} + +// FUNCTION: fn_02292 +std::uint32_t RenderSystemHolder::Width() const { + return this->system ? this->system->Width() : 0; +} + +// FUNCTION: fn_02294 +bool RenderSystemHolder::IsWindowed() const { + return this->system ? this->system->IsWindowed() : false; +} + +// FUNCTION: fn_02295 +HRESULT RenderSystemHolder::TestDevice() const { + return this->system ? this->system->TestDevice() : static_cast(0x8000000E); +} + + // OFFSET: 0x00548FE0 // FUNCTION: fn_01864 CDCSurface::CDCSurface(std::shared_ptr surface) : m_surface(std::move(surface)) { diff --git a/Source/Render/DCSurface.h b/Source/Render/DCSurface.h index 9b30bb64..1e912b59 100644 --- a/Source/Render/DCSurface.h +++ b/Source/Render/DCSurface.h @@ -15,34 +15,27 @@ struct ScreenDimensions { int width; }; -inline ScreenDimensions DefaultResolution() { - return ScreenDimensions{768, 1024}; -} +ScreenDimensions* DefaultResolution(ScreenDimensions* output); struct RenderSystemHolder { - CRenderSystemBase* system; + /* 0000 */ CRenderSystemBase* system; - std::int32_t Backend() const { - return this->system ? this->system->Backend() : -1; - } - CTexture* BackBufferTexture() const { - return this->system ? this->system->BackBufferTexture() : nullptr; - } - std::uint32_t Width() const { - return this->system ? this->system->Width() : 0; - } - std::uint32_t Height() const { - return this->system ? this->system->Height() : 0; - } - bool IsWindowed() const { - return this->system ? this->system->IsWindowed() : false; - } - HRESULT TestDevice() const { - return this->system ? this->system->TestDevice() : static_cast(0x8000000E); - } - HRESULT Present(bool option) const { - return this->system ? this->system->Present(option) : static_cast(0x8000000E); - } + CRenderer* CreateRenderer(); + CSurface* CreateSurface(std::uint32_t width, std::uint32_t height); + CTexture* CreateTexture(std::uint32_t width, std::uint32_t height, std::int32_t format, bool dynamic, bool renderTarget); + CSurface* CreateSurfaceOrTexture(std::uint32_t width, std::uint32_t height); + HRESULT Close(); + void DestroySurface(CSurface* surface); + void UpdateOption(); + void RestoreDisplayMode(); + void PrepareErrorDialog(); + std::int32_t Backend() const; + CTexture* BackBufferTexture() const; + std::uint32_t Width() const; + std::uint32_t Height() const; + bool IsWindowed() const; + HRESULT TestDevice() const; + HRESULT Present(bool option) const; }; __declspec(noinline) inline RenderSystemHolder* GetRenderSystemHolder() {