Changed type of string literals in all (I hope) structs to const char *, reduces .EXE file size by about 200 kB.
This commit is contained in:
@@ -87,7 +87,7 @@ extern int timing_misaligned;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char name[32];
|
||||
const char *name;
|
||||
int cpu_type;
|
||||
int speed;
|
||||
int rspeed;
|
||||
|
||||
@@ -207,7 +207,7 @@ network_card_available(int card)
|
||||
char *
|
||||
network_card_getname(int card)
|
||||
{
|
||||
return(net_cards[card].name);
|
||||
return((char *) net_cards[card].name);
|
||||
}
|
||||
|
||||
|
||||
@@ -233,7 +233,7 @@ network_card_has_config(int card)
|
||||
char *
|
||||
network_card_get_internal_name(int card)
|
||||
{
|
||||
return(net_cards[card].internal_name);
|
||||
return((char *) net_cards[card].internal_name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@ typedef void (*NETRXCB)(void *, uint8_t *, int);
|
||||
|
||||
|
||||
typedef struct {
|
||||
char name[64];
|
||||
char internal_name[32];
|
||||
const char *name;
|
||||
const char *internal_name;
|
||||
device_t *device;
|
||||
void *private;
|
||||
int (*poll)(void *);
|
||||
|
||||
@@ -42,8 +42,8 @@ static int sound_card_last = 0;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char name[64];
|
||||
char internal_name[24];
|
||||
const char *name;
|
||||
const char *internal_name;
|
||||
device_t *device;
|
||||
} SOUND_CARD;
|
||||
|
||||
@@ -80,7 +80,7 @@ int sound_card_available(int card)
|
||||
|
||||
char *sound_card_getname(int card)
|
||||
{
|
||||
return sound_cards[card].name;
|
||||
return (char *) sound_cards[card].name;
|
||||
}
|
||||
|
||||
device_t *sound_card_getdevice(int card)
|
||||
@@ -97,7 +97,7 @@ int sound_card_has_config(int card)
|
||||
|
||||
char *sound_card_get_internal_name(int card)
|
||||
{
|
||||
return sound_cards[card].internal_name;
|
||||
return (char *) sound_cards[card].internal_name;
|
||||
}
|
||||
|
||||
int sound_card_get_from_internal_name(char *s)
|
||||
|
||||
@@ -64,8 +64,8 @@ int cga_palette = 0;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char name[64];
|
||||
char internal_name[24];
|
||||
const char *name;
|
||||
const char *internal_name;
|
||||
device_t *device;
|
||||
int legacy_id;
|
||||
} VIDEO_CARD;
|
||||
@@ -120,7 +120,7 @@ int video_card_available(int card)
|
||||
|
||||
char *video_card_getname(int card)
|
||||
{
|
||||
return video_cards[card].name;
|
||||
return (char *) video_cards[card].name;
|
||||
}
|
||||
|
||||
device_t *video_card_getdevice(int card)
|
||||
@@ -168,7 +168,7 @@ int video_new_to_old(int card)
|
||||
|
||||
char *video_get_internal_name(int card)
|
||||
{
|
||||
return video_cards[card].internal_name;
|
||||
return (char *) video_cards[card].internal_name;
|
||||
}
|
||||
|
||||
int video_get_video_from_internal_name(char *s)
|
||||
|
||||
@@ -47,7 +47,7 @@ static BOOL CALLBACK deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam
|
||||
switch (config->type)
|
||||
{
|
||||
case CONFIG_BINARY:
|
||||
val_int = config_get_int(config_device->name, config->name, config->default_int);
|
||||
val_int = config_get_int((char *) config_device->name, (char *) config->name, config->default_int);
|
||||
|
||||
SendMessage(h, BM_SETCHECK, val_int, 0);
|
||||
|
||||
@@ -55,7 +55,7 @@ static BOOL CALLBACK deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam
|
||||
break;
|
||||
|
||||
case CONFIG_SELECTION:
|
||||
val_int = config_get_int(config_device->name, config->name, config->default_int);
|
||||
val_int = config_get_int((char *) config_device->name, (char *) config->name, config->default_int);
|
||||
|
||||
c = 0;
|
||||
while (selection->description[0])
|
||||
@@ -71,7 +71,7 @@ static BOOL CALLBACK deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam
|
||||
break;
|
||||
|
||||
case CONFIG_HEX16:
|
||||
val_int = config_get_hex16(config_device->name, config->name, config->default_int);
|
||||
val_int = config_get_hex16((char *) config_device->name, (char *) config->name, config->default_int);
|
||||
|
||||
c = 0;
|
||||
while (selection->description[0])
|
||||
@@ -87,7 +87,7 @@ static BOOL CALLBACK deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam
|
||||
break;
|
||||
|
||||
case CONFIG_HEX20:
|
||||
val_int = config_get_hex20(config_device->name, config->name, config->default_int);
|
||||
val_int = config_get_hex20((char *) config_device->name, (char *) config->name, config->default_int);
|
||||
|
||||
c = 0;
|
||||
while (selection->description[0])
|
||||
@@ -125,7 +125,7 @@ static BOOL CALLBACK deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam
|
||||
switch (config->type)
|
||||
{
|
||||
case CONFIG_BINARY:
|
||||
val_int = config_get_int(config_device->name, config->name, config->default_int);
|
||||
val_int = config_get_int((char *) config_device->name, (char *) config->name, config->default_int);
|
||||
|
||||
if (val_int != SendMessage(h, BM_GETCHECK, 0, 0))
|
||||
changed = 1;
|
||||
@@ -134,7 +134,7 @@ static BOOL CALLBACK deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam
|
||||
break;
|
||||
|
||||
case CONFIG_SELECTION:
|
||||
val_int = config_get_int(config_device->name, config->name, config->default_int);
|
||||
val_int = config_get_int((char *) config_device->name, (char *) config->name, config->default_int);
|
||||
|
||||
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||
|
||||
@@ -148,7 +148,7 @@ static BOOL CALLBACK deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam
|
||||
break;
|
||||
|
||||
case CONFIG_HEX16:
|
||||
val_int = config_get_hex16(config_device->name, config->name, config->default_int);
|
||||
val_int = config_get_hex16((char *) config_device->name, (char *) config->name, config->default_int);
|
||||
|
||||
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||
|
||||
@@ -162,7 +162,7 @@ static BOOL CALLBACK deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam
|
||||
break;
|
||||
|
||||
case CONFIG_HEX20:
|
||||
val_int = config_get_hex20(config_device->name, config->name, config->default_int);
|
||||
val_int = config_get_hex20((char *) config_device->name, (char *) config->name, config->default_int);
|
||||
|
||||
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||
|
||||
@@ -201,7 +201,7 @@ static BOOL CALLBACK deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam
|
||||
switch (config->type)
|
||||
{
|
||||
case CONFIG_BINARY:
|
||||
config_set_int(config_device->name, config->name, SendMessage(h, BM_GETCHECK, 0, 0));
|
||||
config_set_int((char *) config_device->name, (char *) config->name, SendMessage(h, BM_GETCHECK, 0, 0));
|
||||
|
||||
id++;
|
||||
break;
|
||||
@@ -210,7 +210,7 @@ static BOOL CALLBACK deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam
|
||||
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||
for (; c > 0; c--)
|
||||
selection++;
|
||||
config_set_int(config_device->name, config->name, selection->value);
|
||||
config_set_int((char *) config_device->name, (char *) config->name, selection->value);
|
||||
|
||||
id += 2;
|
||||
break;
|
||||
@@ -219,7 +219,7 @@ static BOOL CALLBACK deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam
|
||||
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||
for (; c > 0; c--)
|
||||
selection++;
|
||||
config_set_hex16(config_device->name, config->name, selection->value);
|
||||
config_set_hex16((char *) config_device->name, (char *) config->name, selection->value);
|
||||
|
||||
id += 2;
|
||||
break;
|
||||
@@ -228,7 +228,7 @@ static BOOL CALLBACK deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam
|
||||
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||
for (; c > 0; c--)
|
||||
selection++;
|
||||
config_set_hex20(config_device->name, config->name, selection->value);
|
||||
config_set_hex20((char *) config_device->name, (char *) config->name, selection->value);
|
||||
|
||||
id += 2;
|
||||
break;
|
||||
|
||||
@@ -421,7 +421,7 @@ static void win_settings_machine_recalc_cpu_m(HWND hdlg)
|
||||
c = 0;
|
||||
while (models[romstomodel[temp_romset]].cpu[temp_cpu_m].cpus[c].cpu_type != -1)
|
||||
{
|
||||
stransi = models[romstomodel[temp_romset]].cpu[temp_cpu_m].cpus[c].name;
|
||||
stransi = (char *) models[romstomodel[temp_romset]].cpu[temp_cpu_m].cpus[c].name;
|
||||
mbstowcs(lptsTemp, stransi, strlen(stransi) + 1);
|
||||
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)lptsTemp);
|
||||
c++;
|
||||
@@ -466,7 +466,7 @@ static void win_settings_machine_recalc_model(HWND hdlg)
|
||||
c = 0;
|
||||
while (models[romstomodel[temp_romset]].cpu[c].cpus != NULL && c < 4)
|
||||
{
|
||||
stransi = models[romstomodel[temp_romset]].cpu[c].name;
|
||||
stransi = (char *) models[romstomodel[temp_romset]].cpu[c].name;
|
||||
mbstowcs(lptsTemp, stransi, strlen(stransi) + 1);
|
||||
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)lptsTemp);
|
||||
c++;
|
||||
@@ -533,7 +533,7 @@ static BOOL CALLBACK win_settings_machine_proc(HWND hdlg, UINT message, WPARAM w
|
||||
{
|
||||
if (romspresent[models[c].id])
|
||||
{
|
||||
stransi = models[c].name;
|
||||
stransi = (char *) models[c].name;
|
||||
mbstowcs(lptsTemp, stransi, strlen(stransi) + 1);
|
||||
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp);
|
||||
modeltolist[c] = d;
|
||||
|
||||
24
src/device.c
24
src/device.c
@@ -158,7 +158,7 @@ int device_get_config_int(char *s)
|
||||
while (config->type != -1)
|
||||
{
|
||||
if (!strcmp(s, config->name))
|
||||
return config_get_int(current_device->name, s, config->default_int);
|
||||
return config_get_int((char *) current_device->name, s, config->default_int);
|
||||
|
||||
config++;
|
||||
}
|
||||
@@ -172,7 +172,7 @@ int device_get_config_int_ex(char *s, int default_int)
|
||||
while (config->type != -1)
|
||||
{
|
||||
if (!strcmp(s, config->name))
|
||||
return config_get_int(current_device->name, s, default_int);
|
||||
return config_get_int((char *) current_device->name, s, default_int);
|
||||
|
||||
config++;
|
||||
}
|
||||
@@ -186,7 +186,7 @@ int device_get_config_hex16(char *s)
|
||||
while (config->type != -1)
|
||||
{
|
||||
if (!strcmp(s, config->name))
|
||||
return config_get_hex16(current_device->name, s, config->default_int);
|
||||
return config_get_hex16((char *) current_device->name, s, config->default_int);
|
||||
|
||||
config++;
|
||||
}
|
||||
@@ -200,7 +200,7 @@ int device_get_config_hex20(char *s)
|
||||
while (config->type != -1)
|
||||
{
|
||||
if (!strcmp(s, config->name))
|
||||
return config_get_hex20(current_device->name, s, config->default_int);
|
||||
return config_get_hex20((char *) current_device->name, s, config->default_int);
|
||||
|
||||
config++;
|
||||
}
|
||||
@@ -214,7 +214,7 @@ int device_get_config_mac(char *s, int default_int)
|
||||
while (config->type != -1)
|
||||
{
|
||||
if (!strcmp(s, config->name))
|
||||
return config_get_mac(current_device->name, s, default_int);
|
||||
return config_get_mac((char *) current_device->name, s, default_int);
|
||||
|
||||
config++;
|
||||
}
|
||||
@@ -229,7 +229,7 @@ void device_set_config_int(char *s, int val)
|
||||
{
|
||||
if (!strcmp(s, config->name))
|
||||
{
|
||||
config_set_int(current_device->name, s, val);
|
||||
config_set_int((char *) current_device->name, s, val);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ void device_set_config_hex16(char *s, int val)
|
||||
{
|
||||
if (!strcmp(s, config->name))
|
||||
{
|
||||
config_set_hex16(current_device->name, s, val);
|
||||
config_set_hex16((char *) current_device->name, s, val);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -263,7 +263,7 @@ void device_set_config_hex20(char *s, int val)
|
||||
{
|
||||
if (!strcmp(s, config->name))
|
||||
{
|
||||
config_set_hex20(current_device->name, s, val);
|
||||
config_set_hex20((char *) current_device->name, s, val);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -280,7 +280,7 @@ void device_set_config_mac(char *s, int val)
|
||||
{
|
||||
if (!strcmp(s, config->name))
|
||||
{
|
||||
config_set_mac(current_device->name, s, val);
|
||||
config_set_mac((char *) current_device->name, s, val);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -296,7 +296,7 @@ char *device_get_config_string(char *s)
|
||||
while (config->type != -1)
|
||||
{
|
||||
if (!strcmp(s, config->name))
|
||||
return config_get_string(current_device->name, s, config->default_string);
|
||||
return config_get_string((char *) current_device->name, s, (char *) config->default_string);
|
||||
|
||||
config++;
|
||||
}
|
||||
@@ -316,7 +316,7 @@ int model_get_config_int(char *s)
|
||||
while (config->type != -1)
|
||||
{
|
||||
if (!strcmp(s, config->name))
|
||||
return config_get_int(device->name, s, config->default_int);
|
||||
return config_get_int((char *) device->name, s, config->default_int);
|
||||
|
||||
config++;
|
||||
}
|
||||
@@ -336,7 +336,7 @@ char *model_get_config_string(char *s)
|
||||
while (config->type != -1)
|
||||
{
|
||||
if (!strcmp(s, config->name))
|
||||
return config_get_string(device->name, s, config->default_string);
|
||||
return config_get_string((char *) device->name, s, (char *) config->default_string);
|
||||
|
||||
config++;
|
||||
}
|
||||
|
||||
10
src/device.h
10
src/device.h
@@ -41,23 +41,23 @@ enum
|
||||
|
||||
typedef struct device_config_selection_t
|
||||
{
|
||||
char description[256];
|
||||
const char *description;
|
||||
int value;
|
||||
} device_config_selection_t;
|
||||
|
||||
typedef struct device_config_t
|
||||
{
|
||||
char name[256];
|
||||
char description[256];
|
||||
const char *name;
|
||||
const char *description;
|
||||
int type;
|
||||
char default_string[256];
|
||||
const char *default_string;
|
||||
int default_int;
|
||||
device_config_selection_t selection[16];
|
||||
} device_config_t;
|
||||
|
||||
typedef struct device_t
|
||||
{
|
||||
char name[50];
|
||||
const char *name;
|
||||
uint32_t flags;
|
||||
void *(*init)();
|
||||
void (*close)(void *p);
|
||||
|
||||
@@ -37,7 +37,7 @@ static joystick_if_t *joystick_list[] =
|
||||
{
|
||||
&joystick_standard,
|
||||
&joystick_standard_4button,
|
||||
&joystick_standard_6button,
|
||||
&joystick_standard_6button,
|
||||
&joystick_standard_8button,
|
||||
&joystick_ch_flightstick_pro,
|
||||
&joystick_sw_pad,
|
||||
@@ -50,7 +50,7 @@ char *joystick_get_name(int joystick)
|
||||
{
|
||||
if (!joystick_list[joystick])
|
||||
return NULL;
|
||||
return joystick_list[joystick]->name;
|
||||
return (char *) joystick_list[joystick]->name;
|
||||
}
|
||||
|
||||
int joystick_get_max_joysticks(int joystick)
|
||||
@@ -73,19 +73,19 @@ int joystick_get_pov_count(int joystick)
|
||||
return joystick_list[joystick]->pov_count;
|
||||
}
|
||||
|
||||
char *joystick_get_axis_name(int joystick, int id)
|
||||
char *joystick_get_axis_name(int joystick, int id)
|
||||
{
|
||||
return joystick_list[joystick]->axis_names[id];
|
||||
return (char *) joystick_list[joystick]->axis_names[id];
|
||||
}
|
||||
|
||||
char *joystick_get_button_name(int joystick, int id)
|
||||
{
|
||||
return joystick_list[joystick]->button_names[id];
|
||||
return (char *) joystick_list[joystick]->button_names[id];
|
||||
}
|
||||
|
||||
char *joystick_get_pov_name(int joystick, int id)
|
||||
{
|
||||
return joystick_list[joystick]->pov_names[id];
|
||||
return (char *) joystick_list[joystick]->pov_names[id];
|
||||
}
|
||||
|
||||
typedef struct gameport_axis_t
|
||||
|
||||
@@ -6,7 +6,7 @@ extern device_t gameport_201_device;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char name[80];
|
||||
const char *name;
|
||||
void *(*init)();
|
||||
void (*close)(void *p);
|
||||
uint8_t (*read)(void *p);
|
||||
@@ -15,9 +15,9 @@ typedef struct
|
||||
void (*a0_over)(void *p);
|
||||
int axis_count, button_count, pov_count;
|
||||
int max_joysticks;
|
||||
char axis_names[8][32];
|
||||
char button_names[32][32];
|
||||
char pov_names[4][32];
|
||||
const char *axis_names[8];
|
||||
const char *button_names[32];
|
||||
const char *pov_names[4];
|
||||
} joystick_if_t;
|
||||
|
||||
extern int joystick_type;
|
||||
|
||||
@@ -19,8 +19,8 @@ hard_disk_t hdc[HDC_NUM];
|
||||
|
||||
static struct
|
||||
{
|
||||
char name[50];
|
||||
char internal_name[16];
|
||||
const char *name;
|
||||
const char *internal_name;
|
||||
device_t *device;
|
||||
int is_mfm;
|
||||
} hdd_controllers[] =
|
||||
@@ -39,12 +39,12 @@ static struct
|
||||
|
||||
char *hdd_controller_get_name(int hdd)
|
||||
{
|
||||
return hdd_controllers[hdd].name;
|
||||
return (char *) hdd_controllers[hdd].name;
|
||||
}
|
||||
|
||||
char *hdd_controller_get_internal_name(int hdd)
|
||||
{
|
||||
return hdd_controllers[hdd].internal_name;
|
||||
return (char *) hdd_controllers[hdd].internal_name;
|
||||
}
|
||||
|
||||
int hdd_controller_get_flags(int hdd)
|
||||
|
||||
@@ -244,7 +244,7 @@ int model_getmodel(int romset)
|
||||
|
||||
char *model_getname()
|
||||
{
|
||||
return models[model].name;
|
||||
return (char *) models[model].name;
|
||||
}
|
||||
|
||||
|
||||
@@ -255,12 +255,12 @@ device_t *model_getdevice(int model)
|
||||
|
||||
char *model_get_internal_name(void)
|
||||
{
|
||||
return models[model].internal_name;
|
||||
return (char *) models[model].internal_name;
|
||||
}
|
||||
|
||||
char *model_get_internal_name_ex(int m)
|
||||
{
|
||||
return models[m].internal_name;
|
||||
return (char *) models[m].internal_name;
|
||||
}
|
||||
|
||||
int model_get_nvrmask(int m)
|
||||
|
||||
@@ -33,11 +33,11 @@
|
||||
|
||||
|
||||
typedef struct {
|
||||
char name[32];
|
||||
const char *name;
|
||||
int id;
|
||||
char internal_name[24];
|
||||
const char *internal_name;
|
||||
struct {
|
||||
char name[16];
|
||||
const char *name;
|
||||
CPU *cpus;
|
||||
} cpu[5];
|
||||
int fixed_gfxcard;
|
||||
|
||||
@@ -58,14 +58,14 @@ mouse_get_name(int mouse)
|
||||
{
|
||||
if (!mouse_list[mouse])
|
||||
return(NULL);
|
||||
return(mouse_list[mouse]->name);
|
||||
return((char *) mouse_list[mouse]->name);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
mouse_get_internal_name(int mouse)
|
||||
{
|
||||
return(mouse_list[mouse]->internal_name);
|
||||
return((char *) mouse_list[mouse]->internal_name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
|
||||
typedef struct {
|
||||
char name[80];
|
||||
char internal_name[24];
|
||||
const char *name;
|
||||
const char *internal_name;
|
||||
int type;
|
||||
void *(*init)(void);
|
||||
void (*close)(void *p);
|
||||
|
||||
@@ -39,8 +39,8 @@ int scsi_card_last = 0;
|
||||
|
||||
|
||||
typedef struct {
|
||||
char name[64];
|
||||
char internal_name[32];
|
||||
const char *name;
|
||||
const char *internal_name;
|
||||
device_t *device;
|
||||
void (*reset)(void *p);
|
||||
} SCSI_CARD;
|
||||
@@ -68,7 +68,7 @@ int scsi_card_available(int card)
|
||||
|
||||
char *scsi_card_getname(int card)
|
||||
{
|
||||
return(scsi_cards[card].name);
|
||||
return((char *) scsi_cards[card].name);
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ int scsi_card_has_config(int card)
|
||||
|
||||
char *scsi_card_get_internal_name(int card)
|
||||
{
|
||||
return(scsi_cards[card].internal_name);
|
||||
return((char *) scsi_cards[card].internal_name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user