Commit Graph

42 Commits

Author SHA1 Message Date
Paul Chote
b347fade71 Use IReadOnlyFileSystem in artwork loaders. 2016-02-18 18:12:31 +00:00
Paul Chote
4a12e7bafc Load mod yaml via the virtual filesystem. 2016-02-06 16:30:23 +00:00
Paul Chote
ab921682c4 Rewrite yaml merger. 2016-01-30 15:03:56 +00:00
Pavel Penev
1b88d24cfa Unstatic GlobalFileSystem and rename it to FileSystem
Add a ModFiles field on ModData and move all access to the file system to go through that.
2015-12-14 03:42:22 +02:00
Paul Chote
c7249e6fa6 Move yaml removals to the end of the merge. 2015-11-28 17:20:32 +01:00
Paul Chote
a074bb1d4b Rename MiniYaml MergeLiberal -> MergePartial, MergeStrict -> Merge. 2015-11-28 17:20:21 +01:00
Paul Chote
b2458fc614 Remove GlobalFilesystem.OpenWithExts. Closes #5272. 2015-03-28 12:38:48 +00:00
abcdefg30
8ca61aa917 Updated all year numbers 2015-01-09 21:18:05 +01:00
Paul Chote
75b046ae2a Reorganize cursor plumbing in preparation for hardware cursors. 2014-12-23 22:09:22 +13:00
RoosterDragon
9cbac2d5e1 Clean up style of files affected by the last commit. 2014-12-22 17:34:02 +00:00
RoosterDragon
f0f02dff5c Dispose of graphics resources deterministically.
Textures, FrameBuffers and VertexBuffers allocated by the Sdl2 Renderer were only being released via finalizers. This could lead to OpenGL out of memory errors since resources may not be cleaned up in a timely manner. To avoid this, IDisposable has been implemented and transitively applied to classes that use these resources.

As a side-effect some static state is no longer static, particularly in Renderer, in order to facilitate this change and just for nicer design in general.

Also dispose some bitmaps.
2014-12-22 17:34:01 +00:00
RoosterDragon
d671e1de01 Create a separate FrameCache for caching sprite frames.
We split the caching SpriteLoader into a SpriteCache and FrameCache. SpriteLoader instead becomes a holder for static loading methods.

Only a few classes loaded sprite frames, and they all use it with a transient cache. By moving this method into a new class, we can lose the now redundant frame cache, saving on memory significantly since the frame data array can be reclaimed by the GC. This saves ~58 MiB on frames and ~4 MiB on the caching dictionary in simple tests.
2014-10-14 22:06:11 +01:00
Paul Chote
9cf8328979 Add plumbing for mod-defined sprite loaders. 2014-10-07 09:55:49 +13:00
huwpascoe
baecedc7b8 Cursor Doubling
Cursor now doubles with pixel doubling, enabled by a new checkbox in the
settings menu.
2014-08-21 20:08:38 +01:00
RoosterDragon
3a30748f05 Reduce working set by releasing buffers for sheets.
Sheets carry a managed buffer of data that allows updates to be made without having to constantly fetch and set data to the texture memory of the video card. This is useful for things like SheetBuilder which make small progressive changes to sheets.

However these buffers are often large and are kept alive because sheets are referenced by the sprites that use them. If this buffer is explicitly null'ed when it is no longer needed then the GC can reclaim it. Sometimes a buffer need not even be created because the object using the sheet only works on the texture directly anyway.

