1
1
forked from 0ad/0ad
Commit Graph

53 Commits

Author SHA1 Message Date
2e5d9452aa part2: misc source/lib fixes/improvements
move all except user-specified config choices out of config.h and into
appropriate headers
CPU_IA32 -> ARCH_IA32
wsdl: disable use of ddraw (will soon be replaced by WMI)

use shared_ptr without namespace qualifier (it's in tr1)
debug_warn -> debug_assert(0)
LIB_API to allow building as DLL
smart pointers: reduce use of .get()
cache_adt: use map instead of hash_map (avoids needing a hashCompare
class). also remove spurious warning
code_annotation.h: better cassert implementation
move FPS measuring portion of timer.cpp into frequency_filter
move include of memory headers into mmgr.h (to avoid errors, we must
ensure they are included if mmgr is used)
posix_filesystem.h: move definition of mkdir to wfilesystem
stl: disable iterator checks in release mode
wmi: fix COM init bug, use smart pointers
wutil: add code to get DLL module handle (if compiled as such), add
WinScopedLock
timer: fix handling of raw ticks

This was SVN commit r5517.
2007-12-20 20:09:19 +00:00
a34b759720 . split up lib.h/.cpp, include the remnants from PCH, remove (pretty much universal) include of it.
. timer, config: fix definition of ALLOW_RDTSC
. add movsx_be64 (for whirlpool), revise implementation, move to
byte_order, add test
. MAX -> std::max, remove those macros
. add timestamp to system_info as requested by philip

This was SVN commit r5050.
2007-05-09 21:01:11 +00:00
b755ddefda remove all author/modified by tags.
make include guards consistent.

This was SVN commit r5040.
2007-05-07 16:33:24 +00:00
4be0fe18a0 # SwEng
. major compat fixes for interoperation with wxw.
. add crashlog_sender (modified version of debgrpt wxw sample). compiles
but untested, will be changed heavily
further improvements:
. wposix no longer declares CRT functions. instead, use CRT headers..
but don't allow their (incorrect/non-POSIX) declarations to propagate to
users.
. split up win.cpp into wstartup, wutil, winit
. extern "C" -> EXTERN_C
. move sdl.* to lib/external_libraries and add png.h+zlib.h (fixes for
and include of the library)

This was SVN commit r5028.
2007-05-04 17:30:32 +00:00
73683b6109 # SwEng
. the massive renaming undertaking: camelCase functions -> PascalCase.
. add some cppdoc.
. minor additional renaming improvements: e.g. GetIsClosed -> IsClosed
. in entity code, replace constructs like "pvec = new vector; return
pvec; use *pvec; delete pvec" with a simple stack variable passed as
output parameter (avoid unnecessary dynamic allocs)
. timer: simpler handling of raw ticks vs normal timer (less #if)

This was SVN commit r5017.
2007-05-02 12:07:08 +00:00
adc8c64724 # General tidying.
Encryption: Deleted, just in case anyone was ever tempted to use it.
debug_warn: Removed redundant quotes around message.
oglCheck: Added error number to displayed messages, to help when
debugging errors.
Simulation: Fixed syntax confusion.
Entity: Preserve unit ID across entity-template changes (e.g. upgrades).
Atlas: Made some floating-point code less dodgy. Support number keys to
change player while placing units.

This was SVN commit r4814.
2007-01-27 02:36:33 +00:00
0bb0df5b2c # new year's cleanup (reduce dependencies, clean up headers)
- remove headers always included from PCH
- nommgr.h is only included ifdef REDEFINED_NEW (allows leaving out the
mmgr stuff)
- in lib/*.cpp, moved the corresponding include file to right behind the
PCH (catches headers that aren't compilable by themselves)
- byte_order no longer depends on SDL
- add debug_level (another means of filtering debug output; needed for
thesis)
- split posix stuff up into subdirs (lib/posix and sysdep/win/wposix).
makes including only some of the modules (e.g. sockets, time) much
easier.

This was SVN commit r4728.
2007-01-01 21:25:47 +00:00
871cdb6ef9 # SwEng (reduce full recompiles by splitting up master error header)
- error codes now accessed as ERR::NO_MEM, INFO::OK etc.
- no more X-macros => the above are now recognized by visual assist
- error codes are defined by the module originating them (lib_errors has
some generic ones)
  => no full rebuild when adding some
- error descriptions are now in C++ files => can be changed without full
rebuild

added AT_STARTUP in lib.h.

This was SVN commit r4374.
2006-09-22 13:19:40 +00:00
3195893d1c # MacOS X compat (part 1)
- u_anim_name disambiguation
- fix implementation of finite (use our fpclassify instead of compiler's
routine)
- รค -> ae
- workaround for MAP_ANONYMOUS
- fix GLint in ogl.cpp
- add include for SIZE_MAX in string_s
- avoid PIC clobbered error and speed up rdtsc a bit
- add include for stat

This was SVN commit r4170.
2006-07-26 14:04:52 +00:00
b8c131c431 # housekeeping
* zip.h removed old test symbols
* path_util fixed bug in mixed-separating-slash handling
* renamed ERR_OK to INFO_OK; allows searching for "return ERR_" to yield
all actual errors (instead of having to filter out ERR_OK)

This was SVN commit r3945.
2006-06-04 22:27:40 +00:00
5f7855f7f0 Simplification of #Include paths: relative names are used only for included files in the same directory as the including file; everything else uses the full path relative to source/.
This was SVN commit r3930.
2006-06-02 02:10:27 +00:00
3d26549032 Fixed file properties - removed svn:executable and svn:keywords (left over from CVS conversion?) from all files; set svn:eol-style=native for *.cpp, *.h (and fixed files with inconsistent line endings)
This was SVN commit r3802.
2006-04-23 23:14:18 +00:00
836cd08d5e # add CppDoc file header to all files, along with their descriptions.
also:
- renamed wdll to delay_load, and wdll_ver to dll_ver
- removed empty wcpu

This was SVN commit r3751.
2006-04-11 23:59:08 +00:00
34637ba5dc # refactor sysdep API, split it into parts
- split up detect.cpp into snd, cpu, gfx (headers were already split)
- rename detect functions for more clarity (e.g. get_cur_vmode ->
gfx_get_video_mode)
- rename lib/res/sound/snd to snd_mgr to avoid conflict with
sysdep/snd.cpp
- waio: set errno in aio_rw (addresses bug #73)

This was SVN commit r3745.
2006-04-10 20:12:25 +00:00
5738bd4820 # overhauled error handling; made sure all low-level function failures are caught at the source.
* replace all "return ERR_*" with WARN_RETURN(ERR_*) - makes sure
function failures are noticed *at the cause*, not later
* LibError_from_* now take bool warn_if_failed param
* replace more debug_warns with dedicated error codes (allows localized
error reports and doesn't spam the EXE with strings)

This was SVN commit r3722.
2006-04-03 01:00:45 +00:00
8fd256c458 #Use EXT_framebuffer_object when available
* noframebufferobject configuration in system.cfg can be used to
  disable EXT_fbo (in case drivers are flaky etc.)
* shadow texture size now honours the OpenGL maximum texture size as
reported
  by the implementation

This was SVN commit r3693.
2006-03-26 17:36:33 +00:00
b889826a3d Some Linux compile fixes over the place.
Create TerrainRenderer, ShadowMap and WaterManager classes to divide
CRenderer's functions into more logical units.

This was SVN commit r3332.
2006-01-07 01:04:26 +00:00
32aca79221 allocator: add single_calloc (generalization of code previously in wposix for WDIR); add da_reserve; expand pool allocator to allow variable size entries
byte_order: add FOURCC_BE and _LE versions (needed for zip)
ogl: quick hack: prevent crash on laptop by providing a
pglDrawRangeElementsEXT stub
file, h_mgr: update pool_alloc call site

tex: fix incorrect indexing/stride for mipmap generation

vfs_mount: disable archives (zip code is WIP)
zip: heavy WIP. add support for writing archives (needed for thesis);
revised Zip read code. sped up archive open. further major changes
pending.

wposix: moved allocator code (see above)

This was SVN commit r3298.
2005-12-28 20:29:22 +00:00
1c1200a049 - massive overhaul of lib error code returning. int -> LibError everywhere.
- add translators from errno and GetLastError to LibError
- clarified return values of callbacks (they must return
INFO_CB_CONTINUE to continue)
- this exposed a few bugs in error handling chains (returning incorrect
values); also reduced say-nothing instances of return -1.
- move CHECK_ERR etc. macros to lib_error

This was SVN commit r3229.
2005-12-11 22:23:55 +00:00
252bd478c4 Fix wgl extension function pointers (I hope). Thanks for pointing it out, Philipp.
This was SVN commit r3055.
2005-10-30 01:51:16 +00:00
501acc65f5 Extension function pointers are renamed from glXyzARB to pglXyzARB
to avoid conflicts with system header files.

This was SVN commit r3054.
2005-10-30 01:18:15 +00:00
e3b0f20d4e change requested by philip: debug_printf "tags" are now followed by '|' instead of ':' because something like "func: i am blowing up" is rather common.
This was SVN commit r3035.
2005-10-27 16:53:41 +00:00
d49dd25385 ogl, h_mgr: tag-ified debug_printf string for use with new filter
debug: filter mechanism now usable. added docs

This was SVN commit r3001.
2005-10-24 17:38:22 +00:00
a953a8ef57 debug_assert now displays function name also. this neatly avoids the need for __func__ in every debug_warn, which also breaks on Linux. all such constructions have been removed.
This was SVN commit r2968.
2005-10-19 06:29:55 +00:00
b17fbf003d -move app-specific stuff out of lib/ and into "hooks". see new lib/app_hooks* (note X macro goodness)
-move tex_codec stuff out of tex.cpp and into tex_codec.cpp
-tex_codec: use linked list of codecs instead of array (simplifies code
and removes limit)
-ogl_tex: add override mechanism for s3tc/automipmapgen extension detect
-tired of keeping of debug_warn text in sync with function name; now use
__func__ everywhere (and emulate that with __FUNCTION__ on MSC)
-add ONCE_NOT (opposite of ONCE)
-fix 3!! stupid bugs in ia32_control87, its caller and the header that
were canceling each other out. float exceptions now enabled except for
"inexact result" (too common). (update: nicolai had already fixed 2 of
these)

This was SVN commit r2964.
2005-10-19 03:06:54 +00:00
ece006f43e sysdep: add restrict keyword (placebo if not supported)
gfx: extern "C"-ed
wtime, util, win, wdbg_sym: minor / commenting only
wdetect: don't skip gfx_card detect if buffer already filled
glext_funcs: remove obsolete defs

detect: call both OpenGL and platform-specific gfx_card detect; cleanup
vendor name to remove copyright/Inc crap

ogl: remove some variables that don't belong. moved vendor cleanup to
detect. moved S3TC emu code to ogl_tex

This was SVN commit r2905.
2005-10-12 04:22:44 +00:00
04650efe7a Lots of gcc -Wall fixes. The common ones:
- switch() statements don't handle all values in an enum
- missing \n at end of file
- non-virtual destructors in classes containing virtual functions
- order of initializers in constructor initializer lists
... some other stuff (signedness, nested comments, unused variables) as
well.

This was SVN commit r2864.
2005-10-07 15:24:29 +00:00
d367014972 vfs_store: set return value to #bytes written
fix 2 bugs in tex / ogl_tex reported by philip (related to caching) -
thanks!
tex: documented header and improved implementation. add tex_transform_to
for convenience. change tex_write to require going through tex_wrap.

This was SVN commit r2837.
2005-10-03 12:57:31 +00:00
a92e92cd46 Basic GL_ARB_vertex_shader detection.
Remove a redundant copy operation in ModelRData::BuildVertices

This was SVN commit r2822.
2005-09-30 22:23:48 +00:00
db27ff6c9b bugfix when writing screenshot: was calculating rounded up size for VFS incorrectly.
also fix refcnt for tex_wrap temporarily until mem_assign/mem_get_ptr
do.

h_mgr: add disallow-reload support (required for wrapped ogl_tex since
they are not backed by a file)

This was SVN commit r2780.
2005-09-27 15:35:17 +00:00
13501cf58b hook up emulate_glCompressedTexImage2D to new tex transform code (which takes care of DDS unpack)
to that end, provide support for "wrapping" existing textures so that
tex_* and ogl_tex* calls may be used.

also have renderer use ogl_tex for its created-on-the-fly composite
alpha texture
also named atlas's thread (for fun+profit during debugging)

This was SVN commit r2754.
2005-09-19 22:48:20 +00:00
78c751aff6 ogl: add oglSquelchError call. use that if you know a piece of code will trigger an error and want to suppress it (e.g. INVALID_ENUM after using GL_CLAMP_TO_EDGE although we've already warned the user that not everything may work)
file: now provides a much more efficient alternative to file_enum that
does not sort all files (this was a problem for check_if_oal_dll which
was scanning the entire system32 dir)

- use the same DirEnt struct for file and VFS due to clever name pointer
trick.
- wposix: avoid malloc for most opendir() and fix mmap() bugs (thanks to
Philip for noticing+reporting them)
- VFS: was getting too large to manage, now split into an additional
file
- WIP: much more efficient mounting; supports other mount sources than
file or zip (e.g. if we want to add network files); clean separation
between VFS submodules; dox; beginning of thread locking.

This was SVN commit r2589.
2005-08-09 16:32:23 +00:00
ec6b78b252 rename assert2 debug_assert; use instead of all plain assert(), since there are no longer any issues (e.g. can't use while handling an exception)
This was SVN commit r2447.
2005-06-28 04:06:25 +00:00
8f9a3fc38f - config.h: massive improvements, much clearer.
- tentatively activate PCH if gcc > 3.4. remove XP_ defines (which were
undocumented; now in scripting/spidermonkey.h)
- rename some config defines
- move sysdep/debug.h to lib/debug.h (it's portable; was wrong all
along)
- grouped all debug heap related stuff to debug.h:debug_heap_*
- sysdep: fix circular include issue with debug.h

This was SVN commit r2427.
2005-06-22 03:23:22 +00:00
9c4148aa0c replace display_msg with full-blown error dialog
(makes possible philip's suggestion of continuing even if exts are
missing)

printf: add extern "C"

This was SVN commit r2417.
2005-06-21 16:27:26 +00:00
7577d224a6 Terrain XML loading, plus mouse/JS portability and some misc stuff to mix it up
This was SVN commit r2412.
2005-06-20 15:14:36 +00:00
471fd5d6f3 Unbroke more; plus some minor changes.
This was SVN commit r2398.
2005-06-17 01:28:35 +00:00
2f0c785ba7 reorganize code; add paranoid checking for core support of extensions in case the driver forgot to advertise some; remove deadwood (oglPrintErrors - oglCheck does the same); prefix the feature/limit variables with ogl_; add oglHaveExtensions call
This was SVN commit r2396.
2005-06-16 22:21:12 +00:00
d24fd1b0c9 Use gl*ARB wherever possible. They are mapped onto the core gl* function if the driver's version is high enough, else onto the extension's gl*ARB function.
(Just for fun, compressed texture uploads are mapped onto a
decompression function if the user's system doesn't understand S3TC
textures.)
Corrected (unless I'm wrong) GL version identification logic.

This was SVN commit r2384.
2005-06-14 03:33:16 +00:00
fd4eb91e93 debug_out -> debug_printf; MICROLOG moved to ps/Pyrogenesis.h
This was SVN commit r2285.
2005-05-11 18:56:30 +00:00
19b3d2d388 rename oglExtAvail to oglHaveExtension
main.cpp: also provide for different screenshot file formats by passing
in extension
ogl.cpp: also add oglHaveVersion

This was SVN commit r1984.
2005-03-10 16:57:42 +00:00
2b33ba8ade security push: checked every strcpy / strncpy. converted most to strcpy_s; some are flagged as "safe" (e.g. if copying literal that's obviously OK)
This was SVN commit r1962.
2005-03-01 20:13:00 +00:00
85fd8a0f0e stomped various lint warnings:
- /* */ -> //
- clarified expressions
- add casts
- func() -> func(void)
- signed/unsigned

also KB -> KiB, MB -> MiB

This was SVN commit r1775.
2005-01-23 17:54:20 +00:00
0afc3c159d trivialities: add extern, add assert to make sure oglInit called
This was SVN commit r1260.
2004-10-19 17:49:12 +00:00
4e517d52f7 oglCheck() function, which blows up when you add invalid OpenGL code
This was SVN commit r923.
2004-08-06 14:58:58 +00:00
464dfd7ee5 Allow access to GL extension list
This was SVN commit r777.
2004-07-19 19:04:17 +00:00
136182e8bc oglPrintError now outputs to debug output window
This was SVN commit r512.
2004-06-15 02:43:56 +00:00
15ca5cbf21 newline stomper and fixed warnings
This was SVN commit r473.
2004-06-11 02:14:18 +00:00
0dc6007fbd (re)added headers so it'll work without HAVE_PCH
This was SVN commit r396.
2004-06-04 12:41:53 +00:00
6c608edd60 linefix stomped everything :P
This was SVN commit r266.
2004-05-25 23:16:21 +00:00