diff -Naur src-orig/ui/RA_ProgressBar.cpp src-mod/ui/RA_ProgressBar.cpp --- src-orig/ui/RA_ProgressBar.cpp 2008-09-22 05:10:40.000000000 -0400 +++ src-mod/ui/RA_ProgressBar.cpp 2019-02-04 21:08:01.386879720 -0500 @@ -26,6 +26,8 @@ #include "video/GraphicsEngine.h" #include "RaWindow.h" +#define round(var) (long)(var+0.5f) + using std::string; namespace pc { diff -Naur src-orig/vfs/filesystem/externalvfs.cpp src-mod/vfs/filesystem/externalvfs.cpp --- src-orig/vfs/filesystem/externalvfs.cpp 2008-09-22 05:10:40.000000000 -0400 +++ src-mod/vfs/filesystem/externalvfs.cpp 2019-02-04 21:08:02.839271080 -0500 @@ -31,6 +31,8 @@ #include #endif +#include + #include "SDL/SDL_endian.h" #include "video/Renderer.h" diff -Naur src-orig/vfs/mix/ws-key.cpp src-mod/vfs/mix/ws-key.cpp --- src-orig/vfs/mix/ws-key.cpp 2008-09-22 05:10:41.000000000 -0400 +++ src-mod/vfs/mix/ws-key.cpp 2019-02-04 21:08:03.300263800 -0500 @@ -66,7 +66,6 @@ Uint16* endian_Uint32ToUint16ArracyCast (Uint32 *Input, Uint32 len) { -#if SDL_BYTEORDER == SDL_BIG_ENDIAN Uint16 *INPUT; for (Uint16 i = 0; i < len; i++){ @@ -79,14 +78,12 @@ INPUT[i] = SDL_Swap16(INPUT[i]); } return (Uint16*) Input; -#else - return (Uint16 *) Input; -#endif + } Uint32* endian_Uint16ToUint32ArracyCast (Uint16 *Input, Uint32 len) { -#if SDL_BYTEORDER == SDL_BIG_ENDIAN + Uint32 *INPUT; for (Uint16 i = 0; i < len*2; i++){ @@ -99,9 +96,7 @@ INPUT[i] = SDL_Swap32(INPUT[i]); } return (Uint32*) Input; -#else - return (Uint32 *) Input; -#endif + } @@ -126,10 +121,10 @@ for (; i > 0; i--) ((char *)n)[i-1] = (char)key[klen-i]; -#if SDL_BYTEORDER == SDL_BIG_ENDIAN + for (int j = 0; j < 64; j++) n[j] = SDL_Swap32(n[j]); -#endif + } @@ -279,7 +274,6 @@ { Uint32 i1, i2; -#if SDL_BYTEORDER == SDL_BIG_ENDIAN Sint64 Orglen = len; Uint16 *SRC1, *SRC2, *DEST; @@ -287,13 +281,7 @@ SRC2 = endian_Uint32ToUint16ArracyCast (src2, len); DEST = (Uint16*) dest; len += len; -#else - len += len; - Uint16 *SRC1, *SRC2, *DEST; - SRC1 = (Uint16 *)src1; - SRC2 = (Uint16 *)src2; - DEST = (Uint16 *)dest; -#endif + while ((long)--len != -1) { i1 = SRC1[0]; i2 = SRC2[0]; @@ -308,12 +296,12 @@ else carry = 0; } -#if SDL_BYTEORDER == SDL_BIG_ENDIAN + DEST = (Uint16*) dest; SRC2 = (Uint16*) src2; dest = endian_Uint16ToUint32ArracyCast (DEST, Orglen); src2 = endian_Uint16ToUint32ArracyCast (SRC2, Orglen); -#endif + return carry; } @@ -324,23 +312,16 @@ { Uint32 i1, i2; -#if SDL_BYTEORDER == SDL_BIG_ENDIAN + Sint64 Orglen = len; Uint16 *SRC1,*SRC2, *DEST; SRC2 = endian_Uint32ToUint16ArracyCast (src2, len); DEST = dest; len += len; -#else - len += len; - Uint16 *SRC1, *SRC2, *DEST; - SRC1 = (Uint16 *)src1; - SRC2 = (Uint16 *)src2; - DEST = (Uint16 *)dest; -#endif while ((long)--len != -1) { - i1 = SRC1[0]; + i1 = SRC2[0]; i2 = SRC2[0]; DEST[0] = (unsigned short)(i1 - i2 - carry); @@ -352,11 +333,8 @@ else carry = 0; } - -#if SDL_BYTEORDER == SDL_BIG_ENDIAN SRC2 = (Uint16*) src2; src2 = endian_Uint16ToUint32ArracyCast (SRC2, Orglen); -#endif return carry; } @@ -418,13 +396,10 @@ shr_bignum(glob1_hi_inv, 1, 2); glob1_hi_bitlen--; } -#if SDL_BYTEORDER == SDL_BIG_ENDIAN + glob1_hi_inv_lo = ((Uint16 )glob1_hi_inv[0]); glob1_hi_inv_hi = (((Uint16 )(glob1_hi_inv[0]>>16)) ); -#else - glob1_hi_inv_lo = *(Uint16 *)glob1_hi_inv; - glob1_hi_inv_hi = *(((Uint16 *)glob1_hi_inv) + 1); -#endif + } void mul_bignum_word(Uint16* n1, bignum n2, Uint32 mul, Uint32 len) @@ -432,7 +407,6 @@ Uint32 i, tmp; Uint16 *N2; -#if SDL_BYTEORDER == SDL_BIG_ENDIAN bignum N22; for (Uint32 i = 0; i < len/2; i++){ @@ -444,9 +418,7 @@ for (Uint32 i = 0; i < len; i++){ N2[i] = SDL_Swap16(N2[i]); } -#else - N2 = (Uint16 *)n2; -#endif + tmp = 0; for (i = 0; i < len; i++) { tmp = mul * N2[0] + n1[0] + tmp; @@ -468,7 +440,6 @@ init_bignum(dest, 0, len*2); -#if SDL_BYTEORDER == SDL_BIG_ENDIAN bignum SRC22, DEST3; /// @HACK This probably isn't the correct place to do this :) @@ -488,25 +459,15 @@ for (Uint32 i = 0; i < len*2; i++){ SRC2[i] = SDL_Swap16(SRC2[i]); } -#else - SRC2 = (Uint16 *)src2; - DEST = (Uint16 *)dest; -#endif - for (i = 0; i < len*2; i++) { -#if SDL_BYTEORDER == SDL_BIG_ENDIAN - mul_bignum_word(DEST, src1, SRC2[0], len*2); - SRC2++; - DEST++; -#else + mul_bignum_word(DEST, src1, SRC2[0], len*2); SRC2++; DEST++; -#endif } -#if SDL_BYTEORDER == SDL_BIG_ENDIAN + DEST = (Uint16 *)DEST3; for (Uint32 i = 0; i < len*4; i++){ @@ -516,7 +477,6 @@ for (i = 0; i < len*2; i++) { dest[i] = SDL_Swap32(DEST3[i]); } -#endif } @@ -528,7 +488,6 @@ init_bignum(dest, 0, len*2); -#if SDL_BYTEORDER == SDL_BIG_ENDIAN bignum SRC22, DEST3; for (Uint32 i = 0; i < len*2; i++){ @@ -542,10 +501,6 @@ for (Uint32 i = 0; i < len*2; i++){ SRC2[i] = SDL_Swap16(SRC2[i]); } -#else - SRC2 = (Uint16 *)src2; - DEST = (Uint16 *)dest; -#endif for (i = 0; i < len*2; i++) { @@ -554,7 +509,6 @@ DEST++; } -#if SDL_BYTEORDER == SDL_BIG_ENDIAN DEST = (Uint16 *)DEST3; for (Uint32 i = 0; i < len*4; i++){ @@ -564,7 +518,6 @@ for (i = 0; i < len*2; i++) { dest[i] = SDL_Swap32(DEST3[i]); } -#endif } @@ -621,11 +574,7 @@ neg_bignum(glob2, len*2+1); len_diff = g2_len_x2 + 1 - glob1_len_x2; - #if SDL_BYTEORDER == SDL_BIG_ENDIAN glb2 = endian_Uint32ToUint16ArracyCast (glob2, 64); - #else - glb2 = (Uint16*) glob2; - #endif esi = glb2 + (1 + g2_len_x2 - glob1_len_x2); edi = glb2 + (g2_len_x2 + 1); @@ -644,7 +593,6 @@ } neg_bignum(glob2, len); dec_bignum(glob2, len); - #if SDL_BYTEORDER == SDL_BIG_ENDIAN for (int j = 0; j < 64; j++){ glob2[j] = SDL_Swap32(glob2[j]); } @@ -652,7 +600,6 @@ for (int j = 0; j < 64; j++){ tmp[j] = SDL_Swap16(tmp[j]); } - #endif } mov_bignum(n1, glob2, len); } @@ -719,19 +666,15 @@ init_bignum(n2, 0, 64); memmove(n2, pre, a + 1); - #if SDL_BYTEORDER == SDL_BIG_ENDIAN for (int j = 0; j < 64; j++){ n2[j] = SDL_Swap32(n2[j]); } - #endif calc_a_key(n3, n2, pubkey.key2, pubkey.key1, 64); - #if SDL_BYTEORDER == SDL_BIG_ENDIAN for (int j = 0; j < 64; j++){ n3[j] = SDL_Swap32(n3[j]); } - #endif memmove(buf, n3, a);