This commit is contained in:
twinaphex 2019-01-31 15:13:36 +01:00
parent 3d092c8394
commit d24408730b
2 changed files with 39 additions and 38 deletions

View File

@ -175,7 +175,7 @@ static bool command_version(const char* arg)
{
char reply[256] = {0};
sprintf(reply, "%s\n", PACKAGE_VERSION);
snprintf(reply, sizeof(reply), "%s\n", PACKAGE_VERSION);
#if defined(HAVE_CHEEVOS) && (defined(HAVE_STDIN_CMD) || defined(HAVE_NETWORK_CMD) && defined(HAVE_NETWORKING))
command_reply(reply, strlen(reply));
#endif
@ -292,7 +292,7 @@ static bool command_read_ram(const char *arg)
if (data)
{
for (i=0;i<nbytes;i++)
for (i = 0; i < nbytes; i++)
sprintf(reply_at+3*i, " %.2X", data[i]);
reply_at[3*nbytes] = '\n';
command_reply(reply, reply_at+3*nbytes+1 - reply);
@ -304,7 +304,7 @@ static bool command_read_ram(const char *arg)
}
free(reply);
#else
cheevos_var_t var;
cheevos_var_t var;
unsigned i;
char reply[256] = {0};
const uint8_t * data = NULL;
@ -324,7 +324,7 @@ static bool command_read_ram(const char *arg)
{
unsigned nbytes = strtol(reply_at, NULL, 10);
for (i=0;i<nbytes;i++)
for (i = 0; i < nbytes; i++)
sprintf(reply_at+3*i, " %.2X", data[i]);
reply_at[3*nbytes] = '\n';
command_reply(reply, reply_at+3*nbytes+1 - reply);

View File

@ -72,23 +72,21 @@ static void x11_display_server_destroy(void *data)
if (crt_en)
{
snprintf(output, sizeof(output),
"xrandr --newmode \"700x480_59.94\" 13.849698 700 742 801 867 480 490 496 533 interlace -hsync -vsync");
"xrandr --newmode \"700x480_59.94\" 13.849698 700 742 801 867 480 490 496 533 interlace -hsync -vsync");
system(output);
snprintf(output, sizeof(output),
"xrandr --addmode %s 700x480_59.94", orig_output);
"xrandr --addmode %s 700x480_59.94", orig_output);
system(output);
snprintf(output, sizeof(output),
"xrandr --output %s --mode 700x480_59.94", orig_output);
"xrandr --output %s --mode 700x480_59.94", orig_output);
system(output);
snprintf(output, sizeof(output),
"xrandr --delmode %s %s",orig_output, old_mode);
"xrandr --delmode %s %s",orig_output, old_mode);
system(output);
snprintf(output, sizeof(output), "xrandr --rmmode %s", old_mode);
system(output);
@ -133,38 +131,41 @@ static bool x11_display_server_set_window_decorations(void *data, bool on)
static bool x11_display_server_set_resolution(void *data,
unsigned width, unsigned height, int int_hz, float hz, int center, int monitor_index)
{
int i = 0;
int hfp = 0;
int hsp = 0;
int hbp = 0;
int vfp = 0;
int vsp = 0;
int vbp = 0;
int hmax = 0;
int vmax = 0;
int pdefault = 8;
int pwidth = 0;
float roundw = 0.0f;
float roundh = 0.0f;
float pixel_clock = 0;
int screen;
Window window;
XRRScreenResources *res = NULL;
Display *dsp = NULL;
Screen *scrn = NULL;
int i = 0;
int hfp = 0;
int hsp = 0;
int hbp = 0;
int vfp = 0;
int vsp = 0;
int vbp = 0;
int hmax = 0;
int vmax = 0;
int pdefault = 8;
int pwidth = 0;
float roundw = 0.0f;
float roundh = 0.0f;
float pixel_clock = 0;
crt_en = true;
sprintf(old_mode,"%s", new_mode);
Display* dsp = XOpenDisplay(NULL);
Screen* scrn = DefaultScreenOfDisplay(dsp);
XRRScreenResources *res;
int screen = DefaultScreen ( dsp );
Window window = RootWindow ( dsp, screen );
crt_en = true;
snprintf(old_mode, sizeof(old_mode), "%s", new_mode);
dsp = XOpenDisplay(NULL);
scrn = DefaultScreenOfDisplay(dsp);
screen = DefaultScreen ( dsp );
window = RootWindow ( dsp, screen );
/* set core refresh from hz */
video_monitor_set_refresh_rate(hz);
/* following code is the mode line generator */
hsp = width * 1.140;
hfp = width * 1.055;
hsp = width * 1.140;
hfp = width * 1.055;
pwidth = width;
if (height < 400 && width > 400)
@ -181,7 +182,7 @@ static bool x11_display_server_set_resolution(void *data,
if (roundw < 1.20)
roundw = 1.34;
hbp = width * roundw - 8;
hbp = width * roundw - 8;
hmax = hbp;
if (height < 241)