[Glide64] fix up settings defaults

This commit is contained in:
zilmar 2016-03-09 08:55:19 +11:00
parent 19913f206b
commit 9c8678482f
4 changed files with 149 additions and 238 deletions

View File

@ -1267,4 +1267,9 @@ void general_setting(short setting_ID, const char * name, unsigned int value)
void game_setting(short setting_ID, const char * name, unsigned int value)
{
RegisterSetting(setting_ID, Data_DWORD_Game, name, NULL, value, NULL);
}
}
void game_setting_default(short setting_ID, const char * name, short default_setting)
{
RegisterSetting2(setting_ID, Data_DWORD_Game, name, NULL, default_setting);
}

View File

@ -269,6 +269,13 @@ enum
Set_Resolution, Set_wrpResolution,
#endif
// Default Game Settings
Set_optimize_texrect_default, Set_filtering_default, Set_lodmode_default,
Set_fog_default, Set_buff_clear_default, Set_swapmode_default,
Set_aspect_default, Set_fb_smart_default, Set_fb_hires_default,
Set_fb_read_always_default, Set_read_back_to_screen_default, Set_detect_cpu_write_default,
Set_fb_get_info_default, Set_fb_render_default,
//Game Settings
Set_alt_tex_size, Set_use_sts1_only, Set_force_calc_sphere, Set_correct_viewport,
Set_increase_texrect_edge, Set_decrease_fillrect_edge, Set_texture_correction,
@ -288,3 +295,4 @@ extern short Set_basic_mode, Set_texture_dir, Set_log_dir, Set_log_flush;
extern void general_setting(short setting_ID, const char * name, unsigned int value);
extern void game_setting(short setting_ID, const char * name, unsigned int value);
extern void game_setting_default(short setting_ID, const char * name, short default_setting);

View File

@ -155,8 +155,8 @@ CSettings * g_settings;
HOTKEY_INFO hotkey_info;
VOODOO voodoo = { 0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0
0, 0, 0, 0,
0, 0, 0, 0
};
GrTexInfo fontTex;
@ -460,7 +460,7 @@ void ReadSpecialSettings(const char * name)
ZLUT_init();
//frame buffer
int optimize_texrect = GetSetting(Set_optimize_texrect);
int optimize_texrect = GetSetting(g_romopen ? Set_optimize_texrect : Set_optimize_texrect_default);
int ignore_aux_copy = GetSetting(Set_ignore_aux_copy);
int hires_buf_clear = GetSetting(Set_hires_buf_clear);
int read_alpha = GetSetting(Set_fb_read_alpha);
@ -479,56 +479,54 @@ void ReadSpecialSettings(const char * name)
else g_settings->frame_buffer &= ~fb_useless_is_useless;
if (fb_crc_mode >= 0) g_settings->fb_crc_mode = (CSettings::FBCRCMODE)fb_crc_mode;
// if (g_settings->custom_ini)
{
g_settings->filtering = GetSetting(Set_filtering);
g_settings->fog = GetSetting(Set_fog);
g_settings->buff_clear = GetSetting(Set_buff_clear);
g_settings->swapmode = GetSetting(Set_swapmode);
g_settings->aspectmode = GetSetting(Set_aspect);
g_settings->lodmode = GetSetting(Set_lodmode);
int resolution = GetSetting(Set_Resolution);
if (resolution >= 0)
{
g_settings->res_data = (uint32_t)resolution;
if (g_settings->res_data >= 0x18) g_settings->res_data = 12;
g_settings->scr_res_x = g_settings->res_x = resolutions[g_settings->res_data][0];
g_settings->scr_res_y = g_settings->res_y = resolutions[g_settings->res_data][1];
}
g_settings->filtering = GetSetting(g_romopen ? Set_filtering : Set_filtering_default);
g_settings->fog = GetSetting(g_romopen ? Set_fog : Set_fog_default);
g_settings->buff_clear = GetSetting(g_romopen ? Set_buff_clear : Set_buff_clear_default);
g_settings->swapmode = GetSetting(g_romopen ? Set_swapmode : Set_swapmode_default);
g_settings->aspectmode = GetSetting(g_romopen ? Set_aspect : Set_aspect_default);
g_settings->lodmode = GetSetting(g_romopen ? Set_lodmode : Set_lodmode_default);
#ifdef _WIN32
g_settings->res_data = GetSetting(Set_Resolution);
if (g_settings->res_data < 0 || g_settings->res_data >= 0x18) g_settings->res_data = 12;
g_settings->scr_res_x = g_settings->res_x = resolutions[g_settings->res_data][0];
g_settings->scr_res_y = g_settings->res_y = resolutions[g_settings->res_data][1];
#endif
//frame buffer
int smart_read = GetSetting(Set_fb_smart);
int hires = GetSetting(Set_fb_hires);
int read_always = GetSetting(Set_fb_read_always);
int read_back_to_screen = GetSetting(Set_read_back_to_screen);
int cpu_write_hack = GetSetting(Set_detect_cpu_write);
int get_fbinfo = GetSetting(Set_fb_get_info);
int depth_render = GetSetting(Set_fb_render);
//frame buffer
int smart_read = GetSetting(g_romopen ? Set_fb_smart : Set_fb_smart_default);
int hires = GetSetting(g_romopen ? Set_fb_hires : Set_fb_hires_default);
int read_always = GetSetting(g_romopen ? Set_fb_read_always : Set_fb_read_always_default);
int read_back_to_screen = GetSetting(g_romopen ? Set_read_back_to_screen : Set_read_back_to_screen_default);
int cpu_write_hack = GetSetting(g_romopen ? Set_detect_cpu_write : Set_detect_cpu_write_default);
int get_fbinfo = GetSetting(g_romopen ? Set_fb_get_info : Set_fb_get_info_default);
int depth_render = GetSetting(g_romopen ? Set_fb_render : Set_fb_render_default);
if (smart_read > 0) g_settings->frame_buffer |= fb_emulation;
else if (smart_read == 0) g_settings->frame_buffer &= ~fb_emulation;
if (hires > 0) g_settings->frame_buffer |= fb_hwfbe;
else if (hires == 0) g_settings->frame_buffer &= ~fb_hwfbe;
if (read_always > 0) g_settings->frame_buffer |= fb_ref;
else if (read_always == 0) g_settings->frame_buffer &= ~fb_ref;
if (read_back_to_screen == 1) g_settings->frame_buffer |= fb_read_back_to_screen;
else if (read_back_to_screen == 2) g_settings->frame_buffer |= fb_read_back_to_screen2;
else if (read_back_to_screen == 0) g_settings->frame_buffer &= ~(fb_read_back_to_screen | fb_read_back_to_screen2);
if (cpu_write_hack > 0) g_settings->frame_buffer |= fb_cpu_write_hack;
else if (cpu_write_hack == 0) g_settings->frame_buffer &= ~fb_cpu_write_hack;
if (get_fbinfo > 0) g_settings->frame_buffer |= fb_get_info;
else if (get_fbinfo == 0) g_settings->frame_buffer &= ~fb_get_info;
if (depth_render > 0) g_settings->frame_buffer |= fb_depth_render;
else if (depth_render == 0) g_settings->frame_buffer &= ~fb_depth_render;
g_settings->frame_buffer |= fb_motionblur;
}
if (smart_read > 0) g_settings->frame_buffer |= fb_emulation;
else if (smart_read == 0) g_settings->frame_buffer &= ~fb_emulation;
if (hires > 0) g_settings->frame_buffer |= fb_hwfbe;
else if (hires == 0) g_settings->frame_buffer &= ~fb_hwfbe;
if (read_always > 0) g_settings->frame_buffer |= fb_ref;
else if (read_always == 0) g_settings->frame_buffer &= ~fb_ref;
if (read_back_to_screen == 1) g_settings->frame_buffer |= fb_read_back_to_screen;
else if (read_back_to_screen == 2) g_settings->frame_buffer |= fb_read_back_to_screen2;
else if (read_back_to_screen == 0) g_settings->frame_buffer &= ~(fb_read_back_to_screen | fb_read_back_to_screen2);
if (cpu_write_hack > 0) g_settings->frame_buffer |= fb_cpu_write_hack;
else if (cpu_write_hack == 0) g_settings->frame_buffer &= ~fb_cpu_write_hack;
if (get_fbinfo > 0) g_settings->frame_buffer |= fb_get_info;
else if (get_fbinfo == 0) g_settings->frame_buffer &= ~fb_get_info;
if (depth_render > 0) g_settings->frame_buffer |= fb_depth_render;
else if (depth_render == 0) g_settings->frame_buffer &= ~fb_depth_render;
g_settings->frame_buffer |= fb_motionblur;
g_settings->flame_corona = (g_settings->hacks & hack_Zelda) && !fb_depth_render_enabled;
}
void WriteSettings(bool saveEmulationSettings)
{
SetSetting(Set_CardId, g_settings->card_id);
#ifdef _WIN32
SetSetting(Set_Resolution, (int)g_settings->res_data);
SetSetting(Set_wrpResolution, g_settings->wrpResolution);
#endif
SetSetting(Set_ssformat, g_settings->ssformat);
SetSetting(Set_vsync, g_settings->vsync);
SetSetting(Set_ShowFps, g_settings->show_fps);
@ -537,7 +535,6 @@ void WriteSettings(bool saveEmulationSettings)
//SetSetting(Set_advanced_options,g_settings->advanced_options);
SetSetting(Set_texenh_options, g_settings->texenh_options);
SetSetting(Set_wrpResolution, g_settings->wrpResolution);
SetSetting(Set_wrpVRAM, g_settings->wrpVRAM);
SetSetting(Set_wrpFBO, g_settings->wrpFBO);
SetSetting(Set_wrpAnisotropic, g_settings->wrpAnisotropic);
@ -580,25 +577,31 @@ void WriteSettings(bool saveEmulationSettings)
if (saveEmulationSettings)
{
SetSetting(Set_filtering, g_settings->filtering);
SetSetting(Set_fog, g_settings->fog);
SetSetting(Set_buff_clear, g_settings->buff_clear);
SetSetting(Set_swapmode, g_settings->swapmode);
SetSetting(Set_lodmode, g_settings->lodmode);
SetSetting(Set_aspect, g_settings->aspectmode);
SetSetting(g_romopen ? Set_filtering : Set_filtering_default, g_settings->filtering);
SetSetting(g_romopen ? Set_fog : Set_fog_default, g_settings->fog);
SetSetting(g_romopen ? Set_buff_clear : Set_buff_clear_default, g_settings->buff_clear);
SetSetting(g_romopen ? Set_swapmode : Set_swapmode_default, g_settings->swapmode);
SetSetting(g_romopen ? Set_lodmode : Set_lodmode_default, g_settings->lodmode);
SetSetting(g_romopen ? Set_aspect : Set_aspect_default, g_settings->aspectmode);
SetSetting(Set_fb_read_always, g_settings->frame_buffer&fb_ref ? 1 : 0);
SetSetting(Set_fb_smart, g_settings->frame_buffer & fb_emulation ? 1 : 0);
SetSetting(Set_fb_hires, g_settings->frame_buffer & fb_hwfbe ? 1 : 0);
SetSetting(Set_fb_get_info, g_settings->frame_buffer & fb_get_info ? 1 : 0);
SetSetting(Set_fb_render, g_settings->frame_buffer & fb_depth_render ? 1 : 0);
SetSetting(Set_detect_cpu_write, g_settings->frame_buffer & fb_cpu_write_hack ? 1 : 0);
SetSetting(g_romopen ? Set_fb_read_always : Set_fb_read_always_default, g_settings->frame_buffer&fb_ref ? 1 : 0);
SetSetting(g_romopen ? Set_fb_smart : Set_fb_smart_default, g_settings->frame_buffer & fb_emulation ? 1 : 0);
SetSetting(g_romopen ? Set_fb_hires : Set_fb_hires_default, g_settings->frame_buffer & fb_hwfbe ? 1 : 0);
SetSetting(g_romopen ? Set_fb_get_info : Set_fb_get_info_default, g_settings->frame_buffer & fb_get_info ? 1 : 0);
SetSetting(g_romopen ? Set_fb_render : Set_fb_render_default, g_settings->frame_buffer & fb_depth_render ? 1 : 0);
SetSetting(g_romopen ? Set_detect_cpu_write : Set_detect_cpu_write_default, g_settings->frame_buffer & fb_cpu_write_hack ? 1 : 0);
if (g_settings->frame_buffer & fb_read_back_to_screen)
SetSetting(Set_read_back_to_screen, 1);
{
SetSetting(g_romopen ? Set_read_back_to_screen : Set_read_back_to_screen_default, 1);
}
else if (g_settings->frame_buffer & fb_read_back_to_screen2)
SetSetting(Set_read_back_to_screen, 2);
{
SetSetting(g_romopen ? Set_read_back_to_screen : Set_read_back_to_screen_default, 2);
}
else
SetSetting(Set_read_back_to_screen, 0);
{
SetSetting(g_romopen ? Set_read_back_to_screen : Set_read_back_to_screen_default, 0);
}
}
FlushSettings();
@ -838,6 +841,7 @@ int InitGfx()
}
//*/
#ifdef _WIN32
uint32_t res_data = g_settings->res_data;
if (ev_fullscreen)
{
@ -855,39 +859,14 @@ int InitGfx()
res_data = g_settings->res_data | 0x80000000;
}
gfx_context = 0;
// Select the window
/*if (fb_hwfbe_enabled)
{
gfx_context = grSstWinOpenExt (uintptr_t(gfx.hWnd),
res_data,
GR_REFRESH_60Hz,
GR_COLORFORMAT_RGBA,
GR_ORIGIN_UPPER_LEFT,
fb_emulation_enabled?GR_PIXFMT_RGB_565:GR_PIXFMT_ARGB_8888, //32b color is not compatible with fb emulation
2, // Double-buffering
1); // 1 auxillary buffer
}*/
if (!gfx_context)
gfx_context = grSstWinOpen(gfx.hWnd,
res_data,
GR_REFRESH_60Hz,
GR_COLORFORMAT_RGBA,
GR_ORIGIN_UPPER_LEFT,
2, // Double-buffering
1); // 1 auxillary buffer
gfx_context = grSstWinOpen(gfx.hWnd, res_data, GR_REFRESH_60Hz, GR_COLORFORMAT_RGBA, GR_ORIGIN_UPPER_LEFT, 2, 1);
if (!gfx_context)
{
#ifdef _WIN32
MessageBox(gfx.hWnd, "Error setting display mode", "Error", MB_OK | MB_ICONEXCLAMATION);
#endif
// grSstWinClose (gfx_context);
grGlideShutdown();
return FALSE;
}
#endif
GfxInitDone = TRUE;
to_fullscreen = FALSE;
@ -1515,6 +1494,10 @@ void CALL MoveScreen(int xpos, int ypos)
rdp.window_changed = TRUE;
}
#ifdef _WIN32
int GetCurrentResIndex(void);
#endif
void CALL PluginLoaded(void)
{
SetModuleName("default");
@ -1528,7 +1511,10 @@ void CALL PluginLoaded(void)
SetModuleName("Glide64");
general_setting(Set_CardId, "card_id", 0);
#ifdef _WIN32
general_setting(Set_Resolution, "resolution", 7);
general_setting(Set_wrpResolution, "wrpResolution", GetCurrentResIndex());
#endif
general_setting(Set_vsync, "vsync", 1);
general_setting(Set_ssformat, "ssformat", 1);
general_setting(Set_ShowFps, "show_fps", 0);
@ -1536,7 +1522,6 @@ void CALL PluginLoaded(void)
general_setting(Set_clock_24_hr, "clock_24_hr", 0);
general_setting(Set_texenh_options, "texenh_options", 0);
general_setting(Set_hotkeys, "hotkeys", 1);
general_setting(Set_wrpResolution, "wrpResolution", 0);
general_setting(Set_wrpVRAM, "wrpVRAM", 0);
general_setting(Set_wrpFBO, "wrpFBO", 0);
general_setting(Set_wrpAnisotropic, "wrpAnisotropic", 0);
@ -1571,6 +1556,22 @@ void CALL PluginLoaded(void)
general_setting(Set_ghq_hirs_let_texartists_fly, "ghq_hirs_let_texartists_fly", 0);
general_setting(Set_ghq_hirs_dump, "ghq_hirs_dump", 0);
general_setting(Set_optimize_texrect_default, "optimize_texrect", 1);
general_setting(Set_filtering_default, "filtering", 0);
general_setting(Set_lodmode_default, "lodmode", 0);
general_setting(Set_fog_default, "fog", 1);
general_setting(Set_buff_clear_default, "buff_clear", 1);
general_setting(Set_swapmode_default, "swapmode", 1);
general_setting(Set_aspect_default, "aspect", 0);
general_setting(Set_fb_smart_default, "fb_smart", 1);
general_setting(Set_fb_hires_default, "fb_hires", 1);
general_setting(Set_fb_read_always_default, "fb_read_always", 0);
general_setting(Set_read_back_to_screen_default, "read_back_to_screen", 0);
general_setting(Set_detect_cpu_write_default, "detect_cpu_write", 0);
general_setting(Set_fb_get_info_default, "fb_get_info", 0);
general_setting(Set_fb_render_default, "fb_render", 0);
game_setting(Set_alt_tex_size, "alt_tex_size", 0);
game_setting(Set_use_sts1_only, "use_sts1_only", 0);
game_setting(Set_force_calc_sphere, "force_calc_sphere", 0);
@ -1591,26 +1592,26 @@ void CALL PluginLoaded(void)
game_setting(Set_zmode_compare_less, "zmode_compare_less", 0);
game_setting(Set_old_style_adither, "old_style_adither", 0);
game_setting(Set_n64_z_scale, "n64_z_scale", 0);
game_setting(Set_optimize_texrect, "optimize_texrect", 1);
game_setting_default(Set_optimize_texrect, "optimize_texrect", Set_optimize_texrect_default);
game_setting(Set_ignore_aux_copy, "ignore_aux_copy", (unsigned int)-1);
game_setting(Set_hires_buf_clear, "hires_buf_clear", 1);
game_setting(Set_fb_read_alpha, "fb_read_alpha", 0);
game_setting(Set_useless_is_useless, "useless_is_useless", (unsigned int)-1);
game_setting(Set_fb_crc_mode, "fb_crc_mode", 1);
game_setting(Set_filtering, "filtering", 0);
game_setting(Set_fog, "fog", 1);
game_setting(Set_buff_clear, "buff_clear", 1);
game_setting(Set_swapmode, "swapmode", 1);
game_setting(Set_aspect, "aspect", 0);
game_setting(Set_lodmode, "lodmode", 0);
game_setting_default(Set_filtering, "filtering", Set_filtering_default);
game_setting_default(Set_fog, "fog", Set_fog_default);
game_setting_default(Set_buff_clear, "buff_clear", Set_buff_clear_default);
game_setting_default(Set_swapmode, "swapmode", Set_swapmode_default);
game_setting_default(Set_aspect, "aspect", Set_aspect_default);
game_setting_default(Set_lodmode, "lodmode", Set_lodmode_default);
game_setting(Set_fb_smart, "fb_smart", 1);
game_setting(Set_fb_hires, "fb_hires", 1);
game_setting(Set_fb_read_always, "fb_read_always", 0);
game_setting(Set_read_back_to_screen, "read_back_to_screen", 0);
game_setting(Set_detect_cpu_write, "detect_cpu_write", 0);
game_setting(Set_fb_get_info, "fb_get_info", 0);
game_setting(Set_fb_render, "fb_render", 0);
game_setting_default(Set_fb_smart, "fb_smart", Set_fb_smart_default);
game_setting_default(Set_fb_hires, "fb_hires", Set_fb_hires_default);
game_setting_default(Set_fb_read_always, "fb_read_always", Set_fb_read_always_default);
game_setting_default(Set_read_back_to_screen, "read_back_to_screen", Set_read_back_to_screen_default);
game_setting_default(Set_detect_cpu_write, "detect_cpu_write", Set_detect_cpu_write_default);
game_setting_default(Set_fb_get_info, "fb_get_info", Set_fb_get_info_default);
game_setting_default(Set_fb_render, "fb_render", Set_fb_render_default);
WriteTrace(TraceInterface, TraceDebug, "Done");
}
@ -1678,10 +1679,8 @@ void CALL RomOpen(void)
if (code == 0x5000) region = 1; // Europe (PAL)
if (code == 0x5500) region = 0; // Australia (NTSC)
char name[21] = "DEFAULT";
ReadSpecialSettings(name);
// get the name of the ROM
char name[21];
for (int i = 0; i < 20; i++)
{
char ch;
@ -1759,7 +1758,7 @@ void CALL ShowCFB(void)
void drawViRegBG()
{
WriteTrace(TraceGlide64, TraceDebug, "-");
WriteTrace(TraceGlide64, TraceDebug, "start");
const uint32_t VIwidth = *gfx.VI_WIDTH_REG;
FB_TO_SCREEN_INFO fb_info;
fb_info.width = VIwidth;
@ -1787,6 +1786,7 @@ void drawViRegBG()
newSwapBuffers();
DrawFrameBufferToScreen(fb_info);
}
WriteTrace(TraceGlide64, TraceDebug, "done");
}
static void DrawFrameBuffer()
@ -1970,7 +1970,7 @@ void write_png_file(const char* file_name, int width, int height, uint8_t *buffe
int pixel_size = 3;
int p = 0;
png_bytep * row_pointers = (png_bytep*)malloc(sizeof(png_bytep) * height);
png_bytep * row_pointers = (png_bytep*)malloc(sizeof(png_bytep)* height);
for (int y = 0; y < height; y++)
{
row_pointers[y] = (png_byte*)malloc(width*pixel_size);
@ -2436,7 +2436,7 @@ LRESULT CALLBACK LowLevelKeyboardProc(int nCode,
if (p->vkCode == 46) k_del = 1;
goto do_it;
do_it:
do_it:
TabKey =
((p->vkCode == VK_TAB) && ((p->flags & LLKHF_ALTDOWN) != 0)) ||
((p->vkCode == VK_ESCAPE) && ((p->flags & LLKHF_ALTDOWN) != 0)) ||

View File

@ -87,6 +87,15 @@ public:
*_frequency = (FxU32)aResolutions[_idx].dwF;
}
}
int getCurrentResolutions(void)
{
if (dwNumResolutions == 0)
{
init();
}
return currentResolutions;
}
char ** getResolutionsList(int32_t * Size)
{
@ -105,6 +114,7 @@ private:
unsigned int dwNumResolutions;
ResolutionInfo * aResolutions;
char ** aResolutionsStr;
int currentResolutions;
};
FullScreenResolutions::~FullScreenResolutions()
@ -121,9 +131,13 @@ void FullScreenResolutions::init()
{
WriteTrace(TraceGlitch, TraceDebug, "executing");
#ifdef _WIN32
DEVMODE enumMode;
currentResolutions = -1;
DEVMODE enumMode , currentMode;
int iModeNum = 0;
memset(&enumMode, 0, sizeof(DEVMODE));
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &currentMode);
ResolutionInfo prevInfo;
while (EnumDisplaySettings(NULL, iModeNum++, &enumMode) != 0)
{
@ -147,6 +161,10 @@ void FullScreenResolutions::init()
ResolutionInfo curInfo(enumMode.dmPelsWidth, enumMode.dmPelsHeight, enumMode.dmDisplayFrequency);
if (enumMode.dmBitsPerPel == 32 && curInfo != prevInfo)
{
if (enumMode.dmPelsHeight == currentMode.dmPelsHeight && enumMode.dmPelsWidth == currentMode.dmPelsWidth)
{
currentResolutions = current;
}
aResolutions[current] = curInfo;
curInfo.toString(smode);
aResolutionsStr[current] = new char[strlen(smode) + 1];
@ -155,48 +173,7 @@ void FullScreenResolutions::init()
current++;
}
}
#else // _WIN32
SDL_Rect** modes;
SDL_Surface *check_surface;
SDL_PixelFormat *fmt;
int iModeNum;
SDL_InitSubSystem(SDL_INIT_VIDEO);
check_surface = SDL_CreateRGBSurface(NULL, 0, 0, 32, 0, 0, 0, 0);
if (!check_surface || check_surface->format->BitsPerPixel != 32) {
return; //failtrain!
}
fmt = check_surface->format;
modes = SDL_ListModes(fmt, SDL_FULLSCREEN|SDL_HWSURFACE);
ResolutionInfo prevInfo;
for (iModeNum = 0; modes[iModeNum]; ++iModeNum) {
ResolutionInfo curInfo(modes[iModeNum]->w, modes[iModeNum]->h, 0);
if (curInfo != prevInfo) {
dwNumResolutions++;
prevInfo = curInfo;
}
}
aResolutions = new ResolutionInfo[dwNumResolutions];
aResolutionsStr = new char*[dwNumResolutions];
int current = 0;
char smode[256];
memset(&prevInfo, 0, sizeof(ResolutionInfo));
for (iModeNum = 0; modes[iModeNum]; ++iModeNum) {
ResolutionInfo curInfo(modes[iModeNum]->w, modes[iModeNum]->h, 0);
if (curInfo != prevInfo) {
aResolutions[current] = curInfo;
curInfo.toString(smode);
aResolutionsStr[current] = new char[strlen(smode)+1];
strcpy(aResolutionsStr[current], smode);
prevInfo = curInfo;
current++;
}
}
SDL_FreeSurface(check_surface);
#endif // _WIN32
#endif
}
bool FullScreenResolutions::changeDisplaySettings(FxU32 _resolution)
@ -697,7 +674,7 @@ int nAuxBuffers)
return grSstWinOpen(hWnd, screen_resolution, refresh_rate, color_format, origin_location, nColBuffers, nAuxBuffers);
}
#ifdef WIN32
#ifdef _WIN32
# include <fcntl.h>
# ifndef ATTACH_PARENT_PROCESS
# define ATTACH_PARENT_PROCESS ((FxU32)-1)
@ -957,89 +934,6 @@ int nAuxBuffers)
return FXFALSE;
}
}
#else // _WIN32
// init sdl & gl
const SDL_VideoInfo *videoInfo;
Uint32 videoFlags = 0;
fullscreen = 0;
/* Initialize SDL */
printf("(II) Initializing SDL video subsystem...\n");
if (SDL_InitSubSystem(SDL_INIT_VIDEO) == -1)
{
printf("(EE) Error initializing SDL video subsystem: %s\n", SDL_GetError());
return false;
}
/* Video Info */
printf("(II) Getting video info...\n");
if(!(videoInfo = SDL_GetVideoInfo()))
{
printf("(EE) Video query failed: %s\n", SDL_GetError());
SDL_QuitSubSystem(SDL_INIT_VIDEO);
return false;
}
/* Setting the video mode */
videoFlags |= SDL_OPENGL | SDL_GL_DOUBLEBUFFER | SDL_HWPALETTE;
if(videoInfo->hw_available)
videoFlags |= SDL_HWSURFACE;
else
videoFlags |= SDL_SWSURFACE;
if(videoInfo->blit_hw)
videoFlags |= SDL_HWACCEL;
//if (!(screen_resolution & 0x80000000))
//videoFlags |= SDL_FULLSCREEN;
if (screen_resolution & 0x80000000)
{
fullscreen = 0;
}
else
{
FxU32 _width, _height;
g_FullScreenResolutions.getResolution(screen_resolution, &_width, &_height);
width = _width;
height = _height;
videoFlags |= SDL_FULLSCREEN;
fullscreen = 1;
}
TMU_SIZE = (config.vram_size - width * height * 4 * 3) / 2;
//viewport_offset = ((screen_resolution>>2) > 20) ? screen_resolution >> 2 : 20;
// ZIGGY viewport_offset is WIN32 specific, with SDL just set it to zero
viewport_offset = 0; //-10 //-20;
// ZIGGY not sure, but it might be better to let the system choose
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, 16);
// SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, 32);
// SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
// SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
// SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
// SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
printf("(II) Setting video mode %dx%d...\n", width, height);
if(!(m_pScreen = SDL_SetVideoMode(width, height, 0, videoFlags)))
{
printf("(EE) Error setting videomode %dx%d: %s\n", width, height, SDL_GetError());
SDL_QuitSubSystem(SDL_INIT_VIDEO);
return false;
}
char caption[500];
# ifdef _DEBUG
sprintf(caption, "Glide64 debug");
# else // _DEBUG
sprintf(caption, "Glide64");
# endif // _DEBUG
SDL_WM_SetCaption(caption, caption);
glViewport(0, viewport_offset, width, height);
#endif // _WIN32
lfb_color_fmt = color_format;
if (origin_location != GR_ORIGIN_UPPER_LEFT) WriteTrace(TraceGlitch, TraceWarning, "origin must be in upper left corner");
@ -1788,8 +1682,7 @@ grGet(FxU32 pname, FxU32 plength, FxI32 *params)
if (plength < 4 || params == NULL) return 0;
if (!nbTextureUnits)
{
grSstWinOpen((unsigned long)NULL, GR_RESOLUTION_640x480 | 0x80000000, 0, GR_COLORFORMAT_ARGB,
GR_ORIGIN_UPPER_LEFT, 2, 1);
grSstWinOpen((unsigned long)NULL, GR_RESOLUTION_640x480 | 0x80000000, 0, GR_COLORFORMAT_ARGB, GR_ORIGIN_UPPER_LEFT, 2, 1);
grSstWinClose(0);
}
#ifdef VOODOO1
@ -2632,6 +2525,11 @@ FxI32 src_stride, void *src_data)
return FXTRUE;
}
int GetCurrentResIndex(void)
{
return g_FullScreenResolutions.getCurrentResolutions();
}
/* wrapper-specific glide extensions */
FX_ENTRY char ** FX_CALL