Changeset 316
- Timestamp:
- May 4, 2009, 2:42:46 PM (16 years ago)
- Location:
- Daodan
- Files:
-
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Daodan/src/daodan_gl.c
r297 r316 1 1 #include "daodan_gl.h" 2 2 3 #define maxmodes (104) // Dirty hack to add more resolutions, it really should only be 16 ^_^ 3 #define max_modes (104) // Dirty hack to add more resolutions, it really should only be 16 ^_^ 4 #define builtin_modes (sizeof(daodan_reslist) / sizeof(M3tDisplayMode)) 5 #define builtin_depths (sizeof(daodan_resdepths) / sizeof(short)) 4 6 5 7 const M3tDisplayMode daodan_reslist[] = { 6 { 640, 480, 0, 0 }, 7 { 800, 600, 0, 0 }, 8 { 720 , 480, 0, 0 }, 9 { 720 , 576, 0, 0 }, 10 { 768 , 480, 0, 0 }, 11 { 800 , 480, 0, 0 }, 12 { 852 , 480, 0, 0 }, 13 { 856 , 480, 0, 0 }, 14 { 960 , 540, 0, 0 }, 15 { 960 , 720, 0, 0 }, 16 { 1024, 576, 0, 0 }, 17 { 1024, 600, 0, 0 }, 18 { 1024, 640, 0, 0 }, 8 19 { 1024, 768, 0, 0 }, 20 { 1152, 768, 0, 0 }, 21 { 1152, 864, 0, 0 }, 22 { 1280, 720, 0, 0 }, 23 { 1280, 768, 0, 0 }, 24 { 1280, 800, 0, 0 }, 25 { 1280, 960, 0, 0 }, 9 26 { 1280, 1024, 0, 0 }, 27 { 1366, 768, 0, 0 }, 28 { 1400, 1050, 0, 0 }, 29 { 1440, 900, 0, 0 }, 30 { 1600, 900, 0, 0 }, 10 31 { 1600, 1200, 0, 0 }, 11 32 { 1920, 1080, 0, 0 }, 33 { 1920, 1440, 0, 0 }, 12 34 }; 13 35 14 const short daodan_res modes[] = { 16, 32 };36 const short daodan_resdepths[] = { 16, 32 }; 15 37 16 unsigned int ONICALL daodan_enumerate_valid_display_modes(M3tDisplayMode modes[max modes])38 unsigned int ONICALL daodan_enumerate_valid_display_modes(M3tDisplayMode modes[max_modes]) 17 39 { 18 40 unsigned int vmodes = 0; … … 22 44 int i, j; 23 45 24 for (i = 0; i < sizeof(daodan_resmodes) / sizeof(short); i ++)46 for (i = 0; i < builtin_depths; i ++) 25 47 { 26 for (j = 0; j < sizeof(daodan_reslist) / sizeof(M3tDisplayMode); j ++) 27 if (modes[vmodes].Width != screen_x && modes[vmodes].Height != screen_y) 48 modes[vmodes].Width = 640; 49 modes[vmodes].Height = 480; 50 modes[vmodes].Depth = daodan_resdepths[i]; 51 52 if (++vmodes == max_modes - builtin_modes + i) 53 goto modesfull; 54 55 for (j = 0; j < builtin_modes; j ++) 56 if (!(daodan_reslist[j].Width == 640 && daodan_reslist[j].Height == 480) && !(daodan_reslist[j].Width == screen_x && daodan_reslist[j].Height == screen_y) && 57 ((daodan_reslist[j].Width < screen_x && daodan_reslist[j].Height < screen_y) || daodan_testmode(daodan_reslist[j]))) 28 58 { 29 59 modes[vmodes].Width = daodan_reslist[j].Width; 30 60 modes[vmodes].Height = daodan_reslist[j].Height; 31 modes[vmodes].Depth = daodan_res modes[i];61 modes[vmodes].Depth = daodan_resdepths[i]; 32 62 33 if (++vmodes == max modes - sizeof(daodan_reslist) / sizeof(M3tDisplayMode)+ i)63 if (++vmodes == max_modes - builtin_modes + i) 34 64 goto modesfull; 35 65 } … … 37 67 modes[vmodes].Width = GetSystemMetrics(SM_CXSCREEN); 38 68 modes[vmodes].Height = GetSystemMetrics(SM_CYSCREEN); 39 modes[vmodes].Depth = daodan_resmodes[i]; 40 if (++vmodes == maxmodes - sizeof(daodan_reslist) / sizeof(M3tDisplayMode) + i) 69 modes[vmodes].Depth = daodan_resdepths[i]; 70 71 if (++vmodes == max_modes - builtin_modes + i) 41 72 goto modesfull; 42 73 } … … 45 76 return vmodes; 46 77 } 78 79 bool daodan_testmode(M3tDisplayMode mode) 80 { 81 DEVMODE devmode; 82 memset(&devmode, 0, sizeof(devmode)); 83 84 devmode.dmSize = sizeof(devmode); 85 devmode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT; 86 devmode.dmBitsPerPel = mode.Depth; 87 devmode.dmPelsWidth = mode.Width; 88 devmode.dmPelsHeight = mode.Height; 89 90 return (ChangeDisplaySettings(&devmode, CDS_TEST) == DISP_CHANGE_SUCCESSFUL); 91 } -
Daodan/src/daodan_gl.h
r297 r316 7 7 8 8 unsigned int ONICALL daodan_enumerate_valid_display_modes(M3tDisplayMode modes[16]); 9 bool daodan_testmode(M3tDisplayMode mode); 9 10 10 11 #endif
Note:
See TracChangeset
for help on using the changeset viewer.