Skip to content

Commit

Permalink
Remove some globals
Browse files Browse the repository at this point in the history
  • Loading branch information
inactive123 committed Jul 11, 2019
1 parent 91c6bb4 commit 27a6571
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ endif

retroarch: $(RARCH_OBJ)
@$(if $(Q), $(shell echo echo LD $@),)
$(Q)$(LINK) -o $@ $(RARCH_OBJ) $(LIBS) $(LDFLAGS) $(LIBRARY_DIRS)
$(Q)$(LINK) -o $@ $(RARCH_OBJ) $(LIBS) $(LDFLAGS) $(LIBRARY_DIRS) -Wl,-Map=output.map

$(OBJDIR)/%.o: %.c config.h config.mk
@mkdir -p $(dir $@)
Expand Down
2 changes: 1 addition & 1 deletion configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,7 @@ typedef struct settings
char network_buildbot_url[255];
char network_buildbot_assets_url[255];
char browse_url[4096];
char path_stream_url[8192];

char path_menu_xmb_font[PATH_MAX_LENGTH];
char menu_content_show_settings_password[PATH_MAX_LENGTH];
Expand All @@ -608,7 +609,6 @@ typedef struct settings
#endif
char path_record_config[PATH_MAX_LENGTH];
char path_stream_config[PATH_MAX_LENGTH];
char path_stream_url[8192];
char path_menu_wallpaper[PATH_MAX_LENGTH];
char path_audio_dsp_plugin[PATH_MAX_LENGTH];
char path_softfilter_plugin[PATH_MAX_LENGTH];
Expand Down
2 changes: 1 addition & 1 deletion gfx/drivers/caca_gfx.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ static void caca_gfx_get_poke_interface(void *data,
*iface = &caca_poke_interface;
}

void caca_gfx_set_viewport(void *data, unsigned viewport_width,
static void caca_gfx_set_viewport(void *data, unsigned viewport_width,
unsigned viewport_height, bool force_full, bool allow_rotate)
{
}
Expand Down
36 changes: 16 additions & 20 deletions input/connect/connect_wiiupro.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ struct wiiupro
struct wiiupro_buttons btn;
};

struct wiiupro_calib
{
int32_t hatvalue_calib[4];
uint16_t calib_round;
};

struct hidpad_wiiupro_data
{
Expand All @@ -68,10 +63,13 @@ struct hidpad_wiiupro_data
uint32_t slot;
bool have_led;
uint16_t motors[2];
struct
{
int32_t hatvalue_calib[4];
uint16_t calib_round;
} calib;
};

struct wiiupro_calib* calib_data;

static void hidpad_wiiupro_send_control(struct hidpad_wiiupro_data* device)
{
/* 0x12 = Set data report; 0x34 = All buttons and analogs */
Expand All @@ -86,8 +84,6 @@ static void* hidpad_wiiupro_init(void *data,
struct pad_connection* connection = (struct pad_connection*)data;
struct hidpad_wiiupro_data* device = (struct hidpad_wiiupro_data*)
calloc(1, sizeof(struct hidpad_wiiupro_data));
calib_data = (struct wiiupro_calib*)
calloc(1, sizeof(struct wiiupro_calib));

if (!device)
goto error;
Expand All @@ -99,7 +95,7 @@ static void* hidpad_wiiupro_init(void *data,
device->slot = slot;
device->driver = driver;

calib_data->calib_round = 0;
device->calib.calib_round = 0;
/* Without this, the digital buttons won't be reported. */
hidpad_wiiupro_send_control(device);

Expand Down Expand Up @@ -225,25 +221,25 @@ static void hidpad_wiiupro_packet_handler(void *data,

device->data.btn.home = (packet[0x0C] & 0x8) ? 1 : 0;

if(calib_data->calib_round < 5)
if(device->calib.calib_round < 5)
{
calib_data->hatvalue_calib[0] = (packet[4] | (packet[4 + 1] << 8));
calib_data->hatvalue_calib[1] = (packet[8] | (packet[8 + 1] << 8));
calib_data->hatvalue_calib[2] = (packet[6] | (packet[6 + 1] << 8));
calib_data->hatvalue_calib[3] = (packet[10] | (packet[10 + 1] << 8));
device->calib.hatvalue_calib[0] = (packet[4] | (packet[4 + 1] << 8));
device->calib.hatvalue_calib[1] = (packet[8] | (packet[8 + 1] << 8));
device->calib.hatvalue_calib[2] = (packet[6] | (packet[6 + 1] << 8));
device->calib.hatvalue_calib[3] = (packet[10] | (packet[10 + 1] << 8));

calib_data->calib_round++;
device->calib.calib_round++;
}
else
{
device->data.hatvalue[0] = (packet[4] | (packet[4 + 1] << 8))
- calib_data->hatvalue_calib[0];
- device->calib.hatvalue_calib[0];
device->data.hatvalue[1] = (packet[8] | (packet[8 + 1] << 8))
- calib_data->hatvalue_calib[1];
- device->calib.hatvalue_calib[1];
device->data.hatvalue[2] = (packet[6] | (packet[6 + 1] << 8))
- calib_data->hatvalue_calib[2];
- device->calib.hatvalue_calib[2];
device->data.hatvalue[3] = (packet[10] | (packet[10 + 1] << 8))
- calib_data->hatvalue_calib[3];
- device->calib.hatvalue_calib[3];
}
}

Expand Down

0 comments on commit 27a6571

Please sign in to comment.