return RGBFB_NONE;
}
-HRESULT DirectDraw_EnumDisplayModes (DWORD flags, LPDDENUMMODESCALLBACK2 callback)
+HRESULT DirectDraw_EnumDisplayModes (DWORD flags, LPDDENUMMODESCALLBACK2 callback, void *context)
{
HRESULT result;
- result = IDirectDraw7_EnumDisplayModes (dxdata.maindd, flags, NULL, NULL, callback);
+ result = IDirectDraw7_EnumDisplayModes (dxdata.maindd, flags, NULL, context, callback);
return result;
}
/* Bit mask of RGBFF_xxx values. */
uae_u32 colormodes;
};
-extern struct PicassoResolution *DisplayModes;
extern GUID *displayGUID;
#define MAX_DISPLAYS 10
HRESULT DirectDraw_CreateClipper (void);
HRESULT DirectDraw_SetClipper(HWND hWnd);
RGBFTYPE DirectDraw_GetSurfacePixelFormat(LPDDSURFACEDESC2 surface);
-HRESULT DirectDraw_EnumDisplayModes(DWORD flags, LPDDENUMMODESCALLBACK2 callback);
+HRESULT DirectDraw_EnumDisplayModes(DWORD flags, LPDDENUMMODESCALLBACK2 callback, void *context);
HRESULT DirectDraw_EnumDisplays(LPDDENUMCALLBACKEX callback);
DWORD DirectDraw_CurrentWidth (void);
DWORD DirectDraw_CurrentHeight (void);
size += BARRIER;
}
if(!strcmp(shmids[shmid].name,"filesys")) {
- result = xcalloc (size, 1);
+ static uae_u8 *filesysptr;
+ if (filesysptr == NULL)
+ filesysptr = xcalloc (size, 1);
+ result = filesysptr;
shmids[shmid].attached = result;
return result;
}
* programs started from a Picasso workbench.
*/
+#define MULTIDISPLAY 0
#define P96DX 0
#include "sysconfig.h"
{
int i, j, size, cnt;
int misscnt, depths;
+ struct MultiDisplay *md = getdisplay (&currprefs);
+ struct PicassoResolution *DisplayModes = md->DisplayModes;
uaegfx_resname = ds ("uaegfx.card");
xfree (newmodes);
&& DisplayModes[i].res.height == DisplayModes[j].res.height)
i++;
}
- for (i = 0; Displays[i].name; i++)
+#if MULTIDISPLAY
+ for (i = 0; Displays[i].name; i++) {
+ size += PSSO_LibResolution_sizeof;
size += PSSO_ModeInfo_sizeof * depths;
+ }
+#endif
newmodes[cnt].depth = -1;
for (i = 0; i < cnt; i++) {
#endif
}
-static void addmode (uaecptr AmigaBoardInfo, uaecptr *amem, struct LibResolution *res, int w, int h, const char *name, int id, int *unkcnt)
+static void addmode (uaecptr AmigaBoardInfo, uaecptr *amem, struct LibResolution *res, int w, int h, const char *name, int display, int *unkcnt)
{
int depth;
- res->DisplayID = id > 0 ? id : AssignModeID (w, h, unkcnt);
+ if (display > 0) {
+ res->DisplayID = 0x51000000 + display * 0x100000;
+ } else {
+ res->DisplayID = AssignModeID (w, h, unkcnt);
+ }
res->BoardInfo = AmigaBoardInfo;
res->Width = w;
res->Height = h;
while (newmodes[i].depth >= 0) {
struct LibResolution res = { 0 };
j = i;
- addmode (AmigaBoardInfo, &amem, &res, newmodes[i].res.width, newmodes[i].res.height, NULL, -1, &unkcnt);
+ addmode (AmigaBoardInfo, &amem, &res, newmodes[i].res.width, newmodes[i].res.height, NULL, 0, &unkcnt);
write_log ("%08X %4dx%4d %s\n", res.DisplayID, res.Width, res.Height, res.Name);
while (newmodes[i].depth >= 0
&& newmodes[i].res.width == newmodes[j].res.width
AmigaListAddTail (AmigaBoardInfo + PSSO_BoardInfo_ResolutionsList, amem);
amem += PSSO_LibResolution_sizeof;
}
-#if 0
+#if MULTIDISPLAY
for (i = 0; Displays[i].name; i++) {
struct LibResolution res = { 0 };
struct MultiDisplay *md = &Displays[i];
int w = md->rect.right - md->rect.left;
int h = md->rect.bottom - md->rect.top;
- int id = 0x50F00000 - i * 0x10000;
char tmp[100];
if (md->primary)
strcpy (tmp, "UAE:Primary");
else
- sprintf (tmp, "UAE:Monitor#%d", i);
- addmode (AmigaBoardInfo, &amem, &res, w + 16, h, md->name, id, &unkcnt);
+ sprintf (tmp, "UAE:Display#%d", i);
+ addmode (AmigaBoardInfo, &amem, &res, w, h, tmp, i + 1, &unkcnt);
+ write_log ("%08X %4dx%4d %s\n", res.DisplayID, res.Width + 16, res.Height, res.Name);
LibResolutionStructureCount++;
CopyLibResolutionStructureU2A (&res, amem);
#if P96TRACING_ENABLED && P96TRACING_LEVEL > 1
#define WINUAEPUBLICBETA 1
-#define WINUAEBETA "0.1"
-#define WINUAEDATE MAKEBD(2008, 9, 26)
+#define WINUAEBETA "1"
+#define WINUAEDATE MAKEBD(2008, 9, 30)
#define WINUAEEXTRA ""
#define WINUAEREV ""
LPPALETTEENTRY pal;
};
-struct PicassoResolution *DisplayModes;
struct MultiDisplay Displays[MAX_DISPLAYS];
static GUID *displayGUID;
DirectDraw_FreeMainSurface ();
- if (!dd)
+ if (!dd && !dxfullscreen)
return 1;
ddrval = DirectDraw_SetCooperativeLevel (hAmigaWnd, dxfullscreen, TRUE);
{
RGBFTYPE colortype;
int i, j, ct, depth;
+ struct MultiDisplay *md = context;
colortype = DirectDraw_GetSurfacePixelFormat (modeDesc);
if (colortype == RGBFB_NONE)
if (depth == 0)
return DDENUMRET_OK;
i = 0;
- while (DisplayModes[i].depth >= 0) {
- if (DisplayModes[i].depth == depth && DisplayModes[i].res.width == modeDesc->dwWidth && DisplayModes[i].res.height == modeDesc->dwHeight) {
+ while (md->DisplayModes[i].depth >= 0) {
+ if (md->DisplayModes[i].depth == depth && md->DisplayModes[i].res.width == modeDesc->dwWidth && md->DisplayModes[i].res.height == modeDesc->dwHeight) {
for (j = 0; j < MAX_REFRESH_RATES; j++) {
- if (DisplayModes[i].refresh[j] == 0 || DisplayModes[i].refresh[j] == modeDesc->dwRefreshRate)
+ if (md->DisplayModes[i].refresh[j] == 0 || md->DisplayModes[i].refresh[j] == modeDesc->dwRefreshRate)
break;
}
if (j < MAX_REFRESH_RATES) {
- DisplayModes[i].refresh[j] = modeDesc->dwRefreshRate;
- DisplayModes[i].refresh[j + 1] = 0;
+ md->DisplayModes[i].refresh[j] = modeDesc->dwRefreshRate;
+ md->DisplayModes[i].refresh[j + 1] = 0;
return DDENUMRET_OK;
}
}
i++;
}
i = 0;
- while (DisplayModes[i].depth >= 0)
+ while (md->DisplayModes[i].depth >= 0)
i++;
if (i >= MAX_PICASSO_MODES - 1)
return DDENUMRET_OK;
- DisplayModes[i].res.width = modeDesc->dwWidth;
- DisplayModes[i].res.height = modeDesc->dwHeight;
- DisplayModes[i].depth = depth;
- DisplayModes[i].refresh[0] = modeDesc->dwRefreshRate;
- DisplayModes[i].refresh[1] = 0;
- DisplayModes[i].colormodes = ct;
- DisplayModes[i + 1].depth = -1;
- sprintf (DisplayModes[i].name, "%dx%d, %d-bit",
- DisplayModes[i].res.width, DisplayModes[i].res.height, DisplayModes[i].depth * 8);
+ md->DisplayModes[i].res.width = modeDesc->dwWidth;
+ md->DisplayModes[i].res.height = modeDesc->dwHeight;
+ md->DisplayModes[i].depth = depth;
+ md->DisplayModes[i].refresh[0] = modeDesc->dwRefreshRate;
+ md->DisplayModes[i].refresh[1] = 0;
+ md->DisplayModes[i].colormodes = ct;
+ md->DisplayModes[i + 1].depth = -1;
+ sprintf (md->DisplayModes[i].name, "%dx%d, %d-bit",
+ md->DisplayModes[i].res.width, md->DisplayModes[i].res.height, md->DisplayModes[i].depth * 8);
return DDENUMRET_OK;
}
return 1;
return ma->depth - mb->depth;
}
-static void sortmodes (void)
+static void sortmodes (struct MultiDisplay *md)
{
int i = 0, idx = -1;
int pw = -1, ph = -1;
- while (DisplayModes[i].depth >= 0)
+ while (md->DisplayModes[i].depth >= 0)
i++;
- qsort (DisplayModes, i, sizeof (struct PicassoResolution), resolution_compare);
- for (i = 0; DisplayModes[i].depth >= 0; i++) {
- if (DisplayModes[i].res.height != ph || DisplayModes[i].res.width != pw) {
- ph = DisplayModes[i].res.height;
- pw = DisplayModes[i].res.width;
+ qsort (md->DisplayModes, i, sizeof (struct PicassoResolution), resolution_compare);
+ for (i = 0; md->DisplayModes[i].depth >= 0; i++) {
+ if (md->DisplayModes[i].res.height != ph || md->DisplayModes[i].res.width != pw) {
+ ph = md->DisplayModes[i].res.height;
+ pw = md->DisplayModes[i].res.width;
idx++;
}
- DisplayModes[i].residx = idx;
+ md->DisplayModes[i].residx = idx;
}
}
-static void modesList (void)
+static void modesList (struct MultiDisplay *md)
{
int i, j;
i = 0;
- while (DisplayModes[i].depth >= 0) {
- write_log ("%d: %s (", i, DisplayModes[i].name);
+ while (md->DisplayModes[i].depth >= 0) {
+ write_log ("%d: %s (", i, md->DisplayModes[i].name);
j = 0;
- while (DisplayModes[i].refresh[j] > 0) {
+ while (md->DisplayModes[i].refresh[j] > 0) {
if (j > 0)
write_log (",");
- write_log ("%d", DisplayModes[i].refresh[j]);
+ write_log ("%d", md->DisplayModes[i].refresh[j]);
j++;
}
write_log (")\n");
return 1;
}
-static BOOL CALLBACK monitorEnumProc(HMONITOR h, HDC hdc, LPRECT rect, LPARAM data)
+static BOOL CALLBACK monitorEnumProc (HMONITOR h, HDC hdc, LPRECT rect, LPARAM data)
{
MONITORINFOEX lpmi;
int cnt = *((int*)data);
md1 = Displays;
while (md1->name) {
- DisplayModes = md1->DisplayModes = xmalloc (sizeof (struct PicassoResolution) * MAX_PICASSO_MODES);
- DisplayModes[0].depth = -1;
+ md1->DisplayModes = xmalloc (sizeof (struct PicassoResolution) * MAX_PICASSO_MODES);
+ md1->DisplayModes[0].depth = -1;
md1->disabled = 1;
if (DirectDraw_Start (md1->primary ? NULL : &md1->guid)) {
if (SUCCEEDED (DirectDraw_GetDisplayMode ())) {
int b = DirectDraw_GetCurrentDepth ();
write_log ("Desktop: W=%d H=%d B=%d. CXVS=%d CYVS=%d\n", w, h, b,
GetSystemMetrics (SM_CXVIRTUALSCREEN), GetSystemMetrics (SM_CYVIRTUALSCREEN));
- DirectDraw_EnumDisplayModes (DDEDM_REFRESHRATES , modesCallback);
+ DirectDraw_EnumDisplayModes (DDEDM_REFRESHRATES , modesCallback, md1);
//dhack();
- sortmodes ();
- modesList ();
+ sortmodes (md1);
+ modesList (md1);
DirectDraw_Release ();
- if (DisplayModes[0].depth >= 0)
+ if (md1->DisplayModes[0].depth >= 0)
md1->disabled = 0;
}
}
i = 0;
- while (DisplayModes[i].depth > 0)
+ while (md1->DisplayModes[i].depth > 0)
i++;
write_log ("'%s', %d display modes (%s)\n", md1->name, i, md1->disabled ? "disabled" : "enabled");
md1++;
}
- DisplayModes = Displays[0].DisplayModes;
displayGUID = NULL;
}
/* DirectX will fail with "Mode not supported" if we try to switch to a full
* screen mode that doesn't match one of the dimensions we got during enumeration.
* So try to find a best match for the given resolution in our list. */
-int WIN32GFX_AdjustScreenmode(uae_u32 *pwidth, uae_u32 *pheight, uae_u32 *ppixbits)
+int WIN32GFX_AdjustScreenmode (struct MultiDisplay *md, uae_u32 *pwidth, uae_u32 *pheight, uae_u32 *ppixbits)
{
struct PicassoResolution *best;
uae_u32 selected_mask = (*ppixbits == 8 ? RGBMASK_8BIT
i = 0;
index = 0;
- best = &DisplayModes[0];
- dm = &DisplayModes[1];
+ best = &md->DisplayModes[0];
+ dm = &md->DisplayModes[1];
while (dm->depth >= 0) {
c |= currprefs.gfx_size_win.x != changed_prefs.gfx_size_win.x ? 16 : 0;
c |= currprefs.gfx_size_win.y != changed_prefs.gfx_size_win.y ? 16 : 0;
#endif
- c |= currprefs.color_mode != changed_prefs.color_mode ? 2 : 0;
+ c |= currprefs.color_mode != changed_prefs.color_mode ? 2 | 16 : 0;
c |= currprefs.gfx_afullscreen != changed_prefs.gfx_afullscreen ? 16 : 0;
c |= currprefs.gfx_pfullscreen != changed_prefs.gfx_pfullscreen ? 16 : 0;
c |= currprefs.gfx_avsync != changed_prefs.gfx_avsync ? 2 | 16 : 0;
static int getbestmode (int nextbest)
{
int i, disp;
+ struct MultiDisplay *md = getdisplay (&currprefs);
disp = currprefs.gfx_display;
- for (i = 0; DisplayModes[i].depth >= 0; i++) {
- struct PicassoResolution *pr = &DisplayModes[i];
+ for (i = 0; md->DisplayModes[i].depth >= 0; i++) {
+ struct PicassoResolution *pr = &md->DisplayModes[i];
if (pr->res.width == currentmode->native_width && pr->res.height == currentmode->native_height)
break;
}
- if (DisplayModes[i].depth >= 0) {
+ if (md->DisplayModes[i].depth >= 0) {
if (!nextbest)
return 1;
- while (DisplayModes[i].res.width == currentmode->native_width && DisplayModes[i].res.height == currentmode->native_height)
+ while (md->DisplayModes[i].res.width == currentmode->native_width && md->DisplayModes[i].res.height == currentmode->native_height)
i++;
} else {
i = 0;
}
- for (; DisplayModes[i].depth >= 0; i++) {
- struct PicassoResolution *pr = &DisplayModes[i];
+ for (; md->DisplayModes[i].depth >= 0; i++) {
+ struct PicassoResolution *pr = &md->DisplayModes[i];
if (pr->res.width >= currentmode->native_width && pr->res.height >= currentmode->native_height) {
write_log ("FS: %dx%d -> %dx%d\n", currentmode->native_width, currentmode->native_height,
pr->res.width, pr->res.height);
picasso_vidinfo.depth = currentmode->current_depth;
#endif
+ xfree (gfxvidinfo.realbufmem);
+ gfxvidinfo.realbufmem = NULL;
+ gfxvidinfo.bufmem = NULL;
+
if ((currentmode->flags & DM_DDRAW) && !(currentmode->flags & (DM_D3D | DM_SWSCALE | DM_OPENGL))) {
;
void WIN32GFX_WindowSize (void);;
RGBFTYPE WIN32GFX_FigurePixelFormats (RGBFTYPE colortype);
-int WIN32GFX_AdjustScreenmode (uae_u32 *pwidth, uae_u32 *pheight, uae_u32 *ppixbits);
+int WIN32GFX_AdjustScreenmode (struct MultiDisplay *md, uae_u32 *pwidth, uae_u32 *pheight, uae_u32 *ppixbits);
extern HWND hStatusWnd;
extern uae_u32 default_freq;
int i, j, freq, tmp;
char hz[20], hz2[20], txt[100];
LRESULT index;
+ struct MultiDisplay *md = getdisplay (&workprefs);
i = 0; index = 0;
- while (dmode >= 0 && (freq = DisplayModes[dmode].refresh[i]) > 0 && index < MAX_REFRESH_RATES) {
+ while (dmode >= 0 && (freq = md->DisplayModes[dmode].refresh[i]) > 0 && index < MAX_REFRESH_RATES) {
storedrefreshrates[index++] = freq;
i++;
}
#define MAX_FRAMERATE_LENGTH 40
#define MAX_NTH_LENGTH 20
-static int display_mode_index(uae_u32 x, uae_u32 y, uae_u32 d)
+static int display_mode_index (uae_u32 x, uae_u32 y, uae_u32 d)
{
int i;
+ struct MultiDisplay *md = getdisplay (&workprefs);
i = 0;
- while (DisplayModes[i].depth >= 0) {
- if (DisplayModes[i].res.width == x &&
- DisplayModes[i].res.height == y &&
- DisplayModes[i].depth == d)
+ while (md->DisplayModes[i].depth >= 0) {
+ if (md->DisplayModes[i].res.width == x &&
+ md->DisplayModes[i].res.height == y &&
+ md->DisplayModes[i].depth == d)
break;
i++;
}
- if(DisplayModes[i].depth < 0)
+ if(md->DisplayModes[i].depth < 0)
i = -1;
return i;
}
{
int d, d2, index;
int i, cnt;
+ struct MultiDisplay *md = getdisplay (&workprefs);
switch (workprefs.color_mode)
{
if (workprefs.gfx_afullscreen) {
d2 = d;
- if ((index = WIN32GFX_AdjustScreenmode (&workprefs.gfx_size_fs.width, &workprefs.gfx_size_fs.height, &d2)) >= 0) {
+ if ((index = WIN32GFX_AdjustScreenmode (md, &workprefs.gfx_size_fs.width, &workprefs.gfx_size_fs.height, &d2)) >= 0) {
switch (d2)
{
case 15:
index = display_mode_index (workprefs.gfx_size_fs.width, workprefs.gfx_size_fs.height, d);
if (index >= 0)
- SendDlgItemMessage (hDlg, IDC_RESOLUTION, CB_SETCURSEL, DisplayModes[index].residx, 0);
+ SendDlgItemMessage (hDlg, IDC_RESOLUTION, CB_SETCURSEL, md->DisplayModes[index].residx, 0);
else
index = 0;
SendDlgItemMessage(hDlg, IDC_RESOLUTIONDEPTH, CB_RESETCONTENT, 0, 0);
cnt = 0;
gui_display_depths[0] = gui_display_depths[1] = gui_display_depths[2] = -1;
- for (i = 0; DisplayModes[i].depth >= 0; i++) {
- if (DisplayModes[i].depth > 1 && DisplayModes[i].residx == DisplayModes[index].residx) {
+ for (i = 0; md->DisplayModes[i].depth >= 0; i++) {
+ if (md->DisplayModes[i].depth > 1 && md->DisplayModes[i].residx == md->DisplayModes[index].residx) {
char tmp[64];
- sprintf (tmp, "%d", DisplayModes[i].depth * 8);
+ sprintf (tmp, "%d", md->DisplayModes[i].depth * 8);
SendDlgItemMessage(hDlg, IDC_RESOLUTIONDEPTH, CB_ADDSTRING, 0, (LPARAM)tmp);
- if (DisplayModes[i].depth == d)
+ if (md->DisplayModes[i].depth == d)
SendDlgItemMessage (hDlg, IDC_RESOLUTIONDEPTH, CB_SETCURSEL, cnt, 0);
- gui_display_depths[cnt] = DisplayModes[i].depth;
+ gui_display_depths[cnt] = md->DisplayModes[i].depth;
cnt++;
}
}
{
int i = 0, idx = -1;
char tmp[64];
+ struct MultiDisplay *md = getdisplay (&workprefs);
SendDlgItemMessage(hDlg, IDC_RESOLUTION, CB_RESETCONTENT, 0, 0);
- while (DisplayModes[i].depth >= 0) {
- if (DisplayModes[i].depth > 1 && DisplayModes[i].residx != idx) {
- sprintf (tmp, "%dx%d", DisplayModes[i].res.width, DisplayModes[i].res.height);
+ while (md->DisplayModes[i].depth >= 0) {
+ if (md->DisplayModes[i].depth > 1 && md->DisplayModes[i].residx != idx) {
+ sprintf (tmp, "%dx%d", md->DisplayModes[i].res.width, md->DisplayModes[i].res.height);
SendDlgItemMessage(hDlg, IDC_RESOLUTION, CB_ADDSTRING, 0, (LPARAM)tmp);
- idx = DisplayModes[i].residx;
+ idx = md->DisplayModes[i].residx;
}
i++;
}
if (Displays[posn].disabled)
posn = 0;
workprefs.gfx_display = posn;
- DisplayModes = Displays[workprefs.gfx_display].DisplayModes;
init_resolution_combo (hDlg);
init_display_mode (hDlg);
}
if (posn != CB_ERR)
workprefs.gfx_resolution = posn;
} else if (LOWORD (wParam) == IDC_RESOLUTION || LOWORD(wParam) == IDC_RESOLUTIONDEPTH) {
+ struct MultiDisplay *md = getdisplay (&workprefs);
LRESULT posn1, posn2;
posn1 = SendDlgItemMessage (hDlg, IDC_RESOLUTION, CB_GETCURSEL, 0, 0);
if (posn1 == CB_ERR)
posn2 = SendDlgItemMessage (hDlg, IDC_RESOLUTIONDEPTH, CB_GETCURSEL, 0, 0);
if (posn2 == CB_ERR)
return;
- for (i = 0; DisplayModes[i].depth >= 0; i++) {
- if (DisplayModes[i].residx == posn1)
+ for (i = 0; md->DisplayModes[i].depth >= 0; i++) {
+ if (md->DisplayModes[i].residx == posn1)
break;
}
- if (DisplayModes[i].depth < 0)
+ if (md->DisplayModes[i].depth < 0)
return;
j = i;
- while (DisplayModes[i].residx == posn1) {
- if (DisplayModes[i].depth == gui_display_depths[posn2])
+ while (md->DisplayModes[i].residx == posn1) {
+ if (md->DisplayModes[i].depth == gui_display_depths[posn2])
break;
i++;
}
- if (DisplayModes[i].residx != posn1)
+ if (md->DisplayModes[i].residx != posn1)
i = j;
- workprefs.gfx_size_fs.width = DisplayModes[i].res.width;
- workprefs.gfx_size_fs.height = DisplayModes[i].res.height;
- switch(DisplayModes[i].depth)
+ workprefs.gfx_size_fs.width = md->DisplayModes[i].res.width;
+ workprefs.gfx_size_fs.height = md->DisplayModes[i].res.height;
+ switch(md->DisplayModes[i].depth)
{
case 2:
workprefs.color_mode = 2;
+Beta 1:
+
+- huge memory leak fixed (display mode switch)
+- fullscreen color depth change didn't work on the fly
+- multi monitor resolution list may only have listed primary monitor's
+ resolutions
+- OpenGL fullscreen works again
+
Beta 0.1:
- "always on top" change works on the fly