mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-14 03:59:36 +00:00
Fix house data corruption, progress to first screen
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
#include "QDGraf.h"
|
||||
#include "QDState.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class QDManagerImpl final : public QDManager
|
||||
@@ -20,6 +22,8 @@ namespace PortabilityLayer
|
||||
void DisposeGWorld(CGraf *gw) override;
|
||||
QDState *GetState() override;
|
||||
|
||||
int DepthForPixelFormat(GpPixelFormat_t pixelFormat) const override;
|
||||
|
||||
static QDManagerImpl *GetInstance();
|
||||
|
||||
private:
|
||||
@@ -59,6 +63,9 @@ namespace PortabilityLayer
|
||||
|
||||
switch (depth)
|
||||
{
|
||||
case 1:
|
||||
pixelFormat = GpPixelFormats::kBW1;
|
||||
break;
|
||||
case 8:
|
||||
pixelFormat = (colorTable == nullptr) ? GpPixelFormats::k8BitStandard : GpPixelFormats::k8BitCustom;
|
||||
break;
|
||||
@@ -72,9 +79,6 @@ namespace PortabilityLayer
|
||||
return genericErr;
|
||||
}
|
||||
|
||||
if (depth != 8)
|
||||
return genericErr;
|
||||
|
||||
void *grafStorage = MemoryManager::GetInstance()->Alloc(sizeof(CGraf));
|
||||
if (!grafStorage)
|
||||
return mFulErr;
|
||||
@@ -105,6 +109,25 @@ namespace PortabilityLayer
|
||||
return m_port->GetState();
|
||||
}
|
||||
|
||||
int QDManagerImpl::DepthForPixelFormat(GpPixelFormat_t pixelFormat) const
|
||||
{
|
||||
switch (pixelFormat)
|
||||
{
|
||||
case GpPixelFormats::k8BitStandard:
|
||||
case GpPixelFormats::k8BitCustom:
|
||||
return 8;
|
||||
case GpPixelFormats::kRGB555:
|
||||
return 16;
|
||||
case GpPixelFormats::kRGB24:
|
||||
return 24;
|
||||
case GpPixelFormats::kRGB32:
|
||||
return 32;
|
||||
default:
|
||||
assert(false);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
QDManagerImpl *QDManagerImpl::GetInstance()
|
||||
{
|
||||
return &ms_instance;
|
||||
|
||||
Reference in New Issue
Block a user