Commit graph

118 commits

Author SHA1 Message Date
William Wilgus
cb94b3ae2e keyboard add ability to specify temporary custom layouts
rb core allows you to load custom keyboard layouts

this patch adds the ability to load a keyboard layout in a buffer
the custom layout is temporary and does not overwrite the current layout

use like so:

    unsigned short kbd[64];
    unsigned short *kbd_p = kbd;
    if (!kbd_create_layout("ABCD1234\n", kbd, sizeof(kbd)))
        kbd_p = NULL;

    rb->kbd_input(buf,sizeof(buf), kbd_p);

Change-Id: I7be2bd4a1b4797a147fa70228a9749dc56ac052a
2020-07-22 06:48:28 -04:00
William Wilgus
c39f95465b do_menu pass internal synclist reference to callback
keep running into the rigid nature of do_menu
it isn't too bad when you don't need voice but once
you do the fun awaits

do_menu likes to talk on menu enter which is in a loop when you use do_menu
I would like to move the processing to the callback
TOO BAD you only get an action and the menu_item_ex struct
you sent it when calling the function

Change-Id: Iaefd0cc133435d675b7dd27a558c504d6ccb327a
2020-07-19 22:10:26 +00:00
Franklin Wei
7d005335ba puzzles: always reset input state before pause menu
We were improperly conditioning the state reset with `do_pausemenu'. We
should reset the input state no matter what.

Change-Id: Iaafc59b95e9f1f053b57a34f0f28f7c672c0e327
2020-07-14 23:04:46 -04:00
Franklin Wei
987c6575b3 puzzles: more verbose debug output in font loading
No functional changes.

Change-Id: I7baa7bf37b3bdd57064c654a72d0e4e0d5600245
2020-07-14 23:04:46 -04:00
Franklin Wei
4dcd1a9ed8 puzzles: load cached fonts unconditionally
This works around an odd issue in Mines involving the zoom feature. The
chain of events leading to it is rather convoluted:

1. No save game is found, so no fonts are loaded from disk.
2. A new game is started.
3. The user selects the "Zoom" option.
4. The allocation of the zoom framebuffer causes the malloc code to grab
   the audiobuffer. This causes all further font_load() calls to FAIL, due
   to buflib allocations no longer working.
5. The user goes back to the normal view and uncovers a square.
6. Font loading fails, causing the drawing code to fall back to the system
   font.
7. An unrelated bug (not yet tracked down) causes font_get(FONT_UI) to
   return a different font.
8. font_getstringsize() returns the right size of the "wrong" font, leading
   to centering issues upon rb_draw_text().

The real solution to this would be to fix font_get(), but this fix should
prevent the issue from happening if Mines has been run and saved at least
once before.

Change-Id: Ib9ad51376eeb3ca1113a1f3786124b612db88cd7
2020-07-07 21:25:27 +00:00
Franklin Wei
5094aaa4d4 puzzles: Follow cursor in zoom mode and general code cleanup.
Frontends now have a way to retrieve the backend cursor position with some
changes I've submitted upstream. With this information, we can now follow
the cursor around in "interaction mode" while zoomed in, eliminating (most)
need for mode switching.

Also does some cleanup of the frontend code.

Change-Id: I1ba118f67564a3baed95435f5619b73cfa3ae87a
2020-07-06 23:00:13 -04:00
Franklin Wei
051eb3ea31 puzzles: enhancements to mouse mode, zoom feature
- zoom now remembers position between activations (but not when exiting the
  plugin)
- key repeat enabled when panning
- moving mouse out of frame while zoomed will pan
- mouse can be moved diagonally

Change-Id: I39380ef7f36238700b6baa54cac036832933df67
2020-07-02 19:07:16 +00:00
Franklin Wei
2e0a5969b6 puzzles: clean up and document some voodoo
Change-Id: I13d987cc148f053778474e99c719cc8439ec53c0
2020-06-27 20:28:50 -04:00
Franklin Wei
7da8137bdb puzzles: fix crash when loading a corrupt save
I misread the documentation here, thinking that the pointer would be set to
*point to* a null byte, not to a null pointer itself. [1]

[1]: https://www.chiark.greenend.org.uk/~sgtatham/puzzles/devel/midend.html#identify-game

Change-Id: I9b76bba9b1611dfd8e05d076a69f7554b5b74c53
2020-06-27 20:28:46 -04:00
Franklin Wei
c02a9c5ab3 puzzles: refuse to draw non-ASCII characters
We had some issues in Keen with the arithmetic operators not being rendered
properly. This is still a kludge (we should intelligently search the font)
but is still less ugly than the garbage it was drawing before.

Change-Id: I5b957c7371b659ea6d64847145f9913b2a892e48
2020-06-27 20:23:13 -04:00
Franklin Wei
4b108896cc puzzles: replace menu title kludge with more elegant solution
This hack has survived for far too long.

Change-Id: Idca0b647bd6e77f2afcd9a538513a6b9aa970fc7
2020-06-27 19:13:19 -04:00
Franklin Wei
5831801d16 puzzles: disable software poweroff in all puzzles
We have a couple games like Untangle and mouse-mode games in which the
software poweroff is very annoying.

Change-Id: I554b89aecf8c7cc20c6c7f305be1b8807dc9283b
2020-06-27 13:27:40 -04:00
Franklin Wei
f49442d7b7 puzzles: allow secondary select in Rectangles and Map
Change-Id: Ia32d41cd872140481e73b7565904fc196b7c5b01
2020-06-27 00:57:18 +00:00
Franklin Wei
f6448cb440 puzzles: fix numerical chooser while zoomed in
We need to blit the zoom framebuffer to the screen in our chooser loop.

Change-Id: Id2ba1a79b61f14cc34ca9804486f69a2b32484ff
2020-06-25 18:00:52 -04:00
Franklin Wei
e666a7aea8 puzzles: fix text centering when zooming in
For some reason lcd_getstringsize was occasionally reverting to the system
font, rather than the loaded font. This was leading to improper font sizes
being reported.

Change-Id: Ie5fc31de9a6a7af739beb22efc3ec1383206eaea
2020-06-25 17:42:02 -04:00
Franklin Wei
5a45e96f4d puzzles: update README
Change-Id: Ifea2580989f87bb1c4b357b847121bb5f66f4dfe
2020-06-25 16:53:22 -04:00
Franklin Wei
729d6b0cb7 puzzles: update copyright date
Change-Id: I57c0554cb0d2951631d28e249eacb34c4b36ef21
2020-06-25 16:46:03 -04:00
Franklin Wei
d75131569c puzzles: clean up error messages
Expands buffer size, and prints to LOGF.

Change-Id: I6dbcf60152d69c928270023c550976b802269d95
2020-06-25 16:46:03 -04:00
Franklin Wei
b67d9e9217 puzzles: fix crashes and odd behavior on load
I can't believe this has gone unnoticed for so long... We need to update
the game size upon loading games. Who knew?

Change-Id: I929f8139457853440ae687bd937af989fa7c6f93
2020-06-25 16:46:03 -04:00
Franklin Wei
48b0ef1cf2 puzzles: resync with upstream
This brings the upstream version to 9aa7b7c (with some of my changes as
well).

Change-Id: I5bf8a3e0b8672d82cb1bf34afc07adbe12a3ac53
2020-06-25 18:45:58 +00:00
Franklin Wei
dd3a8e0898 puzzles: remove dependency on gamedesc.txt
This should allow syncing with fully clean upstream source trees.

Change-Id: Ie476a4d2ef72a411150cacc2bd45265170670e1d
2020-06-25 18:45:26 +00:00
Solomon Peachy
3cb272c97a build: Fix puzzles build due to missing dependency
As rbcompat.h is -include'd on the command line, the mkdep script doesn't
pick it up.  Explicitly add the dependency to lang_enum.h to the makefile.

Also add lang_enum.h to the 'make clean' target!

Change-Id: I33c8ed0cd5c1d44dce02ac9285469c0e4feac00e
2019-07-20 10:06:12 -04:00
Franklin Wei
38cceb9563 Work around DX90 compile error
Change-Id: I80751a41d0711c52558ba198c22d1f012998302c
2019-05-15 20:39:23 -04:00
Franklin Wei
75fe15a06c puzzles: refactor rockbox frontend
Cleaned up a bit of copy-pasted code and added some useful comments.

Change-Id: I9a6f37acbeeda58b3ea8c65ee96230372400f323
2019-05-15 18:18:17 -04:00
Franklin Wei
f940276fd9 puzzles: resync with upstream
This brings the puzzles source to upstream commit e2135d5. (I've made my own
changes on top of that.)

This brings in a couple bugfixes and a new solver for Dominosa.

Change-Id: I11d46b43171787832330a5e2e0d2f353f36f727d
2019-05-15 18:16:27 -04:00
Franklin Wei
b3356e3aff puzzles: resync with upstream
This brings the code to upstream commit 3ece3d6 (I've made my own Rockbox-
specific changes on top of that).

Changes include using C99 `bool' throughout, and minor logic fixes for some
puzzles.

Change-Id: Ie823e73ae49a8ee1de411d6d406df2ba835af541
2018-12-21 22:13:33 -05:00
Franklin Wei
d64ff86fb6 puzzles: resync with upstream
This brings the source to upstream commit 506b073 (though I have made some
extra commits on top of that). Notably this includes a fix for a double-free
bug that I myself introduced upstream.

Change-Id: I02671586bbc34d63e05398ee971271fed42538cf
2018-06-20 19:13:03 -04:00
Franklin Wei
f727b0787a puzzles: minor nitpicks to fbb6a2f
Just some whitespace changes to maintain stylistic consistency.

Change-Id: I50b5d52db2795cfcb4155bdffbfb80c1c3773112
2018-06-12 12:11:06 -04:00
Franklin Wei
c2d5ac1762 puzzles: fix typo introduced by fbb6a2f
When zoomed in, the original commit made a mono bitmap (a.k.a. text) always
have the red component set to 255. This would cause drawn text to always be
red. Fixed.

Change-Id: Iec06256a3a783948c60c70557de042b375224448
2018-06-12 12:09:44 -04:00
Marcin Bukat
fbb6a2ff6d Agptek Rocker: Build plugins
Patch provided by Aapo Tahkola.

Change-Id: I37a42a950d78d6b8aa3927ec7aeb30030f7be7a5
2018-06-12 10:31:15 +02:00
Franklin Wei
992a12670e puzzles: update frontend for new upstream, misc. changes
The upstream code changed a little bit with regard to the request_keys()
API. Also, we save some bytes (especially on the c200v2) by compiling with
-ffunction-sections and -fdata-sections, which allows Net to fit once again.

Change-Id: I3ab30127169c73e4cd8996f0c12e1223ee18d79f
2018-04-24 19:06:30 -04:00
Franklin Wei
b29611fe2c puzzles: update help text, make generation and testing cleaner
This includes an upstream change to the Galaxies help text. `genhelp.sh'
no longer leaves temporary files sitting around, and the self-test feature
of lz4tiny.c works again.

Change-Id: I787f4cb3c258baade31638d6be18f95b7aa0705e
2018-04-24 19:06:30 -04:00
Franklin Wei
8f23493e08 puzzles: resync with upstream
This brings the upstream version to b3da238 (though some of my own
changes are included on top of that).

Change-Id: Ida73e8cd86765413147ce891af3cc2b7aeda2b2a
2018-04-24 19:06:30 -04:00
Franklin Wei
ef0fb52113 puzzles: silence some warnings
Change-Id: Id6fd9d8dd3021f5e2cb93565d7e419aaf07f9af0
2018-04-24 19:06:30 -04:00
Franklin Wei
22823e2f78 puzzles: save some bytes
This should cut just enough size off the binary to let Net still compile
for the c200v2. This is probably close to the last time I'll be able to do
this; I'm already resorting to dirty hacks like writing super terse error
messages.

Change-Id: I43344b9a601696d7ca56fc02af4a611fd9d1a150
2018-04-17 22:13:31 -04:00
Franklin Wei
e84fc26fb8 puzzles: clean up for rockbox
Disabled vprintf() call in Filling, and reordered vertices in Unequal.

Change-Id: Ia3d8cd46ae3a7909b7dc2a8de762aa3173634d1e
2018-04-17 18:46:05 -04:00
Franklin Wei
6dc9d1d730 puzzles: enable all the remaining games
They all work now :). I merged in part of Chris Boyle's Android port of
Puzzles to give the front end a way to know what keys the back end needs.
This also re-syncs to the latest upstream sources.

Change-Id: Ie0409bbb32f617ae5abf4f81be3b45d1552db9bb
2018-04-17 18:20:12 -04:00
Franklin Wei
9006e75cde puzzles: fix typo
Change-Id: I6b8c18472749248508d4e5b1595b8903e687f67c
2018-03-18 13:07:39 -04:00
Franklin Wei
77641d59a7 puzzles: add formatting to help viewer
The help text is now processed to generate a style array to pass to the
display_text library in addition to the text itself. The help text is still
compressed using LZ4, and still fits on the c200v2.

Change-Id: I7a3a664f90f67a1a018956c72d2b62d92b8ffd17
2018-03-17 22:54:21 -04:00
Franklin Wei
d728b9775b puzzles: fix off-by-one in blitter clipping
Nobody to blame except myself for this one...

Change-Id: I8446b564c3c060411c46675e9baac1c72437c39a
2017-11-24 20:31:45 -05:00
Franklin Wei
f51544a0e5 puzzles: polish mouse mode
Reduces lag when dragging. Also throws some comments in.

Change-Id: Ibd0d95e94200ae6de8258ce8d2e001c931161385
2017-11-24 20:31:45 -05:00
Franklin Wei
ab6e40b977 puzzles: fix copy-paste typo
Change-Id: I09d065574a02a541c43c1a78d92e50a80b5e2ae0
2017-11-24 20:31:45 -05:00
Franklin Wei
c1dc957195 puzzles: clean junk files
These are really not needed.

Change-Id: I8aa8d648c363c657ca104fc9876b3c63558c5608
2017-11-21 19:29:46 -05:00
Franklin Wei
e8e85c5762 puzzles: resync with upstream; add Loopy and Palisade, mouse mode
This brings a various small changes to the drawing and input code,
as well as a brand new "mouse mode", where input goes to a virtual
mouse cursor. Only Loopy has this mouse mode enabled by default,
while other games have it hidden away under the debug menu. Some
changes by me to Palisade were required to make it playable; those
are included here as well. Right now, sgt-net is pushing the c200v2's
upper limit on size and may have to be dropped in a future commit.

Change-Id: I495d2a2125462c2985aec1ffbc54bbe3fe5133bd
2017-11-21 19:29:45 -05:00
Franklin Wei
d9a55ac816 puzzles: fix blitting when zoomed
Both blitter_save() and blitter_load() functioned incorrectly when
zoomed in -- blitter_save() would copy from the wrong location, and
blitter_load() would ignore the y-coordinate of the destination.

Change-Id: I7c85debf5953575f72c4a81e3dbcf514202c3aed
2017-11-04 12:09:16 -04:00
Franklin Wei
7f1dd6f593 puzzles: clarify code and documentation
This adds no functionality, but instead cleans up the source and adds
some more substantial documentation.

Change-Id: I77328c171a61db7729bdf928ba094cfbed4ec0dd
2017-11-04 11:14:18 -04:00
Franklin Wei
9f62373735 puzzles: fix title drawing
This fixes two separate bugs: The first was that the drawmode was not
reliably set when drawing the title, occasionally leading to a black
rectangle where the title should be; the second that the title bar's
space wasn't being cleared before drawing, leading to artifacts when
the length of the title string changed.

Change-Id: I3859125b14d568e1098b095ab134645a504b2d45
2017-11-04 11:14:17 -04:00
Franklin Wei
65e7617ab6 puzzles: add an interaction mode to the "Zoom In" feature
This makes it possible to play the game while zoomed in. Read the
manual entry if you want to know more.

Change-Id: Iff8bab12f92ebd2798047c25d1fde7740aa543ce
2017-10-30 21:25:33 -04:00
Franklin Wei
1f3e70aafc puzzles: sync with upstream
This includes the fix for Map's incorrect cursor positioning when
zoomed in.

Change-Id: I7d7d1f3031bbe1390e89340039996f99efaa8ef5
2017-10-29 17:39:29 -04:00
Franklin Wei
47ebf623cb puzzles: improve zoom rendering
This adds colored font rendering, as well as a workaround for font
loading while zoomed. Additionally, the frontend has been modified to
match the new upstream API.

Change-Id: I8c3fe57e6854f176485bf792cf4778cd54a21674
2017-10-29 12:49:39 -04:00