|
|
1.1 root 1: /*
2: Hatari - statusbar.c
3:
4: This file is distributed under the GNU Public License, version 2 or at
5: your option any later version. Read the file gpl.txt for details.
6:
7: Code to draw statusbar area, floppy leds etc.
1.1.1.3 root 8:
1.1 root 9: Use like this:
10: - Before screen surface is (re-)created Statusbar_SetHeight()
11: has to be called with the new screen height. Add the returned
12: value to screen height (zero means no statusbar). After this,
13: Statusbar_GetHeight() can be used to retrieve the statusbar size
14: - After screen surface is (re-)created, call Statusbar_Init()
15: to re-initialize / re-draw the statusbar
16: - Call Statusbar_SetFloppyLed() to set floppy drive led ON/OFF,
17: or call Statusbar_EnableHDLed() to enabled HD led for a while
18: - Whenever screen is redrawn, call Statusbar_Update() to draw the
19: updated information to the statusbar (outside of screen locking)
20: - If screen redraws may be partial, Statusbar_OverlayRestore()
21: needs to be called before locking the screen for drawing and
22: Statusbar_OverlayBackup() needs to be called after screen unlocking,
23: but before calling Statusbar_Update(). These are needed for
24: hiding the overlay drive led when drive leds are turned OFF.
25: - If other information shown by Statusbar (TOS version etc) changes,
26: call Statusbar_UpdateInfo()
27:
28: TODO:
29: - re-calculate colors on each update to make sure they're
30: correct in Falcon & TT 8-bit palette modes?
31: - call Statusbar_AddMessage() from log.c?
32: */
1.1.1.3 root 33: const char Statusbar_fileid[] = "Hatari statusbar.c : " __DATE__ " " __TIME__;
1.1 root 34:
35: #include <assert.h>
36: #include "main.h"
37: #include "configuration.h"
38: #include "screenSnapShot.h"
39: #include "sdlgui.h"
40: #include "statusbar.h"
41: #include "tos.h"
42: #include "video.h"
43: #include "wavFormat.h"
44: #include "ymFormat.h"
1.1.1.4 ! root 45: #include "avi_record.h"
1.1 root 46:
47: #define DEBUG 0
48: #if DEBUG
49: #define DEBUGPRINT(x) printf x
50: #else
51: #define DEBUGPRINT(x)
52: #endif
53:
54: #define MAX_DRIVE_LEDS (DRIVE_LED_HD + 1)
55:
56: /* whether drive leds should be ON and their previous shown state */
57: static struct {
58: bool state;
59: bool oldstate;
60: Uint32 expire; /* when to disable led, valid only if >0 && state=TRUE */
61: int offset; /* led x-pos on screen */
62: } Led[MAX_DRIVE_LEDS];
63:
64: /* drive leds size & y-pos */
65: static SDL_Rect LedRect;
66:
67: /* overlay led size & pos */
68: static SDL_Rect OverlayLedRect;
69:
70: /* screen contents left under overlay led */
71: static SDL_Surface *OverlayUnderside;
72:
73: static enum {
74: OVERLAY_NONE,
75: OVERLAY_DRAWN,
76: OVERLAY_RESTORED
77: } bOverlayState;
78:
79: static SDL_Rect RecLedRect;
80: static bool bOldRecording;
81:
82: /* led colors */
83: static Uint32 LedColorOn, LedColorOff, RecColorOn, RecColorOff;
84: static Uint32 GrayBg, LedColorBg;
85:
86:
1.1.1.4 ! root 87: #define MAX_MESSAGE_LEN 33
1.1 root 88: typedef struct msg_item {
89: struct msg_item *next;
90: char msg[MAX_MESSAGE_LEN+1];
91: Uint32 timeout; /* msecs, zero=no timeout */
92: Uint32 expire; /* when to expire message */
93: bool shown;
94: } msg_item_t;
95:
96: static msg_item_t DefaultMessage;
97: static msg_item_t *MessageList = &DefaultMessage;
98: static SDL_Rect MessageRect;
99:
1.1.1.4 ! root 100: /* rect for both frame skip value and fast forward indicator */
1.1 root 101: static SDL_Rect FrameSkipsRect;
102: static int nOldFrameSkips;
1.1.1.4 ! root 103: static int bOldFastForward;
1.1 root 104:
105:
106: /* screen height above statusbar and height of statusbar below screen */
107: static int ScreenHeight;
108: static int StatusbarHeight;
109:
110:
111: /*-----------------------------------------------------------------------*/
112: /**
1.1.1.4 ! root 113: * Return statusbar height for given width and height
1.1 root 114: */
1.1.1.4 ! root 115: int Statusbar_GetHeightForSize(int width, int height)
1.1 root 116: {
117: if (ConfigureParams.Screen.bShowStatusbar) {
118: /* Should check the same thing as SDLGui_SetScreen()
119: * does to decide the font size.
120: */
1.1.1.3 root 121: if (width >= 640 && height >= (400-24)) {
1.1.1.4 ! root 122: return 24;
1.1 root 123: } else {
1.1.1.4 ! root 124: return 12;
1.1 root 125: }
126: }
1.1.1.4 ! root 127: return 0;
! 128: }
! 129:
! 130: /*-----------------------------------------------------------------------*/
! 131: /**
! 132: * Set screen height used for statusbar height calculation.
! 133: *
! 134: * Return height of statusbar that should be added to the screen
! 135: * height when screen is (re-)created, or zero if statusbar will
! 136: * not be shown
! 137: */
! 138: int Statusbar_SetHeight(int width, int height)
! 139: {
! 140: ScreenHeight = height;
! 141: StatusbarHeight = Statusbar_GetHeightForSize(width, height);
1.1 root 142: return StatusbarHeight;
143: }
144:
145: /*-----------------------------------------------------------------------*/
146: /**
147: * Return height of statusbar set with Statusbar_SetHeight()
148: */
149: int Statusbar_GetHeight(void)
150: {
151: return StatusbarHeight;
152: }
153:
154:
155: /*-----------------------------------------------------------------------*/
156: /**
157: * Enable HD drive led, it will be automatically disabled after a while.
158: */
159: void Statusbar_EnableHDLed(void)
160: {
161: /* leds are shown for 1/2 sec after enabling */
162: Led[DRIVE_LED_HD].expire = SDL_GetTicks() + 1000/2;
1.1.1.3 root 163: Led[DRIVE_LED_HD].state = true;
1.1 root 164: }
165:
166: /*-----------------------------------------------------------------------*/
167: /**
168: * Set given floppy drive led state, anything enabling led with this
169: * needs also to take care of disabling it.
170: */
171: void Statusbar_SetFloppyLed(drive_index_t drive, bool state)
172: {
173: assert(drive == DRIVE_LED_A || drive == DRIVE_LED_B);
174: Led[drive].state = state;
175: }
176:
177:
178: /*-----------------------------------------------------------------------*/
179: /**
180: * Set overlay led size/pos on given screen to internal Rect
181: * and free previous resources.
182: */
183: static void Statusbar_OverlayInit(const SDL_Surface *surf)
184: {
185: int h;
186: /* led size/pos needs to be re-calculated in case screen changed */
187: h = surf->h / 50;
188: OverlayLedRect.w = 2*h;
189: OverlayLedRect.h = h;
190: OverlayLedRect.x = surf->w - 5*h/2;
191: OverlayLedRect.y = h/2;
192: /* free previous restore surface if it's incompatible */
193: if (OverlayUnderside &&
194: OverlayUnderside->w == OverlayLedRect.w &&
195: OverlayUnderside->h == OverlayLedRect.h &&
196: OverlayUnderside->format->BitsPerPixel == surf->format->BitsPerPixel) {
197: SDL_FreeSurface(OverlayUnderside);
198: OverlayUnderside = NULL;
199: }
200: bOverlayState = OVERLAY_NONE;
201: }
202:
203: /*-----------------------------------------------------------------------*/
204: /**
205: * (re-)initialize statusbar internal variables for given screen surface
206: * (sizes&colors may need to be re-calculated for the new SDL surface)
207: * and draw the statusbar background.
208: */
209: void Statusbar_Init(SDL_Surface *surf)
210: {
211: msg_item_t *item;
212: SDL_Rect ledbox, sbarbox;
213: int i, fontw, fonth, offset;
214: const char *text[MAX_DRIVE_LEDS] = { "A:", "B:", "HD:" };
215:
216: assert(surf);
217:
218: /* dark green and light green for leds themselves */
219: LedColorOff = SDL_MapRGB(surf->format, 0x00, 0x40, 0x00);
220: LedColorOn = SDL_MapRGB(surf->format, 0x00, 0xe0, 0x00);
221: LedColorBg = SDL_MapRGB(surf->format, 0x00, 0x00, 0x00);
222: RecColorOff = SDL_MapRGB(surf->format, 0x40, 0x00, 0x00);
223: RecColorOn = SDL_MapRGB(surf->format, 0xe0, 0x00, 0x00);
224: GrayBg = SDL_MapRGB(surf->format, 0xc0, 0xc0, 0xc0);
225:
226: /* disable leds */
227: for (i = 0; i < MAX_DRIVE_LEDS; i++) {
1.1.1.3 root 228: Led[i].state = Led[i].oldstate = false;
1.1 root 229: Led[i].expire = 0;
230: }
231: Statusbar_OverlayInit(surf);
232:
233: /* disable statusbar if it doesn't fit to video mode */
234: if (surf->h < ScreenHeight + StatusbarHeight) {
235: StatusbarHeight = 0;
236: }
237: if (!StatusbarHeight) {
238: return;
239: }
240:
241: /* prepare fonts */
242: SDLGui_Init();
243: SDLGui_SetScreen(surf);
244: SDLGui_GetFontSize(&fontw, &fonth);
245:
246: /* video mode didn't match, need to recalculate sizes */
247: if (surf->h > ScreenHeight + StatusbarHeight) {
248: StatusbarHeight = fonth + 2;
249: /* actually statusbar vertical offset */
250: ScreenHeight = surf->h - StatusbarHeight;
251: } else {
252: assert(fonth+2 < StatusbarHeight);
253: }
254:
255: /* draw statusbar background gray so that text shows */
256: sbarbox.x = 0;
257: sbarbox.y = surf->h - StatusbarHeight;
258: sbarbox.w = surf->w;
259: sbarbox.h = StatusbarHeight;
260: SDL_FillRect(surf, &sbarbox, GrayBg);
261:
262: /* led size */
1.1.1.4 ! root 263: LedRect.w = fonth/2;
1.1 root 264: LedRect.h = fonth - 4;
265: LedRect.y = ScreenHeight + StatusbarHeight/2 - LedRect.h/2;
1.1.1.4 ! root 266:
1.1 root 267: /* black box for the leds */
268: ledbox = LedRect;
269: ledbox.y -= 1;
270: ledbox.w += 2;
271: ledbox.h += 2;
272:
273: offset = fontw;
274: MessageRect.y = LedRect.y - 2;
275: /* draw led texts and boxes + calculate box offsets */
276: for (i = 0; i < MAX_DRIVE_LEDS; i++) {
277: SDLGui_Text(offset, MessageRect.y, text[i]);
278: offset += strlen(text[i]) * fontw;
279: offset += fontw/2;
280:
281: ledbox.x = offset - 1;
282: SDL_FillRect(surf, &ledbox, LedColorBg);
283:
284: LedRect.x = offset;
285: SDL_FillRect(surf, &LedRect, LedColorOff);
286:
287: Led[i].offset = offset;
1.1.1.4 ! root 288: offset += LedRect.w + fontw;
1.1 root 289: }
290:
291: /* draw frameskip */
292: FrameSkipsRect.x = offset;
293: FrameSkipsRect.y = MessageRect.y;
294: SDLGui_Text(FrameSkipsRect.x, FrameSkipsRect.y, "FS:");
295: FrameSkipsRect.x += 3 * fontw + fontw/2;
1.1.1.4 ! root 296: FrameSkipsRect.w = 4 * fontw;
1.1 root 297: FrameSkipsRect.h = fonth;
1.1.1.4 ! root 298:
! 299: if(ConfigureParams.System.bFastForward) {
! 300: SDLGui_Text(FrameSkipsRect.x, FrameSkipsRect.y, "0 >>");
! 301: } else {
! 302: SDLGui_Text(FrameSkipsRect.x, FrameSkipsRect.y, "0");
! 303: }
! 304:
1.1 root 305: nOldFrameSkips = 0;
1.1.1.4 ! root 306:
1.1 root 307: /* intialize messages */
1.1.1.4 ! root 308: MessageRect.x = FrameSkipsRect.x + FrameSkipsRect.w + fontw;
1.1 root 309: MessageRect.w = MAX_MESSAGE_LEN * fontw;
310: MessageRect.h = fonth;
311: for (item = MessageList; item; item = item->next) {
1.1.1.3 root 312: item->shown = false;
1.1 root 313: }
314:
315: /* draw recording led box */
316: RecLedRect = LedRect;
317: RecLedRect.x = surf->w - fontw - RecLedRect.w;
318: ledbox.x = RecLedRect.x - 1;
319: SDLGui_Text(ledbox.x - 4*fontw - fontw/2, MessageRect.y, "REC:");
320: SDL_FillRect(surf, &ledbox, LedColorBg);
321: SDL_FillRect(surf, &RecLedRect, RecColorOff);
1.1.1.3 root 322: bOldRecording = false;
1.1 root 323:
324: /* and blit statusbar on screen */
325: SDL_UpdateRects(surf, 1, &sbarbox);
326: DEBUGPRINT(("Draw statusbar\n"));
327: }
328:
329:
330: /*-----------------------------------------------------------------------*/
331: /**
332: * Qeueue new statusbar message 'msg' to be shown for 'msecs' milliseconds
333: */
334: void Statusbar_AddMessage(const char *msg, Uint32 msecs)
335: {
336: msg_item_t *item;
337:
338: if (!ConfigureParams.Screen.bShowStatusbar) {
339: /* no sense in queuing messages that aren't shown */
340: return;
341: }
342: item = calloc(1, sizeof(msg_item_t));
343: assert(item);
344:
345: item->next = MessageList;
346: MessageList = item;
347:
348: strncpy(item->msg, msg, MAX_MESSAGE_LEN);
349: item->msg[MAX_MESSAGE_LEN] = '\0';
350: DEBUGPRINT(("Add message: '%s'\n", item->msg));
351:
352: if (msecs) {
353: item->timeout = msecs;
354: } else {
355: /* show items by default for 2.5 secs */
356: item->timeout = 2500;
357: }
1.1.1.3 root 358: item->shown = false;
1.1 root 359: }
360:
361: /*-----------------------------------------------------------------------*/
362: /**
363: * Write given 'more' string to 'buffer' and return new end of 'buffer'
364: */
365: static char *Statusbar_AddString(char *buffer, const char *more)
366: {
367: while(*more) {
368: *buffer++ = *more++;
369: }
370: return buffer;
371: }
372:
373: /*-----------------------------------------------------------------------*/
374: /**
375: * Retrieve/update default statusbar information
376: */
377: void Statusbar_UpdateInfo(void)
378: {
379: char *end = DefaultMessage.msg;
380:
1.1.1.4 ! root 381: /* CPU MHz */
! 382: if (ConfigureParams.System.nCpuFreq > 9) {
! 383: *end++ = '0' + ConfigureParams.System.nCpuFreq / 10;
! 384: }
! 385: *end++ = '0' + ConfigureParams.System.nCpuFreq % 10;
! 386: end = Statusbar_AddString(end, "MHz/");
! 387:
! 388: /* CPU type */
! 389: if(ConfigureParams.System.nCpuLevel > 0) {
! 390: *end++ = '0';
! 391: *end++ = '0' + ConfigureParams.System.nCpuLevel % 10;
! 392: *end++ = '0';
! 393: *end++ = '/';
! 394: }
! 395:
1.1 root 396: /* amount of memory */
397: if (ConfigureParams.Memory.nMemorySize > 9) {
398: *end++ = '1';
399: *end++ = '0' + ConfigureParams.Memory.nMemorySize % 10;
400: } else {
401: if (ConfigureParams.Memory.nMemorySize) {
402: *end++ = '0' + ConfigureParams.Memory.nMemorySize;
403: } else {
404: end = Statusbar_AddString(end, "1/2");
405: }
406: }
407: end = Statusbar_AddString(end, "MB ");
1.1.1.4 ! root 408:
1.1 root 409: /* machine type */
410: switch (ConfigureParams.System.nMachineType) {
411: case MACHINE_ST:
412: end = Statusbar_AddString(end, "ST");
413: break;
414: case MACHINE_STE:
415: end = Statusbar_AddString(end, "STE");
416: break;
417: case MACHINE_TT:
418: end = Statusbar_AddString(end, "TT");
419: break;
420: case MACHINE_FALCON:
421: end = Statusbar_AddString(end, "Falcon");
422: break;
423: default:
424: end = Statusbar_AddString(end, "???");
425: break;
426: }
427:
428: /* TOS type/version */
429: if (bIsEmuTOS) {
430: end = Statusbar_AddString(end, ", EmuTOS");
431: } else {
432: end = Statusbar_AddString(end, ", TOS v");
433: *end++ = '0' + ((TosVersion & 0xf00) >> 8);
434: *end++ = '.';
435: *end++ = '0' + ((TosVersion & 0xf0) >> 4);
436: *end++ = '0' + (TosVersion & 0xf);
437: }
438: *end = '\0';
1.1.1.4 ! root 439:
1.1 root 440: assert(end - DefaultMessage.msg < MAX_MESSAGE_LEN);
441: DEBUGPRINT(("Set default message: '%s'\n", DefaultMessage.msg));
1.1.1.3 root 442: DefaultMessage.shown = false;
1.1 root 443: }
444:
445: /*-----------------------------------------------------------------------*/
446: /**
447: * Draw 'msg' centered to the message area
448: */
449: static void Statusbar_DrawMessage(SDL_Surface *surf, const char *msg)
450: {
451: int fontw, fonth, offset;
452: SDL_FillRect(surf, &MessageRect, GrayBg);
453: if (*msg) {
454: SDLGui_GetFontSize(&fontw, &fonth);
455: offset = (MessageRect.w - strlen(msg) * fontw) / 2;
456: SDLGui_Text(MessageRect.x + offset, MessageRect.y, msg);
457: }
458: SDL_UpdateRects(surf, 1, &MessageRect);
459: DEBUGPRINT(("Draw message: '%s'\n", msg));
460: }
461:
462: /*-----------------------------------------------------------------------*/
463: /**
464: * If message's not shown, show it. If message's timed out,
465: * remove it and show next one.
466: */
467: static void Statusbar_ShowMessage(SDL_Surface *surf, Uint32 ticks)
468: {
469: msg_item_t *next;
470:
471: if (MessageList->shown) {
472: if (!MessageList->expire) {
473: /* last/default message */
474: return;
475: }
476: if (MessageList->expire > ticks) {
477: /* not timed out yet */
478: return;
479: }
480: assert(MessageList->next); /* last message shouldn't end here */
481: next = MessageList->next;
482: free(MessageList);
483: MessageList = next;
484: /* make sure next message gets shown */
1.1.1.3 root 485: MessageList->shown = false;
1.1 root 486: }
487: if (!MessageList->shown) {
488: /* not shown yet, show */
489: Statusbar_DrawMessage(surf, MessageList->msg);
490: if (MessageList->timeout && !MessageList->expire) {
491: MessageList->expire = ticks + MessageList->timeout;
492: }
1.1.1.3 root 493: MessageList->shown = true;
1.1 root 494: }
495: }
496:
497:
498: /*-----------------------------------------------------------------------*/
499: /**
500: * Save the area that will be left under overlay led
501: */
502: void Statusbar_OverlayBackup(SDL_Surface *surf)
503: {
1.1.1.3 root 504: if ((StatusbarHeight && ConfigureParams.Screen.bShowStatusbar)
505: || !ConfigureParams.Screen.bShowDriveLed) {
1.1 root 506: /* overlay not used with statusbar */
507: return;
508: }
509: assert(surf);
510: if (!OverlayUnderside) {
511: SDL_Surface *bak;
512: SDL_PixelFormat *fmt = surf->format;
513: bak = SDL_CreateRGBSurface(surf->flags,
514: OverlayLedRect.w, OverlayLedRect.h,
515: fmt->BitsPerPixel,
516: fmt->Rmask, fmt->Gmask, fmt->Bmask,
517: fmt->Amask);
518: assert(bak);
519: OverlayUnderside = bak;
520: }
521: SDL_BlitSurface(surf, &OverlayLedRect, OverlayUnderside, NULL);
522: }
523:
524: /*-----------------------------------------------------------------------*/
525: /**
526: * Restore the area left under overlay led
527: */
528: void Statusbar_OverlayRestore(SDL_Surface *surf)
529: {
1.1.1.3 root 530: if ((StatusbarHeight && ConfigureParams.Screen.bShowStatusbar)
531: || !ConfigureParams.Screen.bShowDriveLed) {
1.1 root 532: /* overlay not used with statusbar */
533: return;
534: }
535: if (bOverlayState == OVERLAY_DRAWN && OverlayUnderside) {
536: assert(surf);
537: SDL_BlitSurface(OverlayUnderside, NULL, surf, &OverlayLedRect);
538: /* this will make the draw function to update this the screen */
539: bOverlayState = OVERLAY_RESTORED;
540: }
541: }
542:
543: /*-----------------------------------------------------------------------*/
544: /**
545: * Draw overlay led
546: */
547: static void Statusbar_OverlayDrawLed(SDL_Surface *surf, Uint32 color)
548: {
549: SDL_Rect rect;
550: if (bOverlayState == OVERLAY_DRAWN) {
551: /* some led already drawn */
552: return;
553: }
554: bOverlayState = OVERLAY_DRAWN;
555:
556: /* enabled led with border */
557: rect = OverlayLedRect;
558: rect.x += 1;
559: rect.y += 1;
560: rect.w -= 2;
561: rect.h -= 2;
562: SDL_FillRect(surf, &OverlayLedRect, LedColorBg);
563: SDL_FillRect(surf, &rect, color);
564: }
565:
566: /*-----------------------------------------------------------------------*/
567: /**
568: * Draw overlay led onto screen surface if any drives are enabled.
569: */
570: static void Statusbar_OverlayDraw(SDL_Surface *surf)
571: {
572: Uint32 currentticks = SDL_GetTicks();
573: int i;
574:
575: assert(surf);
1.1.1.4 ! root 576: if (bRecordingYM || bRecordingWav || bRecordingAvi) {
1.1 root 577: Statusbar_OverlayDrawLed(surf, RecColorOn);
578: }
579: for (i = 0; i < MAX_DRIVE_LEDS; i++) {
580: if (Led[i].state) {
581: if (Led[i].expire && Led[i].expire < currentticks) {
1.1.1.3 root 582: Led[i].state = false;
1.1 root 583: continue;
584: }
585: Statusbar_OverlayDrawLed(surf, LedColorOn);
586: break;
587: }
588: }
589: /* possible state transitions:
590: * NONE -> DRAWN -> RESTORED -> DRAWN -> RESTORED -> NONE
591: * Other than NONE state needs to be updated on screen
592: */
593: switch (bOverlayState) {
594: case OVERLAY_RESTORED:
595: bOverlayState = OVERLAY_NONE;
596: case OVERLAY_DRAWN:
597: SDL_UpdateRects(surf, 1, &OverlayLedRect);
598: DEBUGPRINT(("Overlay LED = %s\n", bOverlayState==OVERLAY_DRAWN?"ON":"OFF"));
599: break;
600: case OVERLAY_NONE:
601: break;
602: }
603: }
604:
605:
606: /*-----------------------------------------------------------------------*/
607: /**
608: * Update statusbar information (leds etc) if/when needed.
609: *
610: * May not be called when screen is locked (SDL limitation).
611: */
612: void Statusbar_Update(SDL_Surface *surf)
613: {
614: Uint32 color, currentticks;
615: SDL_Rect rect;
616: int i;
617:
618: if (!(StatusbarHeight && ConfigureParams.Screen.bShowStatusbar)) {
619: /* not enabled (anymore), show overlay led instead? */
620: if (ConfigureParams.Screen.bShowDriveLed) {
621: Statusbar_OverlayDraw(surf);
622: }
623: return;
624: }
625: assert(surf);
626: /* Statusbar_Init() not called before this? */
627: assert(surf->h == ScreenHeight + StatusbarHeight);
628:
629: rect = LedRect;
630: currentticks = SDL_GetTicks();
631: for (i = 0; i < MAX_DRIVE_LEDS; i++) {
632: if (Led[i].expire && Led[i].expire < currentticks) {
1.1.1.3 root 633: Led[i].state = false;
1.1 root 634: }
635: if (Led[i].state == Led[i].oldstate) {
636: continue;
637: }
638: Led[i].oldstate = Led[i].state;
639: if (Led[i].state) {
640: color = LedColorOn;
641: } else {
642: color = LedColorOff;
643: }
644: rect.x = Led[i].offset;
645: SDL_FillRect(surf, &rect, color);
646: SDL_UpdateRects(surf, 1, &rect);
647: DEBUGPRINT(("LED[%d] = %s\n", i, Led[i].state?"ON":"OFF"));
648: }
1.1.1.4 ! root 649:
1.1 root 650: Statusbar_ShowMessage(surf, currentticks);
651:
1.1.1.4 ! root 652: if (nOldFrameSkips != nFrameSkips ||
! 653: bOldFastForward != ConfigureParams.System.bFastForward) {
! 654: char fscount[5];
! 655: int end = 2;
! 656:
1.1.1.3 root 657: if (nFrameSkips < 10)
658: fscount[0] = '0' + nFrameSkips;
659: else
660: fscount[0] = 'X';
1.1.1.4 ! root 661: fscount[1] = ' ';
! 662: if(ConfigureParams.System.bFastForward) {
! 663: fscount[2] = '>';
! 664: fscount[3] = '>';
! 665: end = 4;
! 666: }
! 667: fscount[end] = '\0';
! 668:
1.1 root 669: SDL_FillRect(surf, &FrameSkipsRect, GrayBg);
670: SDLGui_Text(FrameSkipsRect.x, FrameSkipsRect.y, fscount);
671: SDL_UpdateRects(surf, 1, &FrameSkipsRect);
672: DEBUGPRINT(("FS = %s\n", fscount));
673: nOldFrameSkips = nFrameSkips;
1.1.1.4 ! root 674: bOldFastForward = ConfigureParams.System.bFastForward;
1.1 root 675: }
676:
1.1.1.4 ! root 677: if ((bRecordingYM || bRecordingWav || bRecordingAvi)
1.1 root 678: != bOldRecording) {
679: bOldRecording = !bOldRecording;
680: if (bOldRecording) {
681: color = RecColorOn;
682: } else {
683: color = RecColorOff;
684: }
685: SDL_FillRect(surf, &RecLedRect, color);
686: SDL_UpdateRects(surf, 1, &RecLedRect);
687: DEBUGPRINT(("REC = ON\n"));
688: }
689: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.