static void reset_drive_gui (int num)
{
- gui_data.drive_disabled[num] = 0;
- gui_data.df[num][0] = 0;
- gui_data.crc32[num] = 0;
+ struct gui_info_drive *gid = &gui_data.drives[num];
+ gid->drive_disabled = 0;
+ gid->df[0] = 0;
+ gid->crc32 = 0;
if (currprefs.floppyslots[num].dfxtype < 0)
- gui_data.drive_disabled[num] = 1;
+ gid->drive_disabled = 1;
}
static void setamax (void)
return type == DRV_PC_525_ONLY_40 || type == DRV_PC_35_ONLY_80 || type == DRV_PC_525_40_80;
}
+static bool drive_writeprotected(drive *drv)
+{
+#ifdef CATWEASEL
+ if (drv->catweasel)
+ return 1;
+#endif
+ return currprefs.floppy_read_only || drv->wrprot || drv->forcedwrprot || drv->diskfile == NULL;
+}
+
static void reset_drive (int num)
{
drive *drv = &floppy[num];
{
drive *drv = floppy + num;
bool writ = dskdmaen == DSKDMA_WRITE && drv->state && !((selected | disabled) & (1 << num));
+ struct gui_info_drive *gid = &gui_data.drives[num];
- if (!force && drv->state == gui_data.drive_motor[num]
- && drv->cyl == gui_data.drive_track[num]
+ if (!force && drv->state == gid->drive_motor
+ && drv->cyl == gid->drive_track
&& side == gui_data.drive_side
- && drv->crc32 == gui_data.crc32[num]
- && writ == gui_data.drive_writing[num]
- && !_tcscmp (gui_data.df[num], currprefs.floppyslots[num].df))
+ && drv->crc32 == gid->crc32
+ && writ == gid->drive_writing
+ && drive_writeprotected(drv) == gid->floppy_protected
+ && !_tcscmp (gid->df, currprefs.floppyslots[num].df))
return;
- _tcscpy (gui_data.df[num], currprefs.floppyslots[num].df);
- gui_data.crc32[num] = drv->crc32;
- gui_data.drive_motor[num] = drv->state;
- gui_data.drive_track[num] = drv->cyl;
+ _tcscpy (gid->df, currprefs.floppyslots[num].df);
+ gid->crc32 = drv->crc32;
+ gid->drive_motor = drv->state;
+ gid->drive_track = drv->cyl;
if (reserved & (1 << num))
gui_data.drive_side = reserved_side;
else
gui_data.drive_side = side;
- gui_data.drive_writing[num] = writ;
- //write_log(_T("%d %d\n"), num, (gui_data.drive_motor[num] ? 1 : 0) | (gui_data.drive_writing[num] ? 2 : 0));
- gui_led (num + LED_DF0, (gui_data.drive_motor[num] ? 1 : 0) | (gui_data.drive_writing[num] ? 2 : 0), -1);
+ gid->drive_writing = writ;
+ gid->floppy_protected = drive_writeprotected(drv);
+ gui_led (num + LED_DF0, (gid->drive_motor ? 1 : 0) | (gid->drive_writing ? 2 : 0), -1);
}
static void drive_fill_bigbuf (drive * drv,int);
return drv->cyl == 0;
}
-static int drive_writeprotected (drive * drv)
-{
-#ifdef CATWEASEL
- if (drv->catweasel)
- return 1;
-#endif
- //write_log(_T("df%d: %d %d %d %x %s\n"), drv-&floppy[0],currprefs.floppy_read_only, drv->wrprot, drv->forcedwrprot, drv->diskfile, drv->diskfile ? zfile_getname(drv->diskfile) : _T("none"));
- return currprefs.floppy_read_only || drv->wrprot || drv->forcedwrprot || drv->diskfile == NULL;
-}
-
static int drive_running (drive * drv)
{
return !drv->motoroff;
#define LED_NET 11
#define LED_MAX 12
+struct gui_info_drive {
+ bool drive_motor; /* motor on off */
+ uae_u8 drive_track; /* rw-head track */
+ bool drive_writing; /* drive is writing */
+ bool drive_disabled; /* drive is disabled */
+ TCHAR df[256]; /* inserted image */
+ uae_u32 crc32; /* crc32 of image */
+ bool floppy_protected; /* image is write protected */
+};
+
struct gui_info
{
- bool drive_motor[4]; /* motor on off */
- uae_u8 drive_track[4]; /* rw-head track */
- bool drive_writing[4]; /* drive is writing */
- bool drive_disabled[4]; /* drive is disabled */
bool powerled; /* state of power led */
uae_u8 powerled_brightness; /* 0 to 255 */
uae_s8 drive_side; /* floppy side */
int fps_color;
int sndbuf, sndbuf_status;
bool sndbuf_avail;
- TCHAR df[4][256]; /* inserted image */
- uae_u32 crc32[4]; /* crc32 of image */
+ struct gui_info_drive drives[4];
};
#define NUM_LEDS (LED_MAX)
#define VISIBLE_LEDS (LED_MAX - 1)
if (led >= 1 && led <= 4) {
x = 23 + (led - 1) * 40;
y = 17;
- track = gui_data.drive_track[led - 1];
- if (gui_data.drive_disabled[led - 1]) {
+ track = gui_data.drives[led - 1].drive_track;
+ if (gui_data.drives[led - 1].drive_disabled) {
track = -1;
on = 0;
}
if (D3D_led)
D3D_led(led, on, brightness);
#ifdef RETROPLATFORM
- if (led >= LED_DF0 && led <= LED_DF3 && !gui_data.drive_disabled[led - LED_DF0]) {
- rp_floppy_track (led - LED_DF0, gui_data.drive_track[led - LED_DF0]);
- writing = gui_data.drive_writing[led - LED_DF0];
+ if (led >= LED_DF0 && led <= LED_DF3 && !gui_data.drives[led - LED_DF0].drive_disabled) {
+ rp_floppy_track(led - LED_DF0, gui_data.drives[led - LED_DF0].drive_track);
+ writing = gui_data.drives[led - LED_DF0].drive_writing;
}
rp_update_leds (led, on, brightness, writing);
#endif
if (led >= LED_DF0 && led <= LED_DF3) {
pos = 7 + (led - LED_DF0);
ptr = drive_text + pos * LED_STRING_WIDTH;
- if (gui_data.drive_disabled[led - 1])
+ if (gui_data.drives[led - 1].drive_disabled)
_tcscpy (ptr, _T(""));
else
- _stprintf (ptr , _T("%02d"), gui_data.drive_track[led - 1]);
- p = gui_data.df[led - 1];
+ _stprintf (ptr , _T("%02d"), gui_data.drives[led - 1].drive_track);
+ p = gui_data.drives[led - 1].df;
j = _tcslen (p) - 1;
if (j < 0)
j = 0;
tt = dfx[led - 1];
tt[0] = 0;
if (_tcslen (p + j) > 0)
- _stprintf (tt, _T("%s [CRC=%08X]"), p + j, gui_data.crc32[led - 1]);
+ _stprintf (tt, _T("%s [CRC=%08X]"), p + j, gui_data.drives[led - 1].crc32);
center = 1;
- if (gui_data.drive_writing[led - 1])
+ if (gui_data.drives[led - 1].drive_writing)
writing = 1;
} else if (led == LED_POWER) {
pos = 3;
}
}
+static uae_u32 rgbmuldiv(uae_u32 rgb, int mul, int div)
+{
+ uae_u32 out = 0;
+ for (int i = 0; i < 3; i++) {
+ int v = (rgb >> (i * 8)) & 0xff;
+ v *= mul;
+ v /= div;
+ out |= v << (i * 8);
+ }
+ return out;
+}
+
void draw_status_line_single(int monid, uae_u8 *buf, int bpp, int y, int totalwidth, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc, uae_u32 *alpha)
{
struct amigadisplay *ad = &adisplays[monid];
c1 = ledcolor (0x00ffffff, rc, gc, bc, alpha);
c2 = ledcolor (0x00000000, rc, gc, bc, alpha);
- cb = ledcolor (TD_BORDER, rc, gc, bc, alpha);
if (td_pos & TD_RIGHT)
x_start = totalwidth - TD_PADX - VISIBLE_LEDS * TD_WIDTH;
int x, c, on = 0, am = 2;
xcolnr on_rgb = 0, on_rgb2 = 0, off_rgb = 0, pen_rgb = 0;
int half = 0;
+ cb = ledcolor(TD_BORDER, rc, gc, bc, alpha);
if (!(currprefs.leds_on_screen_mask[ad->picasso_on ? 1 : 0] & (1 << led)))
continue;
pen_rgb = c1;
if (led >= LED_DF0 && led <= LED_DF3) {
int pled = led - LED_DF0;
- int track = gui_data.drive_track[pled];
+ struct floppyslot *fs = &currprefs.floppyslots[pled];
+ struct gui_info_drive *gid = &gui_data.drives[pled];
+ int track = gid->drive_track;
pos = 7 + pled;
on_rgb = 0x00cc00;
- on_rgb2 = 0x006600;
- off_rgb = 0x003300;
- if (!gui_data.drive_disabled[pled]) {
+ if (!gid->drive_disabled) {
num1 = -1;
num2 = track / 10;
num3 = track % 10;
- on = gui_data.drive_motor[pled];
- if (gui_data.drive_writing[pled]) {
+ on = gid->drive_motor;
+ if (gid->drive_writing) {
on_rgb = 0xcc0000;
- on_rgb2 = 0x880000;
}
half = gui_data.drive_side ? 1 : -1;
- if (gui_data.df[pled][0] == 0)
- pen_rgb = ledcolor (0x00aaaaaa, rc, gc, bc, alpha);
+ if (gid->df[0] == 0) {
+ pen_rgb = ledcolor(0x00aaaaaa, rc, gc, bc, alpha);
+ } else if (gid->floppy_protected) {
+ cb = ledcolor(0xff8040, rc, gc, bc, alpha);
+ }
}
side = gui_data.drive_side;
+ on_rgb &= 0xffffff;
+ off_rgb = rgbmuldiv(on_rgb, 2, 4);
+ on_rgb2 = rgbmuldiv(on_rgb, 2, 3);
} else if (led == LED_POWER) {
pos = 3;
on_rgb = ((gui_data.powerled_brightness * 10 / 16) + 0x33) << 16;
on_rgb = 0x0000cc; // "normal" overflow
off_rgb = 0x000000;
am = 3;
- } else if (led == LED_MD && gui_data.drive_disabled[3]) {
+ } else if (led == LED_MD && gui_data.drives[3].drive_disabled) {
// DF3 reused as internal non-volatile ram led (cd32/cdtv)
pos = 7 + 3;
if (gui_data.md >= 0) {
}
border = 0;
if (y == 0 || y == TD_TOTAL_HEIGHT - 1) {
- c = ledcolor (TD_BORDER, rc, gc, bc, alpha);
+ c = cb;
border = 1;
}