Commit Graph

48 Commits

Author SHA1 Message Date
RoosterDragon
1515ac54f6 Enforce a line length limit. 2015-03-19 17:20:34 +00:00
RoosterDragon
d4421f0a41 Fix some broken Stream.Read calls.
Change callers of this method to use the ReadBytes extension method that ensures the requested amount of bytes are consumed.

Also tighten argument validation.
2015-02-23 19:40:16 +00:00
Taryn Hill
5349c69307 Merge pull request #7467 from ScottNZ/stylecop-fixes
Brace style fixes.
2015-02-12 07:54:10 -06:00
ScottNZ
582b6635ff Brace style fixes 2015-02-13 02:32:49 +13:00
Paul Chote
aa550790e5 Merge pull request #4528 from Mailaender/mime
Registered Linux MIME type to directly load replays
2015-02-12 11:21:37 +00:00
Matthias Mailänder
24deec2a7b fix CodeLineMustNotEndWithWhitespace 2015-01-25 18:41:29 +01:00
Matthias Mailänder
1b5928879c save replays in a less generic file extension 2015-01-18 13:17:11 +01:00
abcdefg30
8ca61aa917 Updated all year numbers 2015-01-09 21:18:05 +01:00
RoosterDragon
a6cda967c2 Formatted all files.
Automatically formatted all files via VS. This generally corrects indentation, removes trailing whitespace and corrects misplaced tabs or spaces. Manually tweaked a few files where required.
2015-01-06 21:28:50 +00:00
Matthias Mailänder
44cd174a8d StyleCop clean OpenRA.Game 2015-01-03 19:00:48 +01:00
Oliver Brakmann
30e42cdc62 Merge pull request #7247 from Hellhake/stylecop-game
Fix StyleCop warnings in OpenRA.Game
2015-01-02 12:58:04 +01:00
Hellhake
5a97a4b63b Fix StyleCop warnings in OpenRA.Game 2015-01-02 12:11:01 +01:00
Hellhake
fa72e04042 Remove BOM 2015-01-01 22:51:12 +01:00
DeadlySurprise
c504383d92 Changed aspect ratio implementation 2014-11-18 22:35:34 +01:00
DeadlySurprise
cdb05537f3 Added tiberian sun vqa file support 2014-11-18 22:35:33 +01:00
DeadlySurprise
b7e3dfc665 Fixed vqa crashes 2014-11-18 18:42:38 +01:00
Paul Chote
446d98e625 Support ini files with spaces around the ‘=‘. 2014-10-08 08:06:50 +13:00
Paul Chote
beb7a394a2 Move ShpD2 sprite loading into Mods.Common. 2014-10-07 09:55:50 +13:00
Paul Chote
533d044755 Move TmpTS sprite loading into Mods.TS. 2014-10-07 09:55:50 +13:00
Paul Chote
37cedd88a2 Move TmpTD sprite loading into Mods.Common. 2014-10-07 09:55:49 +13:00
Paul Chote
997c79130a Move TmpRA sprite loading into Mods.Common. 2014-10-07 09:55:49 +13:00
Paul Chote
ca38193264 Move R8 sprite loading into Mods.D2k. 2014-10-07 09:55:49 +13:00
Paul Chote
c798b306c4 Move ShpTS sprite loading into Mods.Common. 2014-10-07 09:55:49 +13:00
Paul Chote
d658643b73 Move ShpTD sprite loading into Mods.Common. 2014-10-07 09:55:49 +13:00
Paul Chote
2b92ce7edd Use SpriteLoader for frame exporting. 2014-10-07 09:55:49 +13:00
Paul Chote
7207841f8b Use the existing SpriteLoader cache for tilesets. 2014-10-07 09:55:48 +13:00
reaperrr
7589e010c3 Back-port some style fixes from ImaAdpcmLoader to AudLoader. 2014-09-14 13:32:37 +02:00
reaperrr
fec5eb178c Rename Adpcm to ImaAdpcm everywhere.
To avoid confusion with Microsoft ADPCM and other ADPCMs.
2014-09-14 13:27:46 +02:00
Alexander Fast
070d00c678 Fixes year numbers in license text in file headers. 2014-08-21 11:27:52 +02:00
reaperrr
3e3f1394d9 Adds length display support for PCM & IMA music. 2014-08-20 08:22:40 +02:00
James Slater
a5978b5c55 Implement IMA ADPCM WAV file support
Closes #4628
2014-08-13 13:25:28 +02:00
Paul Chote
9e11e38005 Merge pull request #5781 from pavlos256/format80-write-rle
Implement Format80 RLE compression
2014-07-04 10:34:01 +12:00
Pavlos Touboulidis
f5de0101fe Implement Format80 RLE compression 2014-07-03 17:53:48 +03:00
Matthias Mailänder
f5b749e9ce fix a rounding problem in SHP(TS) offset floating point math
closes #5765
2014-07-01 13:40:00 +02:00
RoosterDragon
19072775d4 Changes ISpriteSource.Frames to be of type IReadOnlyList<ISpriteFrame>.
- Updated implementations to return a ReadOnlyList around an array (to reduce wasted memory from exposing lists or lazy enumerators around lists).
- Protect non-public ISpriteFrame classes by making them inner classes to prevent casting.
- Added an AsReadOnly extension method for lists.
2014-06-27 23:38:34 +01:00
ScottNZ
90894aa03e Use var everywhere 2014-06-15 22:17:34 +12:00
ScottNZ
dbffce81a6 Remove unused usings 2014-06-15 22:16:40 +12:00
RoosterDragon
e63f330717 Improved efficiency of startup methods.
- ShpReader will copy the input stream into memory just once rather than for every header.
- ShpReader.CopyImageData switched to use Array.Copy since that uses some unsafe magic for speed.
- In ActorInfo, cache a GetType call and prevent needless materialization in PrerequisitesOf.
- In ObjectCreator, cache type and ctor lookups since these are expensive and often repeated.
- Implement IReadOnlyDictionary<T, U> on Cache<T, U> to provide some supplementary functions.
- In TechTree.GatherOwnedPrerequisites, rearrange a Boolean 'and' expression to evaluate expensive functions later in the chain, and use ContainsKey to speed up name check.
2014-06-09 17:13:01 +01:00
RoosterDragon
531e3b7861 Fixes to StreamExts.
- Almost all calls to Stream.Read were broken. These have been patched to all go through ReadBytes which itself has been fixed to function correctly. The key thing to note is that Stream.Read is very much allowed to return less than the requested number of bytes. If this happens and you're not checking the return result, you'll be working with partially initialized arrays and really bad stuff happens when you do that.
- Call CopyTo rather than copying between streams manually.
- Peek and ReadUInt8 have been changed to avoid a pointless array allocation which is significant overhead for such simple calls.
2014-06-07 00:49:25 +01:00
RoosterDragon
b733465f33 General uncontroversial cleanup:
- Made private methods static where possible (runtime can elide checking the object for null).
- Declared attribute classes as sealed (allows reflection on attributes to complete faster).
- Moved some static cctor's into field initializers (static cctor's are slower than static field initializers).
- Made classes static if they contained only static methods (can't create instances of useless objects).
- Use inferable Exts.Lazy and not new Lazy<T>().
- Added required STAThread attribute to CrashDialog.
- Removed unused parameters in private methods.
- Added Serializable attribute to exceptions.
- Added parameter name in calls to ArgumentNullException.
- Use of as operator instead of is + cast.
- Changed (x as Foo).Bar anti-pattern into ((Foo)x).Bar. Results in sensible cast exceptions on error rather than null dereferences.
- Removed unused method in NullShader.
2014-05-23 15:50:54 +01:00
Pavlos Touboulidis
fe1eb1f3e0 Use the stream extensions instead of the BinaryReader/Writer 2014-05-22 21:54:15 +03:00
Pavlos Touboulidis
38a5e326f6 Fix crash when trying to read empty replay files
It was crashing because it tried to seek 8 bytes before the end
of a file that was empty (zero length).

I also added a few more checks and another try/catch to prevent
any more crashes related to damaged files.
2014-05-22 21:54:15 +03:00
Pavlos Touboulidis
de0a5ebd43 Improve replay metadata and the replay browser
List of changes:

* Better and more filters with new layout, for both mods.

* Rename/Delete/Detele all functionality.

* Simplified ReplayMetadata class considerably by introducing a new
GameInformation data object. The new GameInformation class contains
more information than previously available so the new solution is not
compatible with old replays, meaning it can't read old replays.

* Better and cleaner game information gathering in order to be written
at the end of the replay file.

* Revert changes to ReplayConnection, no longer necessary.

* Better exception message on missing sprites and fonts.

* New "SpawnOccupant" class that holds all the information needed by the
MapPreviewWidget to visualize a spawn point. It was using Session.Client
before and it was necessary to separate it to be able to show information
not available at lobby time.

* Fix keyboard focus UI bug when closing a window would not remove focus.
2014-05-22 21:54:14 +03:00
Pavlos Touboulidis
ce8c42b552 Style & nit fixes 2014-05-22 21:54:14 +03:00
Pavlos Touboulidis
a80c4f086a Add filters to the replay browser dialog
This closes issue #2152. The filters added are:

* Game type (singleplayer / multiplayer)
* Date
* Duration
* Outcome
* Player name

Other changes:

* Added a 'CollapseHiddenChildren' option to the ScrollPanelWidget to
make hidden children take up no space.
* Removed the extension (.rep) from the replay filenames in the
replay browser.
2014-05-22 21:54:14 +03:00
Pavlos Touboulidis
98a05b61b3 Add metadata block to replays
The replay files are just streams all network communication so to
get any info out of them it is necessary to play back the stream
until the wanted information is reached.

This introduces a new metadata block placed at the end of the
replay files and logic to read the new block, or fall back to
playing back the stream for older files.

The replay browser is also updated to use the metadata information
instead of reading the replay stream directly.
2014-05-22 21:54:14 +03:00
Pavlos Touboulidis
2ec6df9680 Fix strange d2k loading slowness
There is a strange issue that appears* when Theater calls
ISpriteFrame.Frames on the R8Reader. The R8Reader uses
IEnumerable.Cast<> which behaves slower and slower, which
makes map loading become 10+ times slower.

The changes here simply avoid the casting.

[*] This happens at least on Linux x86_64 with Mono 3.2.8.

See https://bugzilla.xamarin.com/show_bug.cgi?id=19668
2014-05-11 06:38:19 +03:00
Paul Chote
4935266945 Merge FileFormats dll into Game and reorganise namespaces. 2014-04-17 01:20:47 +12:00