Fix house data corruption, progress to first screen

This commit is contained in:
elasota
2019-12-24 18:39:30 -05:00
parent 3111609536
commit 5cb9b85396
30 changed files with 896 additions and 113 deletions

View File

@@ -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;