Commit Graph

143 Commits

Author SHA1 Message Date
ptitSeb
df3592c88c Need __STDC_LIMIT_MACROS macro here too 2016-04-22 22:03:06 +02:00
ptitSeb
c15a2ce2b3 Nedd __STDC_LIMIT_MACROS for *_MAX constant to be defined 2016-04-22 22:03:06 +02:00
ptitSeb
e1921174d4 Restrict the Eps precision change only to Pandora platform 2016-04-22 22:03:05 +02:00
ptitSeb
c32b7cc829 fix Inverted Right and Middle button on certain case with SDL 2016-04-22 22:03:04 +02:00
ptitSeb
b4e43fac95 Lower Epsilonon Pandora 2016-04-22 22:03:03 +02:00
Joshua Scoggins
88a0ec269b Use stdint.h everywhere since Serious Engine requires MSVC 2013 or greater (#40) 2016-04-22 13:57:32 -04:00
Rohit Nirmal
cb3f3bf521 Use those other averages. (#41) 2016-04-22 13:57:04 -04:00
Ryan C. Gordon
7213794459 Merge pull request #38 from DanielGibson/fix-FloatToInt
Fix for FloatToInt
2016-04-21 23:00:03 -04:00
Daniel Gibson
c74fa69bf6 gcc told me copysignf() in FloatToInt() didn't do anything. oops.
sometimes using GCC *does* find problems clang didn't :)
2016-04-22 04:27:29 +02:00
notaz
52c178718c fix SoundMixer asm
SoundMixer386.asm forgot to save some callee-save registers too
2016-04-22 02:29:47 +03:00
notaz
b1837c2e58 fix Graphics asm
same stuff as in previous commit
2016-04-22 02:29:30 +03:00
notaz
a1b84b3ba0 Revert "fix build on gcc 4.8"
This reverts commit 8bbe4c1d5e.
Going to fix it properly.
2016-04-22 02:29:30 +03:00
notaz
fd045e5025 fix LayerMixer asm
- clobber the whole x87 state for mmx (emms alone requires this)
- add all modified registers to clobber list
  (in some cases use dummy output vars instead)
- use symbolic names
- use more relaxed constraints where possible
- allow gcc to allocate ebx replacement reg
2016-04-22 02:28:42 +03:00
notaz
cb69bd3cdd add some asm helpers 2016-04-22 02:28:41 +03:00
Ryan C. Gordon
fd52a044d4 Merge pull request #36 from DrItanium/abstraction-layer
Abstraction layer
2016-04-21 12:40:44 -04:00
Daniel Gibson
a28a7bb00f now TFE builds on OSX, too 2016-04-21 17:46:44 +02:00
Daniel Gibson
430e0c8a95 Remove "64-bit issue" STUBBED() in Model.cpp, as it only looks fishy
.. but is really fine (most probably).

I added comments instead; see them for explanation why it's fine ;-)
2016-04-21 16:21:47 +02:00
Daniel Gibson
d228b6a7a7 make all BSP-related tags size_t so they can store pointers
The tags are often initially assigned from pointers and then copied
around, even from one tag type to the other.
As BSPTree::MoveSubTreeToArray() uses them to get the original pointer,
we need the pointers anyway, so just CRC-ing the pointers doesn't seem
like a good option. As the tags are assigned from other tag-types
sometimes, I probably would have needed to add Pointers for the same
values in addition to the ULONG tags, that are also copied around along
the tags, to keep the tags ULONG - that seemed like a worse alternative.

However, when writing (via BSPTree::Write_t()) the bn_ulPlaneTag tag
needs to be ULONG, so there I actually use CRC for 64bit pointers (via
IntPtrToID()) - when restoring (in Read_t()), the pointers aren't valid
anymore anyway, so that all should somehow be fine.
I assume that Write_t() is only used by the Editor, anyway, so I fear I
won't be able to test that part of the code on Linux anytime soon.
2016-04-21 16:21:47 +02:00
Daniel Gibson
b437abf10d Use PointerToID() for sound-event ID in CSoundObject::Play()/Stop()
so that code should be 64bit-clean now.
2016-04-21 16:21:47 +02:00
Daniel Gibson
23b6374e9a Add ULONG PointerToID(void*) and IntPtrToID(size_t) that CRC 64bit pointers
Sometimes pointers are casted to ULONG just to get an ID or tag - this
is fine for 32bit pointers, but 64bit pointers will truncate which might
result in not being so unique after all.
CRC-ing the pointer should yield a more likely to be unique 32bit value.
NULL is a special case that yields 0 instead of the CRC, so code that
handles IDs/Tags with value 0 differently will continue to work.
For 32bit builds, it just returns the pointer as ULONG.
2016-04-21 16:21:47 +02:00
Daniel Gibson
e642cbcd20 Change PLATFORM_32/64BIT detection
turns out that using UINTPTR_MAX is a pain on several systems like
FreeBSD or even older Linux/glibc systems, so maybe let's not do that
anymore.
Now I check for known CPU-architectures instead.

I also added some sanity checks to make sure the detection was
correct.
2016-04-21 16:21:47 +02:00
Joshua Scoggins
7f682180f3 Use SERIOUS_MHZ envvar for the time being 2016-04-20 19:24:51 -07:00
Joshua Scoggins
dbd896b58d Use the platform independent version of ReadTSC
- If I use the gnu inline version, the game runs way too fast on my cpu due to
  frequency scaling (I think).
2016-04-20 19:06:02 -07:00
Joshua Scoggins
1b873d3ab4 Bool's must be 32-bits wide 2016-04-20 18:50:36 -07:00
Rohit Nirmal
e166958881 Silence -Wreorder warnings. 2016-04-20 13:31:49 -05:00
Yamagi Burmeister
794180c598 bswap_32() is a linuxism, use inline code instead.
bswap_32() is a function specific to Linux, unavailable on FreeBSD and
OS X. Instead of messing with other platform specific functions, #ifdef
and so on provide a fast inline implementation.
2016-04-19 19:09:20 +02:00
Daniel Gibson
8de421dc9d Textures.cpp: improved td_pulObjects/td_ulObject fix
* td_pulObjects is explicitly set to NULL in the constructor - before
  only td_ulObject was set to NONE (0), so on 64bit half of
  td_pulObjects bytes would remain garbage
* only check td_ulObject for NONE if td_ctFrames <= 1 (until now it
  would frequently check it for NONE even if td_ctFrames > 1, if
  td_pulObjects was != NULL)
2016-04-19 14:38:25 +02:00
Ryan C. Gordon
1f7bb24a4d Merge pull request #26 from DanielGibson/64bit-stuff
Some 64bit improvements, lots of 64bit TODOs/STUBBED()
2016-04-18 22:33:58 -04:00
notaz
8bbe4c1d5e fix build on gcc 4.8
some versions of gcc want to inline DitherBitmap(), and this leads to trouble:
Sources/Engine/Graphics/Graphics.cpp:1167: Error: symbol `rowLoopE' is already defined
Sources/Engine/Graphics/Graphics.cpp:1170: Error: symbol `pixLoopEL' is already defined
...
2016-04-18 23:55:41 +03:00
Daniel Gibson
ab5d0a584f Make Engine/Graphics/Texture.cpp 64bit-clean (hopefully!)
((ULONG*)td_ulObject)[iFr] is fishy - and ULONG td_ulObject already is
in an union with ULONG* td_pulObjects, so use td_pulObjects when
appropriate (i.e. if td_ctFrames>1)
Also fixed some checks accordingly.
2016-04-18 20:10:24 +02:00
Daniel Gibson
80990f2317 Fix some more warnings, Warning about supressed warnings in cmake 2016-04-18 19:10:52 +02:00
Daniel Gibson
5f5106e363 CShell::[SG]etCurrentWorld() instead of putting it in INDEX console var
The code used to store the world pointer as a console variable
"pwoCurrentWorld" of type INDEX (int32) - that won't work for 64bit, so
I added CShell::SetCurrentWorld() and CShell::GetCurrentWorld() and
store it as a pointer.
2016-04-18 18:52:52 +02:00
Joshua Scoggins
a4ca331de9 Added some more todos 2016-04-18 00:13:30 -07:00
Joshua Scoggins
f8cb52f8ad Delete an unused include 2016-04-17 23:50:00 -07:00
Joshua Scoggins
a8c22df784 Forgot to write Engine to disk :( 2016-04-17 23:49:18 -07:00
Joshua Scoggins
2d8a4df68c Add the system specific include file 2016-04-17 23:49:02 -07:00
Joshua Scoggins
0c847ab479 Move system specific includes out to a separate file 2016-04-17 23:48:44 -07:00
Joshua Scoggins
8b8ec1f39a Add some C++11 features into Types.h since C++11 is so cool :D 2016-04-17 23:30:48 -07:00
Joshua Scoggins
c8ab519b77 More big endian targets to detect 2016-04-17 23:26:33 -07:00
Joshua Scoggins
42b2822414 More todo's 2016-04-17 23:20:59 -07:00
Joshua Scoggins
35955d20ba use stdint.h instead of courage in Types.h 2016-04-17 23:18:23 -07:00
Joshua Scoggins
5b2933e217 Defined USE_PORTABLE_C when we can't figure out the platform 2016-04-17 23:06:49 -07:00
Joshua Scoggins
535832668f Fixed a broken function call 2016-04-17 23:04:12 -07:00
Joshua Scoggins
e5c0e4f3f4 Add better platform detection abilities 2016-04-17 23:02:49 -07:00
Joshua Scoggins
e82ad0c131 Move system specific deinit to a separate function for now 2016-04-17 23:02:39 -07:00
Joshua Scoggins
b221d5fce2 Make it so that anything system specific is not in SE_InitEngine 2016-04-17 22:53:31 -07:00
Joshua Scoggins
a3c5d30f21 Move the "please abstract" seconds to separate static functions for now 2016-04-17 22:49:58 -07:00
Joshua Scoggins
21d4aec7f7 Follow coding conventions 2016-04-17 22:40:08 -07:00
Joshua Scoggins
12e8b991b3 Move the platform identification code out of SE_InitEngine to PlatformIdentification 2016-04-17 22:39:19 -07:00
Daniel Gibson
599f644328 Resolved some 64bit issues, marked/commented some others
introduced PLATFORM_32BIT and PLATFORM_64BIT macros, so you can do
#ifdef PLATFORM_64BIT if you need to.
I needed that for CDrawPort::GetID() to properly CRC a pointer.
Also added a sanity check in Engine/Base/Types.h that makes sure that
uintprt_t and size_t have the same size, as the code uses size_t to
store pointers (or cast from pointer to int) all over the place.

Made some "tags" from Engine/Templates/BSP_internal.h size_t instead of
ULONG - they're used to store pointers to identify vertices and such,
so they'd better be big enough to actually store a pointer.
Some more are still missing.
2016-04-17 23:35:04 +02:00