mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-11-18 18:05:21 +00:00
depth/resolution switching infrastructure should be complete now; slot ROM
contains all supported depths, default mode is stored in XPRAM upon startup, and added video_switch_to_mode() call (currently unimplemented in all drivers)
This commit is contained in:
parent
1be8a821a8
commit
0fe2584d92
@ -558,6 +558,15 @@ void video_set_palette(uint8 *pal)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Switch video mode
|
||||
*/
|
||||
|
||||
void video_switch_to_mode(const video_mode &mode)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Video message handling (not neccessary under AmigaOS, handled by periodic_func())
|
||||
*/
|
||||
|
@ -308,6 +308,15 @@ void video_set_palette(uint8 *pal)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Switch video mode
|
||||
*/
|
||||
|
||||
void video_switch_to_mode(const video_mode &mode)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Close down full-screen mode (if bringing up error alerts is unsafe while in full-screen mode)
|
||||
*/
|
||||
|
@ -1356,6 +1356,15 @@ void video_set_palette(uint8 *pal)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Switch video mode
|
||||
*/
|
||||
|
||||
void video_switch_to_mode(const video_mode &mode)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Suspend/resume emulator
|
||||
*/
|
||||
|
@ -86,6 +86,7 @@ extern void VideoQuitFullScreen(void);
|
||||
extern void VideoInterrupt(void);
|
||||
extern void VideoRefresh(void);
|
||||
|
||||
extern void video_switch_to_mode(const video_mode &mode);
|
||||
extern void video_set_palette(uint8 *pal);
|
||||
|
||||
#endif
|
||||
|
@ -139,6 +139,12 @@ bool InitAll(void)
|
||||
if (!VideoInit(ROMVersion == ROM_VERSION_64K || ROMVersion == ROM_VERSION_PLUS || ROMVersion == ROM_VERSION_CLASSIC))
|
||||
return false;
|
||||
|
||||
// Set default video mode
|
||||
XPRAM[0x56] = 0x42; // 'B'
|
||||
XPRAM[0x57] = 0x32; // '2'
|
||||
XPRAM[0x58] = DepthToAppleMode(VideoMonitor.mode.depth);
|
||||
XPRAM[0x59] = 0;
|
||||
|
||||
#if EMULATED_68K
|
||||
// Init 680x0 emulation (this also activates the memory system which is needed for PatchROM())
|
||||
if (!Init680x0())
|
||||
|
@ -43,6 +43,19 @@ static uint8 srom[4096];
|
||||
static uint32 p;
|
||||
|
||||
|
||||
// Check whether a mode with the specified depth exists
|
||||
static bool has_depth(video_depth depth)
|
||||
{
|
||||
vector<video_mode>::const_iterator i = VideoModes.begin(), end = VideoModes.end();
|
||||
while (i != end) {
|
||||
if (i->depth == depth)
|
||||
return true;
|
||||
++i;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Construct slot declaration ROM and copy it into the Mac ROM (must be called after VideoInit())
|
||||
*/
|
||||
@ -322,35 +335,18 @@ bool InstallSlotROM(void)
|
||||
Offs(0x0b, minorLength); // Frame buffer length
|
||||
Offs(0x40, gammaDir); // Gamma directory
|
||||
Rsrc(0x7d, 6); // Video attributes: Default to color, built-in
|
||||
#if 0
|
||||
Offs(0x80, vidMode1); // Video mode parameters for 1 bit
|
||||
Offs(0x81, vidMode2); // Video mode parameters for 2 bit
|
||||
Offs(0x82, vidMode4); // Video mode parameters for 4 bit
|
||||
Offs(0x83, vidMode8); // Video mode parameters for 8 bit
|
||||
Offs(0x84, vidMode16); // Video mode parameters for 16 bit
|
||||
Offs(0x85, vidMode32); // Video mode parameters for 32 bit
|
||||
#else
|
||||
switch (VideoMonitor.mode.depth) {
|
||||
case VDEPTH_1BIT:
|
||||
Offs(0x80, vidMode1); // Video mode parameters
|
||||
break;
|
||||
case VDEPTH_2BIT:
|
||||
Offs(0x80, vidMode2); // Video mode parameters
|
||||
break;
|
||||
case VDEPTH_4BIT:
|
||||
Offs(0x80, vidMode4); // Video mode parameters
|
||||
break;
|
||||
case VDEPTH_8BIT:
|
||||
Offs(0x80, vidMode8); // Video mode parameters
|
||||
break;
|
||||
case VDEPTH_16BIT:
|
||||
Offs(0x80, vidMode16); // Video mode parameters
|
||||
break;
|
||||
case VDEPTH_32BIT:
|
||||
Offs(0x80, vidMode32); // Video mode parameters
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
if (has_depth(VDEPTH_1BIT))
|
||||
Offs(0x80, vidMode1); // Video mode parameters for 1 bit
|
||||
if (has_depth(VDEPTH_2BIT))
|
||||
Offs(0x81, vidMode2); // Video mode parameters for 2 bit
|
||||
if (has_depth(VDEPTH_4BIT))
|
||||
Offs(0x82, vidMode4); // Video mode parameters for 4 bit
|
||||
if (has_depth(VDEPTH_8BIT))
|
||||
Offs(0x83, vidMode8); // Video mode parameters for 8 bit
|
||||
if (has_depth(VDEPTH_16BIT))
|
||||
Offs(0x84, vidMode16); // Video mode parameters for 16 bit
|
||||
if (has_depth(VDEPTH_32BIT))
|
||||
Offs(0x85, vidMode32); // Video mode parameters for 32 bit
|
||||
EndOfList();
|
||||
|
||||
// CPU sResource
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "video.h"
|
||||
#include "video_defs.h"
|
||||
|
||||
#define DEBUG 0
|
||||
#define DEBUG 1
|
||||
#include "debug.h"
|
||||
|
||||
|
||||
@ -63,7 +63,7 @@ struct {
|
||||
|
||||
static bool has_resolution(uint32 id)
|
||||
{
|
||||
vector<video_mode>::const_iterator i = VideoModes.begin(), end = VideoModes.end();
|
||||
std::vector<video_mode>::const_iterator i = VideoModes.begin(), end = VideoModes.end();
|
||||
while (i != end) {
|
||||
if (i->resolution_id == id)
|
||||
return true;
|
||||
@ -73,6 +73,22 @@ static bool has_resolution(uint32 id)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Find specified mode (depth/resolution) (or VideoModes.end() if not found)
|
||||
*/
|
||||
|
||||
static std::vector<video_mode>::const_iterator find_mode(uint16 mode, uint32 id)
|
||||
{
|
||||
std::vector<video_mode>::const_iterator i = VideoModes.begin(), end = VideoModes.end();
|
||||
while (i != end) {
|
||||
if (i->resolution_id == id && DepthToAppleMode(i->depth) == mode)
|
||||
return i;
|
||||
++i;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Find maximum supported depth for given resolution ID
|
||||
*/
|
||||
@ -156,13 +172,18 @@ int16 VideoDriverControl(uint32 pb, uint32 dce)
|
||||
case cscSetMode: { // Set color depth
|
||||
uint16 mode = ReadMacInt16(param + csMode);
|
||||
D(bug(" SetMode %04x\n", mode));
|
||||
//!! switch mode
|
||||
|
||||
if (mode != VidLocal.current_mode) {
|
||||
std::vector<video_mode>::const_iterator i = find_mode(mode, VidLocal.current_id);
|
||||
if (i == VideoModes.end()) {
|
||||
WriteMacInt32(param + csBaseAddr, VidLocal.desc->mac_frame_base);
|
||||
return paramErr;
|
||||
}
|
||||
video_switch_to_mode(*i);
|
||||
VidLocal.current_mode = mode;
|
||||
}
|
||||
WriteMacInt32(param + csBaseAddr, VidLocal.desc->mac_frame_base);
|
||||
//!! VidLocal.current_mode = mode;
|
||||
if (mode != VidLocal.current_mode)
|
||||
return paramErr;
|
||||
else
|
||||
return noErr;
|
||||
return noErr;
|
||||
}
|
||||
|
||||
case cscSetEntries: { // Set palette
|
||||
@ -262,14 +283,19 @@ int16 VideoDriverControl(uint32 pb, uint32 dce)
|
||||
uint16 mode = ReadMacInt16(param + csMode);
|
||||
uint32 id = ReadMacInt32(param + csData);
|
||||
D(bug(" SwitchMode %04x, %08x\n", mode, id));
|
||||
//!! switch mode
|
||||
|
||||
if (mode != VidLocal.current_mode || id != VidLocal.current_id) {
|
||||
std::vector<video_mode>::const_iterator i = find_mode(mode, id);
|
||||
if (i == VideoModes.end()) {
|
||||
WriteMacInt32(param + csBaseAddr, VidLocal.desc->mac_frame_base);
|
||||
return paramErr;
|
||||
}
|
||||
video_switch_to_mode(*i);
|
||||
VidLocal.current_mode = mode;
|
||||
VidLocal.current_id = id;
|
||||
}
|
||||
WriteMacInt32(param + csBaseAddr, VidLocal.desc->mac_frame_base);
|
||||
//!! VidLocal.current_mode = mode;
|
||||
//!! VidLocal.current_id = id;
|
||||
if (mode != VidLocal.current_mode || id != VidLocal.current_id)
|
||||
return paramErr;
|
||||
else
|
||||
return noErr;
|
||||
return noErr;
|
||||
}
|
||||
|
||||
case cscSavePreferredConfiguration: {
|
||||
|
Loading…
Reference in New Issue
Block a user