1
0
forked from 0ad/0ad
Commit Graph

185 Commits

Author SHA1 Message Date
c813a11427 Split ScriptRuntime and ScriptInterface code to separate files.
The runtime is becoming more and more important in the JSAPI. As a
result, we also have more functionality on the runtime level and having
the whole ScriptRuntime class hidden in ScriptInterface.cpp doesn't make
sense anymore. ScriptInterface.cpp also has become quite a large file
and pulling out the runtime part makes it a bit smaller.

Refs #2462

This was SVN commit r15961.
2014-11-13 11:19:28 +00:00
8b9847e007 Replace CScriptValRooted with JS::Heap<T> and custom tracer for CNetClient
Refs #2462

This was SVN commit r15946.
2014-11-09 15:16:00 +00:00
3b49576fa6 Tunes GC scheduling a bit to reduce memory usage.
The main problem was that GC was only called from the simulation before
this patch. This means when you were waiting in the multiplayer lobby or
just had the GUI open, it only called GC when getting close to the JS
runtime size limit (I assume). Another problem was the Net Server
runtime which didn't GC either. Here the runtime size limit is 16 MB
though, so it's not too terrible. These issues have both been addressed
and GC has been given a bit more time per incremental slice to make sure
it gets done in time. It's still far from perfect, but there are too
many changes in SpiderMonkey related to GC, so I don't want to spend too
much time on this yet.

Refs #2808

This was SVN commit r15787.
2014-09-22 20:13:04 +00:00
2b7e9728b6 Fix failure in TestNetComms::test_basic_DISABLED. Patch by Echelon9. Fixes #2426.
This was SVN commit r15672.
2014-08-24 12:02:52 +00:00
e578d215ea Fix free() of not allocated struct in the UPnP code. Patch by Echelon9. Fixes #2338, #2418.
This was SVN commit r15619.
2014-08-06 14:11:04 +00:00
169174824f Exact stack rooting for ScriptInterface::ToString.
I had to change a few other functions to take JS::MutableHandleValue
because JS::Stringify takes a JS::MutableHandleValue as input parameter.
That seems a bit strange because it should not change that value.
I assume it has historical reasons.

Refs #2415
Refs #2462

This was SVN commit r15605.
2014-08-03 17:29:49 +00:00
a2bd44b23a Exact stack rooting for JSON related ScriptInterface functions.
Refs #2415
Refs #2462

This was SVN commit r15603.
2014-08-02 22:21:50 +00:00
5c07a25ddc More exact stack rooting (CallFunction object).
Changes CallFunction and CallFunctionVoid to use a HandleValue as object
parameter. Also changes some JS serialization/deserialization functions
to only support the JSAPI rooted types (drop support for CScriptVal and
CScriptValRooted there). Some other functions got changed too because
they were closely related.

Refs #2415
Refs #2462

This was SVN commit r15592.
2014-07-31 19:18:40 +00:00
28bdd8540f Quite a lot of stack rooting related changes.
Changes GetProperty, SetProperty and HasProperty and a few other
functions to take handles. The conversions to CScriptVal or
CScriptValRooted at some places should be removed in the future. I've
done that to avoid an even larger patch.

Refs #2415
Refs #2462

This was SVN commit r15568.
2014-07-26 22:33:16 +00:00
1659a28aa0 Correctly remove players who cancel while rejoining. Fixes #2240
This was SVN commit r15402.
2014-06-20 03:22:40 +00:00
2081c62ab4 Support newer version of miniupnpc api. Refs #2552.
This was SVN commit r15174.
2014-05-19 21:01:06 +00:00
dfc7567561 Fix multiple observers on multiplayer games to work more reliably. Fixes #2529
This was SVN commit r15171.
2014-05-19 16:02:42 +00:00
d1d7afe46c Implements ready status into gamesetup. Fixes #2447.
This was SVN commit r15006.
2014-04-26 18:34:34 +00:00
7acdde5c86 Changes tests to use global g_ScriptRuntime instead of creating a new JSRuntime for each test.
The tests crashed on my Debian systems but not on my Ubuntu system.
The crash happened in line 142 of SpiderMonkey's ThreadLocal.h.

I know that I had to use a workarounnd for contexts to avoid destroying
the context that was created first. I also had in mind that in newer
versions a JS_Init function got introduced which presumably solves this
kind of issues.
Based on this experience I assumed runtimes could have a similar problem
and this patch indeed fixes the issues.
Unfortunately the correct usage of JSRuntimes in that regard is not
documented.
There's only a rater misterious comment in JSAPI.h which hasn't been
cleared up so far and is most likely completely outdated
(https://bugzilla.mozilla.org/show_bug.cgi?id=992641).

This was SVN commit r14995.
2014-04-25 21:19:51 +00:00
a7b2f6ba47 Fix more then one observer by allowing a game to have multiple players with the -1 ID.
This was SVN commit r14885.
2014-03-29 15:09:42 +00:00
e9e05f4efc Second (main) commit for the SpiderMonkey upgrade.
This commit contains all the required changes to our source files and
build scripts (hopefully).
A next commit will remove the old stuff of SpiderMonkey 1.8.5.

Spcial thanks to:
 - H4writer who helped a lot mainly with the performance issues we
had/have, but also with other problems or questions.
 - Leper for the review.
 - Historic_bruno for implementing the build scripts on Mac OS X and
testing on the Mac.
 - The people from the #jsapi channel and from
mozilla.dev.tech.js-engine who answered a lot of questions and helped
solving problems.
 - All the other people who helped

Refs #1886
Fixes #2442
Fixes #2416

This was SVN commit r14877.
2014-03-28 20:26:32 +00:00
883f307b40 Implement a basic observer mode. Any player which joins a multiplayer game but is not assigned a player slot automatically becomes an observer. Refs #69
This was SVN commit r14849.
2014-03-16 23:29:27 +00:00
ef888367aa Cleanup tex_codec, fixes #2456, patch by IronNerd.
This was SVN commit r14836.
2014-03-13 04:16:20 +00:00
43377fdc5e Fixes an assertion when DEBUG_SERIALIZER_ANNOTATE is set to 1 and you click on "Host Game" from the main menu.
The reason was that CSimulationMessage uses the CBufferBinarySerializer
which did not add debugging annotations and deserialized the created
data with the CStdDeserializer which expects these annotations.
I did not fix the tests which remain broken as before this patch when
annotation is enabled.

This was SVN commit r14775.
2014-02-22 14:30:29 +00:00
fa85527baf Send messages in queue before closing connection, patch by boeseRaupe. Fixes #2420
This was SVN commit r14732.
2014-02-05 02:44:25 +00:00
9ccaa42a54 Fixes MSVC warning C4706: assignment within conditional expression
This was SVN commit r14519.
2014-01-06 02:16:09 +00:00
4b1297b328 Removes g_ScriptingHost and implements global to compartment 1 to 1 relation.
Each GUI Page gets its own compartment and all ScriptInterfaces in the
same thread should now use the same JS Runtime.
This is required for the SpiderMonkey upgrade.
Check the ticket for details.

Closes #2241
Refs #1886
Refs #1966

This was SVN commit r14496.
2014-01-04 10:14:53 +00:00
5e23445339 Make ConfigDB properly thread-safe.
Replace CreateValue with SetValueString so we don't pass pointers to
internal
 ConfigDB structures around. Refs #1810.
Remove some splash screen related functions since we can achieve the
same
 with the ConfigDB functions exposed to scripts.

This was SVN commit r14437.
2013-12-29 23:56:18 +00:00
42bc5165ab Add compile time flag to disable use of miniupnpc.
This was SVN commit r14384.
2013-12-18 16:08:56 +00:00
e83f24e3a6 Move UPnP port forwarding to a thread.
Fix some typos.
Do not return the result, as we would need to allocate it, but we never
use it.

This was SVN commit r14372.
2013-12-17 17:03:49 +00:00
4df4c0dec0 Try to actually do the threading my previous commit said it did.
This was SVN commit r14371.
2013-12-17 14:57:26 +00:00
0ba25e9968 Cache UPnP root URL to try to avoid searching each time. Also make searching asyncronous with the GUI to avoid hanging.
This was SVN commit r14370.
2013-12-17 14:21:49 +00:00
62a10ab938 Fixes Windows build.
Fixes UPnP error handling to be more correct and conventional, refs
#2305

This was SVN commit r14352.
2013-12-15 01:02:26 +00:00
5876ec38d1 Make sure we properly free some UPnP-related variables.
This was SVN commit r14348.
2013-12-14 03:21:21 +00:00
551eb3919d Change UPnP lease duration to 0 (permanent) and update comments.
This was SVN commit r14347.
2013-12-14 03:03:22 +00:00
667537ee49 UPnP-based automatic port-forwarding using miniupnpc. Breaks windows build at the moment. Refs #2305
This was SVN commit r14332.
2013-12-13 02:23:02 +00:00
bffe917914 Multiplayer lobby based on the XmPP protocol. Special thanks to Philip, alpha123, scythetwirler, and anyone else who has helped build, debug or test the lobby.
This was SVN commit r14098.
2013-11-07 20:07:24 +00:00
a00e57df72 Fixes hypothetical mem leak in network code (and an error in Cppcheck), patch by Riemer, fixes #2122
This was SVN commit r13980.
2013-10-10 23:46:42 +00:00
0af34b1fcb Removes some unread variables reported by LLVM. Refs #1114
This was SVN commit r12501.
2012-08-20 23:59:50 +00:00
vts
6b50a660b9 Added elapsed real time (as opposed to elapsed simulation time) to MT_Interpolate messages. Fixes leftover TODO from #824. Refs #824.
This was SVN commit r11944.
2012-06-06 19:37:03 +00:00
c036a7d7e3 Adds control groups to saved game data, based on patch by mk12. Fixes #1261.
This was SVN commit r11783.
2012-05-07 04:18:54 +00:00
893cb2668e Renames our sdl.h to libsdl.h, to avoid case sensitivity errors when it includes SDL.h.
This was SVN commit r10904.
2012-01-12 23:32:27 +00:00
4f559e8aff Report quicksave/quickload times, to help identify performance problems.
This was SVN commit r10901.
2012-01-12 12:47:24 +00:00
0ec4242962 Detect and fix printf signedness errors. Fixes #1086, #1087.
This was SVN commit r10846.
2012-01-01 16:43:10 +00:00
c4bb67a1ca Fix #1064 (use ++it instead of it++ for consistency), based on patch by Echelon9
This was SVN commit r10822.
2011-12-29 01:17:03 +00:00
4f6f0b7baf Fix tests, and warnings, and non-PCH build
This was SVN commit r10801.
2011-12-23 13:01:29 +00:00
fbff0aa98d Fix printf argument types
This was SVN commit r10529.
2011-11-13 18:31:06 +00:00
09a02c96d5 Add initial code annotations for the new profiling tool
This was SVN commit r10466.
2011-11-04 01:35:50 +00:00
4ef66a6950 Provide JSON-compatible string escaping
This was SVN commit r10464.
2011-11-04 01:18:34 +00:00
7064565ff6 # Allow saving and loading single-player games.
Support writing zip files based on in-memory data.
Fix menu sliding animations to be framerate independent.

This was SVN commit r10454.
2011-10-30 00:07:28 +00:00
b454ccca79 Fix GUI issues when reconnecting to multiplayer games
This was SVN commit r10452.
2011-10-29 14:53:13 +00:00
bfe2126a17 # Support rejoining multiplayer games after disconnection.
This was SVN commit r10437.
2011-10-27 16:46:48 +00:00
dfc92de51b Avoid outputting non-printable-ASCII characters in the network log
This was SVN commit r10433.
2011-10-27 14:16:28 +00:00
a2bba82b9d Let CFsm actions override the default state transition
This was SVN commit r10432.
2011-10-27 14:10:55 +00:00
a3c03815c0 Experimental quicksave/quickload feature
This was SVN commit r10427.
2011-10-24 14:55:45 +00:00