More linting in src/win

This commit is contained in:
Jasmine Iwanek
2023-08-21 20:25:16 -04:00
parent 506d548b38
commit bacf8deae3
22 changed files with 405 additions and 372 deletions

View File

@@ -65,30 +65,31 @@
# include <minitrace/minitrace.h> # include <minitrace/minitrace.h>
#endif #endif
typedef struct { typedef struct rc_str_t {
WCHAR str[1024]; WCHAR str[1024];
} rc_str_t; } rc_str_t;
/* Platform Public data, specific. */ /* Platform Public data, specific. */
HINSTANCE hinstance; /* application instance */ HINSTANCE hinstance; /* application instance */
HANDLE ghMutex; HANDLE ghMutex;
uint32_t lang_id, lang_sys; /* current and system language ID */ uint32_t lang_id; /* current and system language ID */
uint32_t lang_sys; /* current and system language ID */
DWORD dwSubLangID; DWORD dwSubLangID;
int acp_utf8; /* Windows supports UTF-8 codepage */ int acp_utf8; /* Windows supports UTF-8 codepage */
volatile int cpu_thread_run = 1; volatile int cpu_thread_run = 1;
/* Local data. */ /* Local data. */
static HANDLE thMain; static HANDLE thMain;
static rc_str_t *lpRCstr2048 = NULL, static rc_str_t *lpRCstr2048 = NULL;
*lpRCstr4096 = NULL, static rc_str_t *lpRCstr4096 = NULL;
*lpRCstr4352 = NULL, static rc_str_t *lpRCstr4352 = NULL;
*lpRCstr4608 = NULL, static rc_str_t *lpRCstr4608 = NULL;
*lpRCstr5120 = NULL, static rc_str_t *lpRCstr5120 = NULL;
*lpRCstr5376 = NULL, static rc_str_t *lpRCstr5376 = NULL;
*lpRCstr5632 = NULL, static rc_str_t *lpRCstr5632 = NULL;
*lpRCstr5888 = NULL, static rc_str_t *lpRCstr5888 = NULL;
*lpRCstr6144 = NULL, static rc_str_t *lpRCstr6144 = NULL;
*lpRCstr7168 = NULL; static rc_str_t *lpRCstr7168 = NULL;
static int vid_api_inited = 0; static int vid_api_inited = 0;
static char *argbuf; static char *argbuf;
static int first_use = 1; static int first_use = 1;
@@ -302,7 +303,7 @@ plat_get_string(int i)
else else
str = lpRCstr7168[i - 7168].str; str = lpRCstr7168[i - 7168].str;
return ((wchar_t *) str); return str;
} }
#ifdef MTR_ENABLED #ifdef MTR_ENABLED
@@ -382,7 +383,9 @@ ProcessCommandLine(char ***argv)
{ {
char **args; char **args;
int argc_max; int argc_max;
int i, q, argc; int i;
int q;
int argc;
if (acp_utf8) { if (acp_utf8) {
i = strlen(GetCommandLineA()) + 1; i = strlen(GetCommandLineA()) + 1;
@@ -399,7 +402,7 @@ ProcessCommandLine(char ***argv)
args = (char **) malloc(sizeof(char *) * argc_max); args = (char **) malloc(sizeof(char *) * argc_max);
if (args == NULL) { if (args == NULL) {
free(argbuf); free(argbuf);
return (0); return 0;
} }
/* parse commandline into argc/argv format */ /* parse commandline into argc/argv format */
@@ -423,11 +426,11 @@ ProcessCommandLine(char ***argv)
args = realloc(args, sizeof(char *) * argc_max); args = realloc(args, sizeof(char *) * argc_max);
if (args == NULL) { if (args == NULL) {
free(argbuf); free(argbuf);
return (0); return 0;
} }
} }
while ((argbuf[i]) && ((q) ? (argbuf[i] != q) : (argbuf[i] != ' '))) while ((argbuf[i]) && (q ? (argbuf[i] != q) : (argbuf[i] != ' ')))
i++; i++;
if (argbuf[i]) { if (argbuf[i]) {
@@ -440,7 +443,7 @@ ProcessCommandLine(char ***argv)
args[argc] = NULL; args[argc] = NULL;
*argv = args; *argv = args;
return (argc); return argc;
} }
/* For the Windows platform, this is the start of the application. */ /* For the Windows platform, this is the start of the application. */
@@ -448,7 +451,8 @@ int WINAPI
WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArg, int nCmdShow) WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArg, int nCmdShow)
{ {
char **argv = NULL; char **argv = NULL;
int argc, i; int argc;
int i;
/* Initialize the COM library for the main thread. */ /* Initialize the COM library for the main thread. */
CoInitializeEx(NULL, COINIT_MULTITHREADED); CoInitializeEx(NULL, COINIT_MULTITHREADED);
@@ -486,7 +490,7 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArg, int nCmdShow)
free(argbuf); free(argbuf);
free(argv); free(argv);
return (1); return 1;
} }
extern int gfxcard[2]; extern int gfxcard[2];
@@ -506,14 +510,16 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArg, int nCmdShow)
free(argbuf); free(argbuf);
free(argv); free(argv);
return (i); return i;
} }
void void
main_thread(void *param) main_thread(void *param)
{ {
uint32_t old_time, new_time; uint32_t old_time;
int drawits, frames; uint32_t new_time;
int drawits;
int frames;
framecountx = 0; framecountx = 0;
title_update = 1; title_update = 1;
@@ -648,14 +654,15 @@ plat_getcwd(char *bufp, int max)
free(temp); free(temp);
} }
return (0); return 0;
} }
int int
plat_chdir(char *path) plat_chdir(char *path)
{ {
wchar_t *temp; wchar_t *temp;
int len, ret; int len;
int ret;
if (acp_utf8) if (acp_utf8)
return (_chdir(path)); return (_chdir(path));
@@ -674,7 +681,8 @@ plat_chdir(char *path)
FILE * FILE *
plat_fopen(const char *path, const char *mode) plat_fopen(const char *path, const char *mode)
{ {
wchar_t *pathw, *modew; wchar_t *pathw;
wchar_t *modew;
int len; int len;
FILE *fp; FILE *fp;
@@ -725,7 +733,7 @@ plat_remove(char *path)
} }
void void
path_normalize(char *path) path_normalize(UNUSED(char *path))
{ {
/* No-op */ /* No-op */
} }
@@ -755,9 +763,9 @@ int
path_abs(char *path) path_abs(char *path)
{ {
if ((path[1] == ':') || (path[0] == '\\') || (path[0] == '/')) if ((path[1] == ':') || (path[0] == '\\') || (path[0] == '/'))
return (1); return 1;
return (0); return 0;
} }
/* Return the last element of a pathname. */ /* Return the last element of a pathname. */
@@ -779,8 +787,8 @@ plat_get_basename(const char *path)
void void
path_get_dirname(char *dest, const char *path) path_get_dirname(char *dest, const char *path)
{ {
int c = (int) strlen(path); int c = (int) strlen(path);
char *ptr; const char *ptr;
ptr = (char *) path; ptr = (char *) path;
@@ -809,7 +817,7 @@ path_get_filename(char *s)
c--; c--;
} }
return (s); return s;
} }
char * char *
@@ -818,7 +826,7 @@ path_get_extension(char *s)
int c = strlen(s) - 1; int c = strlen(s) - 1;
if (c <= 0) if (c <= 0)
return (s); return s;
while (c && s[c] != '.') while (c && s[c] != '.')
c--; c--;
@@ -865,23 +873,24 @@ plat_dir_check(char *path)
free(temp); free(temp);
} }
return (((dwAttrib != INVALID_FILE_ATTRIBUTES && (dwAttrib & FILE_ATTRIBUTE_DIRECTORY))) ? 1 : 0); return ((dwAttrib != INVALID_FILE_ATTRIBUTES && (dwAttrib & FILE_ATTRIBUTE_DIRECTORY)) ? 1 : 0);
} }
int int
plat_dir_create(char *path) plat_dir_create(char *path)
{ {
int ret, len; int ret;
int len;
wchar_t *temp; wchar_t *temp;
if (acp_utf8) if (acp_utf8)
return (int) SHCreateDirectoryExA(NULL, path, NULL); return SHCreateDirectoryExA(NULL, path, NULL);
else { else {
len = mbstoc16s(NULL, path, 0) + 1; len = mbstoc16s(NULL, path, 0) + 1;
temp = malloc(len * sizeof(wchar_t)); temp = malloc(len * sizeof(wchar_t));
mbstoc16s(temp, path, len); mbstoc16s(temp, path, len);
ret = (int) SHCreateDirectoryExW(NULL, temp, NULL); ret = SHCreateDirectoryExW(NULL, temp, NULL);
free(temp); free(temp);
@@ -940,7 +949,7 @@ plat_init_rom_paths(void)
} }
void void
plat_munmap(void *ptr, size_t size) plat_munmap(void *ptr, UNUSED(size_t size))
{ {
VirtualFree(ptr, 0, MEM_RELEASE); VirtualFree(ptr, 0, MEM_RELEASE);
} }
@@ -958,7 +967,8 @@ plat_timer_read(void)
static LARGE_INTEGER static LARGE_INTEGER
plat_get_ticks_common(void) plat_get_ticks_common(void)
{ {
LARGE_INTEGER EndingTime, ElapsedMicroseconds; LARGE_INTEGER EndingTime;
LARGE_INTEGER ElapsedMicroseconds;
if (first_use) { if (first_use) {
QueryPerformanceFrequency(&Frequency); QueryPerformanceFrequency(&Frequency);
@@ -1002,23 +1012,21 @@ plat_delay_ms(uint32_t count)
int int
plat_vidapi(char *name) plat_vidapi(char *name)
{ {
int i;
/* Default/System is SDL Hardware. */ /* Default/System is SDL Hardware. */
if (!strcasecmp(name, "default") || !strcasecmp(name, "system")) if (!strcasecmp(name, "default") || !strcasecmp(name, "system"))
return (1); return 1;
/* If DirectDraw or plain SDL was specified, return SDL Software. */ /* If DirectDraw or plain SDL was specified, return SDL Software. */
if (!strcasecmp(name, "ddraw") || !strcasecmp(name, "sdl")) if (!strcasecmp(name, "ddraw") || !strcasecmp(name, "sdl"))
return (1); return 1;
for (i = 0; i < RENDERERS_NUM; i++) { for (uint8_t i = 0; i < RENDERERS_NUM; i++) {
if (vid_apis[i].name && !strcasecmp(vid_apis[i].name, name)) if (vid_apis[i].name && !strcasecmp(vid_apis[i].name, name))
return (i); return i;
} }
/* Default value. */ /* Default value. */
return (1); return 1;
} }
/* Return the VIDAPI name for the given number. */ /* Return the VIDAPI name for the given number. */
@@ -1049,7 +1057,7 @@ plat_vidapi_name(int api)
break; break;
} }
return (name); return name;
} }
int int
@@ -1073,13 +1081,13 @@ plat_setvid(int api)
i = vid_apis[vid_api].init((void *) hwndRender); i = vid_apis[vid_api].init((void *) hwndRender);
endblit(); endblit();
if (!i) if (!i)
return (0); return 0;
device_force_redraw(); device_force_redraw();
vid_api_inited = 1; vid_api_inited = 1;
return (1); return 1;
} }
/* Tell the renderers about a new screen resolution. */ /* Tell the renderers about a new screen resolution. */
@@ -1121,7 +1129,8 @@ void
plat_setfullscreen(int on) plat_setfullscreen(int on)
{ {
RECT rect; RECT rect;
int temp_x, temp_y; int temp_x;
int temp_y;
int dpi = win_get_dpi(hwndMain); int dpi = win_get_dpi(hwndMain);
/* Are we changing from the same state to the same state? */ /* Are we changing from the same state to the same state? */
@@ -1240,7 +1249,7 @@ plat_language_code(char *langcode)
wchar_t *temp = malloc(len * sizeof(wchar_t)); wchar_t *temp = malloc(len * sizeof(wchar_t));
mbstoc16s(temp, langcode, len); mbstoc16s(temp, langcode, len);
LCID lcid = LocaleNameToLCID((LPWSTR) temp, 0); LCID lcid = LocaleNameToLCID(temp, 0);
free(temp); free(temp);
return lcid; return lcid;

View File

@@ -70,7 +70,7 @@ cassette_eject(void)
} }
void void
cartridge_mount(uint8_t id, char *fn, uint8_t wp) cartridge_mount(uint8_t id, char *fn, UNUSED(uint8_t wp))
{ {
cart_close(id); cart_close(id);
cart_load(id, fn); cart_load(id, fn);
@@ -113,9 +113,9 @@ floppy_eject(uint8_t id)
} }
void void
plat_cdrom_ui_update(uint8_t id, uint8_t reload) plat_cdrom_ui_update(uint8_t id, UNUSED(uint8_t reload))
{ {
cdrom_t *drv = &cdrom[id]; const cdrom_t *drv = &cdrom[id];
if (drv->host_drive == 0) { if (drv->host_drive == 0) {
ui_sb_update_icon_state(SB_CDROM | id, 1); ui_sb_update_icon_state(SB_CDROM | id, 1);

View File

@@ -44,7 +44,7 @@ static LRESULT CALLBACK
#else #else
static BOOL CALLBACK static BOOL CALLBACK
#endif #endif
deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, UNUSED(LPARAM lParam))
{ {
HWND h; HWND h;
@@ -64,8 +64,8 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
const device_config_bios_t *bios; const device_config_bios_t *bios;
char s[512]; char s[512];
char file_filter[512]; char file_filter[512];
char *str; const char *str;
char *val_str; const char *val_str;
wchar_t ws[512]; wchar_t ws[512];
wchar_t *wstr; wchar_t *wstr;
LPTSTR lptsTemp; LPTSTR lptsTemp;
@@ -121,7 +121,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
mbstowcs(lptsTemp, bios->name, strlen(bios->name) + 1); mbstowcs(lptsTemp, bios->name, strlen(bios->name) + 1);
p = 0; p = 0;
for (d = 0; d < bios->files_no; d++) for (d = 0; d < bios->files_no; d++)
p += !!rom_present((char *) bios->files[d]); p += !!rom_present(bios->files[d]);
if (p == bios->files_no) { if (p == bios->files_no) {
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) (LPCSTR) lptsTemp); SendMessage(h, CB_ADDSTRING, 0, (LPARAM) (LPCSTR) lptsTemp);
if (!strcmp(val_str, bios->internal_name)) if (!strcmp(val_str, bios->internal_name))

View File

@@ -160,7 +160,9 @@ file_dlg_w(HWND hwnd, WCHAR *f, WCHAR *fn, WCHAR *title, int save)
{ {
OPENFILENAME ofn; OPENFILENAME ofn;
BOOL r; BOOL r;
/* DWORD err; */ #if 0
DWORD err;
#endif
int old_dopause; int old_dopause;
/* Initialize OPENFILENAME */ /* Initialize OPENFILENAME */

View File

@@ -318,7 +318,7 @@ joystick_process(void)
} }
void void
win_joystick_handle(PRAWINPUT raw) win_joystick_handle(UNUSED(PRAWINPUT raw))
{ {
// Nothing to be done here, atleast currently // Nothing to be done here, atleast currently
} }

View File

@@ -367,10 +367,10 @@ win_joystick_handle(PRAWINPUT raw)
/* Read axes */ /* Read axes */
for (int a = 0; a < plat_joystick_state[j].nr_axes; a++) { for (int a = 0; a < plat_joystick_state[j].nr_axes; a++) {
struct raw_axis_t *axis = &raw_joystick_state[j].axis[a]; const struct raw_axis_t *axis = &raw_joystick_state[j].axis[a];
ULONG uvalue = 0; ULONG uvalue = 0;
LONG value = 0; LONG value = 0;
LONG center = (axis->max - axis->min + 1) / 2; LONG center = (axis->max - axis->min + 1) / 2;
r = HidP_GetUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, axis->link, axis->usage, &uvalue, r = HidP_GetUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, axis->link, axis->usage, &uvalue,
raw_joystick_state[j].data, (PCHAR) raw->data.hid.bRawData, raw->data.hid.dwSizeHid); raw_joystick_state[j].data, (PCHAR) raw->data.hid.bRawData, raw->data.hid.dwSizeHid);
@@ -400,9 +400,9 @@ win_joystick_handle(PRAWINPUT raw)
/* read povs */ /* read povs */
for (int p = 0; p < plat_joystick_state[j].nr_povs; p++) { for (int p = 0; p < plat_joystick_state[j].nr_povs; p++) {
struct raw_pov_t *pov = &raw_joystick_state[j].pov[p]; const struct raw_pov_t *pov = &raw_joystick_state[j].pov[p];
ULONG uvalue = 0; ULONG uvalue = 0;
LONG value = -1; LONG value = -1;
r = HidP_GetUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, pov->link, pov->usage, &uvalue, r = HidP_GetUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, pov->link, pov->usage, &uvalue,
raw_joystick_state[j].data, (PCHAR) raw->data.hid.bRawData, raw->data.hid.dwSizeHid); raw_joystick_state[j].data, (PCHAR) raw->data.hid.bRawData, raw->data.hid.dwSizeHid);
@@ -415,9 +415,13 @@ win_joystick_handle(PRAWINPUT raw)
plat_joystick_state[j].p[p] = value; plat_joystick_state[j].p[p] = value;
// joystick_log("%s %-3d ", plat_joystick_state[j].pov[p].name, plat_joystick_state[j].p[p]); #if 0
joystick_log("%s %-3d ", plat_joystick_state[j].pov[p].name, plat_joystick_state[j].p[p]);
#endif
} }
// joystick_log("\n"); #if 0
joystick_log("\n");
#endif
} }
static int static int

View File

@@ -139,6 +139,7 @@ joystick_init()
void void
joystick_close() joystick_close()
{ {
//
} }
void void
@@ -261,7 +262,7 @@ joystick_process(void)
} }
void void
win_joystick_handle(PRAWINPUT raw) win_joystick_handle(UNUSED(PRAWINPUT raw))
{ {
// Nothing to be done here, atleast currently // Nothing to be done here, atleast currently
} }

