| 1 |
#include "daodan_gl.h" |
| 2 |
|
| 3 |
#define maxmodes (104) // Dirty hack to add more resolutions, it really should only be 16 ^_^ |
| 4 |
|
| 5 |
const M3tDisplayMode daodan_reslist[] = { |
| 6 |
{ 640, 480, 0, 0 }, |
| 7 |
{ 800, 600, 0, 0 }, |
| 8 |
{ 1024, 768, 0, 0 }, |
| 9 |
{ 1280, 1024, 0, 0 }, |
| 10 |
{ 1600, 1200, 0, 0 }, |
| 11 |
{ 1920, 1080, 0, 0 }, |
| 12 |
}; |
| 13 |
|
| 14 |
const short daodan_resmodes[] = { 16, 32 }; |
| 15 |
|
| 16 |
unsigned int ONICALL daodan_enumerate_valid_display_modes(M3tDisplayMode modes[maxmodes]) |
| 17 |
{ |
| 18 |
unsigned int vmodes = 0; |
| 19 |
unsigned int screen_x = GetSystemMetrics(SM_CXSCREEN); |
| 20 |
unsigned int screen_y = GetSystemMetrics(SM_CYSCREEN); |
| 21 |
|
| 22 |
int i, j; |
| 23 |
|
| 24 |
for (i = 0; i < sizeof(daodan_resmodes) / sizeof(short); i ++) |
| 25 |
{ |
| 26 |
for (j = 0; j < sizeof(daodan_reslist) / sizeof(M3tDisplayMode); j ++) |
| 27 |
if (modes[vmodes].Width != screen_x && modes[vmodes].Height != screen_y) |
| 28 |
{ |
| 29 |
modes[vmodes].Width = daodan_reslist[j].Width; |
| 30 |
modes[vmodes].Height = daodan_reslist[j].Height; |
| 31 |
modes[vmodes].Depth = daodan_resmodes[i]; |
| 32 |
|
| 33 |
if (++vmodes == maxmodes - sizeof(daodan_reslist) / sizeof(M3tDisplayMode) + i) |
| 34 |
goto modesfull; |
| 35 |
} |
| 36 |
|
| 37 |
modes[vmodes].Width = GetSystemMetrics(SM_CXSCREEN); |
| 38 |
modes[vmodes].Height = GetSystemMetrics(SM_CYSCREEN); |
| 39 |
modes[vmodes].Depth = daodan_resmodes[i]; |
| 40 |
if (++vmodes == maxmodes - sizeof(daodan_reslist) / sizeof(M3tDisplayMode) + i) |
| 41 |
goto modesfull; |
| 42 |
} |
| 43 |
|
| 44 |
modesfull: |
| 45 |
return vmodes; |
| 46 |
} |