--- previous/src/statusbar.c 2018/04/24 19:25:10 1.1 +++ previous/src/statusbar.c 2018/04/24 19:27:29 1.1.1.3 @@ -38,6 +38,7 @@ const char Statusbar_fileid[] = "Hatari #include "screenSnapShot.h" #include "sdlgui.h" #include "statusbar.h" +#include "screen.h" #include "video.h" #include "avi_record.h" @@ -81,7 +82,7 @@ static Uint32 LedColorOn, LedColorOff, R static Uint32 GrayBg, LedColorBg; -#define MAX_MESSAGE_LEN 33 +#define MAX_MESSAGE_LEN 50 typedef struct msg_item { struct msg_item *next; char msg[MAX_MESSAGE_LEN+1]; @@ -171,6 +172,16 @@ void Statusbar_SetFloppyLed(drive_index_ Led[drive].state = state; } +/*-----------------------------------------------------------------------*/ +/** + * Set scr2 led state, anything enabling led with this + * needs also to take care of disabling it. + */ +void Statusbar_SetSCR2Led(bool state) +{ + bOldRecording = state; +} + /*-----------------------------------------------------------------------*/ /** @@ -313,7 +324,7 @@ void Statusbar_Init(SDL_Surface *surf) RecLedRect = LedRect; RecLedRect.x = surf->w - fontw - RecLedRect.w; ledbox.x = RecLedRect.x - 1; - SDLGui_Text(ledbox.x - 4*fontw - fontw/2, MessageRect.y, "REC:"); + SDLGui_Text(ledbox.x - 4*fontw - fontw/2, MessageRect.y, "LED:"); SDL_FillRect(surf, &ledbox, LedColorBg); SDL_FillRect(surf, &RecLedRect, RecColorOff); bOldRecording = false; @@ -384,32 +395,53 @@ void Statusbar_UpdateInfo(void) /* CPU type */ if(ConfigureParams.System.nCpuLevel > 0) { + *end++ = '6'; + *end++ = '8'; *end++ = '0'; - *end++ = '0' + ConfigureParams.System.nCpuLevel % 10; + switch (ConfigureParams.System.nCpuLevel) { + case 0: *end++ = '0'; break; + case 1: *end++ = '1'; break; + case 2: *end++ = '2'; break; + case 3: *end++ = '3'; break; + case 4: *end++ = '4'; break; + case 5: *end++ = '6'; break; + default: break; + } *end++ = '0'; *end++ = '/'; } /* amount of memory */ - if (ConfigureParams.Memory.nMemorySize > 9) { - *end++ = '1'; - *end++ = '0' + ConfigureParams.Memory.nMemorySize % 10; - } else { - if (ConfigureParams.Memory.nMemorySize) { - *end++ = '0' + ConfigureParams.Memory.nMemorySize; - } else { - end = Statusbar_AddString(end, "1/2"); - } - } - end = Statusbar_AddString(end, "MB "); + char memsize[8]; + sprintf(memsize, "%iMB/", Configuration_CheckMemory(ConfigureParams.Memory.nMemoryBankSize)); + end = Statusbar_AddString(end, memsize); /* machine type */ - end = Statusbar_AddString(end, "NEXT"); + switch (ConfigureParams.System.nMachineType) { + case NEXT_CUBE030: + end = Statusbar_AddString(end, "NeXT Computer"); + break; + case NEXT_CUBE040: + end = Statusbar_AddString(end, "NeXTcube"); + break; + case NEXT_STATION: + end = Statusbar_AddString(end, "NeXTstation"); + break; + + default: + break; + } + if (ConfigureParams.System.bTurbo) + end = Statusbar_AddString(end, " Turbo"); + + if (ConfigureParams.System.bColor) + end = Statusbar_AddString(end, " Color"); *end = '\0'; assert(end - DefaultMessage.msg < MAX_MESSAGE_LEN); DEBUGPRINT(("Set default message: '%s'\n", DefaultMessage.msg)); + /* make sure default message gets (re-)drawn when next checked */ DefaultMessage.shown = false; } @@ -441,7 +473,7 @@ static void Statusbar_ShowMessage(SDL_Su if (MessageList->shown) { if (!MessageList->expire) { - /* last/default message */ + /* last/default message never expires */ return; } if (MessageList->expire > ticks) { @@ -617,5 +649,13 @@ void Statusbar_Update(SDL_Surface *surf) Statusbar_ShowMessage(surf, currentticks); - + /* Draw scr2 LED */ + if (bOldRecording) { + color = RecColorOn; + } else { + color = RecColorOff; + } + SDL_FillRect(surf, &RecLedRect, color); + SDL_UpdateRects(surf, 1, &RecLedRect); + DEBUGPRINT(("SCR2 LED = ON\n")); }