mirror of
https://github.com/elasota/Aerofoil.git
synced 2026-03-01 21:34:15 +00:00
Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d0e457008 | ||
|
|
1bded36339 | ||
|
|
14b0afbdd2 | ||
|
|
6986dd5528 | ||
|
|
3a327a27e7 | ||
|
|
0d304e8a96 | ||
|
|
43cfb7ea6b | ||
|
|
3b5f222d98 | ||
|
|
02bccda8a0 | ||
|
|
e727e462d8 | ||
|
|
47e23fbc71 | ||
|
|
98c217d0bb | ||
|
|
3b91d0492e | ||
|
|
2b3a9f1669 | ||
|
|
0d5db76492 | ||
|
|
2ab1416eef | ||
|
|
c0f71ca1af |
@@ -399,6 +399,8 @@ static void TranslateWindowsMessage(const MSG *msg, IGpVOSEventQueue *eventQueue
|
||||
|
||||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
|
||||
{
|
||||
(void)lpCmdLine;
|
||||
|
||||
LPWSTR cmdLine = GetCommandLineW();
|
||||
|
||||
int nArgs;
|
||||
|
||||
@@ -151,6 +151,16 @@ unsigned int GpSystemServices_Win32::GetCPUCount() const
|
||||
return sysInfo.dwNumberOfProcessors;
|
||||
}
|
||||
|
||||
void GpSystemServices_Win32::SetTextInputEnabled(bool isEnabled)
|
||||
{
|
||||
(void)isEnabled;
|
||||
}
|
||||
|
||||
bool GpSystemServices_Win32::IsTextInputEnabled() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void GpSystemServices_Win32::SetTouchscreenSimulation(bool isTouchscreenSimulation)
|
||||
{
|
||||
m_isTouchscreenSimulation = isTouchscreenSimulation;
|
||||
|
||||
@@ -32,6 +32,8 @@ public:
|
||||
bool IsUsingMouseAsTouch() const override;
|
||||
bool IsTextInputObstructive() const override;
|
||||
unsigned int GetCPUCount() const override;
|
||||
void SetTextInputEnabled(bool isEnabled) override;
|
||||
bool IsTextInputEnabled() const override;
|
||||
|
||||
void SetTouchscreenSimulation(bool isTouchscreenSimulation);
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@ android {
|
||||
}
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 29
|
||||
versionCode 2
|
||||
versionName "1.0.9pre2"
|
||||
versionCode 4
|
||||
versionName "1.0.9b2"
|
||||
externalNativeBuild {
|
||||
ndkBuild {
|
||||
arguments "APP_PLATFORM=android-16"
|
||||
|
||||
@@ -166,6 +166,7 @@ void GpThreadEvent_Cpp11::Destroy()
|
||||
}
|
||||
|
||||
GpSystemServices_Android::GpSystemServices_Android()
|
||||
: m_textInputEnabled(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -269,6 +270,16 @@ unsigned int GpSystemServices_Android::GetCPUCount() const
|
||||
return SDL_GetCPUCount();
|
||||
}
|
||||
|
||||
void GpSystemServices_Android::SetTextInputEnabled(bool isEnabled)
|
||||
{
|
||||
m_textInputEnabled = isEnabled;
|
||||
}
|
||||
|
||||
bool GpSystemServices_Android::IsTextInputEnabled() const
|
||||
{
|
||||
return m_textInputEnabled;
|
||||
}
|
||||
|
||||
GpSystemServices_Android *GpSystemServices_Android::GetInstance()
|
||||
{
|
||||
return &ms_instance;
|
||||
|
||||
@@ -20,9 +20,15 @@ public:
|
||||
bool IsUsingMouseAsTouch() const override;
|
||||
bool IsTextInputObstructive() const override;
|
||||
unsigned int GetCPUCount() const override;
|
||||
void SetTextInputEnabled(bool isEnabled) override;
|
||||
bool IsTextInputEnabled() const override;
|
||||
|
||||
void FlushTextInputEnabled();
|
||||
|
||||
static GpSystemServices_Android *GetInstance();
|
||||
|
||||
private:
|
||||
static GpSystemServices_Android ms_instance;
|
||||
|
||||
bool m_textInputEnabled;
|
||||
};
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <chrono>
|
||||
#include <numeric>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
#pragma push_macro("LoadCursor")
|
||||
@@ -644,6 +645,7 @@ public:
|
||||
void UploadEntire(const void *data, size_t pitch);
|
||||
void Destroy();
|
||||
|
||||
void DestroyAll();
|
||||
bool RecreateAll();
|
||||
|
||||
size_t GetImageWidth() const;
|
||||
@@ -777,7 +779,7 @@ private:
|
||||
};
|
||||
|
||||
void StartOpenGLForWindow(IGpLogDriver *logger);
|
||||
bool InitResources(uint32_t virtualWidth, uint32_t virtualHeight);
|
||||
bool InitResources(uint32_t physicalWidth, uint32_t physicalHeight, uint32_t virtualWidth, uint32_t virtualHeight);
|
||||
|
||||
void BecomeFullScreen();
|
||||
void BecomeWindowed();
|
||||
@@ -821,7 +823,6 @@ private:
|
||||
GLint m_pixelDXDYDimensionsLocation;
|
||||
GLint m_vertexPosUVLocation;
|
||||
GLint m_pixelSurfaceTextureLocation;
|
||||
GLint m_pixelPaletteTextureLocation;
|
||||
|
||||
bool Link(GpDisplayDriver_SDL_GL2 *driver, const GpGLShader<GL_VERTEX_SHADER> *vertexShader, const GpGLShader<GL_FRAGMENT_SHADER> *pixelShader);
|
||||
};
|
||||
@@ -831,6 +832,12 @@ private:
|
||||
GpComPtr<GpGLRenderTargetView> m_virtualScreenTextureRTV;
|
||||
GpComPtr<GpGLTexture> m_virtualScreenTexture;
|
||||
|
||||
GpComPtr<GpGLRenderTargetView> m_upscaleTextureRTV;
|
||||
GpComPtr<GpGLTexture> m_upscaleTexture;
|
||||
|
||||
uint32_t m_upscaleTextureWidth;
|
||||
uint32_t m_upscaleTextureHeight;
|
||||
|
||||
GpComPtr<GpGLVertexArray> m_quadVertexArray;
|
||||
GpComPtr<GpGLBuffer> m_quadVertexBufferKeepalive;
|
||||
GpComPtr<GpGLBuffer> m_quadIndexBuffer;
|
||||
@@ -881,6 +888,7 @@ private:
|
||||
uint32_t m_windowHeightVirtual;
|
||||
float m_pixelScaleX;
|
||||
float m_pixelScaleY;
|
||||
bool m_useUpscaleFilter;
|
||||
|
||||
GpCursor_SDL2 *m_activeCursor;
|
||||
GpCursor_SDL2 *m_pendingCursor;
|
||||
@@ -904,6 +912,8 @@ private:
|
||||
|
||||
uint8_t m_paletteStorage[256 * 4 + GP_SYSTEM_MEMORY_ALIGNMENT];
|
||||
uint8_t *m_paletteData;
|
||||
|
||||
bool m_textInputEnabled;
|
||||
};
|
||||
|
||||
|
||||
@@ -1010,14 +1020,17 @@ void GpDisplayDriverSurface_GL2::Destroy()
|
||||
free(this);
|
||||
}
|
||||
|
||||
bool GpDisplayDriverSurface_GL2::RecreateAll()
|
||||
void GpDisplayDriverSurface_GL2::DestroyAll()
|
||||
{
|
||||
for (GpDisplayDriverSurface_GL2 *scan = this; scan; scan = scan->m_next)
|
||||
{
|
||||
scan->m_invalidateCallback(scan->m_invalidateContext);
|
||||
scan->m_texture = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool GpDisplayDriverSurface_GL2::RecreateAll()
|
||||
{
|
||||
for (GpDisplayDriverSurface_GL2 *scan = this; scan; scan = scan->m_next)
|
||||
{
|
||||
if (!scan->RecreateSingle())
|
||||
@@ -1068,13 +1081,15 @@ bool GpDisplayDriverSurface_GL2::Init(GpDisplayDriverSurface_GL2 *prevSurface)
|
||||
|
||||
CheckGLError(*m_gl, m_driver->GetProperties().m_logger);
|
||||
|
||||
m_prev = prevSurface;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GpDisplayDriverSurface_GL2::RecreateSingle()
|
||||
{
|
||||
m_texture = GpGLTexture::Create(m_driver);
|
||||
return m_texture != nullptr;
|
||||
return m_texture != nullptr && this->Init(m_prev);
|
||||
}
|
||||
|
||||
GLenum GpDisplayDriverSurface_GL2::ResolveGLFormat() const
|
||||
@@ -1165,6 +1180,7 @@ GpDisplayDriver_SDL_GL2::GpDisplayDriver_SDL_GL2(const GpDisplayDriverProperties
|
||||
, m_windowHeightVirtual(480)
|
||||
, m_pixelScaleX(1.0f)
|
||||
, m_pixelScaleY(1.0f)
|
||||
, m_useUpscaleFilter(false)
|
||||
, m_vosFiber(nullptr)
|
||||
, m_vosEvent(nullptr)
|
||||
, m_pendingCursor(nullptr)
|
||||
@@ -1191,6 +1207,7 @@ GpDisplayDriver_SDL_GL2::GpDisplayDriver_SDL_GL2(const GpDisplayDriverProperties
|
||||
, m_contextLost(true)
|
||||
, m_lastSurface(nullptr)
|
||||
, m_firstSurface(nullptr)
|
||||
, m_textInputEnabled(false)
|
||||
{
|
||||
m_bgColor[0] = 0.f;
|
||||
m_bgColor[1] = 0.f;
|
||||
@@ -1901,7 +1918,6 @@ void GpDisplayDriver_SDL_GL2::Run()
|
||||
}
|
||||
|
||||
TranslateSDLMessage(&msg, m_properties.m_eventQueue, m_pixelScaleX, m_pixelScaleY, obstructiveTextInput);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1923,7 +1939,6 @@ void GpDisplayDriver_SDL_GL2::Run()
|
||||
int clientHeight = 0;
|
||||
SDL_GetWindowSize(m_window, &clientWidth, &clientHeight);
|
||||
|
||||
|
||||
unsigned int desiredWidth = clientWidth;
|
||||
unsigned int desiredHeight = clientHeight;
|
||||
if (desiredWidth != m_windowWidthPhysical || desiredHeight != m_windowHeightPhysical || m_isResolutionResetDesired)
|
||||
@@ -1980,9 +1995,9 @@ void GpDisplayDriver_SDL_GL2::Run()
|
||||
new (&m_res) InstancedResources();
|
||||
|
||||
if (m_firstSurface)
|
||||
m_firstSurface->RecreateAll();
|
||||
m_firstSurface->DestroyAll();
|
||||
|
||||
if (!InitResources(m_windowWidthVirtual, m_windowHeightVirtual))
|
||||
if (!InitResources(m_windowWidthPhysical, m_windowHeightPhysical, m_windowWidthVirtual, m_windowHeightVirtual))
|
||||
{
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Information, "Terminating display driver due to InitResources failing");
|
||||
@@ -1990,10 +2005,28 @@ void GpDisplayDriver_SDL_GL2::Run()
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_firstSurface)
|
||||
m_firstSurface->RecreateAll();
|
||||
|
||||
m_contextLost = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
bool wantTextInput = m_properties.m_systemServices->IsTextInputEnabled();
|
||||
if (wantTextInput != m_textInputEnabled)
|
||||
{
|
||||
m_textInputEnabled = wantTextInput;
|
||||
if (m_textInputEnabled)
|
||||
SDL_StartTextInput();
|
||||
else
|
||||
SDL_StopTextInput();
|
||||
}
|
||||
|
||||
// Handle dismissal of on-screen keyboard
|
||||
const bool isTextInputActuallyActive = SDL_IsTextInputActive();
|
||||
m_textInputEnabled = isTextInputActuallyActive;
|
||||
m_properties.m_systemServices->SetTextInputEnabled(isTextInputActuallyActive);
|
||||
|
||||
GpDisplayDriverTickStatus_t tickStatus = PresentFrameAndSync();
|
||||
if (tickStatus == GpDisplayDriverTickStatuses::kFatalFault || tickStatus == GpDisplayDriverTickStatuses::kApplicationTerminated)
|
||||
{
|
||||
@@ -2368,13 +2401,16 @@ void GpDisplayDriver_SDL_GL2::StartOpenGLForWindow(IGpLogDriver *logger)
|
||||
SDL_GL_SetSwapInterval(1);
|
||||
}
|
||||
|
||||
bool GpDisplayDriver_SDL_GL2::InitResources(uint32_t virtualWidth, uint32_t virtualHeight)
|
||||
bool GpDisplayDriver_SDL_GL2::InitResources(uint32_t physicalWidth, uint32_t physicalHeight, uint32_t virtualWidth, uint32_t virtualHeight)
|
||||
{
|
||||
IGpLogDriver *logger = m_properties.m_logger;
|
||||
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Information, "GpDisplayDriver_SDL_GL2::InitResources");
|
||||
|
||||
if ((m_pixelScaleX < 2.0f && m_pixelScaleX > 1.0f) || (m_pixelScaleY < 2.0f && m_pixelScaleY > 1.0f))
|
||||
m_useUpscaleFilter = true;
|
||||
|
||||
CheckGLError(m_gl, logger);
|
||||
|
||||
if (!InitBackBuffer(virtualWidth, virtualHeight))
|
||||
@@ -2684,6 +2720,66 @@ bool GpDisplayDriver_SDL_GL2::InitBackBuffer(uint32_t width, uint32_t height)
|
||||
m_gl.BindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
}
|
||||
|
||||
|
||||
if (m_pixelScaleX != floor(m_pixelScaleX) || m_pixelScaleY != floor(m_pixelScaleY))
|
||||
{
|
||||
uint32_t upscaleX = ceil(m_pixelScaleX);
|
||||
uint32_t upscaleY = ceil(m_pixelScaleY);
|
||||
|
||||
{
|
||||
m_res.m_upscaleTexture = GpGLTexture::Create(this);
|
||||
if (!m_res.m_upscaleTexture)
|
||||
{
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "GpDisplayDriver_SDL_GL2::InitBackBuffer: GpGLTexture::Create for upscale texture failed");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
m_res.m_upscaleTextureWidth = width * upscaleX;
|
||||
m_res.m_upscaleTextureHeight = height * upscaleY;
|
||||
|
||||
GLenum internalFormat = SupportsSizedFormats() ? GL_RGBA8 : GL_RGBA;
|
||||
|
||||
m_gl.BindTexture(GL_TEXTURE_2D, m_res.m_upscaleTexture->GetID());
|
||||
m_gl.PixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
m_gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
m_gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
m_gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
m_gl.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
m_gl.TexImage2D(GL_TEXTURE_2D, 0, internalFormat, m_res.m_upscaleTextureWidth, m_res.m_upscaleTextureHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
|
||||
m_gl.BindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
CheckGLError(m_gl, logger);
|
||||
}
|
||||
|
||||
{
|
||||
m_res.m_upscaleTextureRTV = GpGLRenderTargetView::Create(this);
|
||||
|
||||
if (!m_res.m_upscaleTextureRTV)
|
||||
{
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "GpDisplayDriver_SDL_GL2::InitBackBuffer: GpGLRenderTargetView::Create for upscale texture failed");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
m_gl.BindFramebuffer(GL_FRAMEBUFFER, m_res.m_upscaleTextureRTV->GetID());
|
||||
m_gl.FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_res.m_upscaleTexture->GetID(), 0);
|
||||
GLenum status = m_gl.CheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE)
|
||||
{
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "GpDisplayDriver_SDL_GL2::InitBackBuffer: Framebuffer complete check failed for upscale texture, status was %i VST ID is %i", static_cast<int>(status), static_cast<int>(m_res.m_virtualScreenTextureRTV->GetID()));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
m_gl.BindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
}
|
||||
}
|
||||
|
||||
CheckGLError(m_gl, logger);
|
||||
|
||||
return true;
|
||||
@@ -2692,28 +2788,20 @@ bool GpDisplayDriver_SDL_GL2::InitBackBuffer(uint32_t width, uint32_t height)
|
||||
|
||||
void GpDisplayDriver_SDL_GL2::ScaleVirtualScreen()
|
||||
{
|
||||
m_gl.BindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
|
||||
m_gl.Viewport(0, 0, m_windowWidthPhysical, m_windowHeightPhysical);
|
||||
|
||||
const bool isIntegralScale = (m_pixelScaleX == floor(m_pixelScaleX) && m_pixelScaleY == floor(m_pixelScaleY));
|
||||
|
||||
const BlitQuadProgram &program = isIntegralScale ? m_res.m_copyQuadProgram : m_res.m_scaleQuadProgram;
|
||||
|
||||
if (m_useUpscaleFilter)
|
||||
{
|
||||
const float twoDivWidth = 2.0f / static_cast<float>(m_windowWidthPhysical);
|
||||
const float twoDivHeight = 2.0f / static_cast<float>(m_windowHeightPhysical);
|
||||
m_gl.BindFramebuffer(GL_FRAMEBUFFER, m_res.m_upscaleTextureRTV->GetID());
|
||||
|
||||
// Use the scaled virtual width instead of the physical width to correctly handle cases where the window boundary is in the middle of a pixel
|
||||
float fWidth = static_cast<float>(m_windowWidthVirtual) * m_pixelScaleX;
|
||||
float fHeight = static_cast<float>(m_windowHeightVirtual) * m_pixelScaleY;
|
||||
m_gl.Viewport(0, 0, m_res.m_upscaleTextureWidth, m_res.m_upscaleTextureHeight);
|
||||
|
||||
const BlitQuadProgram &program = m_res.m_scaleQuadProgram;
|
||||
|
||||
float ndcOriginsAndDimensions[4] =
|
||||
{
|
||||
-1.0f,
|
||||
-1.0f,
|
||||
fWidth * twoDivWidth,
|
||||
fHeight * twoDivHeight
|
||||
2.0f,
|
||||
2.0f,
|
||||
};
|
||||
|
||||
float surfaceDimensions_TextureRegion[4] =
|
||||
@@ -2730,8 +2818,73 @@ void GpDisplayDriver_SDL_GL2::ScaleVirtualScreen()
|
||||
|
||||
float dxdy_dimensions[4] =
|
||||
{
|
||||
static_cast<float>(static_cast<double>(m_windowWidthVirtual) / static_cast<double>(m_windowWidthPhysical)),
|
||||
static_cast<float>(static_cast<double>(m_windowHeightVirtual) / static_cast<double>(m_windowHeightPhysical)),
|
||||
static_cast<float>(1.0 / m_windowWidthVirtual),
|
||||
static_cast<float>(1.0 / m_windowHeightVirtual),
|
||||
static_cast<float>(m_windowWidthVirtual),
|
||||
static_cast<float>(m_windowHeightVirtual)
|
||||
};
|
||||
|
||||
m_gl.Uniform4fv(program.m_pixelDXDYDimensionsLocation, 1, reinterpret_cast<const GLfloat*>(dxdy_dimensions));
|
||||
|
||||
GLint attribLocations[] = { program.m_vertexPosUVLocation };
|
||||
|
||||
m_res.m_quadVertexArray->Activate(attribLocations);
|
||||
|
||||
m_gl.ActiveTexture(GL_TEXTURE0 + 0);
|
||||
m_gl.BindTexture(GL_TEXTURE_2D, m_res.m_virtualScreenTexture->GetID());
|
||||
m_gl.Uniform1i(program.m_pixelSurfaceTextureLocation, 0);
|
||||
|
||||
m_gl.BindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_res.m_quadIndexBuffer->GetID());
|
||||
m_gl.DrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, nullptr);
|
||||
|
||||
m_gl.UseProgram(0);
|
||||
|
||||
m_gl.ActiveTexture(GL_TEXTURE0 + 0);
|
||||
m_gl.BindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
m_res.m_quadVertexArray->Deactivate(attribLocations);
|
||||
|
||||
m_gl.BindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
m_gl.BindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
|
||||
m_gl.Viewport(0, 0, m_windowWidthPhysical, m_windowHeightPhysical);
|
||||
|
||||
const BlitQuadProgram &program = m_res.m_copyQuadProgram;
|
||||
|
||||
{
|
||||
const float twoDivWidth = 2.0f / static_cast<float>(m_windowWidthPhysical);
|
||||
const float twoDivHeight = 2.0f / static_cast<float>(m_windowHeightPhysical);
|
||||
|
||||
// Use the scaled virtual width instead of the physical width to correctly handle cases where the window boundary is in the middle of a pixel
|
||||
float fWidth = static_cast<float>(m_windowWidthVirtual) * m_pixelScaleX;
|
||||
float fHeight = static_cast<float>(m_windowHeightVirtual) * m_pixelScaleY;
|
||||
|
||||
float ndcOriginsAndDimensions[4] =
|
||||
{
|
||||
-1.0f,
|
||||
-1.0f,
|
||||
2.0f,
|
||||
2.0f,
|
||||
};
|
||||
|
||||
float surfaceDimensions_TextureRegion[4] =
|
||||
{
|
||||
static_cast<float>(m_windowWidthVirtual),
|
||||
static_cast<float>(m_windowHeightVirtual),
|
||||
1.f,
|
||||
1.f
|
||||
};
|
||||
|
||||
m_gl.UseProgram(program.m_program->GetID());
|
||||
m_gl.Uniform4fv(program.m_vertexNDCOriginAndDimensionsLocation, 1, reinterpret_cast<const GLfloat*>(ndcOriginsAndDimensions));
|
||||
m_gl.Uniform4fv(program.m_vertexSurfaceDimensionsLocation, 1, reinterpret_cast<const GLfloat*>(surfaceDimensions_TextureRegion));
|
||||
|
||||
float dxdy_dimensions[4] =
|
||||
{
|
||||
static_cast<float>(1.0 / m_windowWidthVirtual),
|
||||
static_cast<float>(1.0 / m_windowHeightVirtual),
|
||||
static_cast<float>(m_windowWidthVirtual),
|
||||
static_cast<float>(m_windowHeightVirtual)
|
||||
};
|
||||
@@ -2743,8 +2896,11 @@ void GpDisplayDriver_SDL_GL2::ScaleVirtualScreen()
|
||||
|
||||
m_res.m_quadVertexArray->Activate(attribLocations);
|
||||
|
||||
|
||||
GpGLTexture *inputTexture = m_useUpscaleFilter ? static_cast<GpGLTexture*>(m_res.m_upscaleTexture) : static_cast<GpGLTexture*>(m_res.m_virtualScreenTexture);
|
||||
|
||||
m_gl.ActiveTexture(GL_TEXTURE0 + 0);
|
||||
m_gl.BindTexture(GL_TEXTURE_2D, m_res.m_virtualScreenTexture->GetID());
|
||||
m_gl.BindTexture(GL_TEXTURE_2D, inputTexture->GetID());
|
||||
m_gl.Uniform1i(program.m_pixelSurfaceTextureLocation, 0);
|
||||
|
||||
m_gl.BindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_res.m_quadIndexBuffer->GetID());
|
||||
|
||||
@@ -5,11 +5,6 @@
|
||||
"\n"\
|
||||
"uniform vec4 dxdy_dimensions;\n"\
|
||||
"\n"\
|
||||
"vec3 SamplePixel(vec2 coord)\n"\
|
||||
"{\n"\
|
||||
" return texture2D(surfaceTexture, (coord + vec2(0.5, 0.5)) / dxdy_dimensions.zw).rgb;\n"\
|
||||
"}\n"\
|
||||
"\n"\
|
||||
"void main()\n"\
|
||||
"{\n"\
|
||||
" gl_FragColor = vec4(LinearToSRGB(texture2D(surfaceTexture, texCoord.xy).rgb), 1.0);\n"\
|
||||
@@ -17,5 +12,5 @@
|
||||
|
||||
namespace GpBinarizedShaders
|
||||
{
|
||||
const char *g_copyQuadP_GL2 = GP_GL_SHADER_CODE_PRECISION_PREFIX GP_GL_SHADER_CODE_FUNCTIONS_H GP_GL_SHADER_CODE_COPYQUADP_GLSL;
|
||||
const char *g_copyQuadP_GL2 = GP_GL_SHADER_CODE_MEDIUM_PRECISION_PREFIX GP_GL_SHADER_CODE_FUNCTIONS_H GP_GL_SHADER_CODE_COPYQUADP_GLSL;
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
|
||||
namespace GpBinarizedShaders
|
||||
{
|
||||
const char *g_drawQuadPalettePF_GL2 = "#define ENABLE_FLICKER\n" GP_GL_SHADER_CODE_PRECISION_PREFIX GP_GL_SHADER_CODE_DRAWQUADPIXELCONSTANTS_H GP_GL_SHADER_CODE_FUNCTIONS_H GP_GL_SHADER_CODE_DRAWQUADPALETTEP_GLSL;
|
||||
const char *g_drawQuadPalettePNF_GL2 = GP_GL_SHADER_CODE_PRECISION_PREFIX GP_GL_SHADER_CODE_DRAWQUADPIXELCONSTANTS_H GP_GL_SHADER_CODE_FUNCTIONS_H GP_GL_SHADER_CODE_DRAWQUADPALETTEP_GLSL;
|
||||
const char *g_drawQuadPaletteICCPF_GL2 = "#define USE_ICC_PROFILE\n" "#define ENABLE_FLICKER\n" GP_GL_SHADER_CODE_PRECISION_PREFIX GP_GL_SHADER_CODE_DRAWQUADPIXELCONSTANTS_H GP_GL_SHADER_CODE_FUNCTIONS_H GP_GL_SHADER_CODE_DRAWQUADPALETTEP_GLSL;
|
||||
const char *g_drawQuadPaletteICCPNF_GL2 = "#define USE_ICC_PROFILE\n" GP_GL_SHADER_CODE_PRECISION_PREFIX GP_GL_SHADER_CODE_DRAWQUADPIXELCONSTANTS_H GP_GL_SHADER_CODE_FUNCTIONS_H GP_GL_SHADER_CODE_DRAWQUADPALETTEP_GLSL;
|
||||
const char *g_drawQuadPalettePF_GL2 = "#define ENABLE_FLICKER\n" GP_GL_SHADER_CODE_MEDIUM_PRECISION_PREFIX GP_GL_SHADER_CODE_DRAWQUADPIXELCONSTANTS_H GP_GL_SHADER_CODE_FUNCTIONS_H GP_GL_SHADER_CODE_DRAWQUADPALETTEP_GLSL;
|
||||
const char *g_drawQuadPalettePNF_GL2 = GP_GL_SHADER_CODE_MEDIUM_PRECISION_PREFIX GP_GL_SHADER_CODE_DRAWQUADPIXELCONSTANTS_H GP_GL_SHADER_CODE_FUNCTIONS_H GP_GL_SHADER_CODE_DRAWQUADPALETTEP_GLSL;
|
||||
const char *g_drawQuadPaletteICCPF_GL2 = "#define USE_ICC_PROFILE\n" "#define ENABLE_FLICKER\n" GP_GL_SHADER_CODE_MEDIUM_PRECISION_PREFIX GP_GL_SHADER_CODE_DRAWQUADPIXELCONSTANTS_H GP_GL_SHADER_CODE_FUNCTIONS_H GP_GL_SHADER_CODE_DRAWQUADPALETTEP_GLSL;
|
||||
const char *g_drawQuadPaletteICCPNF_GL2 = "#define USE_ICC_PROFILE\n" GP_GL_SHADER_CODE_MEDIUM_PRECISION_PREFIX GP_GL_SHADER_CODE_DRAWQUADPIXELCONSTANTS_H GP_GL_SHADER_CODE_FUNCTIONS_H GP_GL_SHADER_CODE_DRAWQUADPALETTEP_GLSL;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
#define GP_GL_SHADER_CODE_PRECISION_PREFIX "precision mediump float;\n"\
|
||||
#define GP_GL_SHADER_CODE_MEDIUM_PRECISION_PREFIX "precision mediump float;\n"\
|
||||
|
||||
#define GP_GL_SHADER_CODE_HIGH_PRECISION_PREFIX "precision highp float;\n"\
|
||||
|
||||
|
||||
#define GP_GL_SHADER_CODE_FUNCTIONS_H "vec3 pow3(vec3 v, float ex)\n"\
|
||||
"{\n"\
|
||||
|
||||
@@ -5,41 +5,16 @@
|
||||
"\n"\
|
||||
"uniform vec4 dxdy_dimensions;\n"\
|
||||
"\n"\
|
||||
"vec3 SamplePixel(vec2 coord)\n"\
|
||||
"{\n"\
|
||||
" return texture2D(surfaceTexture, (coord + vec2(0.5, 0.5)) / dxdy_dimensions.zw).rgb;\n"\
|
||||
"}\n"\
|
||||
"\n"\
|
||||
"void main()\n"\
|
||||
"{\n"\
|
||||
" float dx = dxdy_dimensions.x;\n"\
|
||||
" float dy = dxdy_dimensions.y;\n"\
|
||||
" vec2 dimensions = dxdy_dimensions.zw;\n"\
|
||||
" vec2 texCoordInteger = dxdy_dimensions.zw;\n"\
|
||||
" vec2 tc = texCoord.xy;\n"\
|
||||
"\n"\
|
||||
" vec2 pixelTopLeftCoord = max(vec2(0.0, 0.0), texCoord.zw - vec2(dx, dy) * 0.5);\n"\
|
||||
" vec2 pixelBottomRightCoord = pixelTopLeftCoord + min(vec2(1.0, 1.0), vec2(dx, dy));\n"\
|
||||
"\n"\
|
||||
" vec2 topLeftCoordInteger = floor(pixelTopLeftCoord);\n"\
|
||||
" vec2 bottomRightCoordInteger = floor(pixelBottomRightCoord);\n"\
|
||||
"\n"\
|
||||
" vec2 interpolators = saturate((pixelBottomRightCoord - bottomRightCoordInteger) / vec2(dx, dy));\n"\
|
||||
"\n"\
|
||||
" vec3 topLeftColor = SamplePixel(topLeftCoordInteger);\n"\
|
||||
" vec3 topRightColor = SamplePixel(vec2(bottomRightCoordInteger.x, topLeftCoordInteger.y));\n"\
|
||||
" vec3 bottomLeftColor = SamplePixel(vec2(topLeftCoordInteger.x, bottomRightCoordInteger.y));\n"\
|
||||
" vec3 bottomRightColor = SamplePixel(bottomRightCoordInteger);\n"\
|
||||
"\n"\
|
||||
" vec3 topColor = (1.0 - interpolators.x) * topLeftColor + interpolators.x * topRightColor;\n"\
|
||||
" vec3 bottomColor = (1.0 - interpolators.x) * bottomLeftColor + interpolators.x * bottomRightColor;\n"\
|
||||
" vec3 interpolatedColor = (1.0 - interpolators.y) * topColor + interpolators.y * bottomColor;\n"\
|
||||
"\n"\
|
||||
" gl_FragColor = vec4(LinearToSRGB(interpolatedColor), 1.0);\n"\
|
||||
" gl_FragColor = vec4(texture2D(surfaceTexture, tc).rgb, 1.0);\n"\
|
||||
"}\n"
|
||||
|
||||
namespace GpBinarizedShaders
|
||||
{
|
||||
const char *g_scaleQuadP_GL2 = GP_GL_SHADER_CODE_PRECISION_PREFIX GP_GL_SHADER_CODE_FUNCTIONS_H GP_GL_SHADER_CODE_SCALEQUADP_GLSL;
|
||||
const char *g_scaleQuadP_GL2 = GP_GL_SHADER_CODE_MEDIUM_PRECISION_PREFIX GP_GL_SHADER_CODE_FUNCTIONS_H GP_GL_SHADER_CODE_SCALEQUADP_GLSL;
|
||||
|
||||
extern const char *g_drawQuadRGBP_GL2;
|
||||
extern const char *g_drawQuad15BitP_GL2;
|
||||
|
||||
53
ApplicationResourcePatches/DITL/2007.json
Normal file
53
ApplicationResourcePatches/DITL/2007.json
Normal file
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"items" :
|
||||
[
|
||||
{
|
||||
"name" : "Okay",
|
||||
"itemType" : "Button",
|
||||
"pos" : [ 376, 176 ],
|
||||
"size" : [ 58, 20 ],
|
||||
"id" : 1,
|
||||
"enabled" : true
|
||||
},
|
||||
{
|
||||
"name" : "Cancel",
|
||||
"itemType" : "Button",
|
||||
"pos" : [ 302, 176 ],
|
||||
"size" : [ 58, 20 ],
|
||||
"id" : 2,
|
||||
"enabled" : true
|
||||
},
|
||||
{
|
||||
"name" : "",
|
||||
"itemType" : "CustomControl",
|
||||
"pos" : [ 17, 33 ],
|
||||
"size" : [ 401, 122 ],
|
||||
"id" : 2,
|
||||
"enabled" : true
|
||||
},
|
||||
{
|
||||
"name" : "",
|
||||
"itemType" : "CustomControl",
|
||||
"pos" : [ 418, 32 ],
|
||||
"size" : [ 16, 124 ],
|
||||
"id" : 3,
|
||||
"enabled" : true
|
||||
},
|
||||
{
|
||||
"name" : "",
|
||||
"itemType" : "EditBox",
|
||||
"pos" : [ 16, 176 ],
|
||||
"size" : [ 270, 16 ],
|
||||
"id" : 4,
|
||||
"enabled" : true
|
||||
},
|
||||
{
|
||||
"name" : "^0",
|
||||
"itemType" : "Label",
|
||||
"pos" : [ 16, 16 ],
|
||||
"size" : [ 418, 16 ],
|
||||
"id" : 10,
|
||||
"enabled" : true
|
||||
}
|
||||
]
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 12 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 12 KiB |
@@ -9,6 +9,7 @@
|
||||
"DITL/2004.json" : "ApplicationResourcePatches/DITL/2004.json",
|
||||
"DITL/2005.json" : "ApplicationResourcePatches/DITL/2005.json",
|
||||
"DITL/2006.json" : "ApplicationResourcePatches/DITL/2006.json",
|
||||
"DITL/2007.json" : "ApplicationResourcePatches/DITL/2007.json",
|
||||
"PICT/1300.bmp" : "ApplicationResourcePatches/PICT/1300.bmp",
|
||||
"PICT/1301.bmp" : "ApplicationResourcePatches/PICT/1301.bmp",
|
||||
"PICT/1302.bmp" : "ApplicationResourcePatches/PICT/1302.bmp",
|
||||
|
||||
@@ -201,6 +201,7 @@ short RandomInt (short);
|
||||
long RandomLong (long);
|
||||
void RedAlert (short);
|
||||
void LoadGraphic (DrawSurface *surface, short resID); // Only loads from app resources
|
||||
void LoadGraphicNoDither (DrawSurface *surface, short resID);
|
||||
void LoadGraphicCustom (DrawSurface *surface, short resID); // Supports custom graphics
|
||||
void LoadScaledGraphic (DrawSurface *, short, Rect *); // Only loads from app resources
|
||||
void LoadScaledGraphicCustom (DrawSurface *, short, Rect *); // Supports custom graphics
|
||||
|
||||
@@ -99,6 +99,7 @@ void SortHighScores (void);
|
||||
void ZeroHighScores (void);
|
||||
void ZeroAllButHighestScore (void);
|
||||
Boolean TestHighScore (void);
|
||||
void WriteScores (void); // Either saves the house or saves scores, depending on if it's read-only
|
||||
Boolean WriteScoresToDisk (void);
|
||||
Boolean ReadScoresFromDisk (void);
|
||||
|
||||
|
||||
@@ -439,8 +439,8 @@ namespace touchScreenControlGraphics
|
||||
BandsDisabled,
|
||||
BandsActive,
|
||||
BandsIdle,
|
||||
FlipActive,
|
||||
FlipIdle,
|
||||
StopActive,
|
||||
StopIdle,
|
||||
MoveRightActive,
|
||||
MoveRightIdle,
|
||||
MoveLeftActive,
|
||||
|
||||
@@ -55,5 +55,5 @@ extern long theScore;
|
||||
extern short playOriginH, playOriginV;
|
||||
extern short thisRoomNumber, theMode, batteryTotal, bandsTotal;
|
||||
extern short foilTotal, mortals, numMasterObjects, previousRoom;
|
||||
extern Boolean fileDirty, gameDirty, showFoil, doZooms, isPlayMusicGame;
|
||||
extern Boolean fileDirty, showFoil, doZooms, isPlayMusicGame;
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ short lastHighScore;
|
||||
Boolean keyStroke;
|
||||
|
||||
extern short splashOriginH, splashOriginV;
|
||||
extern Boolean quickerTransitions, resumedSavedGame;
|
||||
extern Boolean quickerTransitions, resumedSavedGame, houseIsReadOnly;
|
||||
|
||||
|
||||
//============================================================== Functions
|
||||
@@ -402,7 +402,8 @@ Boolean TestHighScore (void)
|
||||
thisHousePtr->highScores.timeStamps[kMaxScores - 1] = static_cast<uint32_t>(scoreTimestamp);
|
||||
thisHousePtr->highScores.levels[kMaxScores - 1] = CountRoomsVisited();
|
||||
SortHighScores();
|
||||
gameDirty = true;
|
||||
|
||||
WriteScores();
|
||||
}
|
||||
|
||||
if (placing != -1)
|
||||
@@ -734,11 +735,20 @@ Boolean WriteScoresToDisk (void)
|
||||
|
||||
scoresStream->Close();
|
||||
|
||||
gameDirty = false;
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
void WriteScores (void)
|
||||
{
|
||||
if (houseIsReadOnly)
|
||||
{
|
||||
if (!WriteScoresToDisk())
|
||||
YellowAlert(kYellowFailedWrite, 0);
|
||||
}
|
||||
else if (!WriteHouse(theMode == kEditMode))
|
||||
YellowAlert(kYellowFailedWrite, 0);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- ReadScoresFromDisk
|
||||
|
||||
Boolean ReadScoresFromDisk (void)
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#define kGoToDialogID 1043
|
||||
|
||||
void WriteOutPrefs(void);
|
||||
|
||||
void UpdateGoToDialog (Dialog *);
|
||||
int16_t GoToFilter (void *context, Dialog *dial, const TimeTaggedVOSEvent *evt);
|
||||
@@ -104,6 +105,8 @@ Boolean CreateNewHouse (void)
|
||||
InitCursor();
|
||||
if (!OpenHouse())
|
||||
return (false);
|
||||
|
||||
WriteOutPrefs();
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ Rect movieRect;
|
||||
PortabilityLayer::IResourceArchive *houseResFork;
|
||||
short wasHouseVersion;
|
||||
GpIOStream *houseStream;
|
||||
Boolean houseOpen, fileDirty, gameDirty;
|
||||
Boolean houseOpen, fileDirty;
|
||||
Boolean changeLockStateOfHouse, saveHouseLocked, houseIsReadOnly;
|
||||
Boolean hasMovie, tvInRoom;
|
||||
|
||||
@@ -185,78 +185,6 @@ Boolean OpenSpecificHouse (const VFileSpec &specs)
|
||||
}
|
||||
#endif
|
||||
|
||||
//-------------------------------------------------------------- SaveHouseAs
|
||||
|
||||
#ifndef COMPILEDEMO
|
||||
Boolean SaveHouseAs (void)
|
||||
{
|
||||
// TEMP - fix this later -- use NavServices (see House.c)
|
||||
/*
|
||||
StandardFileReply theReply;
|
||||
FSSpec oldHouse;
|
||||
PLError_t theErr;
|
||||
Boolean noProblems;
|
||||
Str255 tempStr;
|
||||
|
||||
noProblems = true;
|
||||
|
||||
GetLocalizedString(15, tempStr);
|
||||
StandardPutFile(tempStr, thisHouseName, &theReply);
|
||||
if (theReply.sfGood)
|
||||
{
|
||||
oldHouse = theHousesSpecs[thisHouseIndex];
|
||||
|
||||
CloseHouseResFork(); // close this house file
|
||||
theErr = FSClose(houseRefNum);
|
||||
if (theErr != PLErrors::kNone)
|
||||
{
|
||||
CheckFileError(theErr, "\pPreferences");
|
||||
return(false);
|
||||
}
|
||||
// create new house file
|
||||
theErr = FSpCreate(&theReply.sfFile, 'ozm5', 'gliH', theReply.sfScript);
|
||||
if (!CheckFileError(theErr, theReply.sfFile.name))
|
||||
return (false);
|
||||
HCreateResFile(theReply.sfFile.vRefNum, theReply.sfFile.parID,
|
||||
theReply.sfFile.name);
|
||||
if (ResError() != PLErrors::kNone)
|
||||
YellowAlert(kYellowFailedResCreate, ResError());
|
||||
PasStringCopy(theReply.sfFile.name, thisHouseName);
|
||||
// open new house data fork
|
||||
theErr = FSpOpenDF(&theReply.sfFile, fsRdWrPerm, &houseRefNum);
|
||||
if (!CheckFileError(theErr, thisHouseName))
|
||||
return (false);
|
||||
|
||||
houseOpen = true;
|
||||
|
||||
noProblems = WriteHouse(false); // write out house data
|
||||
if (!noProblems)
|
||||
return(false);
|
||||
|
||||
BuildHouseList();
|
||||
if (OpenSpecificHouse(&theReply.sfFile)) // open new house again
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
if (OpenSpecificHouse(&oldHouse))
|
||||
{
|
||||
YellowAlert(kYellowOpenedOldHouse, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
YellowAlert(kYellowLostAllHouses, 0);
|
||||
noProblems = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return (noProblems);
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
//-------------------------------------------------------------- ReadHouse
|
||||
// With a house open, this function reads in the actual bits of dataÉ
|
||||
@@ -711,7 +639,6 @@ Boolean ReadHouse (void)
|
||||
|
||||
objActive = kNoObjectSelected;
|
||||
ReflectCurrentRoom(true);
|
||||
gameDirty = false;
|
||||
fileDirty = false;
|
||||
UpdateMenus(false);
|
||||
|
||||
@@ -796,7 +723,6 @@ Boolean WriteHouse (Boolean checkIt)
|
||||
ReflectCurrentRoom(true);
|
||||
}
|
||||
|
||||
gameDirty = false;
|
||||
fileDirty = false;
|
||||
UpdateMenus(false);
|
||||
return (true);
|
||||
@@ -812,17 +738,7 @@ Boolean CloseHouse (void)
|
||||
if (!houseOpen)
|
||||
return (true);
|
||||
|
||||
if (gameDirty)
|
||||
{
|
||||
if (houseIsReadOnly)
|
||||
{
|
||||
if (!WriteScoresToDisk())
|
||||
YellowAlert(kYellowFailedWrite, 0);
|
||||
}
|
||||
else if (!WriteHouse(theMode == kEditMode))
|
||||
YellowAlert(kYellowFailedWrite, 0);
|
||||
}
|
||||
else if (fileDirty)
|
||||
if (fileDirty)
|
||||
{
|
||||
#ifndef COMPILEDEMO
|
||||
if (!QuerySaveChanges()) // false signifies user canceled
|
||||
|
||||
@@ -494,6 +494,12 @@ void DoHeliumEngaged (gliderPtr thisGlider)
|
||||
if (theKeys->IsSet(PL_KEY_EITHER_SPECIAL(kControl)))
|
||||
DoCommandKey();
|
||||
|
||||
// Cheesy - Use touchscreen menu as quit
|
||||
if (pendingTouchScreenMenu)
|
||||
{
|
||||
playing = false;
|
||||
paused = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -378,18 +378,19 @@ void StepLoadScreen(int steps)
|
||||
{
|
||||
if (loadScreenWindow)
|
||||
{
|
||||
Rect loadScreenProgressBarFillRect = loadScreenProgressBarRect.Inset(1, 1);
|
||||
int oldProgress = loadScreenProgress;
|
||||
int loadScreenMax = 25;
|
||||
loadScreenProgress = loadScreenProgress + steps;
|
||||
if (loadScreenProgress > loadScreenMax)
|
||||
loadScreenProgress = loadScreenMax;
|
||||
|
||||
PortabilityLayer::ResolveCachingColor blackColor(StdColors::Black());
|
||||
PortabilityLayer::ResolveCachingColor fillColor(PortabilityLayer::RGBAColor::Create(51, 51, 51, 255));
|
||||
|
||||
int prevStep = oldProgress * loadScreenProgressBarRect.Width() / loadScreenMax;
|
||||
int thisStep = loadScreenProgress * loadScreenProgressBarRect.Width() / loadScreenMax;
|
||||
int prevStep = oldProgress * loadScreenProgressBarFillRect.Width() / loadScreenMax;
|
||||
int thisStep = loadScreenProgress * loadScreenProgressBarFillRect.Width() / loadScreenMax;
|
||||
|
||||
loadScreenWindow->GetDrawSurface()->FillRect(Rect::Create(loadScreenProgressBarRect.top, loadScreenProgressBarRect.left + prevStep, loadScreenProgressBarRect.bottom, loadScreenProgressBarRect.left + thisStep), blackColor);
|
||||
loadScreenWindow->GetDrawSurface()->FillRect(Rect::Create(loadScreenProgressBarFillRect.top, loadScreenProgressBarFillRect.left + prevStep, loadScreenProgressBarFillRect.bottom, loadScreenProgressBarFillRect.left + thisStep), fillColor);
|
||||
ForceSyncFrame();
|
||||
|
||||
for (int i = 0; i < steps; i++)
|
||||
@@ -416,7 +417,7 @@ void InitLoadingWindow()
|
||||
|
||||
if (!isPrefsLoaded)
|
||||
{
|
||||
loadingText = PSTR("Performing First-Time Setup...");
|
||||
loadingText = PSTR("Getting some things ready...");
|
||||
kLoadScreenWidth = 440;
|
||||
}
|
||||
|
||||
@@ -456,13 +457,16 @@ void InitLoadingWindow()
|
||||
surface->DrawString(Point::Create(4+16+8, textY), loadingText, blackColor, font);
|
||||
|
||||
static const int32_t loadBarPadding = 16;
|
||||
static const int32_t loadBarHeight = 10;
|
||||
int32_t loadBarStartX = static_cast<int32_t>(font->MeasureString(loadingText.UChars(), loadingText.Length())) + 4 + 16 + 8 + loadBarPadding;
|
||||
int32_t loadBarEndX = loadScreenLocalRect.right - loadBarPadding;
|
||||
|
||||
loadScreenProgressBarRect = Rect::Create((loadScreenLocalRect.Height() - 8) / 2, loadBarStartX, (loadScreenLocalRect.Height() + 8) / 2, loadBarEndX);
|
||||
loadScreenProgressBarRect = Rect::Create((loadScreenLocalRect.Height() - loadBarHeight) / 2, loadBarStartX, (loadScreenLocalRect.Height() + loadBarHeight) / 2, loadBarEndX);
|
||||
loadScreenProgress = 0;
|
||||
|
||||
PortabilityLayer::ResolveCachingColor partialFillColor(PortabilityLayer::RGBAColor::Create(255, 255, 204, 255));
|
||||
surface->FrameRect(loadScreenProgressBarRect, blackColor);
|
||||
surface->FillRect(loadScreenProgressBarRect.Inset(1, 1), partialFillColor);
|
||||
|
||||
Rect ringDestRect = Rect::Create(8, 8, 24, 24);
|
||||
Rect ringSrcRect = Rect::Create(0, 0, 16, 16);
|
||||
|
||||
@@ -581,7 +581,11 @@ void ResetTouchScreenControlBounds (void)
|
||||
points[TouchScreenCtrlIDs::Movement] = Point::Create(mainWindowRect.left, mainWindowRect.top);
|
||||
points[TouchScreenCtrlIDs::BatteryHelium] = Point::Create(mainWindowRect.left + touchScreenControlEdgeSpacing, mainWindowRect.top + touchScreenControlEdgeSpacing);
|
||||
points[TouchScreenCtrlIDs::Bands] = Point::Create(mainWindowRect.right - touchScreenControlEdgeSpacing - touchScreenControlSize, mainWindowRect.top + touchScreenControlEdgeSpacing);
|
||||
points[TouchScreenCtrlIDs::Menu] = Point::Create(points[TouchScreenCtrlIDs::Bands].h - touchScreenControlInterSpacing - touchScreenControlSize, points[TouchScreenCtrlIDs::BatteryHelium].v);
|
||||
|
||||
if (demoGoing)
|
||||
points[TouchScreenCtrlIDs::Menu] = Point::Create(mainWindowRect.right - touchScreenControlEdgeSpacing - touchScreenControlSize, mainWindowRect.top + touchScreenControlEdgeSpacing);
|
||||
else
|
||||
points[TouchScreenCtrlIDs::Menu] = Point::Create(points[TouchScreenCtrlIDs::Bands].h - touchScreenControlInterSpacing - touchScreenControlSize, points[TouchScreenCtrlIDs::BatteryHelium].v);
|
||||
|
||||
for (int i = 0; i < TouchScreenCtrlIDs::Count; i++)
|
||||
sizes[i] = Point::Create(touchScreenControlSize, touchScreenControlSize);
|
||||
@@ -622,7 +626,7 @@ void InitTouchScreenControlState(void)
|
||||
|
||||
Rect resRect = Rect::Create(0, 0, touchScreenControlSize, touchScreenControlSize);
|
||||
(void)CreateOffScreenGWorld(&touchScreen.graphics[i], &resRect);
|
||||
LoadGraphic(touchScreen.graphics[i], resID);
|
||||
LoadGraphicNoDither(touchScreen.graphics[i], resID);
|
||||
}
|
||||
|
||||
pendingTouchScreenMenu = false;
|
||||
|
||||
@@ -611,43 +611,62 @@ void RenderShreds (void)
|
||||
|
||||
void RenderTouchScreenControls (void)
|
||||
{
|
||||
if (demoGoing)
|
||||
return;
|
||||
|
||||
DrawSurface *ctrlGraphics[TouchScreenCtrlIDs::Count];
|
||||
|
||||
for (int i = 0; i < TouchScreenCtrlIDs::Count; i++)
|
||||
ctrlGraphics[i] = nullptr;
|
||||
|
||||
ctrlGraphics[TouchScreenCtrlIDs::Movement] = nullptr;
|
||||
ctrlGraphics[TouchScreenCtrlIDs::Bands] = touchScreen.graphics[touchScreenControlGraphics::BandsDisabled];
|
||||
ctrlGraphics[TouchScreenCtrlIDs::BatteryHelium] = touchScreen.graphics[touchScreenControlGraphics::BatteryDisabled];
|
||||
ctrlGraphics[TouchScreenCtrlIDs::Menu] = touchScreen.graphics[touchScreenControlGraphics::MenuIdle];
|
||||
|
||||
if (batteryTotal < 0)
|
||||
ctrlGraphics[TouchScreenCtrlIDs::BatteryHelium] = touchScreen.graphics[touchScreenControlGraphics::HeliumIdle];
|
||||
else if (batteryTotal > 0)
|
||||
ctrlGraphics[TouchScreenCtrlIDs::BatteryHelium] = touchScreen.graphics[touchScreenControlGraphics::BatteryIdle];
|
||||
if (demoGoing)
|
||||
{
|
||||
ctrlGraphics[TouchScreenCtrlIDs::Bands] = nullptr;
|
||||
ctrlGraphics[TouchScreenCtrlIDs::BatteryHelium] = nullptr;
|
||||
ctrlGraphics[TouchScreenCtrlIDs::Menu] = touchScreen.graphics[touchScreenControlGraphics::StopIdle];
|
||||
}
|
||||
else
|
||||
{
|
||||
ctrlGraphics[TouchScreenCtrlIDs::Bands] = touchScreen.graphics[touchScreenControlGraphics::BandsDisabled];
|
||||
ctrlGraphics[TouchScreenCtrlIDs::BatteryHelium] = touchScreen.graphics[touchScreenControlGraphics::BatteryDisabled];
|
||||
ctrlGraphics[TouchScreenCtrlIDs::Menu] = touchScreen.graphics[touchScreenControlGraphics::MenuIdle];
|
||||
|
||||
if (bandsTotal > 0)
|
||||
ctrlGraphics[TouchScreenCtrlIDs::Bands] = touchScreen.graphics[touchScreenControlGraphics::BandsIdle];
|
||||
if (batteryTotal < 0)
|
||||
ctrlGraphics[TouchScreenCtrlIDs::BatteryHelium] = touchScreen.graphics[touchScreenControlGraphics::HeliumIdle];
|
||||
else if (batteryTotal > 0)
|
||||
ctrlGraphics[TouchScreenCtrlIDs::BatteryHelium] = touchScreen.graphics[touchScreenControlGraphics::BatteryIdle];
|
||||
|
||||
if (bandsTotal > 0)
|
||||
ctrlGraphics[TouchScreenCtrlIDs::Bands] = touchScreen.graphics[touchScreenControlGraphics::BandsIdle];
|
||||
}
|
||||
|
||||
for (int i = 0; i < touchScreenControlState::kMaxFingers; i++)
|
||||
{
|
||||
if (touchScreen.fingers[i].capturingControl == TouchScreenCtrlIDs::BatteryHelium)
|
||||
if (demoGoing)
|
||||
{
|
||||
if (batteryTotal < 0)
|
||||
ctrlGraphics[TouchScreenCtrlIDs::BatteryHelium] = touchScreen.graphics[touchScreenControlGraphics::HeliumActive];
|
||||
else if (batteryTotal > 0)
|
||||
ctrlGraphics[TouchScreenCtrlIDs::BatteryHelium] = touchScreen.graphics[touchScreenControlGraphics::BatteryActive];
|
||||
if (touchScreen.fingers[i].capturingControl == TouchScreenCtrlIDs::Menu)
|
||||
{
|
||||
ctrlGraphics[TouchScreenCtrlIDs::Menu] = touchScreen.graphics[touchScreenControlGraphics::StopActive];
|
||||
}
|
||||
}
|
||||
else if (touchScreen.fingers[i].capturingControl == TouchScreenCtrlIDs::Bands)
|
||||
else
|
||||
{
|
||||
if (bandsTotal > 0)
|
||||
ctrlGraphics[TouchScreenCtrlIDs::Bands] = touchScreen.graphics[touchScreenControlGraphics::BandsActive];
|
||||
if (touchScreen.fingers[i].capturingControl == TouchScreenCtrlIDs::BatteryHelium)
|
||||
{
|
||||
if (batteryTotal < 0)
|
||||
ctrlGraphics[TouchScreenCtrlIDs::BatteryHelium] = touchScreen.graphics[touchScreenControlGraphics::HeliumActive];
|
||||
else if (batteryTotal > 0)
|
||||
ctrlGraphics[TouchScreenCtrlIDs::BatteryHelium] = touchScreen.graphics[touchScreenControlGraphics::BatteryActive];
|
||||
}
|
||||
else if (touchScreen.fingers[i].capturingControl == TouchScreenCtrlIDs::Bands)
|
||||
{
|
||||
if (bandsTotal > 0)
|
||||
ctrlGraphics[TouchScreenCtrlIDs::Bands] = touchScreen.graphics[touchScreenControlGraphics::BandsActive];
|
||||
}
|
||||
else if (touchScreen.fingers[i].capturingControl == TouchScreenCtrlIDs::Menu)
|
||||
{
|
||||
ctrlGraphics[TouchScreenCtrlIDs::Menu] = touchScreen.graphics[touchScreenControlGraphics::MenuActive];
|
||||
}
|
||||
}
|
||||
else if (touchScreen.fingers[i].capturingControl == TouchScreenCtrlIDs::Menu)
|
||||
ctrlGraphics[TouchScreenCtrlIDs::Menu] = touchScreen.graphics[touchScreenControlGraphics::MenuActive];
|
||||
}
|
||||
|
||||
for (int i = 0; i < TouchScreenCtrlIDs::Count; i++)
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
#define kGrayedOutDownArrow 1053
|
||||
#define kMaxExtraHouses 8
|
||||
|
||||
|
||||
void WriteOutPrefs (void);
|
||||
void UpdateLoadDialog (Dialog *);
|
||||
void PageUpHouses (Dialog *);
|
||||
void PageDownHouses (Dialog *);
|
||||
@@ -343,6 +343,7 @@ void DoLoadHouse (void)
|
||||
Dialog *theDial;
|
||||
short i, wasIndex, screenCount;
|
||||
Boolean leaving, whoCares;
|
||||
bool houseNameDirty = false;
|
||||
|
||||
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
|
||||
|
||||
@@ -411,7 +412,10 @@ void DoLoadHouse (void)
|
||||
PasStringCopy(theHousesSpecs[thisHouseIndex].m_name,
|
||||
thisHouseName);
|
||||
if (OpenHouse())
|
||||
{
|
||||
whoCares = ReadHouse();
|
||||
houseNameDirty = true;
|
||||
}
|
||||
}
|
||||
leaving = true;
|
||||
}
|
||||
@@ -449,7 +453,10 @@ void DoLoadHouse (void)
|
||||
PasStringCopy(theHousesSpecs[thisHouseIndex].m_name,
|
||||
thisHouseName);
|
||||
if (OpenHouse())
|
||||
{
|
||||
whoCares = ReadHouse();
|
||||
houseNameDirty = true;
|
||||
}
|
||||
}
|
||||
leaving = true;
|
||||
}
|
||||
@@ -483,7 +490,10 @@ void DoLoadHouse (void)
|
||||
PasStringCopy(theHousesSpecs[thisHouseIndex].m_name,
|
||||
thisHouseName);
|
||||
if (OpenHouse())
|
||||
{
|
||||
whoCares = ReadHouse();
|
||||
houseNameDirty = true;
|
||||
}
|
||||
}
|
||||
leaving = true;
|
||||
}
|
||||
@@ -501,6 +511,9 @@ void DoLoadHouse (void)
|
||||
UpdateLoadDialog(theDial);
|
||||
}
|
||||
|
||||
if (houseNameDirty)
|
||||
WriteOutPrefs();
|
||||
|
||||
wm->SwapExclusiveWindow(exclWindow); // Pop exclusive window
|
||||
|
||||
theDial->Destroy();
|
||||
|
||||
@@ -99,6 +99,7 @@ void FlashSettingsButton (DrawSurface *, short);
|
||||
void UpdateSettingsMain (Dialog *);
|
||||
int16_t PrefsFilter(void *context, Dialog *dialog, const TimeTaggedVOSEvent *evt);
|
||||
void BitchAboutChanges (void);
|
||||
void WriteOutPrefs (void);
|
||||
|
||||
|
||||
Rect prefButton[4], controlRects[4];
|
||||
@@ -1358,6 +1359,8 @@ void DoSettingsMain (void)
|
||||
}
|
||||
|
||||
PortabilityLayer::HostDisplayDriver::GetInstance()->SetUseICCProfile(isUseICCProfile);
|
||||
|
||||
WriteOutPrefs();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- BitchAboutChanges
|
||||
|
||||
@@ -277,6 +277,22 @@ void LoadGraphic (DrawSurface *surface, short resID)
|
||||
thePicture.Dispose();
|
||||
}
|
||||
|
||||
void LoadGraphicNoDither(DrawSurface *surface, short resID)
|
||||
{
|
||||
Rect bounds;
|
||||
THandle<BitmapImage> thePicture;
|
||||
|
||||
thePicture = PortabilityLayer::ResourceManager::GetInstance()->GetAppResource('PICT', resID).StaticCast<BitmapImage>();
|
||||
if (thePicture == nil)
|
||||
RedAlert(kErrFailedGraphicLoad);
|
||||
|
||||
bounds = (*thePicture)->GetRect();
|
||||
OffsetRect(&bounds, -bounds.left, -bounds.top);
|
||||
surface->DrawPicture(thePicture, bounds, false);
|
||||
|
||||
thePicture.Dispose();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- LoadGraphicCustom
|
||||
// Same as LoadGraphic but supports custom graphics
|
||||
void LoadGraphicCustom(DrawSurface *surface, short resID)
|
||||
|
||||
@@ -41,6 +41,8 @@ static const int kFileBrowserUIOpenDialogTemplateID = 2001;
|
||||
static const int kFileBrowserUISaveDialogTemplateID = 2002;
|
||||
static const int kFileBrowserUIOverwriteDialogTemplateID = 2003;
|
||||
static const int kFileBrowserUIBadNameDialogTemplateID = 2004;
|
||||
static const int kFileBrowserUISaveDialogUnobstructiveTemplateID = 2007;
|
||||
|
||||
|
||||
static const int kOverwriteNoButton = 1;
|
||||
static const int kOverwriteYesButton = 2;
|
||||
@@ -472,6 +474,12 @@ namespace PortabilityLayer
|
||||
|
||||
int16_t FileBrowserUIImpl::PopUpAlert(const Rect &rect, int dialogResID, const DialogTextSubstitutions *substitutions)
|
||||
{
|
||||
PortabilityLayer::HostSystemServices *sysServices = PortabilityLayer::HostSystemServices::GetInstance();
|
||||
|
||||
// Disable text input temporarily and restore it after
|
||||
const bool wasTextInput = sysServices->IsTextInputEnabled();
|
||||
sysServices->SetTextInputEnabled(false);
|
||||
|
||||
PortabilityLayer::DialogManager *dialogManager = PortabilityLayer::DialogManager::GetInstance();
|
||||
Dialog *dialog = dialogManager->LoadDialogFromTemplate(dialogResID, rect, true, false, 0, 0, PL_GetPutInFrontWindowPtr(), PSTR(""), substitutions);
|
||||
|
||||
@@ -488,16 +496,29 @@ namespace PortabilityLayer
|
||||
|
||||
dialog->Destroy();
|
||||
|
||||
sysServices->SetTextInputEnabled(wasTextInput);
|
||||
|
||||
return hit;
|
||||
}
|
||||
|
||||
bool FileBrowserUI::Prompt(Mode mode, VirtualDirectory_t dirID, char *path, size_t &outPathLength, size_t pathCapacity, const PLPasStr &initialFileName, const PLPasStr &promptText)
|
||||
{
|
||||
int dialogID = 0;
|
||||
bool isObstructive = false;
|
||||
int windowHeight = 272;
|
||||
if (mode == Mode_Open)
|
||||
dialogID = kFileBrowserUIOpenDialogTemplateID;
|
||||
else if (mode == Mode_Save)
|
||||
dialogID = kFileBrowserUISaveDialogTemplateID;
|
||||
{
|
||||
if (PortabilityLayer::HostSystemServices::GetInstance()->IsTextInputObstructive())
|
||||
{
|
||||
dialogID = kFileBrowserUISaveDialogUnobstructiveTemplateID;
|
||||
windowHeight = 208;
|
||||
isObstructive = true;
|
||||
}
|
||||
else
|
||||
dialogID = kFileBrowserUISaveDialogTemplateID;
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(false);
|
||||
@@ -538,7 +559,7 @@ namespace PortabilityLayer
|
||||
dirCursor->Destroy();
|
||||
|
||||
const int scrollBarWidth = 16;
|
||||
const Rect windowRect = Rect::Create(0, 0, 272, 450);
|
||||
const Rect windowRect = Rect::Create(0, 0, windowHeight, 450);
|
||||
|
||||
PortabilityLayer::WindowDef wdef = PortabilityLayer::WindowDef::Create(windowRect, PortabilityLayer::WindowStyleFlags::kAlert, true, 0, 0, PSTR(""));
|
||||
|
||||
@@ -557,6 +578,9 @@ namespace PortabilityLayer
|
||||
|
||||
Window *window = dialog->GetWindow();
|
||||
|
||||
if (isObstructive)
|
||||
window->SetPosition(PortabilityLayer::Vec2i(window->GetPosition().m_x, 6));
|
||||
|
||||
DrawSurface *surface = window->GetDrawSurface();
|
||||
|
||||
const PortabilityLayer::DialogItem &firstItem = *dialog->GetItems().begin();
|
||||
|
||||
@@ -32,6 +32,8 @@ namespace PortabilityLayer
|
||||
virtual bool IsUsingMouseAsTouch() const = 0;
|
||||
virtual bool IsTextInputObstructive() const = 0;
|
||||
virtual unsigned int GetCPUCount() const = 0;
|
||||
virtual void SetTextInputEnabled(bool isEnabled) = 0;
|
||||
virtual bool IsTextInputEnabled() const = 0;
|
||||
|
||||
static void SetInstance(HostSystemServices *instance);
|
||||
static HostSystemServices *GetInstance();
|
||||
|
||||
@@ -658,6 +658,9 @@ namespace PortabilityLayer
|
||||
|
||||
bool MenuManagerImpl::FindMenuShortcut(uint16_t &menuID, uint16_t &itemID, uint8_t shortcutChar)
|
||||
{
|
||||
if (!m_menuBarVisible)
|
||||
return false;
|
||||
|
||||
MenuHandle menuH = m_firstMenu;
|
||||
while (menuH)
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "FontFamily.h"
|
||||
#include "FontManager.h"
|
||||
#include "HostSystemServices.h"
|
||||
#include "InputManager.h"
|
||||
#include "MacRomanConversion.h"
|
||||
#include "MemoryManager.h"
|
||||
@@ -42,6 +43,9 @@ namespace PortabilityLayer
|
||||
|
||||
EditboxWidget::~EditboxWidget()
|
||||
{
|
||||
if (m_hasFocus)
|
||||
PortabilityLayer::HostSystemServices::GetInstance()->SetTextInputEnabled(false);
|
||||
|
||||
PortabilityLayer::MemoryManager *mm = PortabilityLayer::MemoryManager::GetInstance();
|
||||
|
||||
if (m_chars)
|
||||
@@ -155,10 +159,15 @@ namespace PortabilityLayer
|
||||
DrawSurface *surface = m_window->GetDrawSurface();
|
||||
DrawControl(surface);
|
||||
}
|
||||
|
||||
PortabilityLayer::HostSystemServices::GetInstance()->SetTextInputEnabled(true);
|
||||
}
|
||||
|
||||
void EditboxWidget::LoseFocus()
|
||||
{
|
||||
if (m_hasFocus)
|
||||
PortabilityLayer::HostSystemServices::GetInstance()->SetTextInputEnabled(false);
|
||||
|
||||
m_hasFocus = false;
|
||||
m_selStartChar = 0;
|
||||
m_selEndChar = 0;
|
||||
@@ -772,6 +781,9 @@ namespace PortabilityLayer
|
||||
|
||||
if (mouseEvent.m_eventType == GpMouseEventTypes::kUp)
|
||||
{
|
||||
// Re-enable text input if it was dismissed
|
||||
PortabilityLayer::HostSystemServices::GetInstance()->SetTextInputEnabled(true);
|
||||
|
||||
m_caratScrollLocked = false;
|
||||
m_isDraggingSelection = false;
|
||||
return WidgetHandleStates::kDigested;
|
||||
@@ -966,6 +978,9 @@ namespace PortabilityLayer
|
||||
int32_t h = m_rect.Height();
|
||||
if (lowerY < h)
|
||||
m_scrollOffset.m_y -= lowerY - h;
|
||||
|
||||
if (m_scrollOffset.m_y > 0)
|
||||
m_scrollOffset.m_y = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -543,7 +543,7 @@ static void RedistributeError(int16_t *errorDiffusionNextRow, int16_t *errorDiff
|
||||
}
|
||||
}
|
||||
|
||||
void DrawSurface::DrawPicture(THandle<BitmapImage> pictHdl, const Rect &bounds)
|
||||
void DrawSurface::DrawPicture(THandle<BitmapImage> pictHdl, const Rect &bounds, bool errorDiffusion)
|
||||
{
|
||||
if (!pictHdl)
|
||||
return;
|
||||
@@ -722,7 +722,7 @@ void DrawSurface::DrawPicture(THandle<BitmapImage> pictHdl, const Rect &bounds)
|
||||
int16_t *errorDiffusionNextRow = nullptr;
|
||||
int16_t *errorDiffusionCurrentRow = nullptr;
|
||||
|
||||
if (bpp == 16 || bpp == 24)
|
||||
if ((bpp == 16 || bpp == 24) && errorDiffusion)
|
||||
{
|
||||
errorDiffusionBuffer = static_cast<int16_t*>(memManager->Alloc(sizeof(int16_t) * numCopyCols * 2 * 3));
|
||||
if (!errorDiffusionBuffer)
|
||||
@@ -802,31 +802,58 @@ void DrawSurface::DrawPicture(THandle<BitmapImage> pictHdl, const Rect &bounds)
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t col = 0; col < numCopyCols; col++)
|
||||
if (!errorDiffusion)
|
||||
{
|
||||
const size_t srcColIndex = col + firstSourceCol;
|
||||
const size_t destColIndex = col + firstDestCol;
|
||||
for (size_t col = 0; col < numCopyCols; col++)
|
||||
{
|
||||
const size_t srcColIndex = col + firstSourceCol;
|
||||
const size_t destColIndex = col + firstDestCol;
|
||||
|
||||
const uint8_t srcLow = currentSourceRow[srcColIndex * 2 + 0];
|
||||
const uint8_t srcHigh = currentSourceRow[srcColIndex * 2 + 1];
|
||||
const uint8_t srcLow = currentSourceRow[srcColIndex * 2 + 0];
|
||||
const uint8_t srcHigh = currentSourceRow[srcColIndex * 2 + 1];
|
||||
|
||||
const unsigned int combinedValue = srcLow | (srcHigh << 8);
|
||||
const unsigned int b = (combinedValue & 0x1f);
|
||||
const unsigned int g = ((combinedValue >> 5) & 0x1f);
|
||||
const unsigned int r = ((combinedValue >> 10) & 0x1f);
|
||||
const unsigned int combinedValue = srcLow | (srcHigh << 8);
|
||||
const unsigned int b = (combinedValue & 0x1f);
|
||||
const unsigned int g = ((combinedValue >> 5) & 0x1f);
|
||||
const unsigned int r = ((combinedValue >> 10) & 0x1f);
|
||||
|
||||
const unsigned int xr = (r << 5) | (r >> 2);
|
||||
const unsigned int xg = (g << 5) | (g >> 2);
|
||||
const unsigned int xb = (b << 5) | (b >> 2);
|
||||
const unsigned int xr = (r << 5) | (r >> 2);
|
||||
const unsigned int xg = (g << 5) | (g >> 2);
|
||||
const unsigned int xb = (b << 5) | (b >> 2);
|
||||
|
||||
ErrorDiffusionWorkPixel wp = ApplyErrorDiffusion(errorDiffusionCurrentRow, xr, xg, xb, col, numCopyCols);
|
||||
uint8_t colorIndex = stdPalette->MapColorLUT(PortabilityLayer::RGBAColor::Create(xr, xg, xb, 255));
|
||||
|
||||
uint8_t colorIndex = stdPalette->MapColorLUT(PortabilityLayer::RGBAColor::Create(wp.m_8[0], wp.m_8[1], wp.m_8[2], 255));
|
||||
PortabilityLayer::RGBAColor resultColor = stdPalette->GetColors()[colorIndex];
|
||||
currentDestRow[destColIndex] = colorIndex;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t col = 0; col < numCopyCols; col++)
|
||||
{
|
||||
const size_t srcColIndex = col + firstSourceCol;
|
||||
const size_t destColIndex = col + firstDestCol;
|
||||
|
||||
RedistributeError(errorDiffusionNextRow, errorDiffusionCurrentRow, wp.m_16[0], wp.m_16[1], wp.m_16[2], resultColor.r, resultColor.g, resultColor.b, col, numCopyCols);
|
||||
const uint8_t srcLow = currentSourceRow[srcColIndex * 2 + 0];
|
||||
const uint8_t srcHigh = currentSourceRow[srcColIndex * 2 + 1];
|
||||
|
||||
currentDestRow[destColIndex] = colorIndex;
|
||||
const unsigned int combinedValue = srcLow | (srcHigh << 8);
|
||||
const unsigned int b = (combinedValue & 0x1f);
|
||||
const unsigned int g = ((combinedValue >> 5) & 0x1f);
|
||||
const unsigned int r = ((combinedValue >> 10) & 0x1f);
|
||||
|
||||
const unsigned int xr = (r << 5) | (r >> 2);
|
||||
const unsigned int xg = (g << 5) | (g >> 2);
|
||||
const unsigned int xb = (b << 5) | (b >> 2);
|
||||
|
||||
ErrorDiffusionWorkPixel wp = ApplyErrorDiffusion(errorDiffusionCurrentRow, xr, xg, xb, col, numCopyCols);
|
||||
|
||||
uint8_t colorIndex = stdPalette->MapColorLUT(PortabilityLayer::RGBAColor::Create(wp.m_8[0], wp.m_8[1], wp.m_8[2], 255));
|
||||
PortabilityLayer::RGBAColor resultColor = stdPalette->GetColors()[colorIndex];
|
||||
|
||||
RedistributeError(errorDiffusionNextRow, errorDiffusionCurrentRow, wp.m_16[0], wp.m_16[1], wp.m_16[2], resultColor.r, resultColor.g, resultColor.b, col, numCopyCols);
|
||||
|
||||
currentDestRow[destColIndex] = colorIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -855,19 +882,38 @@ void DrawSurface::DrawPicture(THandle<BitmapImage> pictHdl, const Rect &bounds)
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t col = 0; col < numCopyCols; col++)
|
||||
if (!errorDiffusion)
|
||||
{
|
||||
const size_t srcColIndex = col + firstSourceCol;
|
||||
const size_t destColIndex = col + firstDestCol;
|
||||
for (size_t col = 0; col < numCopyCols; col++)
|
||||
{
|
||||
const size_t srcColIndex = col + firstSourceCol;
|
||||
const size_t destColIndex = col + firstDestCol;
|
||||
|
||||
ErrorDiffusionWorkPixel wp = ApplyErrorDiffusion(errorDiffusionCurrentRow, currentSourceRow[srcColIndex * 3 + 2], currentSourceRow[srcColIndex * 3 + 1], currentSourceRow[srcColIndex * 3 + 0], col, numCopyCols);
|
||||
const uint8_t r = currentSourceRow[srcColIndex * 3 + 2];
|
||||
const uint8_t g = currentSourceRow[srcColIndex * 3 + 1];
|
||||
const uint8_t b = currentSourceRow[srcColIndex * 3 + 0];
|
||||
|
||||
uint8_t colorIndex = stdPalette->MapColorLUT(PortabilityLayer::RGBAColor::Create(wp.m_8[0], wp.m_8[1], wp.m_8[2], 255));
|
||||
PortabilityLayer::RGBAColor resultColor = stdPalette->GetColors()[colorIndex];
|
||||
uint8_t colorIndex = stdPalette->MapColorLUT(PortabilityLayer::RGBAColor::Create(r, g, b, 255));
|
||||
|
||||
RedistributeError(errorDiffusionNextRow, errorDiffusionCurrentRow, wp.m_16[0], wp.m_16[1], wp.m_16[2], resultColor.r, resultColor.g, resultColor.b, col, numCopyCols);
|
||||
currentDestRow[destColIndex] = colorIndex;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t col = 0; col < numCopyCols; col++)
|
||||
{
|
||||
const size_t srcColIndex = col + firstSourceCol;
|
||||
const size_t destColIndex = col + firstDestCol;
|
||||
|
||||
currentDestRow[destColIndex] = colorIndex;
|
||||
ErrorDiffusionWorkPixel wp = ApplyErrorDiffusion(errorDiffusionCurrentRow, currentSourceRow[srcColIndex * 3 + 2], currentSourceRow[srcColIndex * 3 + 1], currentSourceRow[srcColIndex * 3 + 0], col, numCopyCols);
|
||||
|
||||
uint8_t colorIndex = stdPalette->MapColorLUT(PortabilityLayer::RGBAColor::Create(wp.m_8[0], wp.m_8[1], wp.m_8[2], 255));
|
||||
PortabilityLayer::RGBAColor resultColor = stdPalette->GetColors()[colorIndex];
|
||||
|
||||
RedistributeError(errorDiffusionNextRow, errorDiffusionCurrentRow, wp.m_16[0], wp.m_16[1], wp.m_16[2], resultColor.r, resultColor.g, resultColor.b, col, numCopyCols);
|
||||
|
||||
currentDestRow[destColIndex] = colorIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ struct DrawSurface
|
||||
void DrawStringConstrained(const Point &point, const PLPasStr &str, const Rect &constraintRect, PortabilityLayer::ResolveCachingColor &cacheColor, PortabilityLayer::RenderedFont *font);
|
||||
void DrawStringWrap(const Point &point, const Rect &constrainRect, const PLPasStr &str, PortabilityLayer::ResolveCachingColor &cacheColor, PortabilityLayer::RenderedFont *font);
|
||||
|
||||
void DrawPicture(THandle<BitmapImage> pictHandle, const Rect &rect);
|
||||
void DrawPicture(THandle<BitmapImage> pictHandle, const Rect &rect, bool errorDiffusion = true);
|
||||
|
||||
IGpDisplayDriverSurface *m_ddSurface;
|
||||
|
||||
|
||||
@@ -1513,7 +1513,7 @@ namespace PortabilityLayer
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Information, "prevClearanceY: %i newClearanceY: %i", static_cast<int>(prevClearanceY), static_cast<int>(newClearanceY));
|
||||
|
||||
newY = (static_cast<int64_t>(currentY) - static_cast<int64_t>(menuBarHeight) - chromePadding[WindowChromeSides::kTop]) * static_cast<int64_t>(newClearanceY) / static_cast<int64_t>(prevClearanceY) + chromePadding[WindowChromeSides::kTop];
|
||||
newY = (static_cast<int64_t>(currentY) - chromePadding[WindowChromeSides::kTop]) * static_cast<int64_t>(newClearanceY) / static_cast<int64_t>(prevClearanceY) + chromePadding[WindowChromeSides::kTop];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class HostThreadEvent;
|
||||
|
||||
|
||||
class WorkerThread
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
<Directory Id="AEROFOILRESOURCESDIR" Name="Resources" />
|
||||
<Directory Id="AEROFOILPACKAGEDDIR" Name="Packaged">
|
||||
<Directory Id="AEROFOILHOUSESDIR" Name="Houses" />
|
||||
<Directory Id="AEROFOILWINCURSORSDIR" Name="WinCursors" />
|
||||
</Directory>
|
||||
<Directory Id="AEROFOILDOCUMENTATIONDIR" Name="Documentation" />
|
||||
<Directory Id="AEROFOILTOOLSDIR" Name="Tools" />
|
||||
@@ -163,7 +162,6 @@
|
||||
|
||||
<ComponentRef Id="readme.txt" />
|
||||
|
||||
<ComponentGroupRef Id="WinCursorsComponentGroup"/>
|
||||
<ComponentGroupRef Id="DefaultHousesComponentGroup"/>
|
||||
|
||||
<ComponentGroupRef Id="ResourcesComponentGroup"/>
|
||||
|
||||
@@ -170,22 +170,12 @@
|
||||
<DefineConstants>
|
||||
ResourcesDataDir=$(SolutionDir)\Resources;
|
||||
DocumentationDataDir=$(SolutionDir)\Documentation;
|
||||
WinCursorsDataDir=$(SolutionDir)\Packaged\WinCursors;
|
||||
HousesDataDir=$(SolutionDir)\Packaged\Houses;
|
||||
PackagedDataDir=$(SolutionDir)\Packaged;
|
||||
</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<Target Name="BeforeBuild">
|
||||
<ItemGroup>
|
||||
<HarvestDirectory Include="$(SolutionDir)\Packaged\WinCursors">
|
||||
<DirectoryRefId>AEROFOILWINCURSORSDIR</DirectoryRefId>
|
||||
<SuppressRootDirectory>true</SuppressRootDirectory>
|
||||
<SuppressCom>true</SuppressCom>
|
||||
<SuppressRegistry>true</SuppressRegistry>
|
||||
<ComponentGroupName>WinCursorsComponentGroup</ComponentGroupName>
|
||||
<AutogenerateGuids>true</AutogenerateGuids>
|
||||
<PreprocessorVariable>var.WinCursorsDataDir</PreprocessorVariable>
|
||||
</HarvestDirectory>
|
||||
<HarvestDirectory Include="$(SolutionDir)\Resources">
|
||||
<DirectoryRefId>AEROFOILRESOURCESDIR</DirectoryRefId>
|
||||
<SuppressRootDirectory>true</SuppressRootDirectory>
|
||||
|
||||
Reference in New Issue
Block a user