x64 build - no collision bug found(

Either lost in decompilation or introduced in x64 port.
This commit is contained in:
oz 2021-01-29 16:42:05 +03:00
parent 6756c54d3b
commit cd4679194c
19 changed files with 100 additions and 79 deletions

View File

@ -43,14 +43,14 @@
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>NotSet</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>NotSet</CharacterSet>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings"> <ImportGroup Label="ExtensionSettings">
@ -114,6 +114,7 @@
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>Comctl32.lib;Winmm.lib;Htmlhelp.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -153,6 +154,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>Comctl32.lib;Winmm.lib;Htmlhelp.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>

View File

@ -3,7 +3,7 @@
struct gdrv_bitmap8; struct gdrv_bitmap8;
struct __declspec(align(4)) flasher_type struct flasher_type
{ {
render_sprite_type_struct* Sprite; render_sprite_type_struct* Sprite;
gdrv_bitmap8* BmpArr[2]; gdrv_bitmap8* BmpArr[2];
@ -15,7 +15,7 @@ struct __declspec(align(4)) flasher_type
}; };
struct __declspec(align(4)) TLight_player_backup struct TLight_player_backup
{ {
int MessageField; int MessageField;
int BmpIndex1; int BmpIndex1;

View File

@ -33,13 +33,13 @@ HANDLE WaveMix::ConfigureInit(MIXCONFIG* lpConfig)
{ {
MIXCONFIG mixConfig{}; MIXCONFIG mixConfig{};
memset(&mixConfig, 0, 0x1Cu); memset(&mixConfig, 0, sizeof(MIXCONFIG));
unsigned int copySize = 30; unsigned int copySize = sizeof(MIXCONFIG);
mixConfig.RegistryKey = nullptr; mixConfig.RegistryKey = nullptr;
mixConfig.wSize = 30; mixConfig.wSize = sizeof(MIXCONFIG);
if (lpConfig) if (lpConfig)
{ {
if (lpConfig->wSize < 30u) if (lpConfig->wSize < sizeof(MIXCONFIG))
copySize = lpConfig->wSize; copySize = lpConfig->wSize;
memcpy(&mixConfig, lpConfig, copySize); memcpy(&mixConfig, lpConfig, copySize);
} }
@ -63,7 +63,7 @@ HANDLE WaveMix::ConfigureInit(MIXCONFIG* lpConfig)
if (GetPrivateProfileIntA("general", "ShowDevices", 0, FileName)) if (GetPrivateProfileIntA("general", "ShowDevices", 0, FileName))
ShowWaveOutDevices(); ShowWaveOutDevices();
auto globals = static_cast<GLOBALS*>(LocalAlloc(0x40u, 0x1C0u)); auto globals = static_cast<GLOBALS*>(LocalAlloc(0x40u, sizeof(GLOBALS)));
Globals = globals; Globals = globals;
if (!globals) if (!globals)
return nullptr; return nullptr;
@ -262,7 +262,7 @@ MIXWAVE* WaveMix::OpenWave(HANDLE hMixSession, LPCSTR szWaveFilename, HINSTANCE
return nullptr; return nullptr;
} }
auto mixWave = static_cast<MIXWAVE*>(GlobalLock(GlobalAlloc(0x2040u, 0x42u))); auto mixWave = static_cast<MIXWAVE*>(GlobalLock(GlobalAlloc(0x2040u, sizeof(MIXWAVE))));
if (!mixWave) if (!mixWave)
{ {
if (ShowDebugDialogs) if (ShowDebugDialogs)
@ -1180,7 +1180,7 @@ int WaveMix::Configure(GLOBALS* hMixSession, HWND hWndParent, MIXCONFIG* lpConfi
if (!mixConfig) if (!mixConfig)
{ {
mixConfigLocal.wSize = 30; mixConfigLocal.wSize = sizeof(MIXCONFIG);
mixConfigLocal.dwFlags = 1023; mixConfigLocal.dwFlags = 1023;
GetConfig(static_cast<GLOBALS*>(hMixSession), &mixConfigLocal); GetConfig(static_cast<GLOBALS*>(hMixSession), &mixConfigLocal);
auto dialog = MakeSettingsDlgTemplate(); auto dialog = MakeSettingsDlgTemplate();
@ -1821,7 +1821,7 @@ int WaveMix::Settings_OnInitDialog(HWND hWnd, int wParam, MIXCONFIG* lpMixconfig
GetWindowTextA(hWnd, String, 256); GetWindowTextA(hWnd, String, 256);
wsprintfA(string_buffer, String, 2, 81); wsprintfA(string_buffer, String, 2, 81);
SetWindowTextA(hWnd, string_buffer); SetWindowTextA(hWnd, string_buffer);
SetWindowLongA(hWnd, -21, (LONG)lpMixconfig); SetWindowLongPtr(hWnd, -21, reinterpret_cast<LONG_PTR>(lpMixconfig));
SendMessageA(GetDlgItem(hWnd, 1000), 0xF1u, lpMixconfig->wChannels > 1u, 0); SendMessageA(GetDlgItem(hWnd, 1000), 0xF1u, lpMixconfig->wChannels > 1u, 0);
SendMessageA(GetDlgItem(hWnd, 1001), 0xF1u, lpMixconfig->ResetMixDefaultFlag != 0, 0); SendMessageA(GetDlgItem(hWnd, 1001), 0xF1u, lpMixconfig->ResetMixDefaultFlag != 0, 0);
SendMessageA(GetDlgItem(hWnd, 1004), 0xF1u, lpMixconfig->GoodWavePos != 0, 0); SendMessageA(GetDlgItem(hWnd, 1004), 0xF1u, lpMixconfig->GoodWavePos != 0, 0);
@ -1880,7 +1880,7 @@ int WaveMix::Settings_OnInitDialog(HWND hWnd, int wParam, MIXCONFIG* lpMixconfig
int WaveMix::Settings_OnCommand(HWND hWnd, int command, int lParam, int wParam) int WaveMix::Settings_OnCommand(HWND hWnd, int command, int lParam, int wParam)
{ {
auto userData = (MIXCONFIG*)GetWindowLongA(hWnd, -21); auto userData = reinterpret_cast<MIXCONFIG*>(GetWindowLongPtrA(hWnd, -21));
if (command == 1) if (command == 1)
{ {
if (userData) if (userData)

View File

@ -109,7 +109,7 @@ int fullscrn::enableFullscreen()
if (trick) if (trick)
{ {
GetWindowRect(GetDesktopWindow(), &Rect); GetWindowRect(GetDesktopWindow(), &Rect);
SetWindowPos(hWnd, (HWND)((int)HWND_MESSAGE | 0x2), 0, 0, Rect.right - Rect.left + 1, SetWindowPos(hWnd, (HWND)-1, 0, 0, Rect.right - Rect.left + 1,
Rect.bottom - Rect.top + 1, 8u); Rect.bottom - Rect.top + 1, 8u);
} }
SmthFullScrnFlag2 = 1; SmthFullScrnFlag2 = 1;
@ -126,7 +126,7 @@ int fullscrn::enableFullscreen()
} }
GetWindowRect(GetDesktopWindow(), &Rect); GetWindowRect(GetDesktopWindow(), &Rect);
disableWindowFlagsDisDlg(); disableWindowFlagsDisDlg();
SetWindowPos(hWnd, (HWND)0xFFFFFFFE, 0, 0, Rect.right - Rect.left + 1, Rect.bottom - Rect.top + 1, 8u); SetWindowPos(hWnd, (HWND)-1, 0, 0, Rect.right - Rect.left + 1, Rect.bottom - Rect.top + 1, 8u);
return 0; return 0;
} }
@ -138,7 +138,7 @@ int fullscrn::disableFullscreen()
SmthFullScrnFlag2 = 1; SmthFullScrnFlag2 = 1;
ChangeDisplaySettingsA(nullptr, 4u); ChangeDisplaySettingsA(nullptr, 4u);
if (trick) if (trick)
SetWindowPos(hWnd, (HWND)0xFFFFFFFE, 0, 0, 0, 0, 0x13u); SetWindowPos(hWnd, (HWND)-1, 0, 0, 0, 0, 0x13u);
} }
setWindowFlagsDisDlg(); setWindowFlagsDisDlg();
SetWindowPos( SetWindowPos(

View File

@ -7,9 +7,7 @@ enum class BitmapType : char
DibBitmap = 2, DibBitmap = 2,
}; };
struct gdrv_bitmap8
#pragma pack(push, 1)
struct __declspec(align(1)) gdrv_bitmap8
{ {
BITMAPINFO* Dib; BITMAPINFO* Dib;
char* BmpBufPtr2; char* BmpBufPtr2;
@ -22,8 +20,6 @@ struct __declspec(align(1)) gdrv_bitmap8
int XPosition; int XPosition;
int YPosition; int YPosition;
}; };
#pragma pack(pop)
struct LOGPALETTEx256 struct LOGPALETTEx256
{ {
@ -36,7 +32,6 @@ struct LOGPALETTEx256
} }
}; };
static_assert(sizeof(gdrv_bitmap8) == 37, "Wrong size of gdrv_bitmap8");
class gdrv class gdrv
{ {

View File

@ -22,7 +22,7 @@ struct soundListStruct
char* PtrToSmth; char* PtrToSmth;
}; };
struct __declspec(align(4)) visualKickerStruct struct visualKickerStruct
{ {
float Threshold; float Threshold;
float Boost; float Boost;
@ -33,7 +33,7 @@ struct __declspec(align(4)) visualKickerStruct
}; };
struct __declspec(align(4)) visualStruct struct visualStruct
{ {
float Smoothness; float Smoothness;
float Elasticity; float Elasticity;

View File

@ -10,7 +10,7 @@ struct vector_type
}; };
struct __declspec(align(4)) rectangle_type struct rectangle_type
{ {
int XPosition; int XPosition;
int YPosition; int YPosition;
@ -24,7 +24,7 @@ struct circle_type
float RadiusSq; float RadiusSq;
}; };
struct __declspec(align(4)) ray_type struct ray_type
{ {
vector_type Origin; vector_type Origin;
vector_type Direction; vector_type Direction;
@ -35,7 +35,7 @@ struct __declspec(align(4)) ray_type
int FieldFlag; int FieldFlag;
}; };
struct __declspec(align(4)) line_type struct line_type
{ {
vector_type PerpendicularL; vector_type PerpendicularL;
vector_type Direction; vector_type Direction;
@ -59,7 +59,7 @@ struct wall_point_type
float Y1; float Y1;
}; };
struct __declspec(align(4)) ramp_plane_type struct ramp_plane_type
{ {
vector_type BallCollisionOffset; vector_type BallCollisionOffset;
vector_type2 V1; vector_type2 V1;
@ -84,7 +84,8 @@ public:
static void cross(vector_type* vec1, vector_type* vec2, vector_type* dstVec); static void cross(vector_type* vec1, vector_type* vec2, vector_type* dstVec);
static float magnitude(vector_type* vec); static float magnitude(vector_type* vec);
static void vector_add(vector_type* vec1Dst, vector_type* vec2); static void vector_add(vector_type* vec1Dst, vector_type* vec2);
static float basic_collision(TBall* ball, vector_type* nextPosition, vector_type* direction, float elasticity, float smoothness, static float basic_collision(TBall* ball, vector_type* nextPosition, vector_type* direction, float elasticity,
float smoothness,
float threshold, float boost); float threshold, float boost);
static float Distance_Squared(vector_type vec1, vector_type vec2); static float Distance_Squared(vector_type vec1, vector_type vec2);
static float DotProduct(vector_type* vec1, vector_type* vec2); static float DotProduct(vector_type* vec1, vector_type* vec2);

View File

@ -6,7 +6,6 @@ struct objlist_struct1
int Count; int Count;
void* Array[1]; void* Array[1];
}; };
static_assert(sizeof(objlist_struct1) == 12, "Wrong size of objlist_struct1");
class objlist_class class objlist_class
{ {

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "pinball.h" #include "pinball.h"
struct __declspec(align(4)) optionsStruct struct optionsStruct
{ {
int Sounds; int Sounds;
int Music; int Music;

View File

@ -2,6 +2,7 @@
#include "partman.h" #include "partman.h"
#include "gdrv.h" #include "gdrv.h"
#include "memory.h" #include "memory.h"
#include "zdrv.h"
short partman::_field_size[] = short partman::_field_size[] =
{ {
@ -14,6 +15,7 @@ datFileStruct* partman::load_records(LPCSTR lpFileName)
_OFSTRUCT ReOpenBuff{}; _OFSTRUCT ReOpenBuff{};
datFileHeader header{}; datFileHeader header{};
dat8BitBmpHeader bmpHeader{}; dat8BitBmpHeader bmpHeader{};
dat16BitBmpHeader zMapHeader{};
const HFILE fileHandle = OpenFile(lpFileName, &ReOpenBuff, 0); const HFILE fileHandle = OpenFile(lpFileName, &ReOpenBuff, 0);
if (fileHandle == -1) if (fileHandle == -1)
@ -90,11 +92,11 @@ datFileStruct* partman::load_records(LPCSTR lpFileName)
{ {
auto entryType = static_cast<datFieldTypes>(_lread_char(fileHandle)); auto entryType = static_cast<datFieldTypes>(_lread_char(fileHandle));
entryData->EntryType = entryType; entryData->EntryType = entryType;
int fieldSize = _field_size[static_cast<int>(entryType)]; int fieldSize = _field_size[static_cast<int>(entryType)];
if (fieldSize < 0) if (fieldSize < 0)
{
fieldSize = _lread_long(fileHandle); fieldSize = _lread_long(fileHandle);
}
if (entryType == datFieldTypes::Bitmap8bit) if (entryType == datFieldTypes::Bitmap8bit)
{ {
_hread(fileHandle, &bmpHeader, sizeof(dat8BitBmpHeader)); _hread(fileHandle, &bmpHeader, sizeof(dat8BitBmpHeader));
@ -117,6 +119,18 @@ datFileStruct* partman::load_records(LPCSTR lpFileName)
bmp->XPosition = bmpHeader.XPosition; bmp->XPosition = bmpHeader.XPosition;
bmp->YPosition = bmpHeader.YPosition; bmp->YPosition = bmpHeader.YPosition;
} }
else if (entryType == datFieldTypes::Bitmap16bit)
{
_hread(fileHandle, &zMapHeader, sizeof(dat16BitBmpHeader));
int length = fieldSize - sizeof(dat16BitBmpHeader);
auto zmap = reinterpret_cast<zmap_header_type*>(memory::allocate(sizeof(zmap_header_type) + length));
zmap->Width = zMapHeader.Width;
zmap->Height = zMapHeader.Height;
zmap->Stride = zMapHeader.Stride;
_hread(fileHandle, zmap->ZBuffer, length);
entryData->Buffer = reinterpret_cast<char*>(zmap);
}
else else
{ {
char* entryBuffer = static_cast<char*>(memory::allocate(fieldSize)); char* entryBuffer = static_cast<char*>(memory::allocate(fieldSize));

View File

@ -89,6 +89,22 @@ struct dat8BitBmpHeader
static_assert(sizeof(dat8BitBmpHeader) == 14, "Wrong size of dat8BitBmpHeader"); static_assert(sizeof(dat8BitBmpHeader) == 14, "Wrong size of dat8BitBmpHeader");
#pragma pack(push, 1)
struct __declspec(align(1)) dat16BitBmpHeader
{
__int16 Width;
__int16 Height;
__int16 Stride;
int Unknown0;
__int16 Unknown1_0;
__int16 Unknown1_1;
};
#pragma pack(pop)
static_assert(sizeof(dat16BitBmpHeader) == 14, "Wrong size of zmap_header_type");
class partman class partman
{ {
public: public:

View File

@ -80,26 +80,32 @@ void pinball::FindShiftKeys()
} }
HANDLE pinball::adjust_priority(int priority) void pinball::adjust_priority(int priority)
{ {
HANDLE result = GetCurrentThread(); auto thread = GetCurrentThread();
switch (priority) switch (priority)
{ {
case -2: case -2:
return (HANDLE)SetThreadPriority(result, -2); SetThreadPriority(thread, -2);
break;
case -1: case -1:
return (HANDLE)SetThreadPriority(result, -1); SetThreadPriority(thread, -1);
break;
case 0: case 0:
return (HANDLE)SetThreadPriority(result, 0); SetThreadPriority(thread, 0);
break;
case 1: case 1:
return (HANDLE)SetThreadPriority(result, 1); SetThreadPriority(thread, 1);
break;
case 2: case 2:
return (HANDLE)SetThreadPriority(result, 2); SetThreadPriority(thread, 2);
break;
case 3: case 3:
result = (HANDLE)SetThreadPriority(result, 15); SetThreadPriority(thread, 15);
break;
default:
break; break;
} }
return result;
} }
int pinball::make_path_name(LPSTR lpFilename, LPCSTR lpString2, int nSize) int pinball::make_path_name(LPSTR lpFilename, LPCSTR lpString2, int nSize)

View File

@ -20,7 +20,7 @@ public:
static char* get_rc_string(int uID, int a2); static char* get_rc_string(int uID, int a2);
static int get_rc_int(int uID, int* dst); static int get_rc_int(int uID, int* dst);
static void FindShiftKeys(); static void FindShiftKeys();
static HANDLE adjust_priority(int priority); static void adjust_priority(int priority);
static int make_path_name(LPSTR lpFilename, LPCSTR lpString2, int nSize = 0x12Cu); static int make_path_name(LPSTR lpFilename, LPCSTR lpString2, int nSize = 0x12Cu);
private: private:
static char getRcBuffer[256 * 6]; static char getRcBuffer[256 * 6];

View File

@ -18,9 +18,9 @@ void render::init(gdrv_bitmap8* bmp, float zMin, float zScaler, int width, int h
zscaler = zScaler; zscaler = zScaler;
zmin = zMin; zmin = zMin;
zmax = 4294967300.0f / zScaler + zMin; zmax = 4294967300.0f / zScaler + zMin;
sprite_list = (render_sprite_type_struct**)memory::allocate(0xFA0u); sprite_list = reinterpret_cast<render_sprite_type_struct**>(memory::allocate(1000 * sizeof(void*)));
dirty_list = (render_sprite_type_struct**)memory::allocate(0xFA0u); dirty_list = reinterpret_cast<render_sprite_type_struct**>(memory::allocate(1000 * sizeof(void*)));
ball_list = (render_sprite_type_struct**)memory::allocate(0x50u); ball_list = reinterpret_cast<render_sprite_type_struct**>(memory::allocate(20 * sizeof(void*)));
gdrv::create_bitmap(&vscreen, width, height); gdrv::create_bitmap(&vscreen, width, height);
zdrv::create_zmap(&zscreen, width, height); zdrv::create_zmap(&zscreen, width, height);
zdrv::fill(&zscreen, zscreen.Width, zscreen.Height, 0, 0, 0xFFFF); zdrv::fill(&zscreen, zscreen.Width, zscreen.Height, 0, 0, 0xFFFF);
@ -542,7 +542,7 @@ void render::build_occlude_list()
if (!curSprite->UnknownFlag && curSprite->BoundingRect.Width != -1) if (!curSprite->UnknownFlag && curSprite->BoundingRect.Width != -1)
{ {
if (!spriteArr) if (!spriteArr)
spriteArr = reinterpret_cast<render_sprite_type_struct**>(memory::allocate(0xFA0u)); spriteArr = reinterpret_cast<render_sprite_type_struct**>(memory::allocate(1000 * sizeof(void*)));
int occludeCount = 0; int occludeCount = 0;
auto spritePtr2 = sprite_list; auto spritePtr2 = sprite_list;
for (int i = 0; i < many_sprites; ++i, ++spritePtr2) for (int i = 0; i < many_sprites; ++i, ++spritePtr2)
@ -561,7 +561,7 @@ void render::build_occlude_list()
if (occludeCount) if (occludeCount)
{ {
curSprite->SpriteArray = reinterpret_cast<render_sprite_type_struct**>(memory::realloc( curSprite->SpriteArray = reinterpret_cast<render_sprite_type_struct**>(memory::realloc(
spriteArr, 4 * occludeCount)); spriteArr, sizeof(void*) * occludeCount));
curSprite->SpriteCount = occludeCount; curSprite->SpriteCount = occludeCount;
spriteArr = nullptr; spriteArr = nullptr;
} }

View File

@ -10,7 +10,7 @@ enum class VisualType : char
Ball = 2 Ball = 2
}; };
struct __declspec(align(4)) render_sprite_type_struct struct render_sprite_type_struct
{ {
rectangle_type BmpRect; rectangle_type BmpRect;
gdrv_bitmap8* Bmp; gdrv_bitmap8* Bmp;
@ -28,8 +28,6 @@ struct __declspec(align(4)) render_sprite_type_struct
}; };
static_assert(sizeof(render_sprite_type_struct) == 0x5c, "Wrong size render_sprite_type_struct");
class render class render
{ {
public: public:

View File

@ -12,7 +12,7 @@ splash_struct* splash::splash_screen(HINSTANCE hInstance, LPCSTR bmpName1, LPCST
WNDCLASSA WndClass{}; WNDCLASSA WndClass{};
tagRECT Rect{}; tagRECT Rect{};
auto splashStruct = reinterpret_cast<splash_struct*>(memory::allocate(0x1B0u)); auto splashStruct = reinterpret_cast<splash_struct*>(memory::allocate(sizeof(splash_struct)));
if (!splashStruct) if (!splashStruct)
return nullptr; return nullptr;
@ -43,7 +43,7 @@ splash_struct* splash::splash_screen(HINSTANCE hInstance, LPCSTR bmpName1, LPCST
return nullptr; return nullptr;
} }
SetWindowLongA(windowHandle, 0, reinterpret_cast<LONG>(splashStruct)); SetWindowLongPtrA(windowHandle, -21, reinterpret_cast<LONG_PTR>(splashStruct));
GetWindowRect(GetDesktopWindow(), &Rect); GetWindowRect(GetDesktopWindow(), &Rect);
splash_bitmap_setup(splashStruct); splash_bitmap_setup(splashStruct);
//MoveWindow(splashStruct->WindowHandle, 0, 0, Rect.right - Rect.left, Rect.bottom - Rect.top, 0); //MoveWindow(splashStruct->WindowHandle, 0, 0, Rect.right - Rect.left, Rect.bottom - Rect.top, 0);
@ -62,7 +62,7 @@ splash_struct* splash::splash_screen(HINSTANCE hInstance, LPCSTR bmpName1, LPCST
void splash::splash_bitmap_setup(splash_struct* splashStruct) void splash::splash_bitmap_setup(splash_struct* splashStruct)
{ {
HBITMAP bmpHandle2; HBITMAP bmpHandle2;
BITMAP bmp; BITMAP bmp{};
HBITMAP bmpHandle1 = nullptr; HBITMAP bmpHandle1 = nullptr;
HDC desktopDC = GetDC(GetDesktopWindow()); HDC desktopDC = GetDC(GetDesktopWindow());
@ -92,7 +92,7 @@ void splash::splash_bitmap_setup(splash_struct* splashStruct)
{ {
SelectObject(splashStruct->DrawingContext, bmpHandle2); SelectObject(splashStruct->DrawingContext, bmpHandle2);
DeleteObject(bmpHandle1); DeleteObject(bmpHandle1);
GetObjectA(splashStruct->Bitmap, 24, &bmp); GetObjectA(splashStruct->Bitmap, sizeof(BITMAP), &bmp);
splashStruct->Width = bmp.bmWidth; splashStruct->Width = bmp.bmWidth;
splashStruct->Height = bmp.bmHeight; splashStruct->Height = bmp.bmHeight;
return; return;
@ -274,7 +274,7 @@ LRESULT splash::splash_message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LPARA
{ {
case WM_PAINT: case WM_PAINT:
{ {
auto splashStruct = reinterpret_cast<splash_struct*>(GetWindowLongA(hWnd, 0)); auto splashStruct = reinterpret_cast<splash_struct*>(GetWindowLongPtrA(hWnd, -21));
BeginPaint(hWnd, &Paint); BeginPaint(hWnd, &Paint);
EndPaint(hWnd, &Paint); EndPaint(hWnd, &Paint);
auto dc = GetDC(hWnd); auto dc = GetDC(hWnd);

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
struct __declspec(align(4)) timer_struct struct timer_struct
{ {
int TargetTime; int TargetTime;
void* Caller; void* Caller;

View File

@ -532,20 +532,15 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP
{ {
char cmdLine[0x1F4u]; char cmdLine[0x1F4u];
options::get_string(nullptr, "Shell Exe", tmpBuf, pinball::WindowName, 500); options::get_string(nullptr, "Shell Exe", tmpBuf, pinball::WindowName, 500);
auto iHwnd = reinterpret_cast<size_t>(hwnd_frame);
sprintf_s( sprintf_s(
cmdLine, cmdLine,
"%s %s%lX %s%lX", "%s %s%lX %s%lX",
tmpBuf, tmpBuf,
"select=", "select=",
(int)hwnd_frame, iHwnd,
"confirm=", "confirm=",
(int)hwnd_frame iHwnd * iHwnd * iHwnd * iHwnd * iHwnd * iHwnd * iHwnd);
* (int)hwnd_frame
* (int)hwnd_frame
* (int)hwnd_frame
* (int)hwnd_frame
* (int)hwnd_frame
* (int)hwnd_frame);
if (static_cast<int>(WinExec(cmdLine, 5u)) < 32) if (static_cast<int>(WinExec(cmdLine, 5u)) < 32)
{ {
auto caption = pinball::get_rc_string(170, 0); auto caption = pinball::get_rc_string(170, 0);

View File

@ -1,8 +1,7 @@
#pragma once #pragma once
#include "gdrv.h" #include "gdrv.h"
#pragma pack(push, 1) struct zmap_header_type
struct __declspec(align(1)) zmap_header_type
{ {
__int16 Width; __int16 Width;
__int16 Height; __int16 Height;
@ -12,10 +11,6 @@ struct __declspec(align(1)) zmap_header_type
unsigned __int16 ZBuffer[1]; unsigned __int16 ZBuffer[1];
}; };
#pragma pack(pop)
static_assert(sizeof(zmap_header_type) == 16, "Wrong size of zmap_header_type");
class zdrv class zdrv
{ {
public: public: