1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2006 Miguel A. Arévalo
11 * Color graphics from eboard
12 * GNUChess v2 chess engine Copyright (c) 1988 John Stanback
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
19 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 * KIND, either express or implied.
22 ****************************************************************************/
26 #ifdef HAVE_LCD_BITMAP
28 #if (MEMORYSIZE > 8) /* Lowmem doesn't have playback in chessbox */
29 #define HAVE_PLAYBACK_CONTROL
33 #ifdef HAVE_PLAYBACK_CONTROL
34 #include "lib/playback_control.h"
39 #include "chessbox_pgn.h"
41 /* type definitions */
48 /* External bitmaps */
49 extern const fb_data chessbox_pieces
[];
54 /* Tile size defined by the assigned bitmap */
55 #include "pluginbitmaps/chessbox_pieces.h"
56 #define TILE_WIDTH BMPWIDTH_chessbox_pieces
57 #define TILE_HEIGHT (BMPHEIGHT_chessbox_pieces/26)
59 /* Calculate Offsets */
60 #define XOFS ((LCD_WIDTH-8*TILE_WIDTH)/2)
61 #define YOFS ((LCD_HEIGHT-8*TILE_HEIGHT)/2)
64 #define SAVE_FILE PLUGIN_GAMES_DIR "/chessbox.save"
68 #define COMMAND_MOVE 1
69 #define COMMAND_PLAY 2
70 #define COMMAND_LEVEL 3
71 #define COMMAND_RESTART 4
72 #define COMMAND_QUIT 5
73 #define COMMAND_MENU 6
74 #define COMMAND_SAVE 7
75 #define COMMAND_RESTORE 8
76 #define COMMAND_RESUME 9
77 #define COMMAND_SELECT 10
78 #define COMMAND_NEXT 11
79 #define COMMAND_PREV 12
83 /* level+1's string */
84 const char *level_string
[] = { "Level 1: 60 moves / 5 min" ,
85 "Level 2: 60 moves / 15 min" ,
86 "Level 3: 60 moves / 30 min" ,
87 "Level 4: 40 moves / 30 min" ,
88 "Level 5: 40 moves / 60 min" ,
89 "Level 6: 40 moves / 120 min" ,
90 "Level 7: 40 moves / 240 min" ,
91 "Level 8: 1 move / 15 min" ,
92 "Level 9: 1 move / 60 min" ,
93 "Level 10: 1 move / 600 min" };
95 /* "While thinking" command */
96 int wt_command
= COMMAND_NOP
;
98 /* ---- Get the board column and row (e2 f.e.) for a physical x y ---- */
99 void xy2cr ( short x
, short y
, short *c
, short *r
) {
100 if (computer
== black
) {
109 /* ---- get physical x y for a board column and row (e2 f.e.) ---- */
110 void cr2xy ( short c
, short r
, short *x
, short *y
) {
111 if ( computer
== black
) {
120 /* ---- Draw a complete board ---- */
121 static void cb_drawboard (void) {
122 short r
, c
, x
, y
;
123 short l
, piece
, p_color
;
126 rb
->lcd_clear_display();
128 for (r
= 0; r
< 8; r
++) {
129 for (c
= 0; c
< 8; c
++) {
133 cr2xy ( c
, r
, &x
, &y
);
134 if ( piece
== no_piece
) {
135 rb
->lcd_bitmap_part ( chessbox_pieces
, 0 ,
136 TILE_HEIGHT
* b_color
,
138 XOFS
+ x
*TILE_WIDTH
,
139 YOFS
+ ( 7 - y
)*TILE_HEIGHT
,
143 rb
->lcd_bitmap_part ( chessbox_pieces
,
146 4 * TILE_HEIGHT
* ( piece
- 1 ) +
147 2 * TILE_HEIGHT
* p_color
+
148 TILE_HEIGHT
* b_color
,
150 XOFS
+ x
*TILE_WIDTH
,
151 YOFS
+ (7 - y
)*TILE_HEIGHT
,
155 b_color
= (b_color
== 1) ? 0 : 1 ;
157 b_color
= (b_color
== 1) ? 0 : 1 ;
160 /* draw board limits */
161 #if (LCD_WIDTH > TILE_WIDTH*8) && (LCD_HEIGHT > TILE_HEIGHT*8)
162 rb
->lcd_drawrect(XOFS
- 1, YOFS
- 1, TILE_WIDTH
*8 + 2, TILE_HEIGHT
*8 + 2);
163 #elif LCD_WIDTH > TILE_WIDTH*8
164 rb
->lcd_vline(XOFS
- 1, 0, LCD_HEIGHT
- 1);
165 rb
->lcd_vline(XOFS
+ 8*TILE_WIDTH
, 0, LCD_HEIGHT
- 1);
166 #elif LCD_HEIGHT > TILE_HEIGHT*8
167 rb
->lcd_hline(0, LCD_WIDTH
- 1, YOFS
- 1);
168 rb
->lcd_hline(0, LCD_WIDTH
- 1, YOFS
+ TILE_HEIGHT
*8);
174 /* ---- Switch mark on board ---- */
175 void cb_switch ( short x
, short y
) {
176 rb
->lcd_set_drawmode ( DRMODE_COMPLEMENT
);
177 rb
->lcd_drawrect ( XOFS
+ x
*TILE_WIDTH
+ 1 ,
178 YOFS
+ ( 7 - y
)*TILE_HEIGHT
+1 ,
179 TILE_WIDTH
-2 , TILE_HEIGHT
-2 );
181 rb
->lcd_set_drawmode ( DRMODE_SOLID
);
184 /* ---- callback for capturing interaction while thinking ---- */
185 void cb_wt_callback ( void ) {
186 int button
= BUTTON_NONE
;
188 wt_command
= COMMAND_NOP
;
189 button
= rb
->button_get(false);
193 wt_command
= COMMAND_QUIT
;
198 wt_command
= COMMAND_MENU
;
202 wt_command
= COMMAND_PLAY
;
208 /* ---- set playing parameters depending on level ---- */
209 void cb_setlevel ( int lev
) {
210 Level
= (lev
> 7) ? 7 : ( (lev
< 1) ? 1 : lev
) ;
253 TCflag
= (TCmoves
> 1);
257 /* ---- increase playing level ---- */
258 void cb_levelup ( void ) {
262 cb_setlevel ( Level
+1 );
263 rb
->splash ( HZ
/2 , level_string
[Level
-1] );
266 /* ---- Save current position ---- */
267 void cb_saveposition ( void ) {
272 rb
->splash ( 0 , "Saving position" );
274 fd
= rb
->open(SAVE_FILE
, O_WRONLY
|O_CREAT
);
276 computer
++; rb
->write(fd
, &(computer
), sizeof(computer
)); computer
--;
277 opponent
++; rb
->write(fd
, &(opponent
), sizeof(opponent
)); opponent
--;
278 rb
->write(fd
, &(Game50
), sizeof(Game50
));
280 rb
->write(fd
, &(castld
[white
]), sizeof(castld
[white
]));
281 rb
->write(fd
, &(castld
[black
]), sizeof(castld
[black
]));
282 rb
->write(fd
, &(kingmoved
[white
]), sizeof(kingmoved
[white
]));
283 rb
->write(fd
, &(kingmoved
[black
]), sizeof(kingmoved
[black
]));
285 rb
->write(fd
, &(withbook
), sizeof(withbook
));
286 rb
->write(fd
, &(Level
), sizeof(Level
));
287 rb
->write(fd
, &(TCflag
), sizeof(TCflag
));
288 rb
->write(fd
, &(OperatorTime
), sizeof(OperatorTime
));
290 rb
->write(fd
, &(TimeControl
.clock
[white
]),
291 sizeof(TimeControl
.clock
[white
]) );
292 rb
->write(fd
, &(TimeControl
.clock
[black
]),
293 sizeof(TimeControl
.clock
[black
]) );
294 rb
->write(fd
, &(TimeControl
.moves
[white
]),
295 sizeof(TimeControl
.moves
[white
]) );
296 rb
->write(fd
, &(TimeControl
.moves
[black
]),
297 sizeof(TimeControl
.moves
[black
]) );
298 for (sq
= 0; sq
< 64; sq
++) {
299 if (color
[sq
] == neutral
) c
= 0; else c
= color
[sq
]+1;
300 temp
= 256*board
[sq
] + c
;
301 rb
->write(fd
, &(temp
), sizeof(temp
));
303 for (i
= 0; i
<= GameCnt
; i
++) {
304 if (GameList
[i
].color
== neutral
)
307 c
= GameList
[i
].color
+ 1;
308 rb
->write(fd
, &(GameList
[i
].gmove
), sizeof(GameList
[i
].gmove
));
309 rb
->write(fd
, &(GameList
[i
].score
), sizeof(GameList
[i
].score
));
310 rb
->write(fd
, &(GameList
[i
].depth
), sizeof(GameList
[i
].depth
));
311 rb
->write(fd
, &(GameList
[i
].nodes
), sizeof(GameList
[i
].nodes
));
312 rb
->write(fd
, &(GameList
[i
].time
), sizeof(GameList
[i
].time
));
313 rb
->write(fd
, &(GameList
[i
].piece
), sizeof(GameList
[i
].piece
));
314 rb
->write(fd
, &(c
), sizeof(c
));
319 /* ---- Restore saved position ---- */
320 void cb_restoreposition ( void ) {
326 if ( (fd
= rb
->open(SAVE_FILE
, O_RDONLY
)) >= 0 ) {
327 rb
->splash ( 0 , "Loading position" );
328 rb
->read(fd
, &(computer
), sizeof(computer
));
329 rb
->read(fd
, &(opponent
), sizeof(opponent
));
330 rb
->read(fd
, &(Game50
), sizeof(Game50
));
332 rb
->read(fd
, &(castld
[white
]), sizeof(castld
[white
]));
333 rb
->read(fd
, &(castld
[black
]), sizeof(castld
[black
]));
334 rb
->read(fd
, &(kingmoved
[white
]), sizeof(kingmoved
[white
]));
335 rb
->read(fd
, &(kingmoved
[black
]), sizeof(kingmoved
[black
]));
337 rb
->read(fd
, &(withbook
), sizeof(withbook
));
338 rb
->read(fd
, &(Level
), sizeof(Level
));
339 rb
->read(fd
, &(TCflag
), sizeof(TCflag
));
340 rb
->read(fd
, &(OperatorTime
), sizeof(OperatorTime
));
342 rb
->read(fd
, &(TimeControl
.clock
[white
]),
343 sizeof(TimeControl
.clock
[white
]));
344 rb
->read(fd
, &(TimeControl
.clock
[black
]),
345 sizeof(TimeControl
.clock
[black
]));
346 rb
->read(fd
, &(TimeControl
.moves
[white
]),
347 sizeof(TimeControl
.moves
[white
]));
348 rb
->read(fd
, &(TimeControl
.moves
[black
]),
349 sizeof(TimeControl
.moves
[black
]));
350 for (sq
= 0; sq
< 64; sq
++) {
351 rb
->read(fd
, &(m
), sizeof(m
));
352 board
[sq
] = (m
>> 8); color
[sq
] = (m
& 0xFF);
358 GameCnt
= -1; c
= '?';
359 while (rb
->read(fd
, &(GameList
[++GameCnt
].gmove
),
360 sizeof(GameList
[GameCnt
].gmove
)) > 0) {
361 rb
->read(fd
, &(GameList
[GameCnt
].score
),
362 sizeof(GameList
[GameCnt
].score
));
363 rb
->read(fd
, &(GameList
[GameCnt
].depth
),
364 sizeof(GameList
[GameCnt
].depth
));
365 rb
->read(fd
, &(GameList
[GameCnt
].nodes
),
366 sizeof(GameList
[GameCnt
].nodes
));
367 rb
->read(fd
, &(GameList
[GameCnt
].time
),
368 sizeof(GameList
[GameCnt
].time
));
369 rb
->read(fd
, &(GameList
[GameCnt
].piece
),
370 sizeof(GameList
[GameCnt
].piece
));
371 rb
->read(fd
, &(GameList
[GameCnt
].color
),
372 sizeof(GameList
[GameCnt
].color
));
373 if (GameList
[GameCnt
].color
== 0)
374 GameList
[GameCnt
].color
= neutral
;
376 --GameList
[GameCnt
].color
;
379 if (TimeControl
.clock
[white
] > 0)
381 computer
--; opponent
--;
389 /* ---- show menu in viewer mode---- */
390 static int cb_menu_viewer(void)
394 bool menu_quit
= false;
396 MENUITEM_STRINGLIST(menu
,"Chessbox Menu",NULL
,"Restart Game",
397 "Select Other Game", "Quit");
401 switch(rb
->do_menu(&menu
, &selection
, NULL
, false))
405 result
= COMMAND_RESTART
;
408 result
= COMMAND_SELECT
;
412 result
= COMMAND_QUIT
;
420 /* ---- get a command in game mode ---- */
421 struct cb_command
cb_get_viewer_command (void) {
423 struct cb_command result
= { 0, {0,0,0,0,0}, 0 };
427 button
= rb
->button_get(true);
431 result
.type
= COMMAND_QUIT
;
435 result
.type
= cb_menu_viewer();
438 result
.type
= COMMAND_PREV
;
441 result
.type
= COMMAND_NEXT
;
448 /* ---- viewer main loop ---- */
449 void cb_start_viewer(char* filename
){
450 struct pgn_game_node
*first_game
, *selected_game
;
451 struct pgn_ply_node
*curr_ply
;
452 bool exit_game
= false;
453 bool exit_viewer
= false;
454 struct cb_command command
;
456 first_game
= pgn_list_games(filename
);
457 if (first_game
== NULL
){
458 rb
->splash ( HZ
*2 , "No games found !" );
463 selected_game
= pgn_show_game_list(first_game
);
464 if (selected_game
== NULL
){
468 pgn_parse_game(filename
, selected_game
);
469 if (selected_game
->first_ply
!= NULL
) {
472 GNUChess_Initialize();
477 curr_ply
= selected_game
->first_ply
;
481 command
= cb_get_viewer_command ();
482 switch (command
.type
) {
484 /* unapply the previous ply */
485 if (curr_ply
->prev_node
!= NULL
){
486 curr_ply
= curr_ply
->prev_node
;
488 rb
->splash ( HZ
*2 , "At the begining of the game" );
491 board
[locn
[curr_ply
->row_from
][curr_ply
->column_from
]]
492 = board
[locn
[curr_ply
->row_to
][curr_ply
->column_to
]];
493 color
[locn
[curr_ply
->row_from
][curr_ply
->column_from
]]
494 = color
[locn
[curr_ply
->row_to
][curr_ply
->column_to
]];
495 board
[locn
[curr_ply
->row_to
][curr_ply
->column_to
]] = no_piece
;
496 color
[locn
[curr_ply
->row_to
][curr_ply
->column_to
]] = neutral
;
497 if (curr_ply
->taken_piece
!= no_piece
&& !curr_ply
->enpassant
){
498 board
[locn
[curr_ply
->row_to
][curr_ply
->column_to
]]
499 = curr_ply
->taken_piece
;
500 color
[locn
[curr_ply
->row_to
][curr_ply
->column_to
]]
501 = ((curr_ply
->player
==white
)?black
:white
);
503 if (curr_ply
->castle
){
504 if (curr_ply
->column_to
== 6){
505 /* castling kingside */
506 board
[locn
[curr_ply
->row_to
][7]] = rook
;
507 color
[locn
[curr_ply
->row_to
][7]] = curr_ply
->player
;
508 board
[locn
[curr_ply
->row_to
][5]] = no_piece
;
509 color
[locn
[curr_ply
->row_to
][5]] = neutral
;
511 /* castling queenside */
512 board
[locn
[curr_ply
->row_to
][0]] = rook
;
513 color
[locn
[curr_ply
->row_to
][0]] = curr_ply
->player
;
514 board
[locn
[curr_ply
->row_to
][3]] = no_piece
;
515 color
[locn
[curr_ply
->row_to
][3]] = neutral
;
518 if (curr_ply
->enpassant
){
519 board
[locn
[curr_ply
->row_from
][curr_ply
->column_to
]] = pawn
;
520 color
[locn
[curr_ply
->row_from
][curr_ply
->column_to
]]
521 = ((curr_ply
->player
==white
)?black
:white
);
523 if (curr_ply
->promotion
){
524 board
[locn
[curr_ply
->row_from
][curr_ply
->column_from
]] = pawn
;
525 color
[locn
[curr_ply
->row_from
][curr_ply
->column_from
]]
532 /* apply the current move */
533 if (curr_ply
->player
== neutral
){
534 rb
->splash ( HZ
*2 , "At the end of the game" );
537 board
[locn
[curr_ply
->row_to
][curr_ply
->column_to
]]
538 = board
[locn
[curr_ply
->row_from
][curr_ply
->column_from
]];
539 color
[locn
[curr_ply
->row_to
][curr_ply
->column_to
]]
540 = color
[locn
[curr_ply
->row_from
][curr_ply
->column_from
]];
541 board
[locn
[curr_ply
->row_from
][curr_ply
->column_from
]] = no_piece
;
542 color
[locn
[curr_ply
->row_from
][curr_ply
->column_from
]] = neutral
;
543 if (curr_ply
->castle
){
544 if (curr_ply
->column_to
== 6){
545 /* castling kingside */
546 board
[locn
[curr_ply
->row_to
][5]] = rook
;
547 color
[locn
[curr_ply
->row_to
][5]] = curr_ply
->player
;
548 board
[locn
[curr_ply
->row_to
][7]] = no_piece
;
549 color
[locn
[curr_ply
->row_to
][7]] = neutral
;
551 /* castling queenside */
552 board
[locn
[curr_ply
->row_to
][3]] = rook
;
553 color
[locn
[curr_ply
->row_to
][3]] = curr_ply
->player
;
554 board
[locn
[curr_ply
->row_to
][0]] = no_piece
;
555 color
[locn
[curr_ply
->row_to
][0]] = neutral
;
558 if (curr_ply
->enpassant
){
559 board
[locn
[curr_ply
->row_from
][curr_ply
->column_to
]] = no_piece
;
560 color
[locn
[curr_ply
->row_from
][curr_ply
->column_to
]] = neutral
;
562 if (curr_ply
->promotion
){
563 board
[locn
[curr_ply
->row_to
][curr_ply
->column_to
]]
564 = curr_ply
->promotion_piece
;
565 color
[locn
[curr_ply
->row_to
][curr_ply
->column_to
]]
568 if (curr_ply
->next_node
!= NULL
){
569 curr_ply
= curr_ply
->next_node
;
573 case COMMAND_RESTART
:
574 GNUChess_Initialize();
576 curr_ply
= selected_game
->first_ply
;
584 } while (!exit_game
&& !exit_viewer
);
586 rb
->splash ( HZ
*2 , "Error parsing game !");
588 } while (!exit_viewer
);
591 /* ---- show menu ---- */
592 static int cb_menu(void)
596 bool menu_quit
= false;
598 MENUITEM_STRINGLIST(menu
,"Chessbox Menu",NULL
,"New Game","Resume Game",
599 "Save Game", "Restore Game",
600 #ifdef HAVE_PLAYBACK_CONTROL
607 switch(rb
->do_menu(&menu
, &selection
, NULL
, false))
611 result
= COMMAND_RESTART
;
614 result
= COMMAND_RESUME
;
618 result
= COMMAND_SAVE
;
622 result
= COMMAND_RESTORE
;
626 #ifdef HAVE_PLAYBACK_CONTROL
627 playback_control(NULL
);
631 result
= COMMAND_QUIT
;
639 /* ---- get a command in game mode ---- */
640 struct cb_command
cb_getcommand (void) {
641 static short x
= 4 , y
= 3 ;
643 int button
, lastbutton
= BUTTON_NONE
;
644 int marked
= false , from_marked
= false ;
645 short marked_x
= 0 , marked_y
= 0 ;
646 struct cb_command result
= { 0, {0,0,0,0,0}, 0 };
651 button
= rb
->button_get(true);
655 result
.type
= COMMAND_QUIT
;
659 result
.type
= cb_menu();
662 result
.type
= COMMAND_LEVEL
;
666 if (lastbutton
!= CB_PLAY_PRE
)
669 result
.type
= COMMAND_PLAY
;
672 if ( !from_marked
) cb_switch ( x
, y
);
679 if ( marked
&& ( marked_x
== x
) && ( marked_y
== y
) ) {
682 from_marked
= false ;
687 if ( !from_marked
) cb_switch ( x
, y
);
694 if ( marked
&& ( marked_x
== x
) && ( marked_y
== y
) ) {
697 from_marked
= false ;
702 if ( !from_marked
) cb_switch ( x
, y
);
709 if ( marked
&& ( marked_x
== x
) && ( marked_y
== y
) ) {
712 from_marked
= false ;
717 if ( !from_marked
) cb_switch ( x
, y
);
724 if ( marked
&& ( marked_x
== x
) && ( marked_y
== y
) ) {
727 from_marked
= false ;
733 if (lastbutton
!= CB_SELECT_PRE
)
737 xy2cr ( x
, y
, &c
, &r
);
739 if ( ( color
[l
]!=computer
) && ( board
[l
]!=no_piece
) ) {
746 if ( ( marked_x
== x
) && ( marked_y
== y
) ) {
750 xy2cr ( marked_x
, marked_y
, &c
, &r
);
751 result
.mv_s
[0] = 'a' + c
;
752 result
.mv_s
[1] = '1' + r
;
753 xy2cr ( x
, y
, &c
, &r
);
754 result
.mv_s
[2] = 'a' + c
;
755 result
.mv_s
[3] = '1' + r
;
756 result
.mv_s
[4] = '\00';
757 result
.type
= COMMAND_MOVE
;
763 if (button
!= BUTTON_NONE
)
769 /* ---- game main loop ---- */
770 void cb_play_game(void) {
771 struct cb_command command
;
772 struct pgn_game_node
*game
;
773 char move_buffer
[20];
778 /* load opening book, soon */
781 GNUChess_Initialize();
783 /* init PGN history data structures */
784 game
= pgn_init_game();
786 /* restore saved position, if saved */
787 cb_restoreposition();
788 /* TODO: save/restore the PGN history of unfinished games */
791 /* I don't like configscreens, start game inmediatly */
796 rb
->splash ( HZ
*3 , "Checkmate!" );
797 rb
->button_get(true);
798 pgn_store_game(game
);
799 GNUChess_Initialize();
800 game
= pgn_init_game();
803 command
= cb_getcommand ();
804 switch (command
.type
) {
806 if ( ! VerifyMove (opponent
, command
.mv_s
, 0 , &command
.mv
, move_buffer
) ) {
807 rb
->splash ( HZ
/2 , "Illegal move!" );
812 /* Add the ply to the PGN history (in algebraic notation) */
813 pgn_append_ply(game
, opponent
, move_buffer
, mate
);
815 rb
->splash ( 0 , "Thinking..." );
816 #ifdef HAVE_ADJUSTABLE_CPU_FREQ
817 rb
->cpu_boost ( true );
819 SelectMove ( computer
, 0 , cb_wt_callback
, move_buffer
);
820 #ifdef HAVE_ADJUSTABLE_CPU_FREQ
821 rb
->cpu_boost ( false );
823 /* Add the ply to the PGN history (in algebraic notation) and check
824 * for the result of the game which is only calculated in SelectMove
826 if (move_buffer
[0] != '\0'){
827 pgn_append_ply(game
, computer
, move_buffer
, mate
);
829 pgn_set_result(game
, mate
);
832 if ( wt_command
== COMMAND_QUIT
) {
839 #ifdef COMMAND_RESTART
840 case COMMAND_RESTART
:
841 GNUChess_Initialize();
842 game
= pgn_init_game();
853 case COMMAND_RESTORE
:
854 /* watch out, it will reset the game if no previous game was saved! */
857 GNUChess_Initialize();
859 /* init PGN history data structures */
860 game
= pgn_init_game();
862 /* restore saved position, if saved */
863 cb_restoreposition();
868 if (opponent
== white
) {
875 rb
->splash ( 0 , "Thinking..." );
877 #ifdef HAVE_ADJUSTABLE_CPU_FREQ
878 rb
->cpu_boost ( true );
880 SelectMove ( computer
, 0 , cb_wt_callback
, move_buffer
);
881 #ifdef HAVE_ADJUSTABLE_CPU_FREQ
882 rb
->cpu_boost ( false );
885 /* Add the ply to the PGN history (in algebraic notation) and check
886 * for the result of the game which is only calculated in SelectMove
888 if (move_buffer
[0] != '\0'){
889 pgn_append_ply(game
, computer
, move_buffer
, mate
);
891 pgn_set_result(game
, mate
);
894 if ( wt_command
== COMMAND_QUIT
) {
911 /* TODO: save/restore the PGN history of unfinished games */
912 rb
->lcd_setfont(FONT_UI
);
916 /*****************************************************************************
917 * plugin entry point.
918 ******************************************************************************/
919 enum plugin_status
plugin_start(const void* parameter
) {
924 rb
->lcd_set_backdrop(NULL
);
927 /* end of plugin init */
929 /* if the plugin was invoked as a viewer, parse the file and show the game list
930 * else, start playing a game
932 if (parameter
!= NULL
) {
933 cb_start_viewer((char *)parameter
);
941 #endif /* HAVE_LCD_BITMAP */