Commit Graph

53 Commits

Author SHA1 Message Date
2a0025bc28 # fix warnings and 64-bit bugs in headerless.cpp (workspace update required)
(hopefully fixes often-reported crashes on 64-bit Linux)
remove lib/precompiled.cpp to simplify PCH handling in build system

This was SVN commit r7006.
2009-07-16 23:53:46 +00:00
1743645fd3 Simplify the overly-complex CppDoc-breaking file headers
This was SVN commit r6832.
2009-04-18 17:51:05 +00:00
214b0e6683 Removed outdated licensing information
This was SVN commit r6831.
2009-04-18 17:17:34 +00:00
c9fa7f13d9 Add GPL header
This was SVN commit r6830.
2009-04-18 17:00:33 +00:00
c0ed950657 had to remove uint and ulong from lib/types.h due to conflict with other library.
this snowballed into a massive search+destroy of the hodgepodge of
mostly equivalent types we had in use (int, uint, unsigned, unsigned
int, i32, u32, ulong, uintN).

it is more efficient to use 64-bit types in 64-bit mode, so the
preferred default is size_t (for anything remotely resembling a size or
index). tile coordinates are ssize_t to allow more efficient conversion
to/from floating point. flags are int because we almost never need more
than 15 distinct bits, bit test/set is not slower and int is fastest to
type. finally, some data that is pretty much directly passed to OpenGL
is now typed accordingly.

after several hours, the code now requires fewer casts and less
guesswork.

other changes:
- unit and player IDs now have an "invalid id" constant in the
respective class to avoid casting and -1
- fix some endian/64-bit bugs in the map (un)packing. added a
convenience function to write/read a size_t.
- ia32: change CPUID interface to allow passing in ecx (required for
cache topology detection, which I need at work). remove some unneeded
functions from asm, replace with intrinsics where possible.

This was SVN commit r5942.
2008-05-11 18:48:32 +00:00
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
f6de818ea8 # Added support for automatically loading 3d models in the COLLADA format.
* CMeshManager: Changed to check for .pmd and .dae files and convert
and cache as appropriate.
 * CModelDef: Fixed misinterpreted doc comments in.
 * lib:
   * Fixed init/shutdown sequences to support multiple VFS-using tests
correctly.
   * Fixed most reported memory leaks from the new leak-reporting test
system.
   * Fixed error when trying to dump debug data about fonts after
unloading them.
 * Added sphere dae/pmd data for tests.
 * Added output buffering to DAE->PMD converter.
 * Added precompiled COLLADA converter DLLs.
 * Removed old redundant conversion script.

This was SVN commit r4709.
2006-12-20 03:22:24 +00:00
29ea79f5eb # CSimulation init optimization
* ScriptableComplex.h: big bang (several hundred ms) for little buck:
made all CStrW params const CStrW& instead. this should *always* be done
as a matter of principle, unless the string actually needs to be
modified (in which case compiler will tell you)

* adts: slight improvement to hash table perf: change expansion
threshold to 50% full, and implement quadratic probing (as suggested by
matei)

This was SVN commit r4122.
2006-07-16 23:03:26 +00:00
4630745625 # Updates to the entity bar display system by Andrew.
Bars and rank icons now scale with zoom level. I've left in the old
render functions for now, but they can be removed later.

This was SVN commit r4120.
2006-07-16 19:32:48 +00:00
7cb82ada2f # lots of housekeeping/fixes
premake: document extra_params
ogl: remove EXT_ symbols, use glext instead
adts: move cache into separate file (also remove old cache impl)
move SDL files in sysdep/win to libraries/SDL
ScopeTimerAccrue: change #ifdef spaghetti into templated policy class
app_hooks, define VOID_FUNC to FUNC(.., (void) )
look at stalk walk code; any reason not to work on Win64?
replace ERR_TEX_CODEC_CANNOT_HANDLE with INFO_* - not an error. also
ERR_SYM_SUPPRESS_OUTPUT ERR_SYM_SINGLE_SYMBOL_LIMIT
wdbg_sym: only import RtlCaptureContext once (not every walk_stack)
add sys_last_error (!GetLastError on win32); converts to text in
display_error, also show sys_last_error and errno
app_hooks: move i18n impl out (belongs in pyrogenesis)
fixes to string_s test.

refs #124

This was SVN commit r4020.
2006-06-23 17:41:55 +00:00
d0acaecc5c # housekeeping
fix warnings in self tests
make win_pre_main_init manually callable and remove the main() hook (see
rationale at decl of win_pre_main_init)

This was SVN commit r3981.
2006-06-08 21:27:03 +00:00
1ead202b24 # add CppDoc comments; prepare for automated testing
ia32: prepend CPUCap enum names and rdtsc with ia32 to avoid conflicts.
move all self tests into separate headers as required for Cxxtest.
adts: remove some dead code.

add CppDoc comments to debug, lib (with heavy cleanup), tex, tex_codec,
snd_mgr
slight improvements to path

tex: refactor; split out tex_decode and encode to allow self-test

This was SVN commit r3911.
2006-05-31 04:01:59 +00:00
37663d86fb # bugfixes: prevent incorrect FPU results due to 0-length files, and incorrect file caching due to timestamps delayed by long sojourn in the debugger.
file_cache: avoid caching 0-length files (prevents div by 0)
adts: bit more defensiveness against size=0
trace: now use "dividers" in the trace file instead of relying on
monotony property of the get_time source. this avoids incorrectly
splitting the trace into runs when time is actually not monotonous
(which would cause lots of warnings), e.g. due to debugger.
in the process, changed interface to return (most-recent first) runs,
instead of only the raw unsorted entries.

This was SVN commit r3832.
2006-04-30 21:45:32 +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
6eac18d9fe # housekeeping (improve unreachable code annotations and avoid compiler warnings)
adts: use SAFE_FREE
config: add CONFIG_FINAL; use it in
compression,vfs_optimizer,scriptablecomplex
lib: add discussion of unreachable code avoidance; revise UNREACHABLE
and add NODEFAULT
ogl_tex, tex_dds: remove some unnecessary UNREACHABLE
sysdep: move compiler-specific implementation of UNREACHABLE here.
use NODEFAULT in snd, wdbg, wposix, wsdl

This was SVN commit r3739.
2006-04-10 06:44:54 +00:00
d6abc57868 # add instrumentation to file_cache; bugfixes
adts: whip together inefficient LRU cache manager (mostly for comparing
vs. Landlord)
file_cache: fix self-test (now correctly deals with small cache sizes)
file_stats: more stats for file cache
trace, vfs: bugfix: ignore writes recorded by the trace

This was SVN commit r3684.
2006-03-25 07:08:29 +00:00
8371f42da9 # IO bugfixes and improvements; more support for cache/seek measurements
adts: slight improvements
allocators: change POOL_VARIABLE_ALLOCS to -1 for safety; fix invalid
assumptions of it being 0
lib: more expressive param names
file: add file_get_random_name for randomized trace generation; allow
file_cache.h to declare externally visible file_buf_alloc API

file_cache: zero-length file bugfix; also add several flags to the API
routines allowing statistics gathering to be disabled (avoids distorting
stats due to e.g. trace_entry_causes_io cache simulation)

file_stats: add archive builder info; separate IO timing and seek
accounting (-> correct results)

trace: add random generation capability
vfs: made responsible for cache hit/miss accounting (fixes cache miss
rate display)

This was SVN commit r3681.
2006-03-24 21:56:00 +00:00
7564827a8a adts: DynHashTbl: safely handle calling clear() right before dtor
vfs: remove second call to tree_init (now done by vfs_mount)
vfs_tree: fix memory leak due to not destroying root node. commented and
armor-plated things while at it.

This was SVN commit r3647.
2006-03-16 07:16:24 +00:00
b605cc8a85 adts: fix brain-dead bug that was slowing down Divider_Recip
vfs_optimizer: add note on future improvements

This was SVN commit r3622.
2006-03-10 22:35:58 +00:00
bd922cbe02 Unix cursor support, some gcc warnings, etc
This was SVN commit r3608.
2006-03-06 03:46:12 +00:00
16fe4eeda2 - adts: add TODO comments
- file_cache: add checker for allocations (catches bugs in debug mode);
fix bug that freed buffers even thought they were on extant list.
- vfs_mount: bugfix: was passing P_path to vfs_opt_notify when it should
be V_path
- vfs_optimizer: big refactor; fix bugs in TourBuilder causing some
files to be omitted from archive (thus forcing unnecessary archive
rebuild - because #files not in archive was too big)

This was SVN commit r3602.
2006-03-04 18:58:09 +00:00
c1ca8c978c Various Linux build fixes.
This was SVN commit r3601.
2006-03-04 18:41:22 +00:00
ca1ac3034e fix 2 gnarly bugs:
- adts: Cache.remove_least_valuable was returning false prematurely even
though there were still some items pending eviction; that meant they
remained in cache
- file_cache: wasn't clearing exact_buf_oracle on reset. also made
make_read_only pass correct exact_buf rather than just rounding down.

This was SVN commit r3589.
2006-03-03 20:49:19 +00:00
bc07b9ff0a file code v2 is now feature complete and works.
- adts: add basic benchmark to self-test; use fminf instead of MIN; fix
overly pessimistic invalidation in Landlord_Cached
- allocators: no longer complain if DynArray is full
- lib: warn if rand() min=max
- archive: bugfixes: plug leak, correctly handle 0-length files, carry
over flags when reading uncompressed file from archive
- file: expose file_get_sorted_dirents and implement file_enum in terms
of that
- file_cache: many bugfixes (especially related to CacheAllocator
freelist)
- vfs_optimizer: finish implementation of archive builder
- zip: correctly handle 0-length files
- tex: add tex_is_known_extension
- sysdep: add efficient fminf implementation (assumes P6+)

- config: update archive builder call site
- gamesetup: add call for delayed self tests
- entity: return JSVAL_VOID as per philip's suggestion

This was SVN commit r3553.
2006-02-23 07:55:32 +00:00
4eb33aa89d more dox
This was SVN commit r3541.
2006-02-19 21:06:22 +00:00
0a368a4fec massive update to adts: cache now implemented via templated policy classes.
Entity.h: fix minor warning

This was SVN commit r3539.
2006-02-19 18:51:00 +00:00
c4e3037e60 adts: add LL_OPT_* defines that enable optimizations (some only make sense if there are tons of files, and need to be able to disable them for thesis). realized this would be perfect application of policy template classes, which will replace this.
fix crashdumps: was failing to write out to file (underlying cause:
current directory no longer being set)
app_hooks: add get_log_dir; used by debug and wdbg_sym

minor improvements/documentation in archive+compression+file_cache+zip

main: remove dead ScEd code

This was SVN commit r3498.
2006-02-11 22:49:09 +00:00
21f8f8555e adts: remove_least_valuable safely handles empty cache
lib: add u32_hi/lo
archive: move archive builder logic here from vf_optimizer
file_cache: add flush() call - used when simulating cache
vfs_optimizer: WIP, not yet functional: file gatherer, 50% of TSP tour
generator

This was SVN commit r3486.
2006-02-09 05:59:33 +00:00
92fb5450bc CVFSInputSource clean-up, added headers to adts.{h,cpp}
This was SVN commit r3472.
2006-02-04 22:44:52 +00:00
987a6b7d4e fixed wchar_t issues; now correctly separates utf16, CStrW and jschar.
NOTE: wchar_t should be defined as a built-in type; no more need to
define manually or change project settings.

adts: disambiguate iterator type; add operator- as required by VC8
std::equal() implementation
precompiled: squelch stupid warning (that informs us that array members
are now actually default-initialized as called for by C++)
file_cache: remove debug variable

This was SVN commit r3464.
2006-02-03 20:36:15 +00:00
1227cb2f6d adts: add RingBuf self-test. RingBuf: make entry#0 the 'head' and pop_front a no-op if empty.
allocators: allow pool_create at NLSO ctor time
lib: add rand() function based on libc rand and self-test. (this allows
easily returning a random number within a range, and avoids a number of
pitfalls - the naive rand()%range approach is baaad)
precompiled: add self_test.h, so that self tests won't be accidentally
disabled by forgetting to include the header

file_cache: add self-test; fixed 2 bugs that exposed (was incorrectly
splitting large blocks and not setting class_size bit properly). fix
weird corner case in BlockMgr (attempting to free LRU block but it is
locked).

file_io, wdbg_sym: tiny fixes

This was SVN commit r3461.
2006-02-03 04:02:53 +00:00
7862e79e84 adts: optimize landlord algorithm at advisor's request (only relevant if we have tons of files in cache)
trace: make note of IO size

xmlutils: fix old remnant of Handle vfs_load return type.

This was SVN commit r3456.
2006-02-02 04:11:07 +00:00
e07622b56a Cache: implement meat of landlord algorithm and add remove()
allocators: add freelist capability to Bucket; add provision for
variable XOR fixed size allocs
archive: re-tag file buffers if reading uncompressed from archive;
improve LFH fixup logic
file_cache: add cache line invalidation; lock down pages (readonly) when
IO finished
file_io: cleanup+docs; properly cut off at EOF without breaking
alignment.
file_stats: add seek accounting (WIP)
vfs_optimizer: also record file_buf_free in the trace. initial
implementation of archive builder (WIP)
zip: lfh_fixup now more efficient (does not involve buffer manager -
instead it grabs LFH from temp blocks)
tex: plug FileIOBuf leak. avoid writing to tex.hm because that is a
read-only file_buf.

This was SVN commit r3428.
2006-01-28 22:19:42 +00:00
3b4295a177 Linux build fixes
This was SVN commit r3427.
2006-01-28 22:04:09 +00:00
7838627cd2 - vfs_load now returns error code and takes FileIOBuf; that must be freed via file_buf_free. if Handle is needed, use mem_wrap.
- remove ScEd hacks and CFont et al macro rename
- fix accursed bug in VFS buffer management that was causing ReadFile to
fail without error (not allocating enough padding)
- vfs_tree: bugfix in tree_lookup
- waio: temporarily disable sector size determination (pending better
approach - need to determine if using DVD drive)

This was SVN commit r3421.
2006-01-24 08:16:29 +00:00
4dbeb2ed6c Fixed a compile error (on gcc-3.3 at least): the code in adts.h used
Traits.something where Traits is a typename instead of using
tr.something where tr is an instance of Traits.

This was SVN commit r3417.
2006-01-23 10:35:24 +00:00
f06f0c8240 adts.cpp: remove DynArray, which was an array of pages. (obsoleted by DynArray/Pool allocators)
adts.h: add Cache (landlord algorithm), move DynHashTbl here from
vfs_tree; expand RingBuf and fix its iterator
allocators: minor tweaks+bugfixes; add SingleAllocator C++ wrapper
config, types: avoid stupid ICC warnings
lib: add round_down, u32_from_u16, SAFE_FREE

This was SVN commit r3414.
2006-01-23 07:59:20 +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
479f59e386 adts, lib: add some minor comments
This was SVN commit r2121.
2005-04-09 22:24:08 +00:00
da5816e971 Re-enabled VC's memory debugging by default (when not using USE_MMGR). Hopefully fixed the resulting memory leaks. Also fixed incompatibilities with VC2005.
This was SVN commit r1950.
2005-02-27 22:11:26 +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
7bef7160ca gcc warning fixes
This was SVN commit r702.
2004-07-11 12:49:44 +00:00
70b7f4249f fixed sneaky iterator bug: when ring buffer full, begin() was equal to end()
This was SVN commit r607.
2004-06-27 01:42:17 +00:00
fc476e04f6 stomped on numerous warnings
This was SVN commit r584.
2004-06-21 16:29:47 +00:00
7fb1f4892e adapted ringbug operator[] for timer's needs
This was SVN commit r507.
2004-06-14 13:27:33 +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