cfgfile_write (f, _T("chipset_refreshrate"), _T("%f"), p->chipset_refreshrate);
for (int i = 0; i < MAX_CHIPSET_REFRESH_TOTAL; i++) {
- if (p->cr[i].rate <= 0)
- continue;
struct chipset_refresh *cr = &p->cr[i];
+ if (!cr->inuse)
+ continue;
cr->index = i;
_stprintf (tmp, _T("%f"), cr->rate);
TCHAR *s = tmp + _tcslen (tmp);
_tcscat (s, _T(",lace"));
else if (cr->lace == 0)
_tcscat (s, _T(",nlace"));
+ if ((cr->resolution & 7) != 7) {
+ if (cr->resolution & 1)
+ _tcscat(s, _T(",lores"));
+ if (cr->resolution & 2)
+ _tcscat(s, _T(",hires"));
+ if (cr->resolution & 4)
+ _tcscat(s, _T(",shres"));
+ if (cr->resolution_pct > 0 && cr->resolution_pct < 100)
+ s += _stprintf(s, _T("rpct=%d"), cr->resolution_pct);
+ }
if (cr->framelength > 0)
_tcscat (s, _T(",lof"));
else if (cr->framelength == 0)
_tcscat (s, _T(",nvsync"));
if (cr->rtg)
_tcscat (s, _T(",rtg"));
+ if (cr->filterprofile[0]) {
+ TCHAR *se = cfgfile_escape(cr->filterprofile, _T(","), true);
+ s += _stprintf(s, _T(",filter=%s"), cr->filterprofile);
+ xfree(se);
+ }
if (cr->commands[0]) {
- _tcscat (s, _T(","));
+ _tcscat (s, _T(",cmd="));
_tcscat (s, cr->commands);
for (int j = 0; j < _tcslen (s); j++) {
if (s[j] == '\n')
}
}
}
- if (!_tcscmp (value, _T("direct3d"))) {
+ if (!_tcscmp(value, _T("none"))) {
+ gf->gfx_filtershader[2 * MAX_FILTERSHADERS][0] = 0;
+ for (int i = 0; i < 2 * MAX_FILTERSHADERS; i++) {
+ gf->gfx_filtershader[i][0] = 0;
+ gf->gfx_filtermask[i][0] = 0;
+ }
+ } else if (!_tcscmp (value, _T("direct3d"))) {
p->gfx_api = 1; // forwards compatibiity
} else {
int i = 0;
_tcsncpy (tmpbuf, value, sizeof tmpbuf / sizeof (TCHAR) - 1);
tmpbuf[sizeof tmpbuf / sizeof (TCHAR) - 1] = '\0';
- int vert = -1, horiz = -1, lace = -1, ntsc = -1, framelength = -1, vsync = -1;
+ int vert = -1, horiz = -1, lace = -1, ntsc = -1, framelength = -1, vsync = -1, hres = 0;
bool locked = false;
bool rtg = false;
+ bool cmdmode = false;
double rate = -1;
- TCHAR cmd[MAX_DPATH], label[16] = { 0 };
+ int rpct = 0;
+ TCHAR cmd[MAX_DPATH], filter[64] = { 0 }, label[16] = { 0 };
TCHAR *tmpp = tmpbuf;
TCHAR *end = tmpbuf + _tcslen (tmpbuf);
cmd[0] = 0;
equals++;
*next = 0;
- if (rate < 0)
- rate = _tstof (tmpp);
- else if (!_tcsnicmp (tmpp, _T("v="), 2))
- vert = _tstol (equals);
- else if (!_tcsnicmp (tmpp, _T("h="), 2))
- horiz = _tstol (equals);
- else if (!_tcsnicmp (tmpp, _T("t="), 2))
- _tcsncpy (label, equals, sizeof label / sizeof (TCHAR) - 1);
- else if (equals) {
- if (_tcslen (cmd) + _tcslen (tmpp) + 2 < sizeof (cmd) / sizeof (TCHAR)) {
- _tcscat (cmd, tmpp);
- _tcscat (cmd, _T("\n"));
+ if (cmdmode) {
+ if (_tcslen(cmd) + _tcslen(tmpp) + 2 < sizeof(cmd) / sizeof(TCHAR)) {
+ _tcscat(cmd, tmpp);
+ _tcscat(cmd, _T("\n"));
+ }
+ } else {
+ if (!_tcsnicmp(tmpp, _T("cmd="), 4)) {
+ cmdmode = true;
+ tmpp += 4;
}
+ if (rate < 0)
+ rate = _tstof(tmpp);
+ else if (!_tcsnicmp(tmpp, _T("v="), 2))
+ vert = _tstol(equals);
+ else if (!_tcsnicmp(tmpp, _T("h="), 2))
+ horiz = _tstol(equals);
+ else if (!_tcsnicmp(tmpp, _T("t="), 2))
+ _tcsncpy(label, equals, sizeof label / sizeof(TCHAR) - 1);
+ else if (!_tcsnicmp(tmpp, _T("filter="), 7))
+ _tcsncpy(filter, equals, sizeof filter / sizeof(TCHAR) - 1);
+ else if (!_tcsnicmp(tmpp, _T("rpct="), 5))
+ rpct = _tstol(equals);
+ else if (equals) {
+ if (_tcslen(cmd) + _tcslen (tmpp) + 2 < sizeof (cmd) / sizeof (TCHAR)) {
+ _tcscat(cmd, tmpp);
+ _tcscat(cmd, _T("\n"));
+ }
+ }
+ if (!_tcsnicmp(tmpp, _T("locked"), 4))
+ locked = true;
+ if (!_tcsnicmp(tmpp, _T("nlace"), 5))
+ lace = 0;
+ if (!_tcsnicmp(tmpp, _T("lace"), 4))
+ lace = 1;
+ if (!_tcsnicmp(tmpp, _T("lores"), 5))
+ hres |= 1 << RES_LORES;
+ if (!_tcsnicmp(tmpp, _T("hires"), 5))
+ hres |= 1 << RES_HIRES;
+ if (!_tcsnicmp(tmpp, _T("shres"), 5))
+ hres |= 1 << RES_SUPERHIRES;
+ if (!_tcsnicmp(tmpp, _T("nvsync"), 5))
+ vsync = 0;
+ if (!_tcsnicmp(tmpp, _T("vsync"), 4))
+ vsync = 1;
+ if (!_tcsnicmp(tmpp, _T("ntsc"), 4))
+ ntsc = 1;
+ if (!_tcsnicmp(tmpp, _T("pal"), 3))
+ ntsc = 0;
+ if (!_tcsnicmp(tmpp, _T("lof"), 3))
+ framelength = 1;
+ if (!_tcsnicmp(tmpp, _T("shf"), 3))
+ framelength = 0;
+ if (!_tcsnicmp(tmpp, _T("rtg"), 3))
+ rtg = true;
}
- if (!_tcsnicmp (tmpp, _T("locked"), 4))
- locked = true;
- if (!_tcsnicmp (tmpp, _T("nlace"), 5))
- lace = 0;
- if (!_tcsnicmp (tmpp, _T("lace"), 4))
- lace = 1;
- if (!_tcsnicmp (tmpp, _T("nvsync"), 5))
- vsync = 0;
- if (!_tcsnicmp (tmpp, _T("vsync"), 4))
- vsync = 1;
- if (!_tcsnicmp (tmpp, _T("ntsc"), 4))
- ntsc = 1;
- if (!_tcsnicmp (tmpp, _T("pal"), 3))
- ntsc = 0;
- if (!_tcsnicmp (tmpp, _T("lof"), 3))
- framelength = 1;
- if (!_tcsnicmp (tmpp, _T("shf"), 3))
- framelength = 0;
- if (!_tcsnicmp (tmpp, _T("rtg"), 3))
- rtg = true;
tmpp = next;
if (tmpp >= end)
break;
tmpp++;
}
- if (rate > 0) {
- for (int i = 0; i < MAX_CHIPSET_REFRESH; i++) {
- if (_tcscmp (option, _T("displaydata_pal")) == 0) {
- i = CHIPSET_REFRESH_PAL;
- p->cr[i].rate = -1;
- _tcscpy (label, _T("PAL"));
- } else if (_tcscmp (option, _T("displaydata_ntsc")) == 0) {
- i = CHIPSET_REFRESH_NTSC;
- p->cr[i].rate = -1;
- _tcscpy (label, _T("NTSC"));
- }
- if (p->cr[i].rate <= 0) {
- p->cr[i].horiz = horiz;
- p->cr[i].vert = vert;
- p->cr[i].lace = lace;
- p->cr[i].ntsc = ntsc;
- p->cr[i].vsync = vsync;
- p->cr[i].locked = locked;
- p->cr[i].rtg = rtg;
- p->cr[i].framelength = framelength;
- p->cr[i].rate = rate;
- _tcscpy (p->cr[i].commands, cmd);
- _tcscpy (p->cr[i].label, label);
- break;
- }
+ for (int i = 0; i < MAX_CHIPSET_REFRESH; i++) {
+ struct chipset_refresh *cr = &p->cr[i];
+ if (_tcscmp (option, _T("displaydata_pal")) == 0) {
+ i = CHIPSET_REFRESH_PAL;
+ cr->rate = -1;
+ _tcscpy (label, _T("PAL"));
+ } else if (_tcscmp (option, _T("displaydata_ntsc")) == 0) {
+ i = CHIPSET_REFRESH_NTSC;
+ cr->rate = -1;
+ _tcscpy (label, _T("NTSC"));
+ }
+ if (!cr->inuse) {
+ cr->inuse = true;
+ cr->horiz = horiz;
+ cr->vert = vert;
+ cr->lace = lace;
+ cr->resolution = hres ? hres : 1 + 2 + 4;
+ cr->resolution_pct = rpct;
+ cr->ntsc = ntsc;
+ cr->vsync = vsync;
+ cr->locked = locked;
+ cr->rtg = rtg;
+ cr->framelength = framelength;
+ cr->rate = rate;
+ _tcscpy(cr->commands, cmd);
+ _tcscpy(cr->label, label);
+ TCHAR *se = cfgfile_unescape(filter, NULL);
+ _tcscpy(cr->filterprofile, se);
+ xfree(se);
+ break;
}
}
return 1;