In practise, this reduced memory consumed by such buffers from ~165 MiB to ~112 MiB (at the start of a new RA skirmish mission).
2014-07-02 17:25:56 +01:00
RoosterDragon
7030d8b2b6 Changed HardwarePalette.ApplyModifiers to be more efficient.
- Add separate ImmutablePalette and MutablePalette classes since the distinction is extremely important to HardwarePalette.
- Keep a cache of palettes in HardwarePalette to avoid reallocation them every time ApplyModifiers is called.
- Palettes that are not allowed to be modified are copied to the buffer once when added, rather than every time ApplyModifiers is called.
- The AdjustPalette method now takes a read-only dictionary to prevent the dictionary being messed with.
- Added a constant for the palette size to remove its usage as a magic number in several areas.
- The ColorPreviewManagerWidget is annoying in that it needs to actually permanently update a palette after it has been added. To allow this, HardwarePalette now allows a palette to be replaced after initialization. The WorldRenderer therefore now also updates the PaletteReference it created earlier with the new palette to prevent stale data being used elsewhere.
2014-06-28 01:11:48 +01:00
RoosterDragon
2e992a7310 Changed MiniYaml.NodesDict property into a method.
Method is now called ToDictionary.
- Cached a few invocations into locals which should prevent some redundant evaluation.
- Added ToDictionary overloads that take projection functions for the keys and elements, since several callsites were doing a subsequent Linq.ToDictionary call to get this.
2014-06-09 17:06:42 +01:00
Pavlos Touboulidis
ca44be7b2e Only update the loading screen from the main thread
Fixes the crash experienced by pchote. It's a hack but it's easy
to get rid of and it will have to do for now, until the messy
LoadScreen gets fixed.
2014-05-17 14:33:17 +03:00
Pavlos Touboulidis
5bbf442cd0 Remove reference to Game.modData 2014-05-17 14:33:16 +03:00
Pavlos Touboulidis
63ec6d60e7 Refactoring to remove static Rules & SequenceProvider 2014-05-17 14:32:03 +03:00
Matthias Mailänder
59ace5d01b new shorthand Exts.(Try)ParseIntegerInvariant 2014-05-13 14:16:41 +02:00
Matthias Mailänder
b19d286f56 parse with NumberFormatInfo.InvariantInfo everywhere
closes #5240
2014-05-06 18:31:48 +02:00
Paul Chote
4935266945 Merge FileFormats dll into Game and reorganise namespaces. 2014-04-17 01:20:47 +12:00
ScottNZ
00ec1ca87a Remove unused usings 2013-11-12 19:39:33 +13:00
Matthias Mailänder
0a84ddc8fb fix d2k cursors
- center by default (also works better for ra/cnc/ts)
2013-08-17 23:31:24 +02:00
Paul Chote
7beef85a64 Use PaletteReferences everywhere. 2013-06-15 19:16:08 +12:00
Matthias Mailänder
acc8cd1e5e fixes #2885 forgot to enable the cursor palette before drawing
split HardwarePalette.Update into two functions, closes #2847
2013-04-06 08:44:32 +02:00
Matthias Mailänder
851512a84e eliminate public CursorProvider.Palettes
don't hand over the cursor palette to the world renderer at all
still update worldrender palette (set and apply modifiers)
2013-03-25 06:30:39 +01:00
Matthias Mailänder
ba12aafd78 refactor cursor rendering
create a new cursor palette only once and not in WorldRenderer
move cusrsor sequence lookup and drawing to CursorProvider
2013-03-24 21:21:30 +01:00
Paul Chote
82426e0e45 Move Palette from ModData to WorldRenderer. 2013-02-26 09:35:41 +13:00
Paul Chote
db7887687b Remove hardcoded list of palette mod exclusions. 2013-02-22 15:04:41 +13:00
Matthias Mailänder
c75c72b525 made palette shadowindex configurable 2012-07-01 19:37:57 +12:00
Matthias Mailänder
26b75f406f new settings Transparent for cursors.yaml 2012-06-19 07:43:06 +02:00
Matthias Mailänder
7cbed30dc6 fix cnc palette issues
cursor not supporting transparency; wrong icon, fx palette
2012-06-18 17:40:22 +02:00
Matthias Mailänder
801ff5cc17 make cursor always transparent, fix Arrakis tileset
transparency bugs some cnc cursors, slice BLOXBASE better
2012-06-15 11:06:59 +02:00
Chris Forbes
55036cd58c fix trailing whitespace everywhere 2011-09-26 08:40:39 +13:00
Chris Forbes
ca81871b7b fix broken merging of yaml overrides in maps; we now have a strict mode and a liberal mode. 2011-04-09 10:55:54 +12:00
Paul Chote
094907c1a9 Update copyright header. Normalize line endings to LF. 2011-02-13 10:38:57 +13:00
Paul Chote
5ce5d48b04 Extracting packages 2011-01-27 20:50:01 +13:00
Paul Chote
ea9003d6fc Port cursors to yaml. 2011-01-27 20:50:00 +13:00
Paul Chote
6a90f00298 Start tidying things up 2011-01-27 20:50:00 +13:00
Paul Chote
dbbdc171d2 Use the new-format sequences. 2010-09-09 20:31:53 +12:00