I've tried to list all useful resolutions...
Code: Select all
640 480
800 600
1024 768
1152 864
1280 720
1280 960
1280 1024
1366 768
1600 1200
1680 1050
1920 1080
1920 1200
2560 1440
2560 1600
3840 2160
5120 2880
5120 3200
It's too long. I have a better idea.
Code: Select all
GrContext_t grSstWinOpen( FxU32 hWin,
GrScreenResolution_t res,
GrScreenRefresh_t ref,
GrColorFormat_t cFormat,
GrOriginLocation_t org_loc,
int num_buffers,
int num_aux_buffers
)
GrScreenRefresh_t ref is just int32 value. Officially it can be from 0x0 to 0x17. We can treat any higher value as a pointer to this kind of structure:
Code: Select all
struct
{
int width,
int height,
int colors // not necessary?
}
Glide3x uses GrScreenResolution_t also in this structure for grQueryResolutions function:
Code: Select all
typedef struct {
GrScreenResolution_t resolution;
GrScreenRefresh_t refresh;
int numColorBuffers;
int numAuxBuffers;
} GlideResolution;
We have to treat GrScreenResolution_t resolution also as a pointer if it is higher that 0x17, because program may check if current system supports desired custom resolution.
All pointers in Windows can't be lower than 0xFFFF (you can't allocate memory at 0x0..0xFFFF) and any conflicts aren't possible. Other glide wrappers and official glide driver will report any values higher than 0x17 as unsupported resolution. There is also no any problems.
Also it would be nice to have ability to request list of all possible resolutions via grQueryResolutions. But we can't just use GR_QUERY_ANY ((FxU32)(~0)) because some old programs may be confused by very high value of GrScreenResolution_t. I propose to use a pointer to {-1,-1} (or {0,0}) for request all supported custom resolutions. And for simplicity of reading resolutions list code it would be nice if in this case even standard glide resolutions will be reported in this extended format. For example, instead of GR_RESOLUTION_640x480 0x7 it have to report this resolution as a pointer to {640,480}. Any old programs will not be confused by this because they don't use extended format of query.
I think this extension may be useful for all glide wrappers.
In the glide3x code you may allocate one array for this extended structures of resolutions. When program calls grQueryResolutions with extended format you may use pointers to items from this allocated array. It doesn't require much additional memory, but in this case if grQueryResolutions will be called many times all custom GrScreenResolution_t pointers will be same for one resolution. It may be very useful.
UPD
Oh, I think that I've overcomplicated this thing. We can simply treat this int32 value as a structure with two uint16 values {width, height}! This trick doesn't requires any additional memory and it will be much easier to read this values in the code (just two additional instructions: mov ebx, eax; shr eax, 16). When high part of this value is 0 and low part is lower than 0x18 it means that it is value just GR_RESOLUTION_* constant. 0xFFFFFFFF means GR_QUERY_ANY in the default format. We can use constant 0xFFF
EFFF
E to query resolutions list in the extended format. int16 can contain value from 0 to 65535. I think that it will be enough. Even 8K resolutions so far from 65K...
