amd64 multiplayer now works. Here is a diff for the git version as of July 19, 2019 from this commit (https://github.com/diasurgical/devilutionX/commit/72f65d577124d24ab9f459ef164e31c9ab225b3e).
I added __LP64__ for amd64 specific bits, allowing it to compile on both amd64 and i386. Bryan suggested, "You could probably do #ifdef __i386__ or __amd64__ or more generally, #ifdef __LP64__ I suspect there may be a way to fix it so the code works on both 32-bit and 64-bit platforms, however." To test I connected to a game hosted by Bryan, and we played the first several rooms in the first dungeon. Also, I was able to build and play from i386 and amd64 in the same game. Brian Callahan writes: > We'll sync with releases starting with the next release (presumable > 0.5). I have communicated my findings with upstream (https://github.com/diasurgical/devilutionX/issues/191). Multiplayer testing is a priority for the next release. This diff is pasted for consideration in ports, in case multiplayer is desired before the next release. Tests and feedback are welcome. Thank you to all involved in this port. Bryan Steele writes: > On Fri, Jul 19, 2019 at 10:37:59AM -0400, Bryan Steele wrote: >> On Thu, Jul 18, 2019 at 07:49:51PM -0400, Brian Callahan wrote: >> > Hi ports -- >> > >> > Attached is a new port, games/devilutionx. DevilutionX is an open source >> > engine recreation for the original Diablo I game. >> > >> > --- >> > pkg/DESCR: >> > DevilutionX is an open source recreation of the game engine used in >> > Diablo I, an action role-playing game by Blizzard Entertainment. >> > >> > While this package and the game engine are open source, one still needs >> > to provide the original game assets from Diablo I, which is not open >> > source. You will need to purchase the original game to use this package. >> > --- >> > >> > This port is a multi-person effort between myself, thfr@, and brynet@. The >> > game works very well on amd64--the underlying engine is claimed to be >> > nearly >> > 100% binary identical to the original game. Sadly, multiplayer doesn't work >> > on 64-bit platforms, but this is known and hopefully will be fixed at some >> > point. >> > >> > OK? >> > >> > ~Brian >> >> I'm obviously ok with this going in, w/ the pkg/README fix from Nam. :-) >> >> It's unfortunate that we will initially miss out on multiplayer support, >> but good that someone is working on the problem, and upstream is aware. >> >> Hopefully some of these changes can be sent upstream. >> >> -Bryan. > > To those of you following along, this is the port that thfr@ used when > streaming Diablo last month on OpenBSD. > > https://www.youtube.com/watch?v=5sBKaqkFev8 Index: Makefile =================================================================== RCS file: /cvs/ports/games/devilutionx/Makefile,v retrieving revision 1.1.1.1 diff -u -p -u -p -r1.1.1.1 Makefile --- Makefile 19 Jul 2019 13:42:33 -0000 1.1.1.1 +++ Makefile 24 Jul 2019 01:53:09 -0000 @@ -1,12 +1,12 @@ # $OpenBSD: Makefile,v 1.1.1.1 2019/07/19 13:42:33 bcallah Exp $ COMMENT = open source engine recreation for Diablo 1 game -DISTNAME = devilutionx-0.4.0pl20190715 +DISTNAME = devilutionx-0.4.0pl20190723 CATEGORIES = games x11 GH_ACCOUNT = diasurgical GH_PROJECT = devilutionX -GH_COMMIT = 10ebca4efd422bbf46bad6d12ea4cdade9038b01 +GH_COMMIT = 72f65d577124d24ab9f459ef164e31c9ab225b3e MAINTAINER = Brian Callahan <bcal...@openbsd.org> Index: distinfo =================================================================== RCS file: /cvs/ports/games/devilutionx/distinfo,v retrieving revision 1.1.1.1 diff -u -p -u -p -r1.1.1.1 distinfo --- distinfo 19 Jul 2019 13:42:33 -0000 1.1.1.1 +++ distinfo 24 Jul 2019 01:53:09 -0000 @@ -1,2 +1,2 @@ -SHA256 (devilutionx-0.4.0pl20190715-10ebca4e.tar.gz) = 6WOyN6WpRoYuKpe1P24YgQ8OaYEtShyt8p1R8JrZT4U= -SIZE (devilutionx-0.4.0pl20190715-10ebca4e.tar.gz) = 1350054 +SHA256 (devilutionx-0.4.0pl20190723-72f65d57.tar.gz) = 13YESHQhAY4y15I8OKjjoyf6pxMEJSCeot84/Qs3Cxg= +SIZE (devilutionx-0.4.0pl20190723-72f65d57.tar.gz) = 1354368 Index: patches/patch-CMakeLists_txt =================================================================== RCS file: /cvs/ports/games/devilutionx/patches/patch-CMakeLists_txt,v retrieving revision 1.1.1.1 diff -u -p -u -p -r1.1.1.1 patch-CMakeLists_txt --- patches/patch-CMakeLists_txt 19 Jul 2019 13:42:33 -0000 1.1.1.1 +++ patches/patch-CMakeLists_txt 24 Jul 2019 01:53:09 -0000 @@ -14,7 +14,7 @@ Index: CMakeLists.txt set(ASAN OFF) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DO_LARGEFILE=0 -Dstat64=stat -Dlstat64=lstat -Dlseek64=lseek -Doff64_t=off_t -Dfstat64=fstat -Dftruncate64=ftruncate") endif() -@@ -289,7 +289,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") +@@ -290,7 +290,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") # Silence warnings about __int64 alignment hack not always being applicable target_compile_options(devilutionx PRIVATE -Wno-ignored-attributes) # Fix: error: cast from pointer to smaller type 'unsigned char' loses information Index: patches/patch-SourceX_dvlnet_frame_queue_cpp =================================================================== RCS file: patches/patch-SourceX_dvlnet_frame_queue_cpp diff -N patches/patch-SourceX_dvlnet_frame_queue_cpp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-SourceX_dvlnet_frame_queue_cpp 24 Jul 2019 01:53:09 -0000 @@ -0,0 +1,24 @@ +$OpenBSD$ + +nextsize is 8 bytes. framesize_t is 4 bytes. Copy framesize_t to +nextsize then shift 32 bits to zero out the most significant 32 +bits. This fixes packet_ready(). + +Remove this patch when building for i386 (32-bit). + +Index: SourceX/dvlnet/frame_queue.cpp +--- SourceX/dvlnet/frame_queue.cpp.orig ++++ SourceX/dvlnet/frame_queue.cpp +@@ -48,7 +48,12 @@ bool frame_queue::packet_ready() + if(size() < sizeof(framesize_t)) + return false; + auto szbuf = read(sizeof(framesize_t)); ++ #ifdef __LP64__ ++ std::memcpy(&nextsize, &szbuf[0], sizeof(framesize_t)); ++ nextsize >> 32; ++ #else + std::memcpy(&nextsize, &szbuf[0], sizeof(nextsize)); ++ #endif + if(!nextsize) + throw frame_queue_exception(); + } Index: patches/patch-Source_list_h =================================================================== RCS file: patches/patch-Source_list_h diff -N patches/patch-Source_list_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-Source_list_h 24 Jul 2019 01:53:09 -0000 @@ -0,0 +1,14 @@ +$OpenBSD$ + +Index: Source/list.h +--- Source/list.h.orig ++++ Source/list.h +@@ -154,7 +154,7 @@ void TList<T>::UnlinkAll() + { + for (;;) { + T *node = m_link.Next(); +- if ((int)node <= 0) ++ if ((uintptr_t)node <= 0) + break; + node->m_Link.Unlink(); + } Index: patches/patch-Source_msg_cpp =================================================================== RCS file: patches/patch-Source_msg_cpp diff -N patches/patch-Source_msg_cpp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-Source_msg_cpp 24 Jul 2019 01:53:09 -0000 @@ -0,0 +1,44 @@ +$OpenBSD$ + +This fixes a padding bug. + +(char *)&packeta[1] - packeta->dwSpaceLeft doesn't work because it assumes there +is no padding at the end of TMegaPkt. With padding it started writing a few +bytes after packeta->data, so the first few bytes were garbage. + +The goal is to write to packeta->data at the first available byte, based on +packeta->dwSpaceLeft. It is safer to calculate starting from packeta->data. + +Also, pointers like pNext are 8 bytes long on 64-bit platforms. Should allocate +8 + 4 + 32000 = 32012. + +typedef struct TMegaPkt {^M + struct TMegaPkt *pNext;^M + DWORD dwSpaceLeft;^M + BYTE data[32000];^M +} TMegaPkt; + +Index: Source/msg.cpp +--- Source/msg.cpp.orig ++++ Source/msg.cpp +@@ -47,7 +47,7 @@ void msg_send_packet(int pnum, const void *packet, DWO + msg_get_next_packet(); + packeta = sgpCurrPkt; + } +- memcpy((char *)&packeta[1] - packeta->dwSpaceLeft, packet, dwSize); ++ memcpy((char *)(packeta->data + 32000 - packeta->dwSpaceLeft), packet, dwSize); + sgpCurrPkt->dwSpaceLeft -= dwSize; + } + +@@ -55,7 +55,11 @@ TMegaPkt *msg_get_next_packet() + { + TMegaPkt *result; + ++ #ifdef __LP64__ ++ sgpCurrPkt = (TMegaPkt *)DiabloAllocPtr(32012); ++ #else + sgpCurrPkt = (TMegaPkt *)DiabloAllocPtr(32008); ++ #endif + sgpCurrPkt->pNext = NULL; + sgpCurrPkt->dwSpaceLeft = 32000; + Index: patches/patch-Source_nthread_cpp =================================================================== RCS file: patches/patch-Source_nthread_cpp diff -N patches/patch-Source_nthread_cpp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-Source_nthread_cpp 24 Jul 2019 01:53:09 -0000 @@ -0,0 +1,16 @@ +$OpenBSD$ + +glpMsgTbl stores 64-bit pointers to turn_t variables. This won't fit inside int. + +Index: Source/nthread.cpp +--- Source/nthread.cpp.orig ++++ Source/nthread.cpp +@@ -11,7 +11,7 @@ static CCritSect sgMemCrit; + DWORD gdwDeltaBytesSec; + BOOLEAN nthread_should_run; + DWORD gdwTurnsInTransit; +-int glpMsgTbl[MAX_PLRS]; ++uintptr_t glpMsgTbl[MAX_PLRS]; + unsigned int glpNThreadId; + char sgbSyncCountdown; + int turn_upper_bit; Index: patches/patch-Source_nthread_h =================================================================== RCS file: patches/patch-Source_nthread_h diff -N patches/patch-Source_nthread_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-Source_nthread_h 24 Jul 2019 01:53:09 -0000 @@ -0,0 +1,16 @@ +$OpenBSD$ + +glpMsgTbl stores 64-bit pointers to turn_t variables. This won't fit inside int. + +Index: Source/nthread.h +--- Source/nthread.h.orig ++++ Source/nthread.h +@@ -7,7 +7,7 @@ extern DWORD gdwMsgLenTbl[MAX_PLRS]; + extern DWORD gdwDeltaBytesSec; + extern BOOLEAN nthread_should_run; + extern DWORD gdwTurnsInTransit; +-extern int glpMsgTbl[MAX_PLRS]; ++extern uintptr_t glpMsgTbl[MAX_PLRS]; + extern unsigned int glpNThreadId; + extern int turn_upper_bit; + extern BOOLEAN sgbThreadIsRunning; Index: patches/patch-Source_render_cpp =================================================================== RCS file: /cvs/ports/games/devilutionx/patches/patch-Source_render_cpp,v retrieving revision 1.1.1.1 diff -u -p -u -p -r1.1.1.1 patch-Source_render_cpp --- patches/patch-Source_render_cpp 19 Jul 2019 13:42:33 -0000 1.1.1.1 +++ patches/patch-Source_render_cpp 24 Jul 2019 01:53:09 -0000 @@ -5,309 +5,309 @@ clang Index: Source/render.cpp --- Source/render.cpp.orig +++ Source/render.cpp -@@ -164,7 +164,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) +@@ -161,7 +161,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) } while (i); break; case 1: // upper (top transparent), with lighting -- WorldBoolFlag = (unsigned char)pBuff & 1; +- WorldBoolFlag = (BYTE)pBuff & 1; + WorldBoolFlag = (uintptr_t)pBuff & 1; xx_32 = 32; do { yy_32 = 32; -@@ -181,7 +181,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) +@@ -178,7 +178,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) } if (dst < gpBufEnd) return; -- if (((unsigned char)dst & 1) == WorldBoolFlag) { +- if (((BYTE)dst & 1) == WorldBoolFlag) { + if (((uintptr_t)dst & 1) == WorldBoolFlag) { asm_trans_light_cel_0_2(width, tbl, &dst, &src); } else { asm_trans_light_cel_1_3(width, tbl, &dst, &src); -@@ -238,7 +238,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) +@@ -235,7 +235,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) } else { asm_trans_light_cel_1_3(32 - xx_32, tbl, &dst, &src); } -- src += (unsigned char)src & 2; +- src += (BYTE)src & 2; + src += (uintptr_t)src & 2; - dst = &dst[xx_32 - 800]; + dst = &dst[xx_32 - (SCREEN_WIDTH + 160)]; xx_32 -= 2; if (xx_32 < 0) { -@@ -252,7 +252,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) +@@ -249,7 +249,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) } else { asm_trans_light_cel_1_3(32 - yy_32, tbl, &dst, &src); } -- src += (unsigned char)src & 2; +- src += (BYTE)src & 2; + src += (uintptr_t)src & 2; - dst = &dst[yy_32 - 800]; + dst = &dst[yy_32 - (SCREEN_WIDTH + 160)]; yy_32 += 2; } while (yy_32 != 32); -@@ -301,7 +301,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) +@@ -298,7 +298,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) } else { asm_trans_light_cel_1_3(32 - xx_32, tbl, &dst, &src); } -- src += (unsigned char)src & 2; +- src += (BYTE)src & 2; + src += (uintptr_t)src & 2; - dst = &dst[xx_32 - 800]; + dst = &dst[xx_32 - (SCREEN_WIDTH + 160)]; xx_32 -= 2; if (xx_32 < 0) { -@@ -359,7 +359,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) +@@ -356,7 +356,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) } while (i); break; case 9: // upper (top transparent), without lighting -- WorldBoolFlag = (unsigned char)pBuff & 1; +- WorldBoolFlag = (BYTE)pBuff & 1; + WorldBoolFlag = (uintptr_t)pBuff & 1; yy_32 = 32; LABEL_251: xx_32 = 32; -@@ -383,7 +383,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) +@@ -380,7 +380,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) xx_32 -= width; if (dst < gpBufEnd) return; -- if (((unsigned char)dst & 1) == WorldBoolFlag) { +- if (((BYTE)dst & 1) == WorldBoolFlag) { + if (((uintptr_t)dst & 1) == WorldBoolFlag) { chk_sh_and = width >> 1; if (!(width & 1)) goto LABEL_258; -@@ -775,7 +775,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) +@@ -772,7 +772,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) } while (i); break; case 1: // upper (top transparent), black -- WorldBoolFlag = (unsigned char)pBuff & 1; +- WorldBoolFlag = (BYTE)pBuff & 1; + WorldBoolFlag = (uintptr_t)pBuff & 1; xx_32 = 32; while (1) { yy_32 = 32; -@@ -788,7 +788,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) +@@ -785,7 +785,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) if (dst < gpBufEnd) return; src += width; -- if (((unsigned char)dst & 1) == WorldBoolFlag) { +- if (((BYTE)dst & 1) == WorldBoolFlag) { + if (((uintptr_t)dst & 1) == WorldBoolFlag) { chk_sh_and = width >> 1; if (!(width & 1)) goto LABEL_378; -@@ -1386,7 +1386,7 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned +@@ -1381,7 +1381,7 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, DWORD *p ++dst; --i; } while (i); -- src += (unsigned char)src & 2; +- src += (BYTE)src & 2; + src += (uintptr_t)src & 2; - dst -= 800; + dst -= (SCREEN_WIDTH + 160); --gpDrawMask; --yy_32; -@@ -1471,7 +1471,7 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned +@@ -1466,7 +1466,7 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, DWORD *p xx_32 = 30; while (dst >= gpBufEnd) { asm_cel_light_edge(32 - xx_32, tbl, &dst, &src); -- src += (unsigned char)src & 2; +- src += (BYTE)src & 2; + src += (uintptr_t)src & 2; - dst = &dst[xx_32 - 800]; + dst = &dst[xx_32 - (SCREEN_WIDTH + 160)]; xx_32 -= 2; if (xx_32 < 0) { -@@ -1480,7 +1480,7 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned +@@ -1475,7 +1475,7 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, DWORD *p if (dst < gpBufEnd) break; asm_cel_light_edge(32 - yy_32, tbl, &dst, &src); -- src += (unsigned char)src & 2; +- src += (BYTE)src & 2; + src += (uintptr_t)src & 2; - dst = &dst[yy_32 - 800]; + dst = &dst[yy_32 - (SCREEN_WIDTH + 160)]; yy_32 += 2; } while (yy_32 != 32); -@@ -1502,7 +1502,7 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned +@@ -1497,7 +1497,7 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, DWORD *p do { if (dst < gpBufEnd) break; -- src += (unsigned char)src & 2; +- src += (BYTE)src & 2; + src += (uintptr_t)src & 2; asm_trans_light_mask(32, tbl, &dst, &src, *gpDrawMask); - dst -= 800; + dst -= (SCREEN_WIDTH + 160); --gpDrawMask; -@@ -1516,7 +1516,7 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned +@@ -1511,7 +1511,7 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, DWORD *p xx_32 = 30; while (dst >= gpBufEnd) { asm_cel_light_edge(32 - xx_32, tbl, &dst, &src); -- src += (unsigned char)src & 2; +- src += (BYTE)src & 2; + src += (uintptr_t)src & 2; - dst = &dst[xx_32 - 800]; + dst = &dst[xx_32 - (SCREEN_WIDTH + 160)]; xx_32 -= 2; if (xx_32 < 0) { -@@ -1526,7 +1526,7 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned +@@ -1521,7 +1521,7 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, DWORD *p if (dst < gpBufEnd) break; asm_trans_light_mask(32, tbl, &dst, &src, *gpDrawMask); -- src += (unsigned char)src & 2; +- src += (BYTE)src & 2; + src += (uintptr_t)src & 2; - dst -= 800; + dst -= (SCREEN_WIDTH + 160); --gpDrawMask; --yy_32; -@@ -2107,7 +2107,7 @@ void drawUpperScreen(BYTE *pBuff) +@@ -2099,7 +2099,7 @@ void drawUpperScreen(BYTE *pBuff) xx_32 = 30; while (dst >= gpBufEnd) { asm_cel_light_edge(32 - xx_32, tbl, &dst, &src); -- src += (unsigned char)src & 2; +- src += (BYTE)src & 2; + src += (uintptr_t)src & 2; - dst = &dst[xx_32 - 800]; + dst = &dst[xx_32 - (SCREEN_WIDTH + 160)]; xx_32 -= 2; if (xx_32 < 0) { -@@ -2116,7 +2116,7 @@ void drawUpperScreen(BYTE *pBuff) +@@ -2108,7 +2108,7 @@ void drawUpperScreen(BYTE *pBuff) if (dst < gpBufEnd) break; asm_cel_light_edge(32 - yy_32, tbl, &dst, &src); -- src += (unsigned char)src & 2; +- src += (BYTE)src & 2; + src += (uintptr_t)src & 2; - dst = &dst[yy_32 - 800]; + dst = &dst[yy_32 - (SCREEN_WIDTH + 160)]; yy_32 += 2; } while (yy_32 != 32); -@@ -2149,7 +2149,7 @@ void drawUpperScreen(BYTE *pBuff) +@@ -2141,7 +2141,7 @@ void drawUpperScreen(BYTE *pBuff) xx_32 = 30; while (dst >= gpBufEnd) { asm_cel_light_edge(32 - xx_32, tbl, &dst, &src); -- src += (unsigned char)src & 2; +- src += (BYTE)src & 2; + src += (uintptr_t)src & 2; - dst = &dst[xx_32 - 800]; + dst = &dst[xx_32 - (SCREEN_WIDTH + 160)]; xx_32 -= 2; if (xx_32 < 0) { -@@ -2465,7 +2465,7 @@ void drawTopArchesLowerScreen(BYTE *pBuff) +@@ -2454,7 +2454,7 @@ void drawTopArchesLowerScreen(BYTE *pBuff) } while (i); break; case 1: // lower (top transparent), black -- WorldBoolFlag = (unsigned char)pBuff & 1; +- WorldBoolFlag = (BYTE)pBuff & 1; + WorldBoolFlag = (uintptr_t)pBuff & 1; xx_32 = 32; LABEL_412: yy_32 = 32; -@@ -2489,7 +2489,7 @@ void drawTopArchesLowerScreen(BYTE *pBuff) +@@ -2478,7 +2478,7 @@ void drawTopArchesLowerScreen(BYTE *pBuff) yy_32 -= width; if (dst < gpBufEnd) { src += width; -- if (((unsigned char)dst & 1) == WorldBoolFlag) { +- if (((BYTE)dst & 1) == WorldBoolFlag) { + if (((uintptr_t)dst & 1) == WorldBoolFlag) { chk_sh_and = width >> 1; if (!(width & 1)) goto LABEL_420; -@@ -2895,7 +2895,7 @@ void drawTopArchesLowerScreen(BYTE *pBuff) +@@ -2884,7 +2884,7 @@ void drawTopArchesLowerScreen(BYTE *pBuff) } while (i); break; case 1: // lower (top transparent), with lighting -- WorldBoolFlag = (unsigned char)pBuff & 1; +- WorldBoolFlag = (BYTE)pBuff & 1; + WorldBoolFlag = (uintptr_t)pBuff & 1; xx_32 = 32; do { yy_32 = 32; -@@ -2912,7 +2912,7 @@ void drawTopArchesLowerScreen(BYTE *pBuff) +@@ -2901,7 +2901,7 @@ void drawTopArchesLowerScreen(BYTE *pBuff) } yy_32 -= width; if (dst < gpBufEnd) { -- if (((unsigned char)dst & 1) == WorldBoolFlag) { +- if (((BYTE)dst & 1) == WorldBoolFlag) { + if (((uintptr_t)dst & 1) == WorldBoolFlag) { asm_trans_light_cel_0_2(width, tbl, &dst, &src); } else { asm_trans_light_cel_1_3(width, tbl, &dst, &src); -@@ -3011,7 +3011,7 @@ void drawTopArchesLowerScreen(BYTE *pBuff) +@@ -3000,7 +3000,7 @@ void drawTopArchesLowerScreen(BYTE *pBuff) } else { asm_trans_light_cel_1_3(32 - yy_32, tbl, &dst, &src); } -- src += (unsigned char)src & 2; +- src += (BYTE)src & 2; + src += (uintptr_t)src & 2; - dst = &dst[yy_32 - 800]; + dst = &dst[yy_32 - (SCREEN_WIDTH + 160)]; yy_32 += 2; } while (yy_32 != 32); -@@ -3031,7 +3031,7 @@ void drawTopArchesLowerScreen(BYTE *pBuff) +@@ -3020,7 +3020,7 @@ void drawTopArchesLowerScreen(BYTE *pBuff) } else { asm_trans_light_cel_1_3(32 - xx_32, tbl, &dst, &src); } -- src += (unsigned char)src & 2; +- src += (BYTE)src & 2; + src += (uintptr_t)src & 2; - dst = &dst[xx_32 - 800]; + dst = &dst[xx_32 - (SCREEN_WIDTH + 160)]; xx_32 -= 2; } while (xx_32 >= 0); -@@ -3128,7 +3128,7 @@ void drawTopArchesLowerScreen(BYTE *pBuff) +@@ -3117,7 +3117,7 @@ void drawTopArchesLowerScreen(BYTE *pBuff) } else { asm_trans_light_cel_1_3(32 - xx_32, tbl, &dst, &src); } -- src += (unsigned char)src & 2; +- src += (BYTE)src & 2; + src += (uintptr_t)src & 2; - dst = &dst[xx_32 - 800]; + dst = &dst[xx_32 - (SCREEN_WIDTH + 160)]; xx_32 -= 2; } while (xx_32 >= 0); -@@ -3175,7 +3175,7 @@ LABEL_11: +@@ -3164,7 +3164,7 @@ LABEL_11: } while (i); break; case 9: // lower (top transparent), without lighting -- WorldBoolFlag = (unsigned char)pBuff & 1; +- WorldBoolFlag = (BYTE)pBuff & 1; + WorldBoolFlag = (uintptr_t)pBuff & 1; xx_32 = 32; while (1) { yy_32 = 32; -@@ -3186,7 +3186,7 @@ LABEL_11: +@@ -3175,7 +3175,7 @@ LABEL_11: break; yy_32 -= width; if (dst < gpBufEnd) { -- if (((unsigned char)dst & 1) == WorldBoolFlag) { +- if (((BYTE)dst & 1) == WorldBoolFlag) { + if (((uintptr_t)dst & 1) == WorldBoolFlag) { chk_sh_and = width >> 1; if (!(width & 1)) goto LABEL_280; -@@ -4042,7 +4042,7 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned +@@ -4029,7 +4029,7 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, DWORD *p } do { asm_cel_light_edge(32 - xx_32, tbl, &dst, &src); -- src += (unsigned char)src & 2; +- src += (BYTE)src & 2; + src += (uintptr_t)src & 2; - dst = &dst[xx_32 - 800]; + dst = &dst[xx_32 - (SCREEN_WIDTH + 160)]; xx_32 -= 2; } while (xx_32 >= 0); -@@ -4096,7 +4096,7 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned +@@ -4083,7 +4083,7 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, DWORD *p do { if (dst < gpBufEnd) { asm_trans_light_mask(32, tbl, &dst, &src, *gpDrawMask); -- src += (unsigned char)src & 2; +- src += (BYTE)src & 2; + src += (uintptr_t)src & 2; } else { src += 32; dst += 32; -@@ -4114,7 +4114,7 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned +@@ -4101,7 +4101,7 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, DWORD *p } do { asm_cel_light_edge(32 - xx_32, tbl, &dst, &src); -- src += (unsigned char)src & 2; +- src += (BYTE)src & 2; + src += (uintptr_t)src & 2; - dst = &dst[xx_32 - 800]; + dst = &dst[xx_32 - (SCREEN_WIDTH + 160)]; xx_32 -= 2; } while (xx_32 >= 0); -@@ -4396,7 +4396,7 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned +@@ -4383,7 +4383,7 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, DWORD *p ++dst; --i; } while (i); -- src += (unsigned char)src & 2; +- src += (BYTE)src & 2; + src += (uintptr_t)src & 2; } else { src += 32; dst += 32; -@@ -4821,7 +4821,7 @@ void drawLowerScreen(BYTE *pBuff) +@@ -4805,7 +4805,7 @@ void drawLowerScreen(BYTE *pBuff) } do { asm_cel_light_edge(32 - yy_32, tbl, &dst, &src); -- src += (unsigned char)src & 2; +- src += (BYTE)src & 2; + src += (uintptr_t)src & 2; - dst = &dst[yy_32 - 800]; + dst = &dst[yy_32 - (SCREEN_WIDTH + 160)]; yy_32 += 2; } while (yy_32 != 32); -@@ -4834,7 +4834,7 @@ void drawLowerScreen(BYTE *pBuff) +@@ -4818,7 +4818,7 @@ void drawLowerScreen(BYTE *pBuff) } do { asm_cel_light_edge(32 - xx_32, tbl, &dst, &src); -- src += (unsigned char)src & 2; +- src += (BYTE)src & 2; + src += (uintptr_t)src & 2; - dst = &dst[xx_32 - 800]; + dst = &dst[xx_32 - (SCREEN_WIDTH + 160)]; xx_32 -= 2; } while (xx_32 >= 0); -@@ -4901,7 +4901,7 @@ void drawLowerScreen(BYTE *pBuff) +@@ -4885,7 +4885,7 @@ void drawLowerScreen(BYTE *pBuff) } do { asm_cel_light_edge(32 - xx_32, tbl, &dst, &src); -- src += (unsigned char)src & 2; +- src += (BYTE)src & 2; + src += (uintptr_t)src & 2; - dst = &dst[xx_32 - 800]; + dst = &dst[xx_32 - (SCREEN_WIDTH + 160)]; xx_32 -= 2; } while (xx_32 >= 0); Index: patches/patch-defs_h =================================================================== RCS file: /cvs/ports/games/devilutionx/patches/patch-defs_h,v retrieving revision 1.1.1.1 diff -u -p -u -p -r1.1.1.1 patch-defs_h --- patches/patch-defs_h 19 Jul 2019 13:42:33 -0000 1.1.1.1 +++ patches/patch-defs_h 24 Jul 2019 01:53:09 -0000 @@ -3,7 +3,7 @@ $OpenBSD: patch-defs_h,v 1.1.1.1 2019/07 Index: defs.h --- defs.h.orig +++ defs.h -@@ -151,7 +151,7 @@ +@@ -154,7 +154,7 @@ // Typedef for the function pointer typedef void (*_PVFV)(void);