Commit graph

210 commits

Author SHA1 Message Date
Eric House
22f697cd37 remove option to use backwards-compatible smsproto
Everybody should have upgraded by now...
2019-07-07 13:00:06 -07:00
Eric House
4aa7d67d24 honor comms_getAddrDisabled for relay invite sends
It still isn't for other conn-via types, nor for relay invite receipts
that don't go through comms.
2019-06-26 14:08:55 -07:00
Eric House
7809591de5 fix crash with env not being set for dict iter thread 2019-06-24 11:59:48 -07:00
Eric House
52d2694bc7 add support for 64-bit ARM
Add a third processor type to the .so, and fix first compile-time
warnings and then a few dumb bugs based on assumptions about ptr sizes.
Works to play networked games and browse wordlists, but is not
extensively tested and needs to be before release.
2019-05-29 19:19:00 -07:00
Eric House
d6710622ad replace oft-firing assertion with logging
It's crashing all the time and involves a system that only exists in
debug builds. So I should understand the root cause, but other stuff
needs to get done first.
2019-04-05 13:30:23 -07:00
Eric House
52f839e899 fix null procptr crash in jni
I can't reproduce this, but while testing recovery from DatagramSocket
recreation in RelayService got enough to know that somehow a timer's
procptr's not set. So test before calling, and log instead of crashing.
2019-03-20 13:33:30 -07:00
Eric House
aa2564114a replace assert with logging 2019-03-17 18:26:43 -07:00
Eric House
ab491ebcb4 change name of variant -- it's not the main one anymore 2019-03-10 19:25:57 -07:00
Eric House
5cc57919f5 add new Variant for github & sourceforge releases
and log permission check results
2019-03-09 14:07:06 -08:00
Eric House
0972d3d99f cleanup 2019-03-08 09:20:22 -08:00
Eric House
91b7cf8bd9 remove misplaced assert
It's an error to use an env with the wrong thread, but it IS possible
for more than one thread to be associated with the same env. So don't
assert to the contrary.
2019-03-03 21:01:23 -08:00
Eric House
eeddd8d7cb fixing refcounting and adding logging
Seeing the occasional crash and trying to plug leaks that might be
contributing. I think I fixed the Gameptr.finalize() assertions I've
been seeing forever but the thread match assertion remains. Logs will
help catch that.
2019-03-03 14:40:07 -08:00
Eric House
6eb6038935 make result -1 if will otherwise trip asserts. 2019-02-26 18:46:55 -08:00
Eric House
273e66fd07 add env to map immediately, in initGame()
I'm seeing an assertion failure in cleanup that could be explained by
the cleanup happening when initGame() has been called but no subsequent
jni method that would have added the env to the map. So let's add it
immediately so that can't happen.
2019-02-13 07:13:54 -08:00
Eric House
e6b59ea11d add debug-only option for invitee players to be robots
It's useful when testing to have the remote device play without human
interaction. So add an option, and UI to trigger it, for the players
created remotely in response to an invitation to be robots. There are
guards in place to catch the feature slipping into a release build.
2019-02-07 08:17:54 -08:00
Eric House
bf2ab49c20 remove some logging 2019-02-05 09:37:39 -08:00
Eric House
ce03ab7532 cleanup via new macro 2019-02-04 14:38:40 -08:00
Eric House
15a2897112 Revert "toward compiling with gcc8"
This reverts commit d293517e7c.
2019-01-29 09:05:54 -08:00
Eric House
d293517e7c toward compiling with gcc8
My VSIZE is no longer legal, and apparently there's no workaround (no
way to safely figure the length of an array whose size is known at
compile time.) To avoid the risk of duplicating little constants, added
macros that define length in a way a new VSIZE can pick it up. Couldn't
make that work for struct field arrays, however, so there I'm using
constants.
2019-01-28 17:24:53 -08:00
Eric House
a4152239f6 remove sms permissions from play store variant
and from a new debug variant so that can be tested. Add explanation to
be shown users who try to use the now-unavailable features.
2019-01-24 18:45:24 -08:00
Eric House
d868fef0d2 revert space-only change 2019-01-06 12:04:51 -08:00
Eric House
aecce2826e revert change making userError() take an enum
The set's open-ended on the C side, meaning that an int can't be
converted to an enum reliably. Yay for asserts that caught this.
2019-01-06 11:12:59 -08:00
Eric House
105e8e2623 add logging
Keep some stuff added to debug problem with dict checksums on server.
2019-01-05 18:54:48 -08:00
Eric House
4a90792dec If game's in Spanish, don't require 7 tiles for trade.
Put up an error message if too many tiles selected for trade
(a condition that couldn't exist when the pool was guaranteed to
have at least 7 in it.) (It's a hack: there's not even an enum
giving Spanish's code, and the lang_locale stuff in info.txt isn't
making it into the .xwd format.)
2018-12-29 18:47:48 -08:00
Eric House
f7258f29e8 saw a crash, so gather more info if it happens again. 2018-12-11 14:40:57 -08:00
Eric House
9eec5c37ef fix path name string causing JNI crash on emulator 2018-11-29 09:30:14 -08:00
Eric House
e637f49b95 include port and proto
Pretty sure couldn't have played against an older build without this.
2018-07-26 21:13:09 -07:00
Eric House
9ddc6e4b89 Move transision of cmd and gameid and port (pending) into smsproto
common code, simplifying and unifying what the platform-specific code
has to do. Seems to work.
2018-07-26 07:50:16 -07:00
Eric House
5d6c743087 fix (I hope) null jni array dereference 2018-07-13 18:20:05 -07:00
Eric House
bd1cc4276b cleanup and variable rename (no code changes) 2018-07-11 07:33:36 -07:00
Eric House
9c2a722cc5 change two method names 2018-07-10 07:07:30 -07:00
Eric House
8c14ccc0d2 add new dutil to store by ptr; use for smsproto msgID 2018-07-10 06:36:34 -07:00
Eric House
a9769efe1c implement load/store on android 2018-07-09 07:11:54 -07:00
Eric House
1941642607 add load and store to dutils, and implement with stubs 2018-07-06 06:56:54 -07:00
Eric House
3437ae2ebc use smsproto in Android 2018-07-06 06:48:56 -07:00
Eric House
ed90c9c16d implement util->dutil split for Android
So now all jni code uses a single dutil context, but also a single
mempool and jniutil instance instead of new instances of the latter two
per game and dict-iteration.
2018-07-05 08:32:19 -07:00
Eric House
9cdd5a7b72 share mpool and vtable in jni calls
A number of jni calls were "stateless", which meant they allocated their
own vtmgr and mpool instances each time invoked. Instead invoke them
with the global jni closure and add to it vtmgr (already has mpool) and
use these instead of allocating/freeing each time. To make sure no race
conditions are introduced (mpool, though debug-only, is probably not
thread-safe), guard these new uses with an in-use flag. If that fires
I'll need a mutex or something.
2018-06-27 21:17:44 -07:00
Eric House
875d956836 don't need the local threadinfo at all
I think the crash was just due to removing env from the global state
rather than just leaving it be.
2018-01-23 21:26:11 -08:00
Eric House
d809ff4f7c give dict iter its own threadmap
I like this better than the previous fix: rather than share a
thread->env map with the game world allocate a new one for each
iterator. This could cause problem if the iterator is used on threads
that don't currently call map_thread(), or if there are callbacks that
need to look up the env that I'm not aware of. Needs testing...
2018-01-22 22:02:57 -08:00
Eric House
cbb683fc74 fix env-mapping crash in jni due to race condition
As reported to google, dict iterator destruction was crashing due to a
race condition if it happened after a game using the same dict had been
closed since it needed a mapped env that the game closure would
remove. Fixed in two ways, one by adding the mapping prior to the code
that uses it (a common pattern: add happens many times, whenver it might
be needed, but remove only once), and second by passing env into the
code that was crashing.

The mapping stuff remains inherently racy and I'm not sure now how to
fix that. It depends on there being a place to unmap after which it's
guaranteed the mapped value won't be needed again. When two
objects (game and dict_iter in this case) map the same env/thread combo
there's a race.
2018-01-22 07:45:43 -08:00
Eric House
17f27a1b65 remove relayStatus() from jni
Making it a no-op as the only thing it did, tweaking the net status
indicator, isn't useful.
2017-12-27 14:42:15 -08:00
Eric House
ed57a744b6 use the new built-in game_receiveMessage
I'd forgotten it...
2017-12-19 07:28:19 -08:00
Eric House
af81342021 create new fdroid variant 2017-11-27 20:40:06 -08:00
Eric House
64014944f3 finish: using java's base64 en/decoder from java
Added a wrapper function since for compatibility with the jni's encoding
the flags matter and need to be the same everywhere. Or at least there
should be no chance of their getting changed.
2017-07-13 07:40:28 -07:00
Eric House
0b0a50bd5c add timestamp to chat messages, db and display
On send, add current seconds to message. Store and display in android
code. Display layout needs work.
2017-06-10 11:36:45 -07:00
Eric House
9644f40659 add ui for disabling comms send and receive
Add DEBUG-builds-only UI at the bottom of GameConfig for turning on the
comms feature dropping outgoing or incoming messages. The idea's to use
this to reproduce and fix stalls. There's a noticable slowdown opening
the GameConfig fragment, but it should all be no-op in a release build.
2017-05-26 07:49:38 -07:00
Eric House
b6665a15c4 double-check to avoid crash (by observation)
Chasing a rare play-store-reported JNI crash: test for a null ptr in C
and assert/test in Java.
2017-05-25 07:10:49 -07:00
Eric House
ef2da21bbe xw4dbg -> xw4d: tired of typing the extra letters
Rename the debug variant and make it work. appID stays the same and so
no longer matches. Gradle allows that.
2017-05-23 06:37:31 -07:00
Eric House
55339b6aaf fix release compile warnings 2017-04-06 07:43:20 -07:00
Eric House
a804983b8e fix makeIntArray to work for non-32-bit array sources 2017-03-13 19:32:20 -07:00
Eric House
6e5973c55b toward making tile picking work through rotations
Make face-up tile picker util method return void and add mechanism for
passing in selected tiles asynchronously, as has been done recently with
the rest of the once-blocking util callbacks. Works perfectly in the gtk
case. Likely crashes in curses (if picking face-up option is on.) In
java all the callbacks are there but rather than put up a UI we pretend
the user says "pick 'em for me" each time. Putting up a UI is next.
2017-03-09 20:36:14 -08:00
Eric House
70b3aaa263 modify function to be more useful 2017-03-09 19:35:07 -08:00
Eric House
c271202faa make bad phonies alert non-blocking
Continue conversion of alerts that required blocking the JNI thread. Now
board_commitTurn() takes a second boolean indicating whether phonies
found have been approved by user. Common code informs user, and if he
approves client code calls board_commitTurn() again. In case where
turn's lost there's no call to make back, but there's the undesirable
change that if a robot moves next its move will be reported on top of
the turn-lost alert. Ideally new alerts would appear under, not on top
of, those that have not yet been dismissed.
2017-02-20 07:20:19 -08:00
Eric House
5f12d1a03b assign faces to blanks asynchronously
Next step in converting util_ methods that required blocking: blank tile
assignment. Now post a query and add a method that the client code can
call when the user's decided. Include enough state (col, row, and
playerNum) so that it's probably pretty safe.
2017-02-18 19:16:32 -08:00
Eric House
ca6edcfc9a make trade and move confirm non-blocking
Probably breaks curses build, but for gtk and Android
turn move and trade confirmation into a two-step process, making
board_commitTurn() non-interactive when called with a second
parameter. The old blocking util methods now return void and it's up to
the client code to interact (on the main thread) then re-call
board_commitTurn() if appropriate.
2017-02-17 08:58:20 -08:00
Eric House
2a0b21e5e8 make password fetching non-blocking
First attempt to stop blocking the jni thread: instead of returning a
password from a util_ method, have it include enough state that the UI
can return, put up a dialog, and then pass that state and the password
back and have them matched up again. I think this will work for the
remaining blocking Alerts too.
2017-02-17 06:23:44 -08:00
Eric House
b96d44393a add and use boolToStr
Just to make log messages a bit more helpful. Should be no behavior
change, and no change in code generated in release builds.
2017-01-22 14:15:29 -08:00
Eric House
3ac0039b4d fix jni build. Full .apk now produced.
But it gets confused about downloading wordlists.
2017-01-18 08:33:49 -08:00
Eric House
fcdb66eb87 forgot a file 2017-01-18 07:28:19 -08:00
Eric House
49242f78cf more script fixes; move jni code 2017-01-18 07:27:23 -08:00