fwrite(disk[driveNum], 1, diskSize[driveNum], fp);
fclose(fp);
+ WriteLog("FLOPPY: Successfully wrote image file '%s'...\n", imageName[driveNum]);
+
return true;
}
return nameBuf;
}
+void FloppyDrive::EjectImage(uint8 driveNum/*= 0*/)
+{
+ // Probably want to save a dirty image... ;-)
+ SaveImage(driveNum);
+
+ WriteLog("FLOPPY: Ejected image file '%s' from drive %u...\n", imageName[driveNum], driveNum);
+
+ if (disk[driveNum])
+ delete[] disk[driveNum];
+
+ disk[driveNum] = NULL;
+ diskSize[driveNum] = 0;
+ diskType[driveNum] = DT_UNKNOWN;
+ imageDirty[driveNum] = false;
+ imageName[driveNum][0] = 0; // Zero out filenames
+ memset(nybblizedImage[driveNum], 0xFF, 232960); // Doesn't matter if 00s or FFs...
+
+}
+
+bool FloppyDrive::DriveIsEmpty(uint8 driveNum/*= 0*/)
+{
+ // This is kinda gay, but it works
+ return (imageName[driveNum][0] == 0 ? true : false);
+}
+
// Memory mapped I/O functions
void CreateBlankImage(uint8 driveNum = 0);
void SwapImages(void);
const char * GetImageName(uint8 driveNum = 0);
+ void EjectImage(uint8 driveNum = 0);
+ bool DriveIsEmpty(uint8 driveNum = 0);
// I/O functions ($C0Ex accesses)
DrawStringOpaque(screen, r.x, r.y, fgColor, bgColor, "%s", text.c_str());
}
}
+
+void Text::SetText(std::string s)
+{
+ text = s;
+}
virtual void HandleMouseButton(uint32 x, uint32 y, bool mouseDown) {}
virtual void Draw(void);
virtual void Notify(Element *) {}
+ void SetText(std::string s);
protected:
// uint32 fgColor, bgColor;
cbDown(SDL_CreateRGBSurfaceFrom(&closeBoxDown[4], cbWidth, cbHeight, 32, cbWidth * 4,
MASK_R, MASK_G, MASK_B, MASK_A)),
cbHover(SDL_CreateRGBSurfaceFrom(&closeBoxHover[4], cbWidth, cbHeight, 32, cbWidth * 4,
- MASK_R, MASK_G, MASK_B, MASK_A))
+ MASK_R, MASK_G, MASK_B, MASK_A)), drawBackground(true)
{
//Could probably move this into the initializer list as well...
// closeButton = new Button(w - (cbWidth + 1), 1, cbUp, cbHover, cbDown, this);
for(uint32 i=0; i<list.size(); i++)
list[i]->Draw();
#else
- // These are *always* top level and parentless, so no need to traverse up through
- // the parent chain...
- SDL_FillRect(screen, &extents, bgColor);
+ if (drawBackground)
+ {
+ // These are *always* top level and parentless, so no need to traverse up through
+ // the parent chain...
+ SDL_FillRect(screen, &extents, bgColor);
+ }
+ else
+ RestoreScreenFromBackstore();
// Handle the items this window contains...
for(uint32 i=0; i<list.size(); i++)
list.push_back(closeButton);
}
}
+
+void Window::SetBackgroundDraw(bool state)
+{
+ drawBackground = state;
+}
virtual void Notify(Element *);
void AddElement(Element * e);
void AddCloseButton(void);
+ void SetBackgroundDraw(bool);
protected:
void (* handler)(Element *);
private:
uint16 cbWidth, cbHeight;
SDL_Surface * cbUp, * cbDown, * cbHover;
+ bool drawBackground;
};
#endif // __WINDOW_H__