From cd4679194c1c5d5309cecdd5471d41613cb7ec31 Mon Sep 17 00:00:00 2001 From: oz Date: Fri, 29 Jan 2021 16:42:05 +0300 Subject: [PATCH] x64 build - no collision bug found( Either lost in decompilation or introduced in x64 port. --- SpaceCadetPinball/SpaceCadetPinball.vcxproj | 6 +++-- SpaceCadetPinball/TLight.h | 4 ++-- SpaceCadetPinball/WaveMix.cpp | 18 +++++++------- SpaceCadetPinball/fullscrn.cpp | 6 ++--- SpaceCadetPinball/gdrv.h | 9 ++----- SpaceCadetPinball/loader.h | 8 +++---- SpaceCadetPinball/maths.h | 11 +++++---- SpaceCadetPinball/objlist_class.h | 1 - SpaceCadetPinball/options.h | 2 +- SpaceCadetPinball/partman.cpp | 20 +++++++++++++--- SpaceCadetPinball/partman.h | 16 +++++++++++++ SpaceCadetPinball/pinball.cpp | 26 +++++++++++++-------- SpaceCadetPinball/pinball.h | 2 +- SpaceCadetPinball/render.cpp | 10 ++++---- SpaceCadetPinball/render.h | 4 +--- SpaceCadetPinball/splash.cpp | 14 +++++------ SpaceCadetPinball/timer.h | 2 +- SpaceCadetPinball/winmain.cpp | 13 ++++------- SpaceCadetPinball/zdrv.h | 7 +----- 19 files changed, 100 insertions(+), 79 deletions(-) diff --git a/SpaceCadetPinball/SpaceCadetPinball.vcxproj b/SpaceCadetPinball/SpaceCadetPinball.vcxproj index ebdf4b1..b48f2d0 100644 --- a/SpaceCadetPinball/SpaceCadetPinball.vcxproj +++ b/SpaceCadetPinball/SpaceCadetPinball.vcxproj @@ -43,14 +43,14 @@ Application true v141 - Unicode + NotSet Application false v141 true - Unicode + NotSet @@ -114,6 +114,7 @@ Console true + Comctl32.lib;Winmm.lib;Htmlhelp.lib;%(AdditionalDependencies) @@ -153,6 +154,7 @@ true true true + Comctl32.lib;Winmm.lib;Htmlhelp.lib;%(AdditionalDependencies) diff --git a/SpaceCadetPinball/TLight.h b/SpaceCadetPinball/TLight.h index a2010a7..d48d089 100644 --- a/SpaceCadetPinball/TLight.h +++ b/SpaceCadetPinball/TLight.h @@ -3,7 +3,7 @@ struct gdrv_bitmap8; -struct __declspec(align(4)) flasher_type +struct flasher_type { render_sprite_type_struct* Sprite; 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 BmpIndex1; diff --git a/SpaceCadetPinball/WaveMix.cpp b/SpaceCadetPinball/WaveMix.cpp index 552ce71..967584d 100644 --- a/SpaceCadetPinball/WaveMix.cpp +++ b/SpaceCadetPinball/WaveMix.cpp @@ -33,13 +33,13 @@ HANDLE WaveMix::ConfigureInit(MIXCONFIG* lpConfig) { MIXCONFIG mixConfig{}; - memset(&mixConfig, 0, 0x1Cu); - unsigned int copySize = 30; + memset(&mixConfig, 0, sizeof(MIXCONFIG)); + unsigned int copySize = sizeof(MIXCONFIG); mixConfig.RegistryKey = nullptr; - mixConfig.wSize = 30; + mixConfig.wSize = sizeof(MIXCONFIG); if (lpConfig) { - if (lpConfig->wSize < 30u) + if (lpConfig->wSize < sizeof(MIXCONFIG)) copySize = lpConfig->wSize; memcpy(&mixConfig, lpConfig, copySize); } @@ -63,7 +63,7 @@ HANDLE WaveMix::ConfigureInit(MIXCONFIG* lpConfig) if (GetPrivateProfileIntA("general", "ShowDevices", 0, FileName)) ShowWaveOutDevices(); - auto globals = static_cast(LocalAlloc(0x40u, 0x1C0u)); + auto globals = static_cast(LocalAlloc(0x40u, sizeof(GLOBALS))); Globals = globals; if (!globals) return nullptr; @@ -262,7 +262,7 @@ MIXWAVE* WaveMix::OpenWave(HANDLE hMixSession, LPCSTR szWaveFilename, HINSTANCE return nullptr; } - auto mixWave = static_cast(GlobalLock(GlobalAlloc(0x2040u, 0x42u))); + auto mixWave = static_cast(GlobalLock(GlobalAlloc(0x2040u, sizeof(MIXWAVE)))); if (!mixWave) { if (ShowDebugDialogs) @@ -1180,7 +1180,7 @@ int WaveMix::Configure(GLOBALS* hMixSession, HWND hWndParent, MIXCONFIG* lpConfi if (!mixConfig) { - mixConfigLocal.wSize = 30; + mixConfigLocal.wSize = sizeof(MIXCONFIG); mixConfigLocal.dwFlags = 1023; GetConfig(static_cast(hMixSession), &mixConfigLocal); auto dialog = MakeSettingsDlgTemplate(); @@ -1821,7 +1821,7 @@ int WaveMix::Settings_OnInitDialog(HWND hWnd, int wParam, MIXCONFIG* lpMixconfig GetWindowTextA(hWnd, String, 256); wsprintfA(string_buffer, String, 2, 81); SetWindowTextA(hWnd, string_buffer); - SetWindowLongA(hWnd, -21, (LONG)lpMixconfig); + SetWindowLongPtr(hWnd, -21, reinterpret_cast(lpMixconfig)); SendMessageA(GetDlgItem(hWnd, 1000), 0xF1u, lpMixconfig->wChannels > 1u, 0); SendMessageA(GetDlgItem(hWnd, 1001), 0xF1u, lpMixconfig->ResetMixDefaultFlag != 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) { - auto userData = (MIXCONFIG*)GetWindowLongA(hWnd, -21); + auto userData = reinterpret_cast(GetWindowLongPtrA(hWnd, -21)); if (command == 1) { if (userData) diff --git a/SpaceCadetPinball/fullscrn.cpp b/SpaceCadetPinball/fullscrn.cpp index 7a858ce..d090d1e 100644 --- a/SpaceCadetPinball/fullscrn.cpp +++ b/SpaceCadetPinball/fullscrn.cpp @@ -109,7 +109,7 @@ int fullscrn::enableFullscreen() if (trick) { 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); } SmthFullScrnFlag2 = 1; @@ -126,7 +126,7 @@ int fullscrn::enableFullscreen() } GetWindowRect(GetDesktopWindow(), &Rect); 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; } @@ -138,7 +138,7 @@ int fullscrn::disableFullscreen() SmthFullScrnFlag2 = 1; ChangeDisplaySettingsA(nullptr, 4u); if (trick) - SetWindowPos(hWnd, (HWND)0xFFFFFFFE, 0, 0, 0, 0, 0x13u); + SetWindowPos(hWnd, (HWND)-1, 0, 0, 0, 0, 0x13u); } setWindowFlagsDisDlg(); SetWindowPos( diff --git a/SpaceCadetPinball/gdrv.h b/SpaceCadetPinball/gdrv.h index d1cd47f..edb4789 100644 --- a/SpaceCadetPinball/gdrv.h +++ b/SpaceCadetPinball/gdrv.h @@ -4,12 +4,10 @@ enum class BitmapType : char { None = 0, RawBitmap = 1, - DibBitmap=2, + DibBitmap = 2, }; - -#pragma pack(push, 1) -struct __declspec(align(1)) gdrv_bitmap8 +struct gdrv_bitmap8 { BITMAPINFO* Dib; char* BmpBufPtr2; @@ -22,8 +20,6 @@ struct __declspec(align(1)) gdrv_bitmap8 int XPosition; int YPosition; }; -#pragma pack(pop) - struct LOGPALETTEx256 { @@ -36,7 +32,6 @@ struct LOGPALETTEx256 } }; -static_assert(sizeof(gdrv_bitmap8) == 37, "Wrong size of gdrv_bitmap8"); class gdrv { diff --git a/SpaceCadetPinball/loader.h b/SpaceCadetPinball/loader.h index 3c16893..294eb49 100644 --- a/SpaceCadetPinball/loader.h +++ b/SpaceCadetPinball/loader.h @@ -22,18 +22,18 @@ struct soundListStruct char* PtrToSmth; }; -struct __declspec(align(4)) visualKickerStruct +struct visualKickerStruct { float Threshold; float Boost; float ThrowBallMult; - vector_type ThrowBallAcceleration; + vector_type ThrowBallAcceleration; float ThrowBallAngleMult; int HardHitSoundId; }; -struct __declspec(align(4)) visualStruct +struct visualStruct { float Smoothness; float Elasticity; @@ -69,7 +69,7 @@ public: static float play_sound(int soundIndex); static datFileStruct* loader_table; private: - static errorMsg loader_errors[]; + static errorMsg loader_errors[]; static datFileStruct* sound_record_table; static int sound_count; static int loader_sound_count; diff --git a/SpaceCadetPinball/maths.h b/SpaceCadetPinball/maths.h index fa9f81f..a975463 100644 --- a/SpaceCadetPinball/maths.h +++ b/SpaceCadetPinball/maths.h @@ -10,7 +10,7 @@ struct vector_type }; -struct __declspec(align(4)) rectangle_type +struct rectangle_type { int XPosition; int YPosition; @@ -24,7 +24,7 @@ struct circle_type float RadiusSq; }; -struct __declspec(align(4)) ray_type +struct ray_type { vector_type Origin; vector_type Direction; @@ -35,7 +35,7 @@ struct __declspec(align(4)) ray_type int FieldFlag; }; -struct __declspec(align(4)) line_type +struct line_type { vector_type PerpendicularL; vector_type Direction; @@ -59,7 +59,7 @@ struct wall_point_type float Y1; }; -struct __declspec(align(4)) ramp_plane_type +struct ramp_plane_type { vector_type BallCollisionOffset; vector_type2 V1; @@ -84,7 +84,8 @@ public: static void cross(vector_type* vec1, vector_type* vec2, vector_type* dstVec); static float magnitude(vector_type* vec); 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); static float Distance_Squared(vector_type vec1, vector_type vec2); static float DotProduct(vector_type* vec1, vector_type* vec2); diff --git a/SpaceCadetPinball/objlist_class.h b/SpaceCadetPinball/objlist_class.h index 53b07d2..dd2687c 100644 --- a/SpaceCadetPinball/objlist_class.h +++ b/SpaceCadetPinball/objlist_class.h @@ -6,7 +6,6 @@ struct objlist_struct1 int Count; void* Array[1]; }; -static_assert(sizeof(objlist_struct1) == 12, "Wrong size of objlist_struct1"); class objlist_class { diff --git a/SpaceCadetPinball/options.h b/SpaceCadetPinball/options.h index b210c38..76a12f5 100644 --- a/SpaceCadetPinball/options.h +++ b/SpaceCadetPinball/options.h @@ -1,7 +1,7 @@ #pragma once #include "pinball.h" -struct __declspec(align(4)) optionsStruct +struct optionsStruct { int Sounds; int Music; diff --git a/SpaceCadetPinball/partman.cpp b/SpaceCadetPinball/partman.cpp index 884a22d..ec4f567 100644 --- a/SpaceCadetPinball/partman.cpp +++ b/SpaceCadetPinball/partman.cpp @@ -2,8 +2,9 @@ #include "partman.h" #include "gdrv.h" #include "memory.h" +#include "zdrv.h" -short partman::_field_size[] = +short partman::_field_size[] = { 2, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0 }; @@ -14,6 +15,7 @@ datFileStruct* partman::load_records(LPCSTR lpFileName) _OFSTRUCT ReOpenBuff{}; datFileHeader header{}; dat8BitBmpHeader bmpHeader{}; + dat16BitBmpHeader zMapHeader{}; const HFILE fileHandle = OpenFile(lpFileName, &ReOpenBuff, 0); if (fileHandle == -1) @@ -90,11 +92,11 @@ datFileStruct* partman::load_records(LPCSTR lpFileName) { auto entryType = static_cast(_lread_char(fileHandle)); entryData->EntryType = entryType; + int fieldSize = _field_size[static_cast(entryType)]; if (fieldSize < 0) - { fieldSize = _lread_long(fileHandle); - } + if (entryType == datFieldTypes::Bitmap8bit) { _hread(fileHandle, &bmpHeader, sizeof(dat8BitBmpHeader)); @@ -117,6 +119,18 @@ datFileStruct* partman::load_records(LPCSTR lpFileName) bmp->XPosition = bmpHeader.XPosition; bmp->YPosition = bmpHeader.YPosition; } + else if (entryType == datFieldTypes::Bitmap16bit) + { + _hread(fileHandle, &zMapHeader, sizeof(dat16BitBmpHeader)); + int length = fieldSize - sizeof(dat16BitBmpHeader); + + auto zmap = reinterpret_cast(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(zmap); + } else { char* entryBuffer = static_cast(memory::allocate(fieldSize)); diff --git a/SpaceCadetPinball/partman.h b/SpaceCadetPinball/partman.h index 3d3e01d..006e6b8 100644 --- a/SpaceCadetPinball/partman.h +++ b/SpaceCadetPinball/partman.h @@ -89,6 +89,22 @@ struct 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 { public: diff --git a/SpaceCadetPinball/pinball.cpp b/SpaceCadetPinball/pinball.cpp index 3fc4855..57c9d4c 100644 --- a/SpaceCadetPinball/pinball.cpp +++ b/SpaceCadetPinball/pinball.cpp @@ -37,7 +37,7 @@ int pinball::get_rc_int(int uID, int* dst) void pinball::FindShiftKeys() { signed int i; - int rightShift; + int rightShift; CHAR stringBuf[20]; RightShift = -1; @@ -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) { case -2: - return (HANDLE)SetThreadPriority(result, -2); + SetThreadPriority(thread, -2); + break; case -1: - return (HANDLE)SetThreadPriority(result, -1); + SetThreadPriority(thread, -1); + break; case 0: - return (HANDLE)SetThreadPriority(result, 0); + SetThreadPriority(thread, 0); + break; case 1: - return (HANDLE)SetThreadPriority(result, 1); + SetThreadPriority(thread, 1); + break; case 2: - return (HANDLE)SetThreadPriority(result, 2); + SetThreadPriority(thread, 2); + break; case 3: - result = (HANDLE)SetThreadPriority(result, 15); + SetThreadPriority(thread, 15); + break; + default: break; } - return result; } int pinball::make_path_name(LPSTR lpFilename, LPCSTR lpString2, int nSize) diff --git a/SpaceCadetPinball/pinball.h b/SpaceCadetPinball/pinball.h index e6dfb96..2e15ce8 100644 --- a/SpaceCadetPinball/pinball.h +++ b/SpaceCadetPinball/pinball.h @@ -20,7 +20,7 @@ public: static char* get_rc_string(int uID, int a2); static int get_rc_int(int uID, int* dst); 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); private: static char getRcBuffer[256 * 6]; diff --git a/SpaceCadetPinball/render.cpp b/SpaceCadetPinball/render.cpp index 70bdbfa..b118f4d 100644 --- a/SpaceCadetPinball/render.cpp +++ b/SpaceCadetPinball/render.cpp @@ -18,9 +18,9 @@ void render::init(gdrv_bitmap8* bmp, float zMin, float zScaler, int width, int h zscaler = zScaler; zmin = zMin; zmax = 4294967300.0f / zScaler + zMin; - sprite_list = (render_sprite_type_struct**)memory::allocate(0xFA0u); - dirty_list = (render_sprite_type_struct**)memory::allocate(0xFA0u); - ball_list = (render_sprite_type_struct**)memory::allocate(0x50u); + sprite_list = reinterpret_cast(memory::allocate(1000 * sizeof(void*))); + dirty_list = reinterpret_cast(memory::allocate(1000 * sizeof(void*))); + ball_list = reinterpret_cast(memory::allocate(20 * sizeof(void*))); gdrv::create_bitmap(&vscreen, width, height); zdrv::create_zmap(&zscreen, width, height); 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 (!spriteArr) - spriteArr = reinterpret_cast(memory::allocate(0xFA0u)); + spriteArr = reinterpret_cast(memory::allocate(1000 * sizeof(void*))); int occludeCount = 0; auto spritePtr2 = sprite_list; for (int i = 0; i < many_sprites; ++i, ++spritePtr2) @@ -561,7 +561,7 @@ void render::build_occlude_list() if (occludeCount) { curSprite->SpriteArray = reinterpret_cast(memory::realloc( - spriteArr, 4 * occludeCount)); + spriteArr, sizeof(void*) * occludeCount)); curSprite->SpriteCount = occludeCount; spriteArr = nullptr; } diff --git a/SpaceCadetPinball/render.h b/SpaceCadetPinball/render.h index b6427c3..22115eb 100644 --- a/SpaceCadetPinball/render.h +++ b/SpaceCadetPinball/render.h @@ -10,7 +10,7 @@ enum class VisualType : char Ball = 2 }; -struct __declspec(align(4)) render_sprite_type_struct +struct render_sprite_type_struct { rectangle_type BmpRect; 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 { public: diff --git a/SpaceCadetPinball/splash.cpp b/SpaceCadetPinball/splash.cpp index 632cc55..97ad0d1 100644 --- a/SpaceCadetPinball/splash.cpp +++ b/SpaceCadetPinball/splash.cpp @@ -12,7 +12,7 @@ splash_struct* splash::splash_screen(HINSTANCE hInstance, LPCSTR bmpName1, LPCST WNDCLASSA WndClass{}; tagRECT Rect{}; - auto splashStruct = reinterpret_cast(memory::allocate(0x1B0u)); + auto splashStruct = reinterpret_cast(memory::allocate(sizeof(splash_struct))); if (!splashStruct) return nullptr; @@ -43,7 +43,7 @@ splash_struct* splash::splash_screen(HINSTANCE hInstance, LPCSTR bmpName1, LPCST return nullptr; } - SetWindowLongA(windowHandle, 0, reinterpret_cast(splashStruct)); + SetWindowLongPtrA(windowHandle, -21, reinterpret_cast(splashStruct)); GetWindowRect(GetDesktopWindow(), &Rect); splash_bitmap_setup(splashStruct); //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) { HBITMAP bmpHandle2; - BITMAP bmp; + BITMAP bmp{}; HBITMAP bmpHandle1 = nullptr; HDC desktopDC = GetDC(GetDesktopWindow()); @@ -92,7 +92,7 @@ void splash::splash_bitmap_setup(splash_struct* splashStruct) { SelectObject(splashStruct->DrawingContext, bmpHandle2); DeleteObject(bmpHandle1); - GetObjectA(splashStruct->Bitmap, 24, &bmp); + GetObjectA(splashStruct->Bitmap, sizeof(BITMAP), &bmp); splashStruct->Width = bmp.bmWidth; splashStruct->Height = bmp.bmHeight; return; @@ -224,8 +224,8 @@ void splash::splash_paint(splash_struct* splashStruct, HDC dc) splashStruct->Height, splashStruct->DrawingContext, 0, 0, SRCCOPY);*/ /*Mod - less intrusive splash*/ - BitBlt(dc, 0, 0, splashStruct->Width, splashStruct->Height, - splashStruct->DrawingContext, 0, 0, SRCCOPY); + BitBlt(dc, 0, 0, splashStruct->Width, splashStruct->Height, + splashStruct->DrawingContext, 0, 0, SRCCOPY); } } @@ -274,7 +274,7 @@ LRESULT splash::splash_message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LPARA { case WM_PAINT: { - auto splashStruct = reinterpret_cast(GetWindowLongA(hWnd, 0)); + auto splashStruct = reinterpret_cast(GetWindowLongPtrA(hWnd, -21)); BeginPaint(hWnd, &Paint); EndPaint(hWnd, &Paint); auto dc = GetDC(hWnd); diff --git a/SpaceCadetPinball/timer.h b/SpaceCadetPinball/timer.h index d06b34b..2d073d6 100644 --- a/SpaceCadetPinball/timer.h +++ b/SpaceCadetPinball/timer.h @@ -1,6 +1,6 @@ #pragma once -struct __declspec(align(4)) timer_struct +struct timer_struct { int TargetTime; void* Caller; diff --git a/SpaceCadetPinball/winmain.cpp b/SpaceCadetPinball/winmain.cpp index e63efff..1ef2d84 100644 --- a/SpaceCadetPinball/winmain.cpp +++ b/SpaceCadetPinball/winmain.cpp @@ -313,7 +313,7 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP SetForegroundWindow(hWnd); return 0; } - + if (Msg <= WM_ACTIVATEAPP) { switch (Msg) @@ -532,20 +532,15 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP { char cmdLine[0x1F4u]; options::get_string(nullptr, "Shell Exe", tmpBuf, pinball::WindowName, 500); + auto iHwnd = reinterpret_cast(hwnd_frame); sprintf_s( cmdLine, "%s %s%lX %s%lX", tmpBuf, "select=", - (int)hwnd_frame, + iHwnd, "confirm=", - (int)hwnd_frame - * (int)hwnd_frame - * (int)hwnd_frame - * (int)hwnd_frame - * (int)hwnd_frame - * (int)hwnd_frame - * (int)hwnd_frame); + iHwnd * iHwnd * iHwnd * iHwnd * iHwnd * iHwnd * iHwnd); if (static_cast(WinExec(cmdLine, 5u)) < 32) { auto caption = pinball::get_rc_string(170, 0); diff --git a/SpaceCadetPinball/zdrv.h b/SpaceCadetPinball/zdrv.h index 744b4eb..579e296 100644 --- a/SpaceCadetPinball/zdrv.h +++ b/SpaceCadetPinball/zdrv.h @@ -1,8 +1,7 @@ #pragma once #include "gdrv.h" -#pragma pack(push, 1) -struct __declspec(align(1)) zmap_header_type +struct zmap_header_type { __int16 Width; __int16 Height; @@ -12,10 +11,6 @@ struct __declspec(align(1)) zmap_header_type unsigned __int16 ZBuffer[1]; }; -#pragma pack(pop) - -static_assert(sizeof(zmap_header_type) == 16, "Wrong size of zmap_header_type"); - class zdrv { public: