Warning cleanups, etc

This commit is contained in:
Themaister 2010-05-28 02:54:20 +02:00
parent cd0f21d139
commit 06e79de6ca
3 changed files with 10 additions and 13 deletions

View File

@ -8,13 +8,7 @@
#include <stdbool.h>
#include <GL/glfw.h>
#include "libsnes.hpp"
struct snes_keybind
{
int id;
int key;
int joykey;
};
#include "driver.h"
#define SAVE_STATE_KEY GLFW_KEY_F2
#define LOAD_STATE_KEY GLFW_KEY_F4

11
gl.c
View File

@ -1,12 +1,12 @@
#include "driver.h"
#include <GL/glfw.h>
#include <stdint.h>
#include "config.h"
#include "libsnes.hpp"
#include <stdio.h>
static GLuint texture;
static uint8_t *gl_buffer;
static bool keep_aspect = true;
typedef struct gl
{
@ -20,8 +20,9 @@ static void glfw_input_poll(void *data)
glfwPollEvents();
}
static int16_t glfw_input_state(void *data, bool port, unsigned device, unsigned index, unsigned id)
static int16_t glfw_input_state(void *data, const struct snes_keybind *snes_keybinds, bool port, unsigned device, unsigned index, unsigned id)
{
(void)data;
if ( port != 0 || device != SNES_DEVICE_JOYPAD )
@ -79,7 +80,7 @@ static void GLFWCALL resize(int width, int height)
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if ( force_aspect )
if ( keep_aspect )
{
float desired_aspect = 256.0/224.0;
float in_aspect = (float)width / height;
@ -150,12 +151,14 @@ static void gl_free(void *data)
free(gl_buffer);
}
static void* gl_init(int width, int height, bool fullscreen, bool vsync, input_driver_t **input)
static void* gl_init(int width, int height, bool fullscreen, bool vsync, bool force_aspect, input_driver_t **input)
{
gl_t *foo = malloc(sizeof(gl_t));
if ( foo == NULL )
return NULL;
keep_aspect = force_aspect;
glfwInit();
int res;

View File

@ -68,7 +68,7 @@ static void uninit_audio(void)
static void init_video_input(void)
{
driver.video_data = driver.video->init((fullscreen) ? fullscreen_x : (256 * xscale), (fullscreen) ? fullscreen_y : (224 * yscale), fullscreen, vsync, (input_driver_t**)&(driver.input));
driver.video_data = driver.video->init((fullscreen) ? fullscreen_x : (256 * xscale), (fullscreen) ? fullscreen_y : (224 * yscale), fullscreen, vsync, force_aspect, (input_driver_t**)&(driver.input));
if ( driver.video_data == NULL )
{
@ -159,7 +159,7 @@ static void input_poll(void)
static int16_t input_state(bool port, unsigned device, unsigned index, unsigned id)
{
return driver.input->input_state(driver.input_data, port, device, index, id);
return driver.input->input_state(driver.input_data, snes_keybinds, port, device, index, id);
}