Add custom video modes for full screen in unsual resolutions (e.g. 1400x1050).

X11 and SDL infrastructures have yet to be implemented
This commit is contained in:
gbeauche 2005-03-27 13:44:45 +00:00
parent ca7a87465b
commit fbe378f780
3 changed files with 53 additions and 20 deletions

View File

@ -970,47 +970,56 @@ static int find_mode(int apple_mode, int apple_id, int type)
return -1;
}
// Add custom video mode
static void add_custom_mode(VideoInfo *&p, int type, uint32 x, uint32 y, int apple_mode, int apple_id)
{
p->viType = type;
p->viXsize = x;
p->viYsize = y;
p->viRowBytes = TrivialBytesPerRow(p->viXsize, apple_mode);
p->viAppleMode = apple_mode;
p->viAppleID = apple_id;
p++;
}
// Add mode to list of supported modes
static void add_mode(VideoInfo *&p, uint32 allow, uint32 test, int apple_mode, int apple_id, int type)
{
if (allow & test) {
p->viType = type;
uint32 x = 0, y = 0;
switch (apple_id) {
case APPLE_W_640x480:
case APPLE_640x480:
p->viXsize = 640;
p->viYsize = 480;
x = 640;
y = 480;
break;
case APPLE_W_800x600:
case APPLE_800x600:
p->viXsize = 800;
p->viYsize = 600;
x = 800;
y = 600;
break;
case APPLE_1024x768:
p->viXsize = 1024;
p->viYsize = 768;
x = 1024;
y = 768;
break;
case APPLE_1152x768:
p->viXsize = 1152;
p->viYsize = 768;
x = 1152;
y = 768;
break;
case APPLE_1152x900:
p->viXsize = 1152;
p->viYsize = 900;
x = 1152;
y = 900;
break;
case APPLE_1280x1024:
p->viXsize = 1280;
p->viYsize = 1024;
x = 1280;
y = 1024;
break;
case APPLE_1600x1200:
p->viXsize = 1600;
p->viYsize = 1200;
x = 1600;
y = 1200;
break;
}
p->viRowBytes = TrivialBytesPerRow(p->viXsize, apple_mode);
p->viAppleMode = apple_mode;
p->viAppleID = apple_id;
p++;
add_custom_mode(p, type, x, y, apple_mode, apple_id);
}
}

View File

@ -90,8 +90,9 @@ enum { // viAppleID
APPLE_1152x900,
APPLE_1280x1024,
APPLE_1600x1200,
APPLE_CUSTOM,
APPLE_ID_MIN = APPLE_640x480,
APPLE_ID_MAX = APPLE_1600x1200
APPLE_ID_MAX = APPLE_CUSTOM
};
enum { // Display type

View File

@ -517,6 +517,21 @@ static uint32 max_depth(uint32 id)
return max;
}
// Get X/Y size of specified resolution
static void get_size_of_resolution(int id, uint32 &x, uint32 &y)
{
VideoInfo *p = VModes;
while (p->viType != DIS_INVALID) {
if (p->viAppleID == id) {
x = p->viXsize;
y = p->viYsize;
return;
}
p++;
}
x = y = 0;
}
static int16 VideoStatus(uint32 pb, VidLocals *csSave)
{
int16 code = ReadMacInt16(pb + csCode);
@ -708,6 +723,14 @@ static int16 VideoStatus(uint32 pb, VidLocals *csSave)
WriteMacInt32(param + csVerticalLines, 1200);
WriteMacInt32(param + csRefreshRate, 75<<16);
break;
case APPLE_CUSTOM: {
uint32 x, y;
get_size_of_resolution(work_id, x, y);
WriteMacInt32(param + csHorizontalPixels, x);
WriteMacInt32(param + csVerticalLines, y);
WriteMacInt32(param + csRefreshRate, 75<<16);
break;
}
}
return noErr;
}