Changes since v0.7 : - Major CPU reorganisation. This has possibly broken some stuff, though I fixed all the regressions I could find - Lazy flags. This brought 10% speed improvement at one point, but that's probably been lost now - 430 VX chipset emulation - IDT Winchip emulation (currently sans MMX). Timing is probably wrong - Fixed a few FPU bugs - Timer reorganisation - Sound reorganisation - Other general reorganisation - AdLib Gold emulation - Windows Sound System emulation - Pro Audio Spectrum 16 emulation. This currently works with most DOS stuff, but not in Windows - Major improvements to GUS emulation. Has the downside that it now conflicts with SB emulation, so probably best to not enable both simultaneously - New graphics cards : - ATI-18800 (VGA Edge-16) - ATI-28800 (VGA Charger) - ATI Mach64GX (Graphics Pro Turbo). Quite a few features missing, but Windows doesn't seem to use half the features of this card - Cirrus Logic CL-GD5429. Blitter is a bit broken - Oak OTI-067 - S3 Trio64 (Number Nine 9FX) - S3 Virge. Only framebuffer stuff at the minute, Windows won't recognise the card - Trident TGUI-9440 - VGA. Doesn't work yet - Beginnings of 3DFX emulation, however this is in extremely early stages and doesn't do anything useful - Fixed DMA bug stopping floppy drives working in Windows 3.x - Fixed some other stuff probably - Broke some other stuff probably as well
166 lines
4.5 KiB
C
166 lines
4.5 KiB
C
#include <stdio.h>
|
|
#include <string.h>
|
|
#include "config.h"
|
|
|
|
static char config_file[256];
|
|
|
|
void set_config_file(char *s)
|
|
{
|
|
strcpy(config_file, s);
|
|
}
|
|
|
|
void config_new()
|
|
{
|
|
FILE *f = fopen(config_file, "wt");
|
|
fclose(f);
|
|
}
|
|
|
|
int get_config_int(char *head, char *name, int def)
|
|
{
|
|
char buffer[256];
|
|
char name2[256];
|
|
FILE *f = fopen(config_file, "rt");
|
|
int c, d;
|
|
int res = def;
|
|
|
|
if (!f)
|
|
return def;
|
|
|
|
// pclog("Searching for %s\n", name);
|
|
|
|
while (1)
|
|
{
|
|
fgets(buffer, 255, f);
|
|
if (feof(f)) break;
|
|
|
|
c = d = 0;
|
|
|
|
while (buffer[c] == ' ' && buffer[c])
|
|
c++;
|
|
|
|
if (!buffer[c]) continue;
|
|
|
|
while (buffer[c] != '=' && buffer[c] != ' ' && buffer[c])
|
|
name2[d++] = buffer[c++];
|
|
|
|
if (!buffer[c]) continue;
|
|
name2[d] = 0;
|
|
|
|
// pclog("Comparing %s and %s\n", name, name2);
|
|
if (strcmp(name, name2)) continue;
|
|
// pclog("Found!\n");
|
|
|
|
while ((buffer[c] == '=' || buffer[c] == ' ') && buffer[c])
|
|
c++;
|
|
|
|
if (!buffer[c]) continue;
|
|
|
|
sscanf(&buffer[c], "%i", &res);
|
|
// pclog("Reading value - %i\n", res);
|
|
break;
|
|
}
|
|
|
|
fclose(f);
|
|
return res;
|
|
}
|
|
|
|
char config_return_string[256];
|
|
|
|
char *get_config_string(char *head, char *name, char *def)
|
|
{
|
|
char buffer[256];
|
|
char name2[256];
|
|
FILE *f = fopen(config_file, "rt");
|
|
int c, d;
|
|
|
|
strcpy(config_return_string, def);
|
|
|
|
if (!f)
|
|
return config_return_string;
|
|
|
|
// pclog("Searching for %s\n", name);
|
|
|
|
while (1)
|
|
{
|
|
fgets(buffer, 255, f);
|
|
if (feof(f)) break;
|
|
|
|
c = d = 0;
|
|
|
|
while (buffer[c] == ' ' && buffer[c])
|
|
c++;
|
|
|
|
if (!buffer[c]) continue;
|
|
|
|
while (buffer[c] != '=' && buffer[c] != ' ' && buffer[c])
|
|
name2[d++] = buffer[c++];
|
|
|
|
if (!buffer[c]) continue;
|
|
name2[d] = 0;
|
|
|
|
// pclog("Comparing %s and %s\n", name, name2);
|
|
if (strcmp(name, name2)) continue;
|
|
// pclog("Found!\n");
|
|
|
|
while ((buffer[c] == '=' || buffer[c] == ' ') && buffer[c])
|
|
c++;
|
|
|
|
if (!buffer[c]) continue;
|
|
|
|
strcpy(config_return_string, &buffer[c]);
|
|
|
|
c = strlen(config_return_string) - 1;
|
|
// pclog("string len %i\n", c);
|
|
while (config_return_string[c] <= 32 && config_return_string[c])
|
|
config_return_string[c--] = 0;
|
|
|
|
// pclog("Reading value - %s\n", config_return_string);
|
|
break;
|
|
}
|
|
|
|
fclose(f);
|
|
return config_return_string;
|
|
}
|
|
|
|
void set_config_int(char *head, char *name, int val)
|
|
{
|
|
FILE *f = fopen(config_file, "at");
|
|
// if (!f) pclog("set_config_int - !f\n");
|
|
fprintf(f, "%s = %i\n", name, val);
|
|
// pclog("Write %s = %i\n", name, val);
|
|
fclose(f);
|
|
// pclog("fclose\n");
|
|
}
|
|
|
|
void set_config_string(char *head, char *name, char *val)
|
|
{
|
|
FILE *f = fopen(config_file, "at");
|
|
// if (!f) pclog("set_config_string - !f\n");
|
|
fprintf(f, "%s = %s\n", name, val);
|
|
// pclog("Write %s = %s\n", name, val);
|
|
fclose(f);
|
|
}
|
|
|
|
char *get_filename(char *s)
|
|
{
|
|
int c = strlen(s) - 1;
|
|
while (c > 0)
|
|
{
|
|
if (s[c] == '/' || s[c] == '\\')
|
|
return &s[c+1];
|
|
c--;
|
|
}
|
|
return s;
|
|
}
|
|
|
|
void append_filename(char *dest, char *s1, char *s2, int size)
|
|
{
|
|
sprintf(dest, "%s%s", s1, s2);
|
|
}
|
|
|
|
void put_backslash(char *s)
|
|
{
|
|
int c = strlen(s) - 1;
|
|
if (s[c] != '/' && s[c] != '\\')
|
|
s[c] = '/';
|
|
}
|