Commit graph

4224 commits

Author SHA1 Message Date
Franklin Wei
ec1a74a37c puzzles: faster, smaller sqrt()
Change-Id: I18e170ee49bff131fe76fa4bb1b9e0f120818b82
2017-08-23 14:22:09 -04:00
Sebastian Leonhardt
f2f1889b10 Sokoban: enable restarting level via "Select Level"
This patch disables the (deliberate) feature of "Select Level",
that selecting the current level wouldn't restart but rather
resume. (i.e. now selecting any level will always start this
from scratch).

There definitely should be a way to restart the current level
via menu. Currently the only possibility to do this is via
button presses, but (a) these are hard to remember combos, and
(b) they are not defined on all targets.
This patch is meant as a lightwight alternative to g#1356
(adding a "restart level" option to the menu).

Change-Id: I18ee5aff5c922f95c28d1edf2ba71dd2e50687d2
2017-08-23 01:15:50 +02:00
Sebastian Leonhardt
28ae700444 FS#11922: Lua game - Pixel Painter
* Changed keymaps to PLA and added to SOURCES and CATEGORIES file
* improved keymaps: implement wrap-around and key repeat
* change keymap according to screen orientation
* fix font size calculation
* use blocking button query in main loop
* replace tabs with spaces
* added manual entry
* added original author to CREDITS

Change-Id: Id67ae99cbb7a737c7f4608e278b77a389ac2ffa6
2017-08-23 00:25:11 +02:00
Franklin Wei
7944969ff7 puzzles: fix build
Change-Id: Ifb6d7938968a48a1492483b33c84050abcfb75e0
2017-08-16 15:01:38 -04:00
Franklin Wei
71850e8e69 puzzles: various useless tweaks
Change-Id: Ibf9769f99d61581b184d0ffa4ef0614eb976f0e8
2017-08-16 11:40:42 -04:00
Franklin Wei
d0c4ef4b78 puzzles: enable long-press in Map
This allows for stippling regions.

Change-Id: If8f271b66f6f350c843d6669918ea39712acd818
2017-08-16 11:40:42 -04:00
Franklin Wei
ef9c2f4457 puzzles: fix polygon drawing in Inertia
Yet another hack to accommodate our polygon algorithm...

Change-Id: Ic5d304be23d30c380b19771ab68cf01c416261b4
2017-08-16 11:40:42 -04:00
Franklin Wei
f31a400bac puzzles: add more parameter validation checks
Fixes some annoying crashes.

Change-Id: If3c293bd90e301c3e697d1e5fcb1b0aa2ea320fb
2017-08-16 11:40:42 -04:00
Franklin Wei
c78ff7f615 puzzles: fix floating-point formatting
This is pretty ad-hoc, but the only other ways are to rewrite
sprintf (which would use too much memory on the c200v2), or
implement support for floats in rockbox's formatter, neither of
which are acceptable.

Change-Id: I70d59fd3e90a16e2db9ae0a84cd8c14807f50b46
2017-08-16 11:40:42 -04:00
Franklin Wei
bf25f3e6e7 puzzles: compress extensive help text
This is only really needed to save a few bytes on the c200v2, but
since it adds negligible overhead, so it's implemented for all
targets.

A stripped down version of the LZ4 reference implementation is found
in lz4tiny.c.

Change-Id: Ib914ba71c84e04da282328662c752e533912e197
2017-08-16 11:40:37 -04:00
Franklin Wei
ca228d3d87 puzzles: cut size for c200v2
- font caching is disabled
- font table is dynamically allocated
- side effect: tlsf isn't reset between runs anymore, memory leaks will have a bigger impact

Change-Id: I0b25c22665d956895e8007883d522256010d04ab
2017-08-09 21:51:23 -04:00
Franklin Wei
51984098ef puzzles: enable Mines
It should work now that arm memset() has been fixed for negative
values. This is the last puzzle that was disabled due to a crash.
2017-07-27 19:09:50 -04:00
Franklin Wei
076cf0aa9b puzzles: new input scheme for Mines and Magnets
Both these puzzles now have long press mapped to spacebar.
2017-07-27 19:09:50 -04:00
Franklin Wei
f1b82b1acf puzzles: polish up the config menus 2017-07-27 19:09:50 -04:00
Franklin Wei
1a5149a0ae puzzles: tweak text positioning 2017-07-27 19:09:50 -04:00
Franklin Wei
aa7b168fd7 puzzles: font caching
This lets puzzles remember which fonts were loaded previously so
they can be preloaded when the puzzle is started (and the disk is
spinning), instead of while the game is being played.
2017-07-27 19:09:50 -04:00
Franklin Wei
eb43bce106 puzzles: add number chooser for integer settings
Sure beats typing on the virtual keyboard.
2017-07-27 19:09:50 -04:00
Franklin Wei
513fb8b332 puzzles: update debug menu
Add an option to visualize polygon rendering to aid in diagnosing
artifacts.
2017-07-27 19:09:50 -04:00
Franklin Wei
403d011bd8 puzzles: fix flag drawing in Mines
Yet another workaround to accomodate our polygon
drawing "algorithm" (if you can call it that).
2017-07-27 19:09:50 -04:00
Franklin Wei
3a70222a73 puzzles: fix star drawing in Signpost
- change point ordering to make concave polygon rendering work
- also enables an "Easter egg" of sorts

Change-Id: I3b4044a374dce1cff889d5f3744de9e634978591
2017-07-17 17:03:03 -04:00
Franklin Wei
e7a35ba383 puzzles: dynamic text size via custom font pack
Up to now, we'd just ignore whatever font size the puzzle asked for,
and instead just go with either the UI font or system font regardless
of their size, which led to some horrible-looking puzzles. This patch
adds the ability to automatically load fonts of the proper size when
they are available, which makes text-based puzzles such as Pattern and
Slant function correctly with any UI font.

The font pack, which should be extracted to the system-wide fonts
directory consists of 3 small bitmap fonts from 7px to 10px and then
anti-aliased Deja Vu fonts from 10px to 36px. It is available in the
source tree (apps/plugins/puzzles/fonts.zip), or from
<http://download.rockbox.org/useful/sgt-fonts.zip>.

Change-Id: I05c8fe7bd6d867e14de9b941deb91e8c642ee4a8
2017-07-17 16:58:13 -04:00
Franklin Wei
84e13d5749 puzzles: allow using hints in Fifteen
This maps the select button to the "h" key for Fifteen only.

Change-Id: I7a5a61cec46e86254218fabfb191974f98c12319
2017-07-12 12:23:21 -04:00
Franklin Wei
552a271c6f puzzles: remove redundant help content
It used to be that each puzzle had a complete copy of the entire
puzzles manual and the "quick help" text for every single puzzle. This
was obviously a waste, so now each puzzle only has the sections of the
manual that apply to it, saving about 100KB or so per puzzle. This
also has the added benefit of shrinking binary size enough to allow
full help support on the c200v2, which has been enabled.

Change-Id: I76c799635de058e4a48e0c18b79537857af7cf85
2017-06-03 13:45:07 -04:00
Franklin Wei
cefbde0bbb puzzles: correct drawmode for text
DRMODE_FG should be used instead of DRMODE_COMPLEMENT to allow text to
be drawn in color, benefitting puzzles such as Slant and Pattern.

Change-Id: I292216490a58344cb93dc5c2ec1780229735313a
2017-06-02 18:19:10 -04:00
Franklin Wei
6d541fe9b6 puzzles: work around inconsistent naming
Change-Id: I0541485af087d0bea845e05fbcf61b01be91bf6f
2017-05-22 19:46:01 -04:00
Franklin Wei
6bba062599 puzzles: clarify target-specific macros
Change-Id: I1f68f25a557bb2daa5e83a6d6f02711abeec5165
2017-05-21 14:37:17 -04:00
Franklin Wei
504346ab48 puzzles: fix Bridges crash on Clip Zip
- small screen could lead to invalid viewport coordinates

Change-Id: I1f2a323554e4ed31f250218220b464a02bffa308
2017-05-18 18:03:53 -04:00
Franklin Wei
7b6f34a456 puzzles: fix building
- disables help on c200v2
- renames conflicting function

Change-Id: I0c4ff1bb40e7e3cafd0170090f22b80bf0656741
2017-05-17 17:42:30 -04:00
Franklin Wei
001860ce78 puzzles: full help system
- embeds the upstream halibut documentation for plugin use

- currently every plugin has a copy of the help text, but in the
  future a centralized system using overlays might be better

Change-Id: Idb6eb9accc2fa786a4c6bc2b704e7cf5fd3f78dd
2017-05-16 16:45:39 -04:00
Boris Gjenero
1b4ee1f33a Fix Samsung YH92X/YH820 keypad conditional in text_editor
All the *_PAD values are always #defined. So the change made in
5e91ec1 was applied to all devices instead of only those it was
meant to be applied to.

Change-Id: Iba72316ecf2e3c83132b47484731cd177686b19e
2017-05-06 21:34:21 -04:00
Franklin Wei
271c30f206 puzzles: remember the previous preset when selecting
Change-Id: I22c84257a3aa9b19bf5e94f9de51204bbade08c5
2017-05-04 20:37:04 -04:00
Franklin Wei
f15c117a8f puzzles: fix optimization flags
Change-Id: Ib0524fd4594e9524612eca0da54b3d13dc79b22c
2017-05-04 20:10:58 -04:00
Franklin Wei
4bc3bfe612 puzzles: simplify makefile
Change-Id: I14b4bda7e706e73d2d4475c9d536fbef9e2b9577
2017-05-02 18:33:25 -04:00
Franklin Wei
cce3adb179 add fake stdio.h
Change-Id: Iec6159b095b29b5ffb3ef5a46d068012fbe10f00
2017-04-30 19:13:13 -04:00
Franklin Wei
ecd7c72254 add rule for rbcompat.h
Change-Id: Icb7320f9233f2c121a8487d5b5c4cbcb483e9345
2017-04-30 18:33:55 -04:00
Franklin Wei
078d52c290 fix puzzles: round 4
Change-Id: Ibba738b8179c166f680dee0ce7536890fca1c0e4
2017-04-30 18:33:55 -04:00
Franklin Wei
36aedfd165 fix puzzles... round 3
Change-Id: I014ace22f0b83d8e407bd46df361532207f984bc
2017-04-30 16:32:57 -04:00
Franklin Wei
28fef2e415 Fix puzzles... again
Change-Id: I34dd8673ebcbc7fcd55681175d0e18c8bbc5fe6c
2017-04-30 13:57:13 -04:00
Franklin Wei
881746789a puzzles: refactor and resync with upstream
This brings puzzles up-to-date with upstream revision
2d333750272c3967cfd5cd3677572cddeaad5932, though certain changes made
by me, including cursor-only Untangle and some compilation fixes
remain. Upstream code has been moved to its separate subdirectory and
future syncs can be done by simply copying over the new sources.

Change-Id: Ia6506ca5f78c3627165ea6791d38db414ace0804
2017-04-29 18:24:42 -04:00
Franklin Wei
35d69c80a6 Rewrite void* arithmetic
cppcheck reported:
[chessbox/chessbox_pgn.c:51]: (portability) 'bufptr' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined.

Change-Id: Ib2139489fa316fb61b4bcdc08f17b97eb6ad0be7
2017-03-15 18:27:25 -04:00
Franklin Wei
8628c60469 Remove redundant code
cppcheck reported: [speedread.c:151]: (style) Condition 'h<0' is always true

Change-Id: I78fe0bbd205b0ca5b03a71ace81ef4f9b616e268
2017-03-15 18:14:13 -04:00
Franklin Wei
9ecabc0a75 fix build for mono targets
Change-Id: I704231b10987ae2adddedebb975538f222843bce
2017-03-15 15:19:00 -04:00
Franklin Wei
6fb865a066 fix name
Change-Id: I6113d48f763195cdea36b8a9efd9e5dd18098c99
2017-03-15 15:05:35 -04:00
Franklin Wei
1bab5562c2 Speed-reading plugin
Partially based on `spread0r', an open-source ebook reader: https://github.com/xypiie/spread0r

Similar to Spritz(TM): http://spritzinc.com

Change-Id: I6aa54addd1910a83a266aea561406b6268449b67
2017-03-15 15:02:53 -04:00
Franklin Wei
0a9f71790b xworld: fix several horrendous bugs
- unregisters timer on exit, preventing possible crash
- disables synchronization mechanisms when used from an IRQ
- prevents memory allocations from overflowing the audio buffer (unlikely)

Change-Id: I3c2c4ebe93c10ca9176ed0455e7aacc2d10c059e
2017-02-12 20:36:31 -05:00
Franklin Wei
e4a04fa105 xworld: get rid of annoying warning
Change-Id: I9faf00a97d0718efb0e4667018e9ff81ba80ee83
2017-02-12 20:36:31 -05:00
Franklin Wei
f483a07950 puzzles: fix makefile producing temporary files in the build directory (sorry!)
- thanks to Michael Sevakis for catching this

Change-Id: Ia02ba7a06a55bc0741df9ce2c21f868d7e0abdd4
2017-02-10 17:12:34 -05:00
Franklin Wei
abd75a17d1 puzzles: fix up makefile
- rewrote a bunch of repetitive rules with a pattern rule

Change-Id: I86a61a7ed8398f18789e5efaf4996d9eafd50651
2017-02-09 22:36:05 -05:00
Amaury Pouly
d7871914ac Fix dangerous casts
On Windows 64-bit, the size of long is 32-bit, thus any pointer to long cast is
not valid. In any case, one should use intptr_t and ptrdiff_t when casting
to integers. This commit attempts to fix all instances reported by GCC.
When relevant, I replaced code by the macros PTR_ADD, ALIGN_UP from system.h

Change-Id: I2273b0e8465d3c4689824717ed5afa5ed238a2dc
2017-02-04 17:24:47 +01:00
William Wilgus
1fa7c56351 Fix for Chessbox bug FS#10363
Chessbox was overflowing GameList[240] causing the board to flip + crash

GameCnt changed to unsigned char which allows the array to roll over
to 0 after 255

define MAX_GAME_CNT 256 and GameList[MAX_GAME_CNT] along with 1 byte GameCnt
should fix this issue

dbg save routine left in for now to help identify any other problems

Added bounds checking to prevent second bug found when loading .pgn files

Change-Id: I2b615c8ecbed4368724412f80ce07346f3cf30a7
2017-02-01 01:33:48 +01:00