View File

@@ -150,7 +150,7 @@ static LRESULT CALLBACK
#else #else
static BOOL CALLBACK static BOOL CALLBACK
#endif #endif
joystickconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) joystickconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, UNUSED(LPARAM lParam))
{ {
HWND h; HWND h;
int c; int c;

View File

@@ -55,15 +55,15 @@ convert_scan_code(UINT16 scan_code)
void void
keyboard_getkeymap(void) keyboard_getkeymap(void)
{ {
WCHAR *keyName = L"SYSTEM\\CurrentControlSet\\Control\\Keyboard Layout"; const WCHAR *keyName = L"SYSTEM\\CurrentControlSet\\Control\\Keyboard Layout";
WCHAR *valueName = L"Scancode Map"; const WCHAR *valueName = L"Scancode Map";
unsigned char buf[32768]; unsigned char buf[32768];
DWORD bufSize; DWORD bufSize;
HKEY hKey; HKEY hKey;
int j; int j;
UINT32 *bufEx2; const UINT32 *bufEx2;
int scMapCount; int scMapCount;
UINT16 *bufEx; const UINT16 *bufEx;
int scancode_unmapped; int scancode_unmapped;
int scancode_mapped; int scancode_mapped;

View File

@@ -723,10 +723,10 @@ media_menu_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
break; break;
default: default:
return (0); return 0;
} }
return (1); return 1;
} }
HMENU HMENU

View File

@@ -52,9 +52,12 @@ void
win_mouse_handle(PRAWINPUT raw) win_mouse_handle(PRAWINPUT raw)
{ {
RAWMOUSE state = raw->data.mouse; RAWMOUSE state = raw->data.mouse;
static int x, delta_x; static int x;
static int y, delta_y; static int delta_x;
static int b, delta_z; static int y;
static int delta_y;
static int b;
static int delta_z;
b = mouse_get_buttons_ex(); b = mouse_get_buttons_ex();

View File

@@ -41,7 +41,7 @@ static unsigned char *empty;
static int static int
create_86f(char *file_name, disk_size_t disk_size, uint8_t rpm_mode) create_86f(char *file_name, disk_size_t disk_size, uint8_t rpm_mode)
{ {
FILE *f; FILE *fp;
uint32_t magic = 0x46423638; uint32_t magic = 0x46423638;
uint16_t version = 0x020C; uint16_t version = 0x020C;
@@ -67,9 +67,9 @@ create_86f(char *file_name, disk_size_t disk_size, uint8_t rpm_mode)
tflags |= (disk_size.rpm << 5); /* RPM. */ tflags |= (disk_size.rpm << 5); /* RPM. */
switch (disk_size.hole) { switch (disk_size.hole) {
default:
case 0: case 0:
case 1: case 1:
default:
switch (rpm_mode) { switch (rpm_mode) {
case 1: case 1:
array_size = 25250; array_size = 25250;
@@ -108,13 +108,13 @@ create_86f(char *file_name, disk_size_t disk_size, uint8_t rpm_mode)
memset(tarray, 0, 2048); memset(tarray, 0, 2048);
memset(empty, 0, array_size); memset(empty, 0, array_size);
f = plat_fopen(file_name, "wb"); fp = plat_fopen(file_name, "wb");
if (!f) if (!fp)
return 0; return 0;
fwrite(&magic, 4, 1, f); fwrite(&magic, 4, 1, fp);
fwrite(&version, 2, 1, f); fwrite(&version, 2, 1, fp);
fwrite(&dflags, 2, 1, f); fwrite(&dflags, 2, 1, fp);
track_size = array_size + 6; track_size = array_size + 6;
@@ -126,17 +126,17 @@ create_86f(char *file_name, disk_size_t disk_size, uint8_t rpm_mode)
for (i = 0; i < (disk_size.tracks * disk_size.sides) << shift; i++) for (i = 0; i < (disk_size.tracks * disk_size.sides) << shift; i++)
tarray[i] = track_base + (i * track_size); tarray[i] = track_base + (i * track_size);
fwrite(tarray, 1, (disk_size.sides == 2) ? 2048 : 1024, f); fwrite(tarray, 1, (disk_size.sides == 2) ? 2048 : 1024, fp);
for (i = 0; i < (disk_size.tracks * disk_size.sides) << shift; i++) { for (i = 0; i < (disk_size.tracks * disk_size.sides) << shift; i++) {
fwrite(&tflags, 2, 1, f); fwrite(&tflags, 2, 1, fp);
fwrite(&index_hole_pos, 4, 1, f); fwrite(&index_hole_pos, 4, 1, fp);
fwrite(empty, 1, array_size, f); fwrite(empty, 1, array_size, fp);
} }
free(empty); free(empty);
fclose(f); fclose(fp);
return 1; return 1;
} }
@@ -147,7 +147,7 @@ static int is_mo;
static int static int
create_sector_image(char *file_name, disk_size_t disk_size, uint8_t is_fdi) create_sector_image(char *file_name, disk_size_t disk_size, uint8_t is_fdi)
{ {
FILE *f; FILE *fp;
uint32_t total_size = 0; uint32_t total_size = 0;
uint32_t total_sectors = 0; uint32_t total_sectors = 0;
uint32_t sector_bytes = 0; uint32_t sector_bytes = 0;
@@ -158,8 +158,8 @@ create_sector_image(char *file_name, disk_size_t disk_size, uint8_t is_fdi)
uint32_t zero_bytes = 0; uint32_t zero_bytes = 0;
uint16_t base = 0x1000; uint16_t base = 0x1000;
f = plat_fopen(file_name, "wb"); fp = plat_fopen(file_name, "wb");
if (!f) if (!fp)
return 0; return 0;
sector_bytes = (128 << disk_size.sector_len); sector_bytes = (128 << disk_size.sector_len);
@@ -184,7 +184,7 @@ create_sector_image(char *file_name, disk_size_t disk_size, uint8_t is_fdi)
*(uint8_t *) &(empty[0x18]) = (uint8_t) disk_size.sides; *(uint8_t *) &(empty[0x18]) = (uint8_t) disk_size.sides;
*(uint8_t *) &(empty[0x1C]) = (uint8_t) disk_size.tracks; *(uint8_t *) &(empty[0x1C]) = (uint8_t) disk_size.tracks;
fwrite(empty, 1, base, f); fwrite(empty, 1, base, fp);
free(empty); free(empty);
} }
@@ -241,10 +241,10 @@ create_sector_image(char *file_name, disk_size_t disk_size, uint8_t is_fdi)
empty[fat1_offs + 0x02] = empty[fat2_offs + 0x02] = 0xFF; empty[fat1_offs + 0x02] = empty[fat2_offs + 0x02] = 0xFF;
} }
fwrite(empty, 1, total_size, f); fwrite(empty, 1, total_size, fp);
free(empty); free(empty);
fclose(f); fclose(fp);
return 1; return 1;
} }
@@ -253,7 +253,7 @@ static int
create_zip_sector_image(char *file_name, disk_size_t disk_size, uint8_t is_zdi, HWND hwnd) create_zip_sector_image(char *file_name, disk_size_t disk_size, uint8_t is_zdi, HWND hwnd)
{ {
HWND h; HWND h;
FILE *f; FILE *fp;
uint32_t total_size = 0; uint32_t total_size = 0;
uint32_t total_sectors = 0; uint32_t total_sectors = 0;
uint32_t sector_bytes = 0; uint32_t sector_bytes = 0;
@@ -266,8 +266,8 @@ create_zip_sector_image(char *file_name, disk_size_t disk_size, uint8_t is_zdi,
uint32_t pbar_max = 0; uint32_t pbar_max = 0;
MSG msg; MSG msg;
f = plat_fopen(file_name, "wb"); fp = plat_fopen(file_name, "wb");
if (!f) if (!fp)
return 0; return 0;
sector_bytes = (128 << disk_size.sector_len); sector_bytes = (128 << disk_size.sector_len);
@@ -316,7 +316,7 @@ create_zip_sector_image(char *file_name, disk_size_t disk_size, uint8_t is_zdi,
*(uint8_t *) &(empty[0x18]) = (uint8_t) disk_size.sides; *(uint8_t *) &(empty[0x18]) = (uint8_t) disk_size.sides;
*(uint8_t *) &(empty[0x1C]) = (uint8_t) disk_size.tracks; *(uint8_t *) &(empty[0x1C]) = (uint8_t) disk_size.tracks;
fwrite(empty, 1, 2048, f); fwrite(empty, 1, 2048, fp);
SendMessage(h, PBM_SETPOS, (WPARAM) 1, (LPARAM) 0); SendMessage(h, PBM_SETPOS, (WPARAM) 1, (LPARAM) 0);
while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE | PM_NOYIELD)) { while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE | PM_NOYIELD)) {
@@ -324,7 +324,7 @@ create_zip_sector_image(char *file_name, disk_size_t disk_size, uint8_t is_zdi,
DispatchMessage(&msg); DispatchMessage(&msg);
} }
fwrite(&empty[0x0800], 1, 2048, f); fwrite(&empty[0x0800], 1, 2048, fp);
free(empty); free(empty);
SendMessage(h, PBM_SETPOS, (WPARAM) 2, (LPARAM) 0); SendMessage(h, PBM_SETPOS, (WPARAM) 2, (LPARAM) 0);
@@ -468,7 +468,7 @@ create_zip_sector_image(char *file_name, disk_size_t disk_size, uint8_t is_zdi,
} }
for (uint32_t i = 0; i < pbar_max; i++) { for (uint32_t i = 0; i < pbar_max; i++) {
fwrite(&empty[i << 11], 1, 2048, f); fwrite(&empty[i << 11], 1, 2048, fp);
SendMessage(h, PBM_SETPOS, (WPARAM) i + 2, (LPARAM) 0); SendMessage(h, PBM_SETPOS, (WPARAM) i + 2, (LPARAM) 0);
while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE | PM_NOYIELD)) { while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE | PM_NOYIELD)) {
@@ -479,7 +479,7 @@ create_zip_sector_image(char *file_name, disk_size_t disk_size, uint8_t is_zdi,
free(empty); free(empty);
fclose(f); fclose(fp);
return 1; return 1;
} }
@@ -488,7 +488,7 @@ static int
create_mo_sector_image(char *file_name, int8_t disk_size, uint8_t is_mdi, HWND hwnd) create_mo_sector_image(char *file_name, int8_t disk_size, uint8_t is_mdi, HWND hwnd)
{ {
HWND h; HWND h;
FILE *f; FILE *fp;
const mo_type_t *dp = &mo_types[disk_size]; const mo_type_t *dp = &mo_types[disk_size];
uint8_t *empty; uint8_t *empty;
uint8_t *empty2 = NULL; uint8_t *empty2 = NULL;
@@ -502,8 +502,8 @@ create_mo_sector_image(char *file_name, int8_t disk_size, uint8_t is_mdi, HWND h
uint32_t j; uint32_t j;
MSG msg; MSG msg;
f = plat_fopen(file_name, "wb"); fp = plat_fopen(file_name, "wb");
if (!f) if (!fp)
return 0; return 0;
sector_bytes = dp->bytes_per_sector; sector_bytes = dp->bytes_per_sector;
@@ -551,7 +551,7 @@ create_mo_sector_image(char *file_name, int8_t disk_size, uint8_t is_mdi, HWND h
*(uint8_t *) &(empty[0x18]) = (uint8_t) 64; *(uint8_t *) &(empty[0x18]) = (uint8_t) 64;
*(uint8_t *) &(empty[0x1C]) = (uint8_t) (dp->sectors / 64) / 25; *(uint8_t *) &(empty[0x1C]) = (uint8_t) (dp->sectors / 64) / 25;
fwrite(empty, 1, 2048, f); fwrite(empty, 1, 2048, fp);
SendMessage(h, PBM_SETPOS, (WPARAM) 1, (LPARAM) 0); SendMessage(h, PBM_SETPOS, (WPARAM) 1, (LPARAM) 0);
while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE | PM_NOYIELD)) { while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE | PM_NOYIELD)) {
@@ -559,7 +559,7 @@ create_mo_sector_image(char *file_name, int8_t disk_size, uint8_t is_mdi, HWND h
DispatchMessage(&msg); DispatchMessage(&msg);
} }
fwrite(&empty[0x0800], 1, 2048, f); fwrite(&empty[0x0800], 1, 2048, fp);
free(empty); free(empty);
SendMessage(h, PBM_SETPOS, (WPARAM) 1, (LPARAM) 0); SendMessage(h, PBM_SETPOS, (WPARAM) 1, (LPARAM) 0);
@@ -579,7 +579,7 @@ create_mo_sector_image(char *file_name, int8_t disk_size, uint8_t is_mdi, HWND h
} }
for (uint32_t i = 0; i < blocks_num; i++) { for (uint32_t i = 0; i < blocks_num; i++) {
fwrite(empty, 1, 1048576, f); fwrite(empty, 1, 1048576, fp);
SendMessage(h, PBM_SETPOS, (WPARAM) i + j, (LPARAM) 0); SendMessage(h, PBM_SETPOS, (WPARAM) i + j, (LPARAM) 0);
@@ -590,7 +590,7 @@ create_mo_sector_image(char *file_name, int8_t disk_size, uint8_t is_mdi, HWND h
} }
if (total_size2 > 0) { if (total_size2 > 0) {
fwrite(empty2, 1, total_size2, f); fwrite(empty2, 1, total_size2, fp);
SendMessage(h, PBM_SETPOS, (WPARAM) pbar_max - 1, (LPARAM) 0); SendMessage(h, PBM_SETPOS, (WPARAM) pbar_max - 1, (LPARAM) 0);
@@ -604,7 +604,7 @@ create_mo_sector_image(char *file_name, int8_t disk_size, uint8_t is_mdi, HWND h
free(empty2); free(empty2);
free(empty); free(empty);
fclose(f); fclose(fp);
return 1; return 1;
} }
@@ -653,21 +653,21 @@ static LRESULT CALLBACK
#else #else
static BOOL CALLBACK static BOOL CALLBACK
#endif #endif
NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, UNUSED(LPARAM lParam))
{ {
HWND h; HWND h;
int i = 0; int i = 0;
int wcs_len; int wcs_len;
int ext_offs; int ext_offs;
wchar_t *ext; const wchar_t *ext;
uint8_t disk_size; uint8_t disk_size;
uint8_t rpm_mode; uint8_t rpm_mode;
int ret; int ret;
FILE *f; FILE *fp;
int zip_types; int zip_types;
int mo_types; int mo_types;
int floppy_types; int floppy_types;
wchar_t *twcs; wchar_t *twcs;
switch (message) { switch (message) {
case WM_INITDIALOG: case WM_INITDIALOG:
@@ -763,9 +763,9 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
} }
} }
h = GetDlgItem(hdlg, IDC_EDIT_FILE_NAME); h = GetDlgItem(hdlg, IDC_EDIT_FILE_NAME);
f = _wfopen(wopenfilestring, L"rb"); fp = _wfopen(wopenfilestring, L"rb");
if (f != NULL) { if (fp != NULL) {
fclose(f); fclose(fp);
if (new_floppy_msgbox_ex(hdlg, MBX_QUESTION, (wchar_t *) IDS_4111, (wchar_t *) IDS_4118, (wchar_t *) IDS_4120, (wchar_t *) IDS_4121, NULL) != 0) /* yes */ if (new_floppy_msgbox_ex(hdlg, MBX_QUESTION, (wchar_t *) IDS_4111, (wchar_t *) IDS_4118, (wchar_t *) IDS_4120, (wchar_t *) IDS_4121, NULL) != 0) /* yes */
return FALSE; return FALSE;
} }

View File

@@ -236,9 +236,9 @@ handle_window_messages(UINT message, WPARAM wParam, LPARAM lParam, int fullscree
PRAWINPUT raw = NULL; PRAWINPUT raw = NULL;
/* Here we read the raw input data */ /* Here we read the raw input data */
GetRawInputData((HRAWINPUT) (LPARAM) lParam, RID_INPUT, NULL, &size, sizeof(RAWINPUTHEADER)); GetRawInputData((HRAWINPUT) lParam, RID_INPUT, NULL, &size, sizeof(RAWINPUTHEADER));
raw = (PRAWINPUT) malloc(size); raw = (PRAWINPUT) malloc(size);
if (GetRawInputData((HRAWINPUT) (LPARAM) lParam, RID_INPUT, raw, &size, sizeof(RAWINPUTHEADER)) == size) { if (GetRawInputData((HRAWINPUT) lParam, RID_INPUT, raw, &size, sizeof(RAWINPUTHEADER)) == size) {
switch (raw->header.dwType) { switch (raw->header.dwType) {
case RIM_TYPEKEYBOARD: case RIM_TYPEKEYBOARD:
keyboard_handle(raw); keyboard_handle(raw);
@@ -447,8 +447,8 @@ opengl_fail(void)
window = NULL; window = NULL;
} }
wchar_t *message = plat_get_string(IDS_2153); const wchar_t *message = plat_get_string(IDS_2153);
wchar_t *header = plat_get_string(IDS_2154); const wchar_t *header = plat_get_string(IDS_2154);
MessageBox(parent, header, message, MB_OK); MessageBox(parent, header, message, MB_OK);
WaitForSingleObject(sync_objects.closing, INFINITE); WaitForSingleObject(sync_objects.closing, INFINITE);
@@ -456,7 +456,7 @@ opengl_fail(void)
_endthread(); _endthread();
} }
static void __stdcall opengl_debugmsg_callback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const void *userParam) static void __stdcall opengl_debugmsg_callback(UNUSED(GLenum source), UNUSED(GLenum type), UNUSED(GLuint id), UNUSED(GLenum severity), UNUSED(GLsizei length), const GLchar *message, UNUSED(const void *userParam))
{ {
pclog("OpenGL: %s\n", message); pclog("OpenGL: %s\n", message);
} }
@@ -468,7 +468,7 @@ static void __stdcall opengl_debugmsg_callback(GLenum source, GLenum type, GLuin
* Events are used to synchronize communication. * Events are used to synchronize communication.
*/ */
static void static void
opengl_main(void *param) opengl_main(UNUSED(void *param))
{ {
/* Initialize COM library for this thread before SDL does so. */ /* Initialize COM library for this thread before SDL does so. */
CoInitializeEx(NULL, COINIT_MULTITHREADED); CoInitializeEx(NULL, COINIT_MULTITHREADED);
@@ -638,7 +638,7 @@ opengl_main(void *param)
} while (wait_result == WAIT_TIMEOUT); } while (wait_result == WAIT_TIMEOUT);
HANDLE sync_event = sync_objects.asArray[wait_result - WAIT_OBJECT_0]; const HANDLE sync_event = sync_objects.asArray[wait_result - WAIT_OBJECT_0];
if (sync_event == sync_objects.closing) { if (sync_event == sync_objects.closing) {
closing = 1; closing = 1;
@@ -902,7 +902,7 @@ opengl_init(HWND hwnd)
write_pos = 0; write_pos = 0;
thread = thread_create(opengl_main, (void *) NULL); thread = thread_create(opengl_main, NULL);
atexit(opengl_close); atexit(opengl_close);
@@ -936,7 +936,7 @@ opengl_close(void)
for (int i = 0; i < sizeof(sync_objects) / sizeof(HANDLE); i++) { for (int i = 0; i < sizeof(sync_objects) / sizeof(HANDLE); i++) {
CloseHandle(sync_objects.asArray[i]); CloseHandle(sync_objects.asArray[i]);
sync_objects.asArray[i] = (HANDLE) NULL; sync_objects.asArray[i] = NULL;
} }
parent = NULL; parent = NULL;

View File

@@ -82,15 +82,15 @@ typedef enum {
static char * static char *
read_file_to_string(const char *path) read_file_to_string(const char *path)
{ {
FILE *file_handle = plat_fopen(path, "rb"); FILE *fp = plat_fopen(path, "rb");
if (file_handle != NULL) { if (fp != NULL) {
/* get file size */ /* get file size */
fseek(file_handle, 0, SEEK_END); fseek(fp, 0, SEEK_END);
size_t file_size = (size_t) ftell(file_handle); size_t file_size = (size_t) ftell(fp);
fseek(file_handle, 0, SEEK_SET); fseek(fp, 0, SEEK_SET);
/* read to buffer and close */ /* read to buffer and close */
char *content = (char *) malloc(sizeof(char) * (file_size + 1)); char *content = (char *) malloc(sizeof(char) * (file_size + 1));
@@ -98,9 +98,9 @@ read_file_to_string(const char *path)
if (!content) if (!content)
return NULL; return NULL;
size_t length = fread(content, sizeof(char), file_size, file_handle); size_t length = fread(content, sizeof(char), file_size, fp);
fclose(file_handle); fclose(fp);
content[length] = 0; content[length] = 0;
@@ -183,7 +183,7 @@ load_custom_shaders(const char *path)
it must be captured and placed as the first statement. */ it must be captured and placed as the first statement. */
if (version_start != NULL) { if (version_start != NULL) {
/* Version directive found, search the line end */ /* Version directive found, search the line end */
char *version_end = strchr(version_start, '\n'); const char *version_end = strchr(version_start, '\n');
if (version_end != NULL) { if (version_end != NULL) {
char version[30] = ""; char version[30] = "";

View File

@@ -45,7 +45,7 @@ int c;
HWND hwndPreferences; HWND hwndPreferences;
BOOL CALLBACK BOOL CALLBACK
EnumResLangProc(HMODULE hModule, LPCTSTR lpszType, LPCTSTR lpszName, WORD wIDLanguage, LONG_PTR lParam) EnumResLangProc(UNUSED(HMODULE hModule), UNUSED(LPCTSTR lpszType), UNUSED(LPCTSTR lpszName), WORD wIDLanguage, LONG_PTR lParam)
{ {
wchar_t temp[LOCALE_NAME_MAX_LENGTH + 1]; wchar_t temp[LOCALE_NAME_MAX_LENGTH + 1];
LCIDToLocaleName(wIDLanguage, temp, LOCALE_NAME_MAX_LENGTH, 0); LCIDToLocaleName(wIDLanguage, temp, LOCALE_NAME_MAX_LENGTH, 0);
@@ -205,7 +205,7 @@ static LRESULT CALLBACK
#else #else
static BOOL CALLBACK static BOOL CALLBACK
#endif #endif
PreferencesDlgProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) PreferencesDlgProcedure(HWND hdlg, UINT message, WPARAM wParam, UNUSED(LPARAM lParam))
{ {
switch (message) { switch (message) {
case WM_INITDIALOG: case WM_INITDIALOG:

View File

@@ -188,8 +188,8 @@ sdl_stretch(int *w, int *h, int *x, int *y)
hsr = hw / hh; hsr = hw / hh;
switch (video_fullscreen_scale) { switch (video_fullscreen_scale) {
case FULLSCR_SCALE_FULL:
default: default:
case FULLSCR_SCALE_FULL:
*w = sdl_w; *w = sdl_w;
*h = sdl_h; *h = sdl_h;
*x = 0; *x = 0;
@@ -256,7 +256,7 @@ sdl_blit(int x, int y, int w, int h, int monitor_index)
SDL_UpdateTexture(sdl_tex, &r_src, &(buffer32->line[y][x]), 2048 * sizeof(uint32_t)); SDL_UpdateTexture(sdl_tex, &r_src, &(buffer32->line[y][x]), 2048 * sizeof(uint32_t));
if (monitors[0].mon_screenshots) if (monitors[0].mon_screenshots)
video_screenshot((uint32_t *) buffer32->dat, x, y, 2048); video_screenshot(buffer32->dat, x, y, 2048);
video_blit_complete(); video_blit_complete();
@@ -276,7 +276,7 @@ sdl_blit(int x, int y, int w, int h, int monitor_index)
} }
static void static void
sdl_blit_ex(int x, int y, int w, int h, int monitor_index) sdl_blit_ex(int x, int y, int w, int h, UNUSED(int monitor_index))
{ {
SDL_Rect r_src; SDL_Rect r_src;
void *pixeldata; void *pixeldata;
@@ -465,7 +465,9 @@ sdl_set_fs(int fs)
else else
sdl_flags &= ~RENDERER_FULL_SCREEN; sdl_flags &= ~RENDERER_FULL_SCREEN;
// sdl_reinit_texture(); #if 0
sdl_reinit_texture();
#endif
sdl_enabled = 1; sdl_enabled = 1;
SDL_UnlockMutex(sdl_mutex); SDL_UnlockMutex(sdl_mutex);
} }
@@ -528,19 +530,19 @@ sdl_init_common(int flags)
} }
int int
sdl_inits(HWND h) sdl_inits(UNUSED(HWND h))
{ {
return sdl_init_common(0); return sdl_init_common(0);
} }
int int
sdl_inith(HWND h) sdl_inith(UNUSED(HWND h))
{ {
return sdl_init_common(RENDERER_HARDWARE); return sdl_init_common(RENDERER_HARDWARE);
} }
int int
sdl_initho(HWND h) sdl_initho(UNUSED(HWND h))
{ {
return sdl_init_common(RENDERER_HARDWARE | RENDERER_OPENGL); return sdl_init_common(RENDERER_HARDWARE | RENDERER_OPENGL);
} }

View File

@@ -38,11 +38,13 @@
#define LOG_PREFIX "serial_passthrough: " #define LOG_PREFIX "serial_passthrough: "
void void
plat_serpt_close(void *p) plat_serpt_close(void *priv)
{ {
serial_passthrough_t *dev = (serial_passthrough_t *) p; serial_passthrough_t *dev = (serial_passthrough_t *) priv;
// fclose(dev->master_fd); #if 0
fclose(dev->master_fd);
#endif
FlushFileBuffers((HANDLE) dev->master_fd); FlushFileBuffers((HANDLE) dev->master_fd);
if (dev->mode == SERPT_MODE_VCON) if (dev->mode == SERPT_MODE_VCON)
DisconnectNamedPipe((HANDLE) dev->master_fd); DisconnectNamedPipe((HANDLE) dev->master_fd);
@@ -56,31 +58,34 @@ plat_serpt_close(void *p)
static void static void
plat_serpt_write_vcon(serial_passthrough_t *dev, uint8_t data) plat_serpt_write_vcon(serial_passthrough_t *dev, uint8_t data)
{ {
/* fd_set wrfds; #if 0
* int res; fd_set wrfds;
*/ int res;
#endif
/* We cannot use select here, this would block the hypervisor! */ /* We cannot use select here, this would block the hypervisor! */
/* FD_ZERO(&wrfds); #if 0
FD_SET(ctx->master_fd, &wrfds); FD_ZERO(&wrfds);
FD_SET(ctx->master_fd, &wrfds);
res = select(ctx->master_fd + 1, NULL, &wrfds, NULL, NULL); res = select(ctx->master_fd + 1, NULL, &wrfds, NULL, NULL);
if (res <= 0) { if (res <= 0)
return; return;
} #endif
*/
/* just write it out */ /* just write it out */
// fwrite(dev->master_fd, &data, 1); #if 0
fwrite(dev->master_fd, &data, 1);
#endif
DWORD bytesWritten = 0; DWORD bytesWritten = 0;
WriteFile((HANDLE) dev->master_fd, &data, 1, &bytesWritten, NULL); WriteFile((HANDLE) dev->master_fd, &data, 1, &bytesWritten, NULL);
} }
void void
plat_serpt_set_params(void *p) plat_serpt_set_params(void *priv)
{ {
serial_passthrough_t *dev = (serial_passthrough_t *) p; const serial_passthrough_t *dev = (serial_passthrough_t *) priv;
if (dev->mode == SERPT_MODE_HOSTSER) { if (dev->mode == SERPT_MODE_HOSTSER) {
DCB serialattr = {}; DCB serialattr = {};
@@ -123,9 +128,9 @@ plat_serpt_set_params(void *p)
} }
void void
plat_serpt_write(void *p, uint8_t data) plat_serpt_write(void *priv, uint8_t data)
{ {
serial_passthrough_t *dev = (serial_passthrough_t *) p; serial_passthrough_t *dev = (serial_passthrough_t *) priv;
switch (dev->mode) { switch (dev->mode) {
case SERPT_MODE_VCON: case SERPT_MODE_VCON:
@@ -146,9 +151,9 @@ plat_serpt_read_vcon(serial_passthrough_t *dev, uint8_t *data)
} }
int int
plat_serpt_read(void *p, uint8_t *data) plat_serpt_read(void *priv, uint8_t *data)
{ {
serial_passthrough_t *dev = (serial_passthrough_t *) p; serial_passthrough_t *dev = (serial_passthrough_t *) priv;
int res = 0; int res = 0;
switch (dev->mode) { switch (dev->mode) {
@@ -212,9 +217,9 @@ open_host_serial_port(serial_passthrough_t *dev)
} }
int int
plat_serpt_open_device(void *p) plat_serpt_open_device(void *priv)
{ {
serial_passthrough_t *dev = (serial_passthrough_t *) p; serial_passthrough_t *dev = (serial_passthrough_t *) priv;
switch (dev->mode) { switch (dev->mode) {
case SERPT_MODE_VCON: case SERPT_MODE_VCON:

View File

@@ -664,12 +664,12 @@ win_settings_save(void)
} }
memcpy(zip_drives, temp_zip_drives, ZIP_NUM * sizeof(zip_drive_t)); memcpy(zip_drives, temp_zip_drives, ZIP_NUM * sizeof(zip_drive_t));
for (uint8_t i = 0; i < ZIP_NUM; i++) { for (uint8_t i = 0; i < ZIP_NUM; i++) {
zip_drives[i].f = NULL; zip_drives[i].fp = NULL;
zip_drives[i].priv = NULL; zip_drives[i].priv = NULL;
} }
memcpy(mo_drives, temp_mo_drives, MO_NUM * sizeof(mo_drive_t)); memcpy(mo_drives, temp_mo_drives, MO_NUM * sizeof(mo_drive_t));
for (uint8_t i = 0; i < MO_NUM; i++) { for (uint8_t i = 0; i < MO_NUM; i++) {
mo_drives[i].f = NULL; mo_drives[i].fp = NULL;
mo_drives[i].priv = NULL; mo_drives[i].priv = NULL;
} }
@@ -701,7 +701,7 @@ win_settings_machine_recalc_fpu(HWND hdlg)
settings_reset_content(hdlg, IDC_COMBO_FPU); settings_reset_content(hdlg, IDC_COMBO_FPU);
c = 0; c = 0;
while (1) { while (1) {
stransi = (char *) fpu_get_name_from_index(temp_cpu_f, temp_cpu, c); stransi = fpu_get_name_from_index(temp_cpu_f, temp_cpu, c);
type = fpu_get_type_from_index(temp_cpu_f, temp_cpu, c); type = fpu_get_type_from_index(temp_cpu_f, temp_cpu, c);
if (!stransi) if (!stransi)
break; break;
@@ -756,13 +756,13 @@ win_settings_machine_recalc_cpu(HWND hdlg)
static void static void
win_settings_machine_recalc_cpu_m(HWND hdlg) win_settings_machine_recalc_cpu_m(HWND hdlg)
{ {
int c; int c;
int i; int i;
int first_eligible = -1; int first_eligible = -1;
int current_eligible = 0; int current_eligible = 0;
int last_eligible = 0; int last_eligible = 0;
LPTSTR lptsTemp; LPTSTR lptsTemp;
char *stransi; const char *stransi;
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR)); lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
@@ -802,14 +802,14 @@ win_settings_machine_recalc_cpu_m(HWND hdlg)
static void static void
win_settings_machine_recalc_machine(HWND hdlg) win_settings_machine_recalc_machine(HWND hdlg)
{ {
HWND h; HWND h;
int c; int c;
int i; int i;
int current_eligible; int current_eligible;
LPTSTR lptsTemp; LPTSTR lptsTemp;
char *stransi; char *stransi;
UDACCEL accel; UDACCEL accel;
device_t *d; const device_t *d;
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR)); lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
@@ -910,7 +910,7 @@ static LRESULT CALLBACK
#else #else
static BOOL CALLBACK static BOOL CALLBACK
#endif #endif
win_settings_machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) win_settings_machine_proc(HWND hdlg, UINT message, WPARAM wParam, UNUSED(LPARAM lParam))
{ {
HWND h; HWND h;
HWND h2; HWND h2;
@@ -945,7 +945,7 @@ win_settings_machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
memset(listtomachine, 0x00, sizeof(listtomachine)); memset(listtomachine, 0x00, sizeof(listtomachine));
while (machine_get_internal_name_ex(c) != NULL) { while (machine_get_internal_name_ex(c) != NULL) {
if (machine_available(c) && (machine_get_type(c) == temp_machine_type)) { if (machine_available(c) && (machine_get_type(c) == temp_machine_type)) {
stransi = machine_getname_ex(c); stransi = (char *) machine_getname_ex(c);
mbstowcs(lptsTemp, stransi, strlen(stransi) + 1); mbstowcs(lptsTemp, stransi, strlen(stransi) + 1);
settings_add_string(hdlg, IDC_COMBO_MACHINE, (LPARAM) lptsTemp); settings_add_string(hdlg, IDC_COMBO_MACHINE, (LPARAM) lptsTemp);
listtomachine[d] = c; listtomachine[d] = c;
@@ -1002,7 +1002,7 @@ win_settings_machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
memset(listtomachine, 0x00, sizeof(listtomachine)); memset(listtomachine, 0x00, sizeof(listtomachine));
while (machine_get_internal_name_ex(c) != NULL) { while (machine_get_internal_name_ex(c) != NULL) {
if (machine_available(c) && (machine_get_type(c) == temp_machine_type)) { if (machine_available(c) && (machine_get_type(c) == temp_machine_type)) {
stransi = machine_getname_ex(c); stransi = (char *) machine_getname_ex(c);
mbstowcs(lptsTemp, stransi, strlen(stransi) + 1); mbstowcs(lptsTemp, stransi, strlen(stransi) + 1);
settings_add_string(hdlg, IDC_COMBO_MACHINE, (LPARAM) lptsTemp); settings_add_string(hdlg, IDC_COMBO_MACHINE, (LPARAM) lptsTemp);
listtomachine[d] = c; listtomachine[d] = c;
@@ -1098,10 +1098,10 @@ win_settings_machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
} }
static void static void
generate_device_name(const device_t *device, char *internal_name, int bus) generate_device_name(const device_t *device, const char *internal_name, int bus)
{ {
char temp[512]; char temp[512];
WCHAR *wtemp; const WCHAR *wtemp;
memset(device_name, 0x00, 512 * sizeof(WCHAR)); memset(device_name, 0x00, 512 * sizeof(WCHAR));
memset(temp, 0x00, 512); memset(temp, 0x00, 512);
@@ -1124,7 +1124,7 @@ static LRESULT CALLBACK
#else #else
static BOOL CALLBACK static BOOL CALLBACK
#endif #endif
win_settings_video_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) win_settings_video_proc(HWND hdlg, UINT message, WPARAM wParam, UNUSED(LPARAM lParam))
{ {
int c = 0; int c = 0;
int d = 0; int d = 0;
@@ -1347,7 +1347,7 @@ static LRESULT CALLBACK
#else #else
static BOOL CALLBACK static BOOL CALLBACK
#endif #endif
win_settings_input_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) win_settings_input_proc(HWND hdlg, UINT message, WPARAM wParam, UNUSED(LPARAM lParam))
{ {
wchar_t str[128]; wchar_t str[128];
const char *joy_name; const char *joy_name;
@@ -1441,17 +1441,17 @@ mpu401_present(void)
int int
mpu401_standalone_allow(void) mpu401_standalone_allow(void)
{ {
char *md; const char *mdout;
char *mdin; const char *mdin;
if (!machine_has_bus(temp_machine, MACHINE_BUS_ISA) && !machine_has_bus(temp_machine, MACHINE_BUS_MCA)) if (!machine_has_bus(temp_machine, MACHINE_BUS_ISA) && !machine_has_bus(temp_machine, MACHINE_BUS_MCA))
return 0; return 0;
md = midi_out_device_get_internal_name(temp_midi_output_device); mdout = midi_out_device_get_internal_name(temp_midi_output_device);
mdin = midi_in_device_get_internal_name(temp_midi_input_device); mdin = midi_in_device_get_internal_name(temp_midi_input_device);
if (md != NULL) { if (mdout != NULL) {
if (!strcmp(md, "none") && !strcmp(mdin, "none")) if (!strcmp(mdout, "none") && !strcmp(mdin, "none"))
return 0; return 0;
} }
@@ -1463,7 +1463,7 @@ static LRESULT CALLBACK
#else #else
static BOOL CALLBACK static BOOL CALLBACK
#endif #endif
win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, UNUSED(LPARAM lParam))
{ {
uint16_t c; uint16_t c;
uint16_t d; uint16_t d;
@@ -1799,12 +1799,12 @@ static LRESULT CALLBACK
#else #else
static BOOL CALLBACK static BOOL CALLBACK
#endif #endif
win_settings_ports_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) win_settings_ports_proc(HWND hdlg, UINT message, WPARAM wParam, UNUSED(LPARAM lParam))
{ {
int c; int c;
int i; int i;
char *s; const char *s;
LPTSTR lptsTemp; LPTSTR lptsTemp;
switch (message) { switch (message) {
case WM_INITDIALOG: case WM_INITDIALOG:
@@ -1813,7 +1813,7 @@ win_settings_ports_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
for (i = 0; i < PARALLEL_MAX; i++) { for (i = 0; i < PARALLEL_MAX; i++) {
c = 0; c = 0;
while (1) { while (1) {
s = lpt_device_get_name(c); s = (char *) lpt_device_get_name(c);
if (!s) if (!s)
break; break;
@@ -1877,7 +1877,7 @@ static LRESULT CALLBACK
#else #else
static BOOL CALLBACK static BOOL CALLBACK
#endif #endif
win_settings_storage_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) win_settings_storage_proc(HWND hdlg, UINT message, WPARAM wParam, UNUSED(LPARAM lParam))
{ {
int c; int c;
int d; int d;
@@ -2102,7 +2102,7 @@ static LRESULT CALLBACK
#else #else
static BOOL CALLBACK static BOOL CALLBACK
#endif #endif
win_settings_network_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) win_settings_network_proc(HWND hdlg, UINT message, WPARAM wParam, UNUSED(LPARAM lParam))
{ {
int c; int c;
int d; int d;
@@ -2448,7 +2448,7 @@ recalc_location_controls(HWND hdlg, int is_add_dlg, int assign_id)
settings_show_window(hdlg, IDC_COMBO_HD_ID, TRUE); settings_show_window(hdlg, IDC_COMBO_HD_ID, TRUE);
if (assign_id) if (assign_id)
next_free_scsi_id((uint8_t *) (is_add_dlg ? &(new_hdd.scsi_id) : &(temp_hdd[lv1_current_sel].scsi_id))); next_free_scsi_id((is_add_dlg ? &(new_hdd.scsi_id) : &(temp_hdd[lv1_current_sel].scsi_id)));
settings_set_cur_sel(hdlg, IDC_COMBO_HD_ID, is_add_dlg ? new_hdd.scsi_id : temp_hdd[lv1_current_sel].scsi_id); settings_set_cur_sel(hdlg, IDC_COMBO_HD_ID, is_add_dlg ? new_hdd.scsi_id : temp_hdd[lv1_current_sel].scsi_id);
} }
} }
@@ -2463,8 +2463,8 @@ bus_full(uint64_t *tracking, int count)
int full = 0; int full = 0;
switch (count) { switch (count) {
case 2:
default: default:
case 2:
full = (*tracking & 0xFF00LL); full = (*tracking & 0xFF00LL);
full = full && (*tracking & 0x00FFLL); full = full && (*tracking & 0x00FFLL);
break; break;
@@ -2820,14 +2820,14 @@ set_edit_box_contents(HWND hdlg, int id, uint32_t val)
h = GetDlgItem(hdlg, id); h = GetDlgItem(hdlg, id);
wsprintf(szText, plat_get_string(IDS_2107), val); wsprintf(szText, plat_get_string(IDS_2107), val);
SendMessage(h, WM_SETTEXT, (WPARAM) wcslen(szText), (LPARAM) szText); SendMessage(h, WM_SETTEXT, wcslen(szText), (LPARAM) szText);
} }
static void static void
set_edit_box_text_contents(HWND hdlg, int id, WCHAR *text) set_edit_box_text_contents(HWND hdlg, int id, WCHAR *text)
{ {
HWND h = GetDlgItem(hdlg, id); HWND h = GetDlgItem(hdlg, id);
SendMessage(h, WM_SETTEXT, (WPARAM) wcslen(text), (LPARAM) text); SendMessage(h, WM_SETTEXT, wcslen(text), (LPARAM) text);
} }
static void static void
@@ -2876,11 +2876,11 @@ recalc_selection(HWND hdlg)
HWND vhd_progress_hdlg; HWND vhd_progress_hdlg;
static void static void
vhd_progress_callback(uint32_t current_sector, uint32_t total_sectors) vhd_progress_callback(uint32_t current_sector, UNUSED(uint32_t total_sectors))
{ {
MSG msg; MSG msg;
HWND h = GetDlgItem(vhd_progress_hdlg, IDC_PBAR_IMG_CREATE); HWND h = GetDlgItem(vhd_progress_hdlg, IDC_PBAR_IMG_CREATE);
SendMessage(h, PBM_SETPOS, (WPARAM) current_sector, (LPARAM) 0); SendMessage(h, PBM_SETPOS, current_sector, (LPARAM) 0);
while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE | PM_NOYIELD)) { while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE | PM_NOYIELD)) {
TranslateMessage(&msg); TranslateMessage(&msg);
DispatchMessage(&msg); DispatchMessage(&msg);
@@ -3029,10 +3029,10 @@ static LRESULT CALLBACK
#else #else
static BOOL CALLBACK static BOOL CALLBACK
#endif #endif
win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, UNUSED(LPARAM lParam))
{ {
HWND h; HWND h;
FILE *f; FILE *fp;
uint32_t temp; uint32_t temp;
uint32_t i = 0; uint32_t i = 0;
uint32_t sector_size = 512; uint32_t sector_size = 512;
@@ -3198,38 +3198,38 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
img_format = settings_get_cur_sel(hdlg, IDC_COMBO_HD_IMG_FORMAT); img_format = settings_get_cur_sel(hdlg, IDC_COMBO_HD_IMG_FORMAT);
if (img_format < IMG_FMT_VHD_FIXED) { if (img_format < IMG_FMT_VHD_FIXED) {
f = _wfopen(hd_file_name, L"wb"); fp = _wfopen(hd_file_name, L"wb");
} else { } else {
f = (FILE *) 0; fp = (FILE *) 0;
} }
if (img_format == IMG_FMT_HDI) { /* HDI file */ if (img_format == IMG_FMT_HDI) { /* HDI file */
if (size >= 0x100000000LL) { if (size >= 0x100000000LL) {
fclose(f); fclose(fp);
settings_msgbox_header(MBX_ERROR, (wchar_t *) IDS_4116, (wchar_t *) IDS_4104); settings_msgbox_header(MBX_ERROR, (wchar_t *) IDS_4116, (wchar_t *) IDS_4104);
return TRUE; return TRUE;
} }
fwrite(&zero, 1, 4, f); /* 00000000: Zero/unknown */ fwrite(&zero, 1, 4, fp); /* 00000000: Zero/unknown */
fwrite(&zero, 1, 4, f); /* 00000004: Zero/unknown */ fwrite(&zero, 1, 4, fp); /* 00000004: Zero/unknown */
fwrite(&base, 1, 4, f); /* 00000008: Offset at which data starts */ fwrite(&base, 1, 4, fp); /* 00000008: Offset at which data starts */
fwrite(&size, 1, 4, f); /* 0000000C: Full size of the data (32-bit) */ fwrite(&size, 1, 4, fp); /* 0000000C: Full size of the data (32-bit) */
fwrite(&sector_size, 1, 4, f); /* 00000010: Sector size in bytes */ fwrite(&sector_size, 1, 4, fp); /* 00000010: Sector size in bytes */
fwrite(&spt, 1, 4, f); /* 00000014: Sectors per cylinder */ fwrite(&spt, 1, 4, fp); /* 00000014: Sectors per cylinder */
fwrite(&hpc, 1, 4, f); /* 00000018: Heads per cylinder */ fwrite(&hpc, 1, 4, fp); /* 00000018: Heads per cylinder */
fwrite(&tracks, 1, 4, f); /* 0000001C: Cylinders */ fwrite(&tracks, 1, 4, fp); /* 0000001C: Cylinders */
for (i = 0; i < 0x3f8; i++) for (i = 0; i < 0x3f8; i++)
fwrite(&zero, 1, 4, f); fwrite(&zero, 1, 4, fp);
} else if (img_format == IMG_FMT_HDX) { /* HDX file */ } else if (img_format == IMG_FMT_HDX) { /* HDX file */
fwrite(&signature, 1, 8, f); /* 00000000: Signature */ fwrite(&signature, 1, 8, fp); /* 00000000: Signature */
fwrite(&size, 1, 8, f); /* 00000008: Full size of the data (64-bit) */ fwrite(&size, 1, 8, fp); /* 00000008: Full size of the data (64-bit) */
fwrite(&sector_size, 1, 4, f); /* 00000010: Sector size in bytes */ fwrite(&sector_size, 1, 4, fp); /* 00000010: Sector size in bytes */
fwrite(&spt, 1, 4, f); /* 00000014: Sectors per cylinder */ fwrite(&spt, 1, 4, fp); /* 00000014: Sectors per cylinder */
fwrite(&hpc, 1, 4, f); /* 00000018: Heads per cylinder */ fwrite(&hpc, 1, 4, fp); /* 00000018: Heads per cylinder */
fwrite(&tracks, 1, 4, f); /* 0000001C: Cylinders */ fwrite(&tracks, 1, 4, fp); /* 0000001C: Cylinders */
fwrite(&zero, 1, 4, f); /* 00000020: [Translation] Sectors per cylinder */ fwrite(&zero, 1, 4, fp); /* 00000020: [Translation] Sectors per cylinder */
fwrite(&zero, 1, 4, f); /* 00000004: [Translation] Heads per cylinder */ fwrite(&zero, 1, 4, fp); /* 00000004: [Translation] Heads per cylinder */
} else if (img_format >= IMG_FMT_VHD_FIXED) { /* VHD file */ } else if (img_format >= IMG_FMT_VHD_FIXED) { /* VHD file */
MVHDGeom _86box_geometry; MVHDGeom _86box_geometry;
block_size = settings_get_cur_sel(hdlg, IDC_COMBO_HD_BLOCK_SIZE) == 0 ? MVHD_BLOCK_LARGE : MVHD_BLOCK_SMALL; block_size = settings_get_cur_sel(hdlg, IDC_COMBO_HD_BLOCK_SIZE) == 0 ? MVHD_BLOCK_LARGE : MVHD_BLOCK_SMALL;
@@ -3282,18 +3282,18 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
h = GetDlgItem(hdlg, IDC_PBAR_IMG_CREATE); h = GetDlgItem(hdlg, IDC_PBAR_IMG_CREATE);
if (size) { if (size) {
if (f) { if (fp) {
fwrite(big_buf, 1, size, f); fwrite(big_buf, 1, size, fp);
} }
SendMessage(h, PBM_SETPOS, (WPARAM) 1, (LPARAM) 0); SendMessage(h, PBM_SETPOS, (WPARAM) 1, (LPARAM) 0);
} }
if (r) { if (r) {
for (i = 0; i < r; i++) { for (i = 0; i < r; i++) {
if (f) { if (fp) {
fwrite(big_buf, 1, 1048576, f); fwrite(big_buf, 1, 1048576, fp);
} }
SendMessage(h, PBM_SETPOS, (WPARAM) (i + 1), (LPARAM) 0); SendMessage(h, PBM_SETPOS, (i + 1), (LPARAM) 0);
settings_process_messages(); settings_process_messages();
} }
@@ -3301,8 +3301,8 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
free(big_buf); free(big_buf);
if (f) { if (fp) {
fclose(f); fclose(fp);
} }
settings_msgbox_header(MBX_INFO, (wchar_t *) IDS_4113, (wchar_t *) IDS_4117); settings_msgbox_header(MBX_INFO, (wchar_t *) IDS_4113, (wchar_t *) IDS_4117);
} }
@@ -3330,36 +3330,36 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
} }
if (!(existing & 1)) { if (!(existing & 1)) {
f = _wfopen(wopenfilestring, L"rb"); fp = _wfopen(wopenfilestring, L"rb");
if (f != NULL) { if (fp != NULL) {
fclose(f); fclose(fp);
if (settings_msgbox_ex(MBX_QUESTION_YN, (wchar_t *) IDS_4111, (wchar_t *) IDS_4118, (wchar_t *) IDS_4120, (wchar_t *) IDS_4121, NULL) != 0) /* yes */ if (settings_msgbox_ex(MBX_QUESTION_YN, (wchar_t *) IDS_4111, (wchar_t *) IDS_4118, (wchar_t *) IDS_4120, (wchar_t *) IDS_4121, NULL) != 0) /* yes */
return FALSE; return FALSE;
} }
} }
f = _wfopen(wopenfilestring, (existing & 1) ? L"rb" : L"wb"); fp = _wfopen(wopenfilestring, (existing & 1) ? L"rb" : L"wb");
if (f == NULL) { if (fp == NULL) {
hdd_add_file_open_error: hdd_add_file_open_error:
fclose(f); fclose(fp);
settings_msgbox_header(MBX_ERROR, (existing & 1) ? (wchar_t *) IDS_4114 : (wchar_t *) IDS_4115, (existing & 1) ? (wchar_t *) IDS_4107 : (wchar_t *) IDS_4108); settings_msgbox_header(MBX_ERROR, (existing & 1) ? (wchar_t *) IDS_4114 : (wchar_t *) IDS_4115, (existing & 1) ? (wchar_t *) IDS_4107 : (wchar_t *) IDS_4108);
return TRUE; return TRUE;
} }
if (existing & 1) { if (existing & 1) {
if (image_is_hdi(openfilestring) || image_is_hdx(openfilestring, 1)) { if (image_is_hdi(openfilestring) || image_is_hdx(openfilestring, 1)) {
fseeko64(f, 0x10, SEEK_SET); fseeko64(fp, 0x10, SEEK_SET);
fread(&sector_size, 1, 4, f); fread(&sector_size, 1, 4, fp);
if (sector_size != 512) { if (sector_size != 512) {
settings_msgbox_header(MBX_ERROR, (wchar_t *) IDS_4119, (wchar_t *) IDS_4109); settings_msgbox_header(MBX_ERROR, (wchar_t *) IDS_4119, (wchar_t *) IDS_4109);
fclose(f); fclose(fp);
return TRUE; return TRUE;
} }
spt = hpc = tracks = 0; spt = hpc = tracks = 0;
fread(&spt, 1, 4, f); fread(&spt, 1, 4, fp);
fread(&hpc, 1, 4, f); fread(&hpc, 1, 4, fp);
fread(&tracks, 1, 4, f); fread(&tracks, 1, 4, fp);
} else if (image_is_vhd(openfilestring, 1)) { } else if (image_is_vhd(openfilestring, 1)) {
fclose(f); fclose(fp);
MVHDMeta *vhd = mvhd_open(openfilestring, 0, &vhd_error); MVHDMeta *vhd = mvhd_open(openfilestring, 0, &vhd_error);
if (vhd == NULL) { if (vhd == NULL) {
settings_msgbox_header(MBX_ERROR, (existing & 1) ? (wchar_t *) IDS_4114 : (wchar_t *) IDS_4115, (existing & 1) ? (wchar_t *) IDS_4107 : (wchar_t *) IDS_4108); settings_msgbox_header(MBX_ERROR, (existing & 1) ? (wchar_t *) IDS_4114 : (wchar_t *) IDS_4115, (existing & 1) ? (wchar_t *) IDS_4107 : (wchar_t *) IDS_4108);
@@ -3386,8 +3386,8 @@ hdd_add_file_open_error:
size = (uint64_t) tracks * hpc * spt * 512; size = (uint64_t) tracks * hpc * spt * 512;
mvhd_close(vhd); mvhd_close(vhd);
} else { } else {
fseeko64(f, 0, SEEK_END); fseeko64(fp, 0, SEEK_END);
size = ftello64(f); size = ftello64(fp);
if (((size % 17) == 0) && (size <= 142606336)) { if (((size % 17) == 0) && (size <= 142606336)) {
spt = 17; spt = 17;
if (size <= 26738688) if (size <= 26738688)
@@ -3432,7 +3432,7 @@ hdd_add_file_open_error:
no_update = 0; no_update = 0;
} }
fclose(f); fclose(fp);
} }
h = GetDlgItem(hdlg, IDC_EDIT_HD_FILE_NAME); h = GetDlgItem(hdlg, IDC_EDIT_HD_FILE_NAME);
@@ -3623,8 +3623,8 @@ hdd_add_file_open_error:
hdd_ptr->bus = b; hdd_ptr->bus = b;
switch (hdd_ptr->bus) { switch (hdd_ptr->bus) {
case HDD_BUS_DISABLED:
default: default:
case HDD_BUS_DISABLED:
max_spt = max_hpc = max_tracks = 0; max_spt = max_hpc = max_tracks = 0;
break; break;
case HDD_BUS_MFM: case HDD_BUS_MFM:
@@ -3968,11 +3968,11 @@ combo_id_to_format_string_id(int combo_id)
static BOOL static BOOL
win_settings_floppy_drives_recalc_list(HWND hdlg) win_settings_floppy_drives_recalc_list(HWND hdlg)
{ {
LVITEM lvI; LVITEM lvI;
char s[256]; char s[256];
char *t; const char *t;
WCHAR szText[256]; WCHAR szText[256];
HWND hwndList = GetDlgItem(hdlg, IDC_LIST_FLOPPY_DRIVES); HWND hwndList = GetDlgItem(hdlg, IDC_LIST_FLOPPY_DRIVES);
lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE; lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE;
lvI.stateMask = lvI.state = 0; lvI.stateMask = lvI.state = 0;
@@ -4028,8 +4028,8 @@ win_settings_cdrom_drives_recalc_list(HWND hdlg)
lvI.iSubItem = 0; lvI.iSubItem = 0;
switch (temp_cdrom[i].bus_type) { switch (temp_cdrom[i].bus_type) {
case CDROM_BUS_DISABLED:
default: default:
case CDROM_BUS_DISABLED:
lvI.pszText = plat_get_string(fsid); lvI.pszText = plat_get_string(fsid);
lvI.iImage = 0; lvI.iImage = 0;
break; break;
@@ -4063,7 +4063,7 @@ win_settings_cdrom_drives_recalc_list(HWND hdlg)
if (ListView_SetItem(hwndList, &lvI) == -1) if (ListView_SetItem(hwndList, &lvI) == -1)
return FALSE; return FALSE;
/* #if 0
lvI.iSubItem = 2; lvI.iSubItem = 2;
lvI.pszText = plat_get_string(temp_cdrom[i].early ? IDS_2060 : IDS_2061); lvI.pszText = plat_get_string(temp_cdrom[i].early ? IDS_2060 : IDS_2061);
lvI.iItem = i; lvI.iItem = i;
@@ -4071,7 +4071,7 @@ win_settings_cdrom_drives_recalc_list(HWND hdlg)
if (ListView_SetItem(hwndList, &lvI) == -1) if (ListView_SetItem(hwndList, &lvI) == -1)
return FALSE; return FALSE;
*/ #endif
} }
return TRUE; return TRUE;
@@ -4094,8 +4094,8 @@ win_settings_mo_drives_recalc_list(HWND hdlg)
lvI.iSubItem = 0; lvI.iSubItem = 0;
switch (temp_mo_drives[i].bus_type) { switch (temp_mo_drives[i].bus_type) {
case MO_BUS_DISABLED:
default: default:
case MO_BUS_DISABLED:
lvI.pszText = plat_get_string(fsid); lvI.pszText = plat_get_string(fsid);
lvI.iImage = 0; lvI.iImage = 0;
break; break;
@@ -4156,8 +4156,8 @@ win_settings_zip_drives_recalc_list(HWND hdlg)
lvI.iSubItem = 0; lvI.iSubItem = 0;
switch (temp_zip_drives[i].bus_type) { switch (temp_zip_drives[i].bus_type) {
case ZIP_BUS_DISABLED:
default: default:
case ZIP_BUS_DISABLED:
lvI.pszText = plat_get_string(fsid); lvI.pszText = plat_get_string(fsid);
lvI.iImage = 0; lvI.iImage = 0;
break; break;
@@ -4450,11 +4450,11 @@ get_selected_drive(HWND hdlg, int id, int max)
static void static void
win_settings_floppy_drives_update_item(HWND hdlg, int i) win_settings_floppy_drives_update_item(HWND hdlg, int i)
{ {
LVITEM lvI; LVITEM lvI;
char s[256]; char s[256];
char *t; const char *t;
WCHAR szText[256]; WCHAR szText[256];
HWND hwndList = GetDlgItem(hdlg, IDC_LIST_FLOPPY_DRIVES); HWND hwndList = GetDlgItem(hdlg, IDC_LIST_FLOPPY_DRIVES);
lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE; lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE;
lvI.stateMask = lvI.iSubItem = lvI.state = 0; lvI.stateMask = lvI.iSubItem = lvI.state = 0;
@@ -4508,8 +4508,8 @@ win_settings_cdrom_drives_update_item(HWND hdlg, int i)
fsid = combo_id_to_format_string_id(temp_cdrom[i].bus_type); fsid = combo_id_to_format_string_id(temp_cdrom[i].bus_type);
switch (temp_cdrom[i].bus_type) { switch (temp_cdrom[i].bus_type) {
case CDROM_BUS_DISABLED:
default: default:
case CDROM_BUS_DISABLED:
lvI.pszText = plat_get_string(fsid); lvI.pszText = plat_get_string(fsid);
lvI.iImage = 0; lvI.iImage = 0;
break; break;
@@ -4541,7 +4541,7 @@ win_settings_cdrom_drives_update_item(HWND hdlg, int i)
if (ListView_SetItem(hwndList, &lvI) == -1) if (ListView_SetItem(hwndList, &lvI) == -1)
return; return;
/* #if 0
lvI.iSubItem = 2; lvI.iSubItem = 2;
lvI.pszText = plat_get_string(temp_cdrom[i].early ? IDS_2060 : IDS_2061); lvI.pszText = plat_get_string(temp_cdrom[i].early ? IDS_2060 : IDS_2061);
lvI.iItem = i; lvI.iItem = i;
@@ -4549,7 +4549,7 @@ win_settings_cdrom_drives_update_item(HWND hdlg, int i)
if (ListView_SetItem(hwndList, &lvI) == -1) if (ListView_SetItem(hwndList, &lvI) == -1)
return; return;
*/ #endif
} }
static void static void
@@ -4571,8 +4571,8 @@ win_settings_mo_drives_update_item(HWND hdlg, int i)
fsid = combo_id_to_format_string_id(temp_mo_drives[i].bus_type); fsid = combo_id_to_format_string_id(temp_mo_drives[i].bus_type);
switch (temp_mo_drives[i].bus_type) { switch (temp_mo_drives[i].bus_type) {
case MO_BUS_DISABLED:
default: default:
case MO_BUS_DISABLED:
lvI.pszText = plat_get_string(fsid); lvI.pszText = plat_get_string(fsid);
lvI.iImage = 0; lvI.iImage = 0;
break; break;
@@ -4629,8 +4629,8 @@ win_settings_zip_drives_update_item(HWND hdlg, int i)
fsid = combo_id_to_format_string_id(temp_zip_drives[i].bus_type); fsid = combo_id_to_format_string_id(temp_zip_drives[i].bus_type);
switch (temp_zip_drives[i].bus_type) { switch (temp_zip_drives[i].bus_type) {
case ZIP_BUS_DISABLED:
default: default:
case ZIP_BUS_DISABLED:
lvI.pszText = plat_get_string(fsid); lvI.pszText = plat_get_string(fsid);
lvI.iImage = 0; lvI.iImage = 0;
break; break;
@@ -4700,12 +4700,14 @@ cdrom_recalc_location_controls(HWND hdlg, int assign_id)
settings_show_window(hdlg, IDC_COMBO_CD_CHANNEL_IDE, FALSE); settings_show_window(hdlg, IDC_COMBO_CD_CHANNEL_IDE, FALSE);
settings_show_window(hdlg, IDC_COMBO_CD_SPEED, bus != CDROM_BUS_DISABLED); settings_show_window(hdlg, IDC_COMBO_CD_SPEED, bus != CDROM_BUS_DISABLED);
settings_show_window(hdlg, IDT_CD_SPEED, bus != CDROM_BUS_DISABLED); settings_show_window(hdlg, IDT_CD_SPEED, bus != CDROM_BUS_DISABLED);
/* #if 0
settings_show_window(hdlg, IDC_CHECKEARLY, bus != CDROM_BUS_DISABLED); settings_show_window(hdlg, IDC_CHECKEARLY, bus != CDROM_BUS_DISABLED);
*/ #endif
if (bus != CDROM_BUS_DISABLED) { if (bus != CDROM_BUS_DISABLED) {
settings_set_cur_sel(hdlg, IDC_COMBO_CD_SPEED, temp_cdrom[lv2_current_sel].speed - 1); settings_set_cur_sel(hdlg, IDC_COMBO_CD_SPEED, temp_cdrom[lv2_current_sel].speed - 1);
// settings_set_check(hdlg, IDC_CHECKEARLY, temp_cdrom[lv2_current_sel].early); #if 0
settings_set_check(hdlg, IDC_CHECKEARLY, temp_cdrom[lv2_current_sel].early);
#endif
} }
switch (bus) { switch (bus) {
@@ -4723,7 +4725,7 @@ cdrom_recalc_location_controls(HWND hdlg, int assign_id)
settings_show_window(hdlg, IDC_COMBO_CD_ID, TRUE); settings_show_window(hdlg, IDC_COMBO_CD_ID, TRUE);
if (assign_id) if (assign_id)
next_free_scsi_id((uint8_t *) &temp_cdrom[lv2_current_sel].scsi_device_id); next_free_scsi_id(&temp_cdrom[lv2_current_sel].scsi_device_id);
settings_set_cur_sel(hdlg, IDC_COMBO_CD_ID, temp_cdrom[lv2_current_sel].scsi_device_id); settings_set_cur_sel(hdlg, IDC_COMBO_CD_ID, temp_cdrom[lv2_current_sel].scsi_device_id);
break; break;
@@ -4801,7 +4803,7 @@ mo_recalc_location_controls(HWND hdlg, int assign_id)
settings_show_window(hdlg, IDC_COMBO_MO_ID, TRUE); settings_show_window(hdlg, IDC_COMBO_MO_ID, TRUE);
if (assign_id) if (assign_id)
next_free_scsi_id((uint8_t *) &temp_mo_drives[lv1_current_sel].scsi_device_id); next_free_scsi_id(&temp_mo_drives[lv1_current_sel].scsi_device_id);
settings_set_cur_sel(hdlg, IDC_COMBO_MO_ID, temp_mo_drives[lv1_current_sel].scsi_device_id); settings_set_cur_sel(hdlg, IDC_COMBO_MO_ID, temp_mo_drives[lv1_current_sel].scsi_device_id);
break; break;
@@ -4863,7 +4865,7 @@ zip_recalc_location_controls(HWND hdlg, int assign_id)
settings_show_window(hdlg, IDC_COMBO_ZIP_ID, TRUE); settings_show_window(hdlg, IDC_COMBO_ZIP_ID, TRUE);
if (assign_id) if (assign_id)
next_free_scsi_id((uint8_t *) &temp_zip_drives[lv2_current_sel].scsi_device_id); next_free_scsi_id(&temp_zip_drives[lv2_current_sel].scsi_device_id);
settings_set_cur_sel(hdlg, IDC_COMBO_ZIP_ID, temp_zip_drives[lv2_current_sel].scsi_device_id); settings_set_cur_sel(hdlg, IDC_COMBO_ZIP_ID, temp_zip_drives[lv2_current_sel].scsi_device_id);
break; break;
@@ -4971,8 +4973,8 @@ win_settings_floppy_and_cdrom_drives_proc(HWND hdlg, UINT message, WPARAM wParam
cdrom_add_locations(hdlg); cdrom_add_locations(hdlg);
switch (temp_cdrom[lv2_current_sel].bus_type) { switch (temp_cdrom[lv2_current_sel].bus_type) {
case CDROM_BUS_DISABLED:
default: default:
case CDROM_BUS_DISABLED:
b = 0; b = 0;
break; break;
case CDROM_BUS_ATAPI: case CDROM_BUS_ATAPI:
@@ -5012,8 +5014,8 @@ win_settings_floppy_and_cdrom_drives_proc(HWND hdlg, UINT message, WPARAM wParam
ignore_change = 1; ignore_change = 1;
switch (temp_cdrom[lv2_current_sel].bus_type) { switch (temp_cdrom[lv2_current_sel].bus_type) {
case CDROM_BUS_DISABLED:
default: default:
case CDROM_BUS_DISABLED:
b = 0; b = 0;
break; break;
case CDROM_BUS_ATAPI: case CDROM_BUS_ATAPI:
@@ -5095,12 +5097,12 @@ win_settings_floppy_and_cdrom_drives_proc(HWND hdlg, UINT message, WPARAM wParam
win_settings_cdrom_drives_update_item(hdlg, lv2_current_sel); win_settings_cdrom_drives_update_item(hdlg, lv2_current_sel);
break; break;
/* #if 0
case IDC_CHECKEARLY: case IDC_CHECKEARLY:
temp_cdrom[lv2_current_sel].early = settings_get_check(hdlg, IDC_CHECKEARLY); temp_cdrom[lv2_current_sel].early = settings_get_check(hdlg, IDC_CHECKEARLY);
win_settings_cdrom_drives_update_item(hdlg, lv2_current_sel); win_settings_cdrom_drives_update_item(hdlg, lv2_current_sel);
break; break;
*/ #endif
} }
ignore_change = 0; ignore_change = 0;
@@ -5143,8 +5145,8 @@ win_settings_other_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam
mo_add_locations(hdlg); mo_add_locations(hdlg);
switch (temp_mo_drives[lv1_current_sel].bus_type) { switch (temp_mo_drives[lv1_current_sel].bus_type) {
case MO_BUS_DISABLED:
default: default:
case MO_BUS_DISABLED:
b = 0; b = 0;
break; break;
case MO_BUS_ATAPI: case MO_BUS_ATAPI:
@@ -5167,8 +5169,8 @@ win_settings_other_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam
zip_add_locations(hdlg); zip_add_locations(hdlg);
switch (temp_zip_drives[lv2_current_sel].bus_type) { switch (temp_zip_drives[lv2_current_sel].bus_type) {
case ZIP_BUS_DISABLED:
default: default:
case ZIP_BUS_DISABLED:
b = 0; b = 0;
break; break;
case ZIP_BUS_ATAPI: case ZIP_BUS_ATAPI:
@@ -5198,8 +5200,8 @@ win_settings_other_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam
ignore_change = 1; ignore_change = 1;
switch (temp_mo_drives[lv1_current_sel].bus_type) { switch (temp_mo_drives[lv1_current_sel].bus_type) {
case MO_BUS_DISABLED:
default: default:
case MO_BUS_DISABLED:
b = 0; b = 0;
break; break;
case MO_BUS_ATAPI: case MO_BUS_ATAPI:
@@ -5221,8 +5223,8 @@ win_settings_other_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam
ignore_change = 1; ignore_change = 1;
switch (temp_zip_drives[lv2_current_sel].bus_type) { switch (temp_zip_drives[lv2_current_sel].bus_type) {
case ZIP_BUS_DISABLED:
default: default:
case ZIP_BUS_DISABLED:
b = 0; b = 0;
break; break;
case ZIP_BUS_ATAPI: case ZIP_BUS_ATAPI:
@@ -5351,7 +5353,7 @@ static LRESULT CALLBACK
#else #else
static BOOL CALLBACK static BOOL CALLBACK
#endif #endif
win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, UNUSED(LPARAM lParam))
{ {
int c; int c;
int d; int d;

View File

@@ -39,7 +39,7 @@ static LRESULT CALLBACK
#else #else
static BOOL CALLBACK static BOOL CALLBACK
#endif #endif
SoundGainDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) SoundGainDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, UNUSED(LPARAM lParam))
{ {
HWND h; HWND h;
@@ -47,7 +47,7 @@ SoundGainDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
case WM_INITDIALOG: case WM_INITDIALOG:
old_gain = sound_gain; old_gain = sound_gain;
h = GetDlgItem(hdlg, IDC_SLIDER_GAIN); h = GetDlgItem(hdlg, IDC_SLIDER_GAIN);
SendMessage(h, TBM_SETRANGE, (WPARAM) 1, (LPARAM) MAKELONG(0, 9)); SendMessage(h, TBM_SETRANGE, (WPARAM) 1, MAKELONG(0, 9));
SendMessage(h, TBM_SETPOS, (WPARAM) 1, 9 - (sound_gain >> 1)); SendMessage(h, TBM_SETPOS, (WPARAM) 1, 9 - (sound_gain >> 1));
SendMessage(h, TBM_SETTICFREQ, (WPARAM) 1, 0); SendMessage(h, TBM_SETTICFREQ, (WPARAM) 1, 0);
SendMessage(h, TBM_SETLINESIZE, (WPARAM) 0, 1); SendMessage(h, TBM_SETLINESIZE, (WPARAM) 0, 1);

View File

@@ -178,7 +178,7 @@ SpecifyDimensionsDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM
break; break;
} }
return (FALSE); return FALSE;
} }
void void

View File

@@ -493,22 +493,22 @@ ui_sb_set_ready(int ready)
void void
ui_sb_update_panes(void) ui_sb_update_panes(void)
{ {
int i; int i;
int id; int id;
int cart_int; int cart_int;
int mfm_int; int mfm_int;
int xta_int; int xta_int;
int esdi_int; int esdi_int;
int ide_int; int ide_int;
int scsi_int; int scsi_int;
int edge = 0; int edge = 0;
int c_mfm; int c_mfm;
int c_esdi; int c_esdi;
int c_xta; int c_xta;
int c_ide; int c_ide;
int c_scsi; int c_scsi;
int do_net; int do_net;
char *hdc_name; const char *hdc_name;
if (!config_changed) if (!config_changed)
return; return;
@@ -833,7 +833,7 @@ StatusBarPopupMenu(HWND hwnd, POINT pt, int id)
pt.x = id * icon_width; /* Justify to the left. */ pt.x = id * icon_width; /* Justify to the left. */
pt.y = 0; /* Justify to the top. */ pt.y = 0; /* Justify to the top. */
ClientToScreen(hwnd, (LPPOINT) &pt); ClientToScreen(hwnd, &pt);
switch (sb_part_meanings[id] & 0xF0) { switch (sb_part_meanings[id] & 0xF0) {
case SB_CASSETTE: case SB_CASSETTE:
@@ -865,7 +865,7 @@ StatusBarPopupMenu(HWND hwnd, POINT pt, int id)
/* API: Load status bar icons */ /* API: Load status bar icons */
void void
StatusBarLoadIcon(HINSTANCE hInst) StatusBarLoadIcon(UNUSED(HINSTANCE hInst))
{ {
win_load_icon_set(); win_load_icon_set();
} }
@@ -891,19 +891,19 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
case WM_RBUTTONDOWN: case WM_RBUTTONDOWN:
GetClientRect(hwnd, (LPRECT) &rc); GetClientRect(hwnd, &rc);
pt.x = GET_X_LPARAM(lParam); pt.x = GET_X_LPARAM(lParam);
pt.y = GET_Y_LPARAM(lParam); pt.y = GET_Y_LPARAM(lParam);
if (PtInRect((LPRECT) &rc, pt)) if (PtInRect(&rc, pt))
StatusBarPopupMenu(hwnd, pt, (pt.x / icon_width)); StatusBarPopupMenu(hwnd, pt, (pt.x / icon_width));
break; break;
case WM_LBUTTONDBLCLK: case WM_LBUTTONDBLCLK:
GetClientRect(hwnd, (LPRECT) &rc); GetClientRect(hwnd, &rc);
pt.x = GET_X_LPARAM(lParam); pt.x = GET_X_LPARAM(lParam);
pt.y = GET_Y_LPARAM(lParam); pt.y = GET_Y_LPARAM(lParam);
item_id = (pt.x / icon_width); item_id = (pt.x / icon_width);
if (PtInRect((LPRECT) &rc, pt) && (item_id < sb_parts)) { if (PtInRect(&rc, pt) && (item_id < sb_parts)) {
if (sb_part_meanings[item_id] == SB_SOUND) if (sb_part_meanings[item_id] == SB_SOUND)
SoundGainDialogCreate(hwndMain); SoundGainDialogCreate(hwndMain);
} }
@@ -1052,6 +1052,7 @@ ui_sb_bugui(char *str)
/* API */ /* API */
void void
ui_sb_mt32lcd(char *str) ui_sb_mt32lcd(UNUSED(char *str))
{ {
//
} }

View File

@@ -57,20 +57,20 @@
#define TIMER_1SEC 1 /* ID of the one-second timer */ #define TIMER_1SEC 1 /* ID of the one-second timer */
/* Platform Public data, specific. */ /* Platform Public data, specific. */
HWND hwndMain = NULL; /* application main window */ HWND hwndMain = NULL; /* application main window */
HWND hwndRender = NULL; /* machine render window */ HWND hwndRender = NULL; /* machine render window */
HWND hwndRender2 = NULL; /* machine second screen render window */ HWND hwndRender2 = NULL; /* machine second screen render window */
HMENU menuMain; /* application main menu */ HMENU menuMain; /* application main menu */
RECT oldclip; /* mouse rect */ RECT oldclip; /* mouse rect */
int sbar_height = 23; /* statusbar height */ int sbar_height = 23; /* statusbar height */
int tbar_height = 23; /* toolbar height */ int tbar_height = 23; /* toolbar height */
int minimized = 0; int minimized = 0;
int infocus = 1; int infocus = 1;
int button_down = 0; int button_down = 0;
int rctrl_is_lalt = 0; int rctrl_is_lalt = 0;
int user_resize = 0; int user_resize = 0;
int fixed_size_x = 0; int fixed_size_x = 0;
int fixed_size_y = 0; int fixed_size_y = 0;
int kbd_req_capture = 0; int kbd_req_capture = 0;
int hide_status_bar = 0; int hide_status_bar = 0;
int hide_tool_bar = 0; int hide_tool_bar = 0;
@@ -396,10 +396,14 @@ plat_power_off(void)
/* Cleanly terminate all of the emulator's components so as /* Cleanly terminate all of the emulator's components so as
to avoid things like threads getting stuck. */ to avoid things like threads getting stuck. */
// do_stop(); #if 0
do_stop();
#endif
cpu_thread_run = 0; cpu_thread_run = 0;
// exit(-1); #if 0
exit(-1);
#endif
} }
#ifdef MTR_ENABLED #ifdef MTR_ENABLED
@@ -422,7 +426,7 @@ static LRESULT CALLBACK
#else #else
static BOOL CALLBACK static BOOL CALLBACK
#endif #endif
input_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) input_proc(UNUSED(HWND hwnd), UINT message, UNUSED(WPARAM wParam), LPARAM lParam)
{ {
switch (message) { switch (message) {
case WM_INPUT: case WM_INPUT:
@@ -476,8 +480,8 @@ input_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
default: default:
return 1; return 1;
#if 0 #if 0
return(CallWindowProc((WNDPROC)input_orig_proc, return(CallWindowProc((WNDPROC)input_orig_proc,
hwnd, message, wParam, lParam)); hwnd, message, wParam, lParam));
#endif #endif
} }
@@ -499,7 +503,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
int temp_y; int temp_y;
if (input_proc(hwnd, message, wParam, lParam) == 0) if (input_proc(hwnd, message, wParam, lParam) == 0)
return (0); return 0;
switch (message) { switch (message) {
case WM_CREATE: case WM_CREATE:
@@ -876,7 +880,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
media_menu_proc(hwnd, message, wParam, lParam); media_menu_proc(hwnd, message, wParam, lParam);
break; break;
} }
return (0); return 0;
case WM_ENTERMENULOOP: case WM_ENTERMENULOOP:
break; break;
@@ -914,7 +918,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
if (IsIconic(hwndMain)) { if (IsIconic(hwndMain)) {
plat_vidapi_enable(0); plat_vidapi_enable(0);
minimized = 1; minimized = 1;
return (0); return 0;
} else if (minimized) { } else if (minimized) {
minimized = 0; minimized = 0;
video_force_resize_set(1); video_force_resize_set(1);
@@ -970,7 +974,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
plat_vidapi_enable(2); plat_vidapi_enable(2);
} }
return (0); return 0;
case WM_TIMER: case WM_TIMER:
if (wParam == TIMER_1SEC) if (wParam == TIMER_1SEC)
@@ -988,7 +992,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_KEYUP: case WM_KEYUP:
case WM_SYSKEYDOWN: case WM_SYSKEYDOWN:
case WM_SYSKEYUP: case WM_SYSKEYUP:
return (0); return 0;
case WM_CLOSE: case WM_CLOSE:
win_notify_dlg_open(); win_notify_dlg_open();
@@ -1137,7 +1141,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
break; break;
} }
return (0); return 0;
} }
static LRESULT CALLBACK static LRESULT CALLBACK
@@ -1182,7 +1186,7 @@ SDLSubWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
} }
static HRESULT CALLBACK static HRESULT CALLBACK
TaskDialogProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, LONG_PTR lpRefData) TaskDialogProcedure(HWND hwnd, UINT message, UNUSED(WPARAM wParam), LPARAM lParam, UNUSED(LONG_PTR lpRefData))
{ {
switch (message) { switch (message) {
case TDN_HYPERLINK_CLICKED: case TDN_HYPERLINK_CLICKED:
@@ -1242,7 +1246,7 @@ ui_init(int nCmdShow)
tdconfig.pszMainInstruction = MAKEINTRESOURCE(IDS_2121); tdconfig.pszMainInstruction = MAKEINTRESOURCE(IDS_2121);
tdconfig.pszContent = MAKEINTRESOURCE(IDS_2056); tdconfig.pszContent = MAKEINTRESOURCE(IDS_2056);
TaskDialogIndirect(&tdconfig, NULL, NULL, NULL); TaskDialogIndirect(&tdconfig, NULL, NULL, NULL);
return (6); return 6;
} }
/* Load the desired language */ /* Load the desired language */
@@ -1251,7 +1255,7 @@ ui_init(int nCmdShow)
set_language(helper_lang); set_language(helper_lang);
win_settings_open(NULL); win_settings_open(NULL);
return (0); return 0;
} }
#ifdef DISCORD #ifdef DISCORD
@@ -1286,19 +1290,19 @@ ui_init(int nCmdShow)
ExtractIconExW(path, 0, &wincl.hIcon, &wincl.hIconSm, 1); ExtractIconExW(path, 0, &wincl.hIcon, &wincl.hIconSm, 1);
if (!RegisterClassEx(&wincl)) if (!RegisterClassEx(&wincl))
return (2); return 2;
wincl.lpszClassName = SUB_CLASS_NAME; wincl.lpszClassName = SUB_CLASS_NAME;
wincl.lpfnWndProc = SubWindowProcedure; wincl.lpfnWndProc = SubWindowProcedure;
if (!RegisterClassEx(&wincl)) if (!RegisterClassEx(&wincl))
return (2); return 2;
wincl.lpszClassName = SDL_CLASS_NAME; wincl.lpszClassName = SDL_CLASS_NAME;
wincl.lpfnWndProc = SDLMainWindowProcedure; wincl.lpfnWndProc = SDLMainWindowProcedure;
if (!RegisterClassEx(&wincl)) if (!RegisterClassEx(&wincl))
return (2); return 2;
wincl.lpszClassName = SDL_SUB_CLASS_NAME; wincl.lpszClassName = SDL_SUB_CLASS_NAME;
wincl.lpfnWndProc = SDLSubWindowProcedure; wincl.lpfnWndProc = SDLSubWindowProcedure;
if (!RegisterClassEx(&wincl)) if (!RegisterClassEx(&wincl))
return (2); return 2;
/* Now create our main window. */ /* Now create our main window. */
swprintf_s(title, sizeof_w(title), L"%hs - %s %s", vm_name, EMU_NAME_W, EMU_VERSION_FULL_W); swprintf_s(title, sizeof_w(title), L"%hs - %s %s", vm_name, EMU_NAME_W, EMU_VERSION_FULL_W);
@@ -1378,7 +1382,7 @@ ui_init(int nCmdShow)
/* Warn the user about unsupported configs. */ /* Warn the user about unsupported configs. */
if (cpu_override && ui_msgbox_ex(MBX_WARNING | MBX_QUESTION_OK, (void *) IDS_2146, (void *) IDS_2147, (void *) IDS_2148, (void *) IDS_2120, NULL)) { if (cpu_override && ui_msgbox_ex(MBX_WARNING | MBX_QUESTION_OK, (void *) IDS_2146, (void *) IDS_2147, (void *) IDS_2148, (void *) IDS_2120, NULL)) {
DestroyWindow(hwnd); DestroyWindow(hwnd);
return (0); return 0;
} }
GetClipCursor(&oldclip); GetClipCursor(&oldclip);
@@ -1392,7 +1396,7 @@ ui_init(int nCmdShow)
if (!RegisterRawInputDevices(&ridev, 1, sizeof(ridev))) { if (!RegisterRawInputDevices(&ridev, 1, sizeof(ridev))) {
tdconfig.pszContent = MAKEINTRESOURCE(IDS_2106); tdconfig.pszContent = MAKEINTRESOURCE(IDS_2106);
TaskDialogIndirect(&tdconfig, NULL, NULL, NULL); TaskDialogIndirect(&tdconfig, NULL, NULL, NULL);
return (4); return 4;
} }
keyboard_getkeymap(); keyboard_getkeymap();
@@ -1401,7 +1405,7 @@ ui_init(int nCmdShow)
if (haccel == NULL) { if (haccel == NULL) {
tdconfig.pszContent = MAKEINTRESOURCE(IDS_2105); tdconfig.pszContent = MAKEINTRESOURCE(IDS_2105);
TaskDialogIndirect(&tdconfig, NULL, NULL, NULL); TaskDialogIndirect(&tdconfig, NULL, NULL, NULL);
return (3); return 3;
} }
/* Initialize the mouse module. */ /* Initialize the mouse module. */
@@ -1420,14 +1424,14 @@ ui_init(int nCmdShow)
tdconfig.pszMainInstruction = MAKEINTRESOURCE(IDS_2121); tdconfig.pszMainInstruction = MAKEINTRESOURCE(IDS_2121);
tdconfig.pszContent = MAKEINTRESOURCE(IDS_2056); tdconfig.pszContent = MAKEINTRESOURCE(IDS_2056);
TaskDialogIndirect(&tdconfig, NULL, NULL, NULL); TaskDialogIndirect(&tdconfig, NULL, NULL, NULL);
return (6); return 6;
} }
/* Initialize the configured Video API. */ /* Initialize the configured Video API. */
if (!plat_setvid(vid_api)) { if (!plat_setvid(vid_api)) {
tdconfig.pszContent = MAKEINTRESOURCE(IDS_2090); tdconfig.pszContent = MAKEINTRESOURCE(IDS_2090);
TaskDialogIndirect(&tdconfig, NULL, NULL, NULL); TaskDialogIndirect(&tdconfig, NULL, NULL, NULL);
return (5); return 5;
} }
/* Set up the current window size. */ /* Set up the current window size. */
@@ -1640,13 +1644,13 @@ plat_mouse_capture(int on)
} }
void void
ui_init_monitor(int monitor_index) ui_init_monitor(UNUSED(int monitor_index))
{ {
// Nothing done here yet // Nothing done here yet
} }
void void
ui_deinit_monitor(int monitor_index) ui_deinit_monitor(UNUSED(int monitor_index))
{ {
// Nothing done here yet // Nothing done here yet
} }