sonarlint work in the win32 ui

This commit is contained in:
Jasmine Iwanek
2023-06-01 04:17:40 -04:00
parent 95d3fbe83d
commit cc9b7d7a2b
18 changed files with 389 additions and 258 deletions

View File

@@ -47,18 +47,26 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND h;
int val_int, id, c, d;
int p, q;
int val_int;
int id;
int c;
int d;
int p;
int q;
#ifdef USE_RTMIDI
int num;
#endif
int changed, cid;
int changed;
int cid;
const device_config_t *config;
const device_config_selection_t *selection;
const device_config_bios_t *bios;
char s[512], file_filter[512];
char *str, *val_str;
wchar_t ws[512], *wstr;
char s[512];
char file_filter[512];
char *str;
char *val_str;
wchar_t ws[512];
wchar_t *wstr;
LPTSTR lptsTemp;
config = config_device.dev->config;

View File

@@ -56,12 +56,13 @@ ui_msgbox_ex(int flags, void *header, void *message, void *btn1, void *btn2, voi
{
WCHAR temp[512];
TASKDIALOGCONFIG tdconfig = { 0 };
TASKDIALOG_BUTTON tdbuttons[3],
tdb_yes = { IDYES, STRING_OR_RESOURCE(btn1) },
tdb_no = { IDNO, STRING_OR_RESOURCE(btn2) },
tdb_cancel = { IDCANCEL, STRING_OR_RESOURCE(btn3) },
tdb_exit = { IDCLOSE, MAKEINTRESOURCE(IDS_2120) };
int ret = 0, checked = 0;
TASKDIALOG_BUTTON tdbuttons[3];
TASKDIALOG_BUTTON tdb_yes = { IDYES, STRING_OR_RESOURCE(btn1) };
TASKDIALOG_BUTTON tdb_no = { IDNO, STRING_OR_RESOURCE(btn2) };
TASKDIALOG_BUTTON tdb_cancel = { IDCANCEL, STRING_OR_RESOURCE(btn3) };
TASKDIALOG_BUTTON tdb_exit = { IDCLOSE, MAKEINTRESOURCE(IDS_2120) };
int ret = 0;
int checked = 0;
/* Configure the default OK button. */
tdconfig.cButtons = 0;
@@ -150,7 +151,7 @@ ui_msgbox_ex(int flags, void *header, void *message, void *btn1, void *btn2, voi
if (checked)
ret += 10;
return (ret);
return ret;
}
int
@@ -201,16 +202,17 @@ file_dlg_w(HWND hwnd, WCHAR *f, WCHAR *fn, WCHAR *title, int save)
c16stombs(openfilestring, wopenfilestring, sizeof(openfilestring));
filterindex = ofn.nFilterIndex;
return (0);
return 0;
}
return (1);
return 1;
}
int
file_dlg(HWND hwnd, WCHAR *f, char *fn, char *title, int save)
{
WCHAR ufn[512], title_buf[512];
WCHAR ufn[512];
WCHAR title_buf[512];
if (fn)
mbstoc16s(ufn, fn, strlen(fn) + 1);
@@ -223,7 +225,9 @@ file_dlg(HWND hwnd, WCHAR *f, char *fn, char *title, int save)
int
file_dlg_mb(HWND hwnd, char *f, char *fn, char *title, int save)
{
WCHAR uf[512], ufn[512], title_buf[512];
WCHAR uf[512];
WCHAR ufn[512];
WCHAR title_buf[512];
mbstoc16s(uf, f, strlen(f) + 1);
mbstoc16s(ufn, fn, strlen(fn) + 1);

View File

@@ -35,9 +35,7 @@ char icon_set[256] = ""; /* name of the iconset to be used */
void
win_clear_icon_set(void)
{
int i;
for (i = 0; i < 256; i++)
for (uint16_t i = 0; i < 256; i++)
if (hIcon[i] != 0) {
DestroyIcon(hIcon[i]);
hIcon[i] = 0;
@@ -47,9 +45,10 @@ win_clear_icon_set(void)
void
win_system_icon_set(void)
{
int i, x = win_get_system_metrics(SM_CXSMICON, dpi), y = win_get_system_metrics(SM_CYSMICON, dpi);
int x = win_get_system_metrics(SM_CXSMICON, dpi);
int y = win_get_system_metrics(SM_CYSMICON, dpi);
for (i = 0; i < 256; i++)
for (uint16_t i = 0; i < 256; i++)
hIcon[i] = LoadImage(hinstance, MAKEINTRESOURCE(i), IMAGE_ICON, x, y, LR_DEFAULTCOLOR);
}
@@ -136,16 +135,18 @@ win_load_icon_set(void)
return;
}
char path_root[2048] = { 0 }, temp[2048] = { 0 };
wchar_t wtemp[2048] = { 0 };
char path_root[2048] = { 0 };
char temp[2048] = { 0 };
wchar_t wtemp[2048] = { 0 };
win_get_icons_path(path_root);
strcat(path_root, icon_set);
path_slash(path_root);
int i, count = sizeof(icon_files) / sizeof(_ICON_DATA),
x = win_get_system_metrics(SM_CXSMICON, dpi), y = win_get_system_metrics(SM_CYSMICON, dpi);
for (i = 0; i < count; i++) {
int count = sizeof(icon_files) / sizeof(_ICON_DATA);
int x = win_get_system_metrics(SM_CXSMICON, dpi);
int y = win_get_system_metrics(SM_CYSMICON, dpi);
for (int i = 0; i < count; i++) {
path_append_filename(temp, path_root, icon_files[i].filename);
mbstoc16s(wtemp, temp, strlen(temp) + 1);

View File

@@ -242,7 +242,8 @@ joystick_get_axis(int joystick_nr, int mapping)
void
joystick_process(void)
{
int c, d;
int c;
int d;
if (!joystick_type)
return;
@@ -288,8 +289,10 @@ joystick_process(void)
joystick_state[c].button[d] = plat_joystick_state[joystick_nr].b[joystick_state[c].button_mapping[d]];
for (d = 0; d < joystick_get_pov_count(joystick_type); d++) {
int x, y;
double angle, magnitude;
int x;
int y;
double angle;
double magnitude;
x = joystick_get_axis(joystick_nr, joystick_state[c].pov_mapping[d][0]);
y = joystick_get_axis(joystick_nr, joystick_state[c].pov_mapping[d][1]);
@@ -316,4 +319,5 @@ joystick_process(void)
void
win_joystick_handle(PRAWINPUT raw)
{
// Nothing to be done here, atleast currently
}

View File

@@ -79,15 +79,13 @@ XINPUT_STATE controllers[XINPUT_MAX_JOYSTICKS];
void
joystick_init()
{
int c;
atexit(joystick_close);
joysticks_present = 0;
memset(controllers, 0, sizeof(XINPUT_STATE) * XINPUT_MAX_JOYSTICKS);
for (c = 0; c < XINPUT_MAX_JOYSTICKS; c++) {
for (uint8_t c = 0; c < XINPUT_MAX_JOYSTICKS; c++) {
int value = XInputGetState(c, &controllers[c]);
if (value != ERROR_SUCCESS)
continue;
@@ -171,7 +169,8 @@ joystick_poll(void)
plat_joystick_state[c].b[10] = (controllers[c].Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_THUMB) ? 128 : 0;
plat_joystick_state[c].b[11] = (controllers[c].Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_THUMB) ? 128 : 0;
int dpad_x = 0, dpad_y = 0;
int dpad_x = 0;
int dpad_y = 0;
if (controllers[c].Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_UP)
dpad_y -= 32767;
if (controllers[c].Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_DOWN)
@@ -217,14 +216,14 @@ joystick_get_axis(int joystick_nr, int mapping)
void
joystick_process(void)
{
int c, d;
int d;
if (!joystick_type)
return;
joystick_poll();
for (c = 0; c < joystick_get_max_joysticks(joystick_type); c++) {
for (int c = 0; c < joystick_get_max_joysticks(joystick_type); c++) {
if (joystick_state[c].plat_joystick_nr) {
int joystick_nr = joystick_state[c].plat_joystick_nr - 1;
@@ -234,8 +233,10 @@ joystick_process(void)
joystick_state[c].button[d] = plat_joystick_state[joystick_nr].b[joystick_state[c].button_mapping[d]];
for (d = 0; d < joystick_get_pov_count(joystick_type); d++) {
int x, y;
double angle, magnitude;
int x;
int y;
double angle;
double magnitude;
x = joystick_get_axis(joystick_nr, joystick_state[c].pov_mapping[d][0]);
y = joystick_get_axis(joystick_nr, joystick_state[c].pov_mapping[d][1]);
@@ -262,4 +263,5 @@ joystick_process(void)
void
win_joystick_handle(PRAWINPUT raw)
{
// Nothing to be done here, atleast currently
}

View File

@@ -27,7 +27,8 @@ rebuild_axis_button_selections(HWND hdlg)
int id = IDC_CONFIG_BASE + 2;
HWND h;
int joystick;
int c, d;
int c;
int d;
char s[269];
h = GetDlgItem(hdlg, IDC_CONFIG_BASE);

View File

@@ -107,7 +107,9 @@ void
keyboard_handle(PRAWINPUT raw)
{
USHORT scancode;
static int recv_lalt = 0, recv_ralt = 0, recv_tab = 0;
static int recv_lalt = 0;
static int recv_ralt = 0;
static int recv_tab = 0;
RAWKEYBOARD rawKB = raw->data.keyboard;
scancode = rawKB.MakeCode;

View File

@@ -35,7 +35,8 @@
#define ZIP_FIRST CDROM_FIRST + CDROM_NUM
#define MO_FIRST ZIP_FIRST + ZIP_NUM
static HMENU media_menu, stbar_menu;
static HMENU media_menu;
static HMENU stbar_menu;
static HMENU menus[1 + 2 + FDD_NUM + CDROM_NUM + ZIP_NUM + MO_NUM];
static char index_map[255];
@@ -75,7 +76,8 @@ media_menu_load_resource(wchar_t *lpName)
static void
media_menu_set_name_cassette(void)
{
wchar_t name[512], fn[512];
wchar_t name[512];
wchar_t fn[512];
MENUITEMINFO mii = { 0 };
if (strlen(cassette_fname) == 0)
@@ -95,7 +97,8 @@ media_menu_set_name_cassette(void)
static void
media_menu_set_name_cartridge(int drive)
{
wchar_t name[512], fn[512];
wchar_t name[512];
wchar_t fn[512];
MENUITEMINFO mii = { 0 };
if (strlen(cart_fns[drive]) == 0) {
@@ -117,7 +120,9 @@ media_menu_set_name_cartridge(int drive)
static void
media_menu_set_name_floppy(int drive)
{
wchar_t name[512], temp[512], fn[512];
wchar_t name[512];
wchar_t temp[512];
wchar_t fn[512];
MENUITEMINFO mii = { 0 };
mbstoc16s(temp, fdd_getname(fdd_get_type(drive)),
@@ -141,7 +146,9 @@ media_menu_set_name_floppy(int drive)
static void
media_menu_set_name_cdrom(int drive)
{
wchar_t name[512], *temp, fn[512];
wchar_t name[512];
wchar_t *temp;
wchar_t fn[512];
MENUITEMINFO mii = { 0 };
int bus = cdrom[drive].bus_type;
@@ -171,7 +178,9 @@ media_menu_set_name_cdrom(int drive)
static void
media_menu_set_name_zip(int drive)
{
wchar_t name[512], *temp, fn[512];
wchar_t name[512];
wchar_t *temp;
wchar_t fn[512];
MENUITEMINFO mii = { 0 };
int bus = zip_drives[drive].bus_type;
@@ -200,7 +209,9 @@ media_menu_set_name_zip(int drive)
static void
media_menu_set_name_mo(int drive)
{
wchar_t name[512], *temp, fn[512];
wchar_t name[512];
wchar_t *temp;
wchar_t fn[512];
MENUITEMINFO mii = { 0 };
int bus = mo_drives[drive].bus_type;
@@ -529,7 +540,9 @@ media_menu_init(void)
int
media_menu_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int id = 0, ret = 0, wp = 0;
int id = 0;
int ret = 0;
int wp = 0;
id = LOWORD(wParam) & 0x00ff;

View File

@@ -28,8 +28,9 @@
#include <86box/win.h>
int mouse_capture;
double mouse_sensitivity = 1.0; /* Unused. */
double mouse_x_error = 0.0, mouse_y_error = 0.0; /* Unused. */
double mouse_sensitivity = 1.0; /* Unused. */
double mouse_x_error = 0.0; /* Unused. */
double mouse_y_error = 0.0; /* Unused. */
typedef struct {
int buttons;
@@ -63,7 +64,8 @@ void
win_mouse_handle(PRAWINPUT raw)
{
RAWMOUSE state = raw->data.mouse;
static int x, y;
static int x;
static int y;
/* read mouse buttons and wheel */
if (state.usButtonFlags & RI_MOUSE_LEFT_BUTTON_DOWN)

View File

@@ -49,7 +49,8 @@ create_86f(char *file_name, disk_size_t disk_size, uint8_t rpm_mode)
uint32_t index_hole_pos = 0;
uint32_t tarray[512];
uint32_t array_size;
uint32_t track_base, track_size;
uint32_t track_base;
uint32_t track_size;
int i;
uint32_t shift = 0;
@@ -262,7 +263,6 @@ create_zip_sector_image(char *file_name, disk_size_t disk_size, uint8_t is_zdi,
uint32_t zero_bytes = 0;
uint16_t base = 0x1000;
uint32_t pbar_max = 0;
uint32_t i;
MSG msg;
f = plat_fopen(file_name, "wb");
@@ -466,7 +466,7 @@ create_zip_sector_image(char *file_name, disk_size_t disk_size, uint8_t is_zdi,
Data = 0x38200 */
}
for (i = 0; i < pbar_max; i++) {
for (uint32_t i = 0; i < pbar_max; i++) {
fwrite(&empty[i << 11], 1, 2048, f);
SendMessage(h, PBM_SETPOS, (WPARAM) i + 2, (LPARAM) 0);
@@ -489,13 +489,16 @@ create_mo_sector_image(char *file_name, int8_t disk_size, uint8_t is_mdi, HWND h
HWND h;
FILE *f;
const mo_type_t *dp = &mo_types[disk_size];
uint8_t *empty, *empty2 = NULL;
uint32_t total_size = 0, total_size2;
uint8_t *empty;
uint8_t *empty2 = NULL;
uint32_t total_size = 0;
uint32_t total_size2;
uint32_t total_sectors = 0;
uint32_t sector_bytes = 0;
uint16_t base = 0x1000;
uint32_t pbar_max = 0, blocks_num;
uint32_t i, j;
uint32_t pbar_max = 0;
uint32_t blocks_num;
uint32_t j;
MSG msg;
f = plat_fopen(file_name, "wb");
@@ -574,7 +577,7 @@ create_mo_sector_image(char *file_name, int8_t disk_size, uint8_t is_mdi, HWND h
memset(empty, 0x00, total_size2);
}
for (i = 0; i < blocks_num; i++) {
for (uint32_t i = 0; i < blocks_num; i++) {
fwrite(empty, 1, 1048576, f);
SendMessage(h, PBM_SETPOS, (WPARAM) i + j, (LPARAM) 0);
@@ -605,7 +608,8 @@ create_mo_sector_image(char *file_name, int8_t disk_size, uint8_t is_mdi, HWND h
return 1;
}
static int fdd_id, sb_part;
static int fdd_id;
static int sb_part;
static int file_type = 0; /* 0 = IMG, 1 = Japanese FDI, 2 = 86F */
static char fd_file_name[1024];
@@ -624,7 +628,7 @@ new_floppy_msgbox_header(HWND hwnd, int flags, void *header, void *message)
hwndMain = h;
return (i);
return i;
}
static int
@@ -640,7 +644,7 @@ new_floppy_msgbox_ex(HWND hwnd, int flags, void *header, void *message, void *bt
hwndMain = h;
return (i);
return i;
}
#if defined(__amd64__) || defined(__aarch64__)
@@ -652,12 +656,16 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND h;
int i = 0;
int wcs_len, ext_offs;
int wcs_len;
int ext_offs;
wchar_t *ext;
uint8_t disk_size, rpm_mode;
uint8_t disk_size;
uint8_t rpm_mode;
int ret;
FILE *f;
int zip_types, mo_types, floppy_types;
int zip_types;
int mo_types;
int floppy_types;
wchar_t *twcs;
switch (message) {
@@ -770,19 +778,19 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
ext_offs = wcs_len - 4;
ext = &(wopenfilestring[ext_offs]);
if (is_zip) {
if (((wcs_len >= 4) && !wcsicmp(ext, L".ZDI")))
if ((wcs_len >= 4) && !wcsicmp(ext, L".ZDI"))
file_type = 1;
else
file_type = 0;
} else if (is_mo) {
if (((wcs_len >= 4) && !wcsicmp(ext, L".MDI")))
if ((wcs_len >= 4) && !wcsicmp(ext, L".MDI"))
file_type = 1;
else
file_type = 0;
} else {
if (((wcs_len >= 4) && !wcsicmp(ext, L".FDI")))
if ((wcs_len >= 4) && !wcsicmp(ext, L".FDI"))
file_type = 1;
else if ((((wcs_len >= 4) && !wcsicmp(ext, L".86F")) || (filterindex == 3)))
else if (((wcs_len >= 4) && !wcsicmp(ext, L".86F")) || (filterindex == 3))
file_type = 2;
else
file_type = 0;
@@ -815,7 +823,7 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
break;
}
return (FALSE);
return FALSE;
}
void

View File

@@ -494,8 +494,12 @@ opengl_main(void *param)
}
/* Keep track of certain parameters, only changed in this thread to avoid race conditions */
int fullscreen = resize_info.fullscreen, video_width = INIT_WIDTH, video_height = INIT_HEIGHT,
output_width = resize_info.width, output_height = resize_info.height, frametime = options.frametime;
int fullscreen = resize_info.fullscreen;
int video_width = INIT_WIDTH;
int video_height = INIT_HEIGHT;
int output_width = resize_info.width;
int output_height = resize_info.height;
int frametime = options.frametime;
SDL_SysWMinfo wmi = { 0 };
SDL_VERSION(&wmi.version);
@@ -703,7 +707,11 @@ opengl_main(void *param)
}
if (fullscreen) {
int width, height, pad_x = 0, pad_y = 0, px_size = 1;
int width;
int height;
int pad_x = 0;
int pad_y = 0;
int px_size = 1;
float ratio = 0;
const float ratio43 = 4.f / 3.f;
@@ -821,14 +829,12 @@ opengl_main(void *param)
static void
opengl_blit(int x, int y, int w, int h, int monitor_index)
{
int row;
if ((x < 0) || (y < 0) || (w <= 0) || (h <= 0) || (w > 2048) || (h > 2048) || (buffer32 == NULL) || (thread == NULL) || atomic_flag_test_and_set(&blit_info[write_pos].in_use) || monitor_index >= 1) {
video_blit_complete_monitor(monitor_index);
return;
}
for (row = 0; row < h; ++row)
for (int row = 0; row < h; ++row)
video_copy(&(((uint8_t *) blit_info[write_pos].buffer)[row * ROW_LENGTH * sizeof(uint32_t)]), &(buffer32->line[y + row][x]), w * sizeof(uint32_t));
if (monitors[0].mon_screenshots)

View File

@@ -38,7 +38,8 @@ static LCID temp_language;
static char temp_icon_set[256] = { 0 };
int enum_helper, c;
int enum_helper;
int c;
HWND hwndPreferences;
@@ -112,7 +113,8 @@ preferences_fill_iconsets(HWND hdlg)
if (hFind != INVALID_HANDLE_VALUE) {
do {
if (wcscmp(data.cFileName, L".") && wcscmp(data.cFileName, L"..") && (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
wchar_t temp[512] = { 0 }, dispname[512] = { 0 };
wchar_t temp[512] = { 0 };
wchar_t dispname[512] = { 0 };
mbstoc16s(temp, icon_path_root, strlen(icon_path_root) + 1);
wcscat(temp, data.cFileName);
wcscat(temp, L"\\iconinfo.txt");
@@ -279,7 +281,7 @@ PreferencesDlgProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
break;
}
return (FALSE);
return FALSE;
}
void

View File

@@ -81,10 +81,16 @@ static SDL_Window *sdl_win = NULL;
static SDL_Renderer *sdl_render = NULL;
static SDL_Texture *sdl_tex = NULL;
static HWND sdl_parent_hwnd = NULL;
static int sdl_w, sdl_h;
static int sdl_fs, sdl_flags = -1;
static int cur_w, cur_h;
static int cur_wx = 0, cur_wy = 0, cur_ww = 0, cur_wh = 0;
static int sdl_w;
static int sdl_h;
static int sdl_fs;
static int sdl_flags = -1;
static int cur_w;
static int cur_h;
static int cur_wx = 0;
static int cur_wy = 0;
static int cur_ww = 0;
static int cur_wh = 0;
static volatile int sdl_enabled = 0;
static SDL_mutex *sdl_mutex = NULL;
@@ -164,7 +170,16 @@ sdl_integer_scale(double *d, double *g)
static void
sdl_stretch(int *w, int *h, int *x, int *y)
{
double hw, gw, hh, gh, dx, dy, dw, dh, gsr, hsr;
double hw;
double gw;
double hh;
double gh;
double dx;
double dy;
double dw;
double dh;
double gsr;
double hsr;
hw = (double) sdl_w;
hh = (double) sdl_h;
@@ -265,8 +280,8 @@ sdl_blit_ex(int x, int y, int w, int h, int monitor_index)
{
SDL_Rect r_src;
void *pixeldata;
int pitch, ret;
int row;
int pitch;
int ret;
if (!sdl_enabled || (x < 0) || (y < 0) || (w <= 0) || (h <= 0) || (w > 2048) || (h > 2048) || (buffer32 == NULL) || (sdl_render == NULL) || (sdl_tex == NULL)) {
video_blit_complete();
@@ -277,7 +292,7 @@ sdl_blit_ex(int x, int y, int w, int h, int monitor_index)
SDL_LockTexture(sdl_tex, 0, &pixeldata, &pitch);
for (row = 0; row < h; ++row)
for (int row = 0; row < h; ++row)
video_copy(&(((uint8_t *) pixeldata)[row * 2048 * sizeof(uint32_t)]), &(buffer32->line[y + row][x]), w * sizeof(uint32_t));
if (monitors[0].mon_screenshots)
@@ -363,10 +378,9 @@ static int old_capture = 0;
static void
sdl_select_best_hw_driver(void)
{
int i;
SDL_RendererInfo renderInfo;
for (i = 0; i < SDL_GetNumRenderDrivers(); ++i) {
for (int i = 0; i < SDL_GetNumRenderDrivers(); ++i) {
SDL_GetRenderDriverInfo(i, &renderInfo);
if (renderInfo.flags & SDL_RENDERER_ACCELERATED) {
SDL_SetHint(SDL_HINT_RENDER_DRIVER, renderInfo.name);
@@ -401,7 +415,10 @@ sdl_reinit_texture(void)
void
sdl_set_fs(int fs)
{
int w = 0, h = 0, x = 0, y = 0;
int w = 0;
int h = 0;
int x = 0;
int y = 0;
RECT rect;
SDL_LockMutex(sdl_mutex);
@@ -468,7 +485,7 @@ sdl_init_common(int flags)
/* Initialize the SDL system. */
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
sdl_log("SDL: initialization failed (%s)\n", SDL_GetError());
return (0);
return 0;
}
if (flags & RENDERER_HARDWARE) {
@@ -507,7 +524,7 @@ sdl_init_common(int flags)
sdl_enabled = 1;
sdl_mutex = SDL_CreateMutex();
return (1);
return 1;
}
int
@@ -531,13 +548,16 @@ sdl_initho(HWND h)
int
sdl_pause(void)
{
return (0);
return 0;
}
void
sdl_resize(int x, int y)
{
int ww = 0, wh = 0, wx = 0, wy = 0;
int ww = 0;
int wh = 0;
int wx = 0;
int wy = 0;
if (video_fullscreen & 2)
return;

View File

@@ -85,7 +85,12 @@
static int first_cat = 0;
/* Machine category */
static int temp_machine_type, temp_machine, temp_cpu, temp_wait_states, temp_fpu, temp_sync;
static int temp_machine_type;
static int temp_machine;
static int temp_cpu;
static int temp_wait_states;
static int temp_fpu;
static int temp_sync;
static cpu_family_t *temp_cpu_f;
static uint32_t temp_mem_size;
#ifdef USE_DYNAREC
@@ -94,10 +99,14 @@ static int temp_dynarec;
static int temp_fpu_softfloat;
/* Video category */
static int temp_gfxcard[2], temp_ibm8514, temp_voodoo, temp_xga;
static int temp_gfxcard[2];
static int temp_ibm8514;
static int temp_voodoo;
static int temp_xga;
/* Input devices category */
static int temp_mouse, temp_joystick;
static int temp_mouse;
static int temp_joystick;
/* Sound category */
static int temp_sound_card[SOUND_CARD_MAX];
@@ -145,27 +154,48 @@ static cdrom_t temp_cdrom[CDROM_NUM];
static zip_drive_t temp_zip_drives[ZIP_NUM];
static mo_drive_t temp_mo_drives[MO_NUM];
static HWND hwndParentDialog, hwndChildDialog;
static HWND hwndParentDialog;
static HWND hwndChildDialog;
static uint32_t displayed_category = 0;
extern int is486;
static int listtomachinetype[256], listtomachine[256];
static int listtocpufamily[256], listtocpu[256];
static int settings_list_to_device[2][256], settings_list_to_fdc[20];
static int settings_list_to_midi[20], settings_list_to_midi_in[20];
static int listtomachinetype[256];
static int listtomachine[256];
static int listtocpufamily[256];
static int listtocpu[256];
static int settings_list_to_device[2][256];
static int settings_list_to_fdc[20];
static int settings_list_to_midi[20];
static int settings_list_to_midi_in[20];
static int settings_list_to_hdc[20];
static int max_spt = 63, max_hpc = 255, max_tracks = 266305;
static uint64_t mfm_tracking, esdi_tracking, xta_tracking, ide_tracking, scsi_tracking[8];
static int max_spt = 63;
static int max_hpc = 255;
static int max_tracks = 266305;
static uint64_t mfm_tracking;
static uint64_t esdi_tracking;
static uint64_t xta_tracking;
static uint64_t ide_tracking;
static uint64_t scsi_tracking[8];
static uint64_t size;
static int hd_listview_items, hdc_id_to_listview_index[HDD_NUM];
static int no_update = 0, existing = 0, chs_enabled = 0;
static int lv1_current_sel, lv2_current_sel;
static int hard_disk_added = 0, next_free_id = 0, selection = 127;
static int spt, hpc, tracks, ignore_change = 0;
static int hd_listview_items;
static int hdc_id_to_listview_index[HDD_NUM];
static int no_update = 0;
static int existing = 0;
static int chs_enabled = 0;
static int lv1_current_sel;
static int lv2_current_sel;
static int hard_disk_added = 0;
static int next_free_id = 0;
static int selection = 127;
static int spt;
static int hpc;
static int tracks;
static int ignore_change = 0;
static hard_disk_t new_hdd, *hdd_ptr;
static hard_disk_t new_hdd;
static hard_disk_t *hdd_ptr;
static wchar_t hd_file_name[512];
static WCHAR device_name[512];
@@ -297,7 +327,7 @@ settings_msgbox_header(int flags, void *header, void *message)
hwndMain = h;
return (i);
return i;
}
static int
@@ -313,7 +343,7 @@ settings_msgbox_ex(int flags, void *header, void *message, void *btn1, void *btn
hwndMain = h;
return (i);
return i;
}
/* This does the initial read of global variables into the temporary ones. */
@@ -660,7 +690,8 @@ win_settings_save(void)
static void
win_settings_machine_recalc_fpu(HWND hdlg)
{
int c, type;
int c;
int type;
LPTSTR lptsTemp;
const char *stransi;
@@ -723,7 +754,11 @@ win_settings_machine_recalc_cpu(HWND hdlg)
static void
win_settings_machine_recalc_cpu_m(HWND hdlg)
{
int c, i, first_eligible = -1, current_eligible = 0, last_eligible = 0;
int c;
int i;
int first_eligible = -1;
int current_eligible = 0;
int last_eligible = 0;
LPTSTR lptsTemp;
char *stransi;
@@ -766,7 +801,9 @@ static void
win_settings_machine_recalc_machine(HWND hdlg)
{
HWND h;
int c, i, current_eligible;
int c;
int i;
int current_eligible;
LPTSTR lptsTemp;
char *stransi;
UDACCEL accel;
@@ -873,8 +910,10 @@ static BOOL CALLBACK
#endif
win_settings_machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND h, h2;
int c, d;
HWND h;
HWND h2;
int c;
int d;
int old_machine_type;
LPTSTR lptsTemp;
char *stransi;
@@ -1085,7 +1124,8 @@ static BOOL CALLBACK
#endif
win_settings_video_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
int c = 0, d = 0;
int c = 0;
int d = 0;
int e;
switch (message) {
@@ -1294,7 +1334,7 @@ mouse_valid(int num, int m)
const device_t *dev;
if ((num == MOUSE_TYPE_INTERNAL) && !machine_has_flags(m, MACHINE_MOUSE))
return (0);
return 0;
dev = mouse_get_device(num);
return (device_is_valid(dev, m));
@@ -1309,7 +1349,8 @@ win_settings_input_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
wchar_t str[128];
char *joy_name;
int c, d;
int c;
int d;
switch (message) {
case WM_INITDIALOG:
@@ -1398,7 +1439,8 @@ mpu401_present(void)
int
mpu401_standalone_allow(void)
{
char *md, *mdin;
char *md;
char *mdin;
if (!machine_has_bus(temp_machine, MACHINE_BUS_ISA) && !machine_has_bus(temp_machine, MACHINE_BUS_MCA))
return 0;
@@ -1421,7 +1463,8 @@ static BOOL CALLBACK
#endif
win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
uint16_t c, d;
uint16_t c;
uint16_t d;
LPTSTR lptsTemp;
const device_t *sound_dev[SOUND_CARD_MAX];
@@ -1756,7 +1799,8 @@ static BOOL CALLBACK
#endif
win_settings_ports_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
int c, i;
int c;
int i;
char *s;
LPTSTR lptsTemp;
@@ -1833,11 +1877,14 @@ static BOOL CALLBACK
#endif
win_settings_storage_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
int c, d;
int e, is_at;
int c;
int d;
int e;
int is_at;
LPTSTR lptsTemp;
char *stransi;
const device_t *scsi_dev, *fdc_dev;
const device_t *scsi_dev;
const device_t *fdc_dev;
const device_t *hdc_dev;
switch (message) {
@@ -2054,7 +2101,8 @@ static BOOL CALLBACK
#endif
win_settings_network_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
int c, d;
int c;
int d;
LPTSTR lptsTemp;
switch (message) {
@@ -2245,12 +2293,11 @@ static void
normalize_hd_list(void)
{
hard_disk_t ihdd[HDD_NUM];
int i, j;
int j = 0;
j = 0;
memset(ihdd, 0x00, HDD_NUM * sizeof(hard_disk_t));
for (i = 0; i < HDD_NUM; i++) {
for (uint8_t i = 0; i < HDD_NUM; i++) {
if (temp_hdd[i].bus != HDD_BUS_DISABLED) {
memcpy(&(ihdd[j]), &(temp_hdd[i]), sizeof(hard_disk_t));
j++;
@@ -2264,13 +2311,13 @@ static int
get_selected_hard_disk(HWND hdlg)
{
int hard_disk = -1;
int i, j = 0;
int j = 0;
HWND h;
if (hd_listview_items == 0)
return 0;
for (i = 0; i < hd_listview_items; i++) {
for (int i = 0; i < hd_listview_items; i++) {
h = GetDlgItem(hdlg, IDC_LIST_HARD_DISKS);
j = ListView_GetItemState(h, i, LVIS_SELECTED);
if (j)
@@ -2312,9 +2359,7 @@ add_locations(HWND hdlg)
static uint8_t
next_free_binary_channel(uint64_t *tracking)
{
int64_t i;
for (i = 0; i < 2; i++) {
for (int64_t i = 0; i < 2; i++) {
if (!(*tracking & (0xffLL << (i << 3LL))))
return i;
}
@@ -2325,9 +2370,7 @@ next_free_binary_channel(uint64_t *tracking)
static uint8_t
next_free_ide_channel(void)
{
int64_t i;
for (i = 0; i < (IDE_BUS_MAX * IDE_CHAN_MAX); i++) {
for (int64_t i = 0; i < (IDE_BUS_MAX * IDE_CHAN_MAX); i++) {
if (!(ide_tracking & (0xffLL << (i << 3LL))))
return i;
}
@@ -2338,9 +2381,7 @@ next_free_ide_channel(void)
static void
next_free_scsi_id(uint8_t *id)
{
int64_t i;
for (i = 0; i < (SCSI_BUS_MAX * SCSI_ID_MAX); i++) {
for (int64_t i = 0; i < (SCSI_BUS_MAX * SCSI_ID_MAX); i++) {
if (!(scsi_tracking[i >> 3] & (0xffLL << ((i & 0x07) << 3LL)))) {
*id = i;
return;
@@ -2353,9 +2394,9 @@ next_free_scsi_id(uint8_t *id)
static void
recalc_location_controls(HWND hdlg, int is_add_dlg, int assign_id)
{
int i = 0, bus = 0;
int bus = 0;
for (i = IDT_CHANNEL; i <= IDT_ID; i++)
for (uint16_t i = IDT_CHANNEL; i <= IDT_ID; i++)
settings_show_window(hdlg, i, FALSE);
settings_show_window(hdlg, IDC_COMBO_HD_CHANNEL, FALSE);
settings_show_window(hdlg, IDC_COMBO_HD_ID, FALSE);
@@ -2442,10 +2483,14 @@ bus_full(uint64_t *tracking, int count)
static void
recalc_next_free_id(HWND hdlg)
{
int i, enable_add = 0;
int c_mfm = 0, c_esdi = 0;
int c_xta = 0, c_ide = 0;
int c_atapi = 0, c_scsi = 0;
int i;
int enable_add = 0;
int c_mfm = 0;
int c_esdi = 0;
int c_xta = 0;
int c_ide = 0;
int c_atapi = 0;
int c_scsi = 0;
next_free_id = -1;
@@ -2557,7 +2602,8 @@ win_settings_hard_disks_recalc_list(HWND hdlg)
{
LVITEM lvI;
int j = 0;
WCHAR szText[256], usr_path_w[1024];
WCHAR szText[256];
WCHAR usr_path_w[1024];
HWND hwndList = GetDlgItem(hdlg, IDC_LIST_HARD_DISKS);
mbstoc16s(usr_path_w, usr_path, sizeof_w(usr_path_w));
@@ -2676,21 +2722,21 @@ static void
win_settings_hard_disks_resize_columns(HWND hdlg)
{
/* Bus, File, Cylinders, Heads, Sectors, Size */
int iCol, width[C_COLUMNS_HARD_DISKS] = {
C_COLUMNS_HARD_DISKS_BUS,
C_COLUMNS_HARD_DISKS_FILE,
C_COLUMNS_HARD_DISKS_CYLS,
C_COLUMNS_HARD_DISKS_HEADS,
C_COLUMNS_HARD_DISKS_SECT,
C_COLUMNS_HARD_DISKS_SIZE,
C_COLUMNS_HARD_DISKS_SPEED
};
int width[C_COLUMNS_HARD_DISKS] = {
C_COLUMNS_HARD_DISKS_BUS,
C_COLUMNS_HARD_DISKS_FILE,
C_COLUMNS_HARD_DISKS_CYLS,
C_COLUMNS_HARD_DISKS_HEADS,
C_COLUMNS_HARD_DISKS_SECT,
C_COLUMNS_HARD_DISKS_SIZE,
C_COLUMNS_HARD_DISKS_SPEED
};
int total = 0;
HWND hwndList = GetDlgItem(hdlg, IDC_LIST_HARD_DISKS);
RECT r;
GetWindowRect(hwndList, &r);
for (iCol = 0; iCol < (C_COLUMNS_HARD_DISKS - 1); iCol++) {
for (int iCol = 0; iCol < (C_COLUMNS_HARD_DISKS - 1); iCol++) {
width[iCol] = MulDiv(width[iCol], dpi, 96);
total += width[iCol];
ListView_SetColumnWidth(hwndList, iCol, MulDiv(width[iCol], dpi, 96));
@@ -2703,12 +2749,11 @@ static BOOL
win_settings_hard_disks_init_columns(HWND hdlg)
{
LVCOLUMN lvc;
int iCol;
HWND hwndList = GetDlgItem(hdlg, IDC_LIST_HARD_DISKS);
lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
for (iCol = 0; iCol < C_COLUMNS_HARD_DISKS; iCol++) {
for (int iCol = 0; iCol < C_COLUMNS_HARD_DISKS; iCol++) {
lvc.iSubItem = iCol;
lvc.pszText = plat_get_string(IDS_BUS + iCol);
@@ -2792,14 +2837,13 @@ get_edit_box_text_contents(HWND hdlg, int id, WCHAR *text_buffer, int buffer_siz
static int
hdconf_initialize_hdt_combo(HWND hdlg)
{
int i = 0;
uint64_t temp_size = 0;
uint32_t size_mb = 0;
WCHAR szText[256];
selection = 127;
for (i = 0; i < 127; i++) {
for (uint8_t i = 0; i < 127; i++) {
temp_size = ((uint64_t) hdd_table[i][0]) * hdd_table[i][1] * hdd_table[i][2];
size_mb = (uint32_t) (temp_size >> 11LL);
wsprintf(szText, plat_get_string(IDS_2108), size_mb, hdd_table[i][0], hdd_table[i][1], hdd_table[i][2]);
@@ -2816,10 +2860,8 @@ hdconf_initialize_hdt_combo(HWND hdlg)
static void
recalc_selection(HWND hdlg)
{
int i = 0;
selection = 127;
for (i = 0; i < 127; i++) {
for (uint8_t i = 0; i < 127; i++) {
if ((tracks == (int) hdd_table[i][0]) && (hpc == (int) hdd_table[i][1]) && (spt == (int) hdd_table[i][2]))
selection = i;
}
@@ -2988,9 +3030,12 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
{
HWND h;
FILE *f;
uint32_t temp, i = 0, sector_size = 512;
uint32_t zero = 0, base = 0x1000;
uint64_t signature = 0xD778A82044445459ll;
uint32_t temp;
uint32_t i = 0;
uint32_t sector_size = 512;
uint32_t zero = 0;
uint32_t base = 0x1000;
uint64_t signature = 0xD778A82044445459LL;
uint64_t r = 0;
char *big_buf;
char hd_file_name_multibyte[1200];
@@ -2999,7 +3044,8 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
uint8_t channel = 0;
uint8_t id = 0;
wchar_t *twcs;
int img_format, block_size;
int img_format;
int block_size;
WCHAR text_buf[256];
RECT rect;
POINT point;
@@ -3142,7 +3188,7 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
sector_size = 512;
if (!(existing & 1) && (wcslen(hd_file_name) > 0)) {
if (size > 0x1FFFFFFE00ll) {
if (size > 0x1FFFFFFE00LL) {
settings_msgbox_header(MBX_ERROR, (wchar_t *) IDS_4116, (wchar_t *) IDS_4105);
return TRUE;
}
@@ -3155,7 +3201,7 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
}
if (img_format == IMG_FMT_HDI) { /* HDI file */
if (size >= 0x100000000ll) {
if (size >= 0x100000000LL) {
fclose(f);
settings_msgbox_header(MBX_ERROR, (wchar_t *) IDS_4116, (wchar_t *) IDS_4104);
return TRUE;
@@ -3760,9 +3806,7 @@ hard_disk_untrack(uint8_t id)
static void
hard_disk_track_all(void)
{
int i;
for (i = 0; i < HDD_NUM; i++)
for (uint8_t i = 0; i < HDD_NUM; i++)
hard_disk_track(i);
}
@@ -3773,7 +3817,9 @@ static BOOL CALLBACK
#endif
win_settings_hard_disks_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
int old_sel = 0, b = 0, assign = 0;
int old_sel = 0;
int b = 0;
int assign = 0;
const uint8_t hd_icons[2] = { 80, 0 };
switch (message) {
@@ -3920,15 +3966,15 @@ static BOOL
win_settings_floppy_drives_recalc_list(HWND hdlg)
{
LVITEM lvI;
int i = 0;
char s[256], *t;
char s[256];
char *t;
WCHAR szText[256];
HWND hwndList = GetDlgItem(hdlg, IDC_LIST_FLOPPY_DRIVES);
lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE;
lvI.stateMask = lvI.state = 0;
for (i = 0; i < FDD_NUM; i++) {
for (uint8_t i = 0; i < FDD_NUM; i++) {
lvI.iSubItem = 0;
if (temp_fdd_types[i] > 0) {
t = fdd_getname(temp_fdd_types[i]);
@@ -3967,14 +4013,14 @@ static BOOL
win_settings_cdrom_drives_recalc_list(HWND hdlg)
{
LVITEM lvI;
int i = 0, fsid = 0;
int fsid = 0;
WCHAR szText[256];
HWND hwndList = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES);
lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE;
lvI.stateMask = lvI.iSubItem = lvI.state = 0;
for (i = 0; i < CDROM_NUM; i++) {
for (uint8_t i = 0; i < CDROM_NUM; i++) {
fsid = combo_id_to_format_string_id(temp_cdrom[i].bus_type);
lvI.iSubItem = 0;
@@ -4032,7 +4078,7 @@ static BOOL
win_settings_mo_drives_recalc_list(HWND hdlg)
{
LVITEM lvI;
int i = 0, fsid = 0;
int fsid = 0;
WCHAR szText[256];
char szType[30];
HWND hwndList = GetDlgItem(hdlg, IDC_LIST_MO_DRIVES);
@@ -4040,7 +4086,7 @@ win_settings_mo_drives_recalc_list(HWND hdlg)
lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE;
lvI.stateMask = lvI.iSubItem = lvI.state = 0;
for (i = 0; i < MO_NUM; i++) {
for (uint8_t i = 0; i < MO_NUM; i++) {
fsid = combo_id_to_format_string_id(temp_mo_drives[i].bus_type);
lvI.iSubItem = 0;
@@ -4095,14 +4141,14 @@ static BOOL
win_settings_zip_drives_recalc_list(HWND hdlg)
{
LVITEM lvI;
int i = 0, fsid = 0;
int fsid = 0;
WCHAR szText[256];
HWND hwndList = GetDlgItem(hdlg, IDC_LIST_ZIP_DRIVES);
lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE;
lvI.stateMask = lvI.iSubItem = lvI.state = 0;
for (i = 0; i < ZIP_NUM; i++) {
for (uint8_t i = 0; i < ZIP_NUM; i++) {
fsid = combo_id_to_format_string_id(temp_zip_drives[i].bus_type);
lvI.iSubItem = 0;
@@ -4148,17 +4194,17 @@ win_settings_zip_drives_recalc_list(HWND hdlg)
static void
win_settings_floppy_drives_resize_columns(HWND hdlg)
{
int iCol, width[C_COLUMNS_FLOPPY_DRIVES] = {
C_COLUMNS_FLOPPY_DRIVES_TYPE,
C_COLUMNS_FLOPPY_DRIVES_TURBO,
C_COLUMNS_FLOPPY_DRIVES_BPB
};
int width[C_COLUMNS_FLOPPY_DRIVES] = {
C_COLUMNS_FLOPPY_DRIVES_TYPE,
C_COLUMNS_FLOPPY_DRIVES_TURBO,
C_COLUMNS_FLOPPY_DRIVES_BPB
};
int total = 0;
HWND hwndList = GetDlgItem(hdlg, IDC_LIST_FLOPPY_DRIVES);
RECT r;
GetWindowRect(hwndList, &r);
for (iCol = 0; iCol < C_COLUMNS_FLOPPY_DRIVES; iCol++) {
for (uint8_t iCol = 0; iCol < C_COLUMNS_FLOPPY_DRIVES; iCol++) {
width[iCol] = MulDiv(width[iCol], dpi, 96);
total += width[iCol];
ListView_SetColumnWidth(hwndList, iCol, MulDiv(width[iCol], dpi, 96));
@@ -4216,17 +4262,17 @@ win_settings_floppy_drives_init_columns(HWND hdlg)
static void
win_settings_cdrom_drives_resize_columns(HWND hdlg)
{
int iCol, width[C_COLUMNS_CDROM_DRIVES] = {
C_COLUMNS_CDROM_DRIVES_BUS,
C_COLUMNS_CDROM_DRIVES_SPEED,
C_COLUMNS_CDROM_DRIVES_EARLIER
};
int width[C_COLUMNS_CDROM_DRIVES] = {
C_COLUMNS_CDROM_DRIVES_BUS,
C_COLUMNS_CDROM_DRIVES_SPEED,
C_COLUMNS_CDROM_DRIVES_EARLIER
};
int total = 0;
HWND hwndList = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES);
RECT r;
GetWindowRect(hwndList, &r);
for (iCol = 0; iCol < C_COLUMNS_CDROM_DRIVES; iCol++) {
for (uint8_t iCol = 0; iCol < C_COLUMNS_CDROM_DRIVES; iCol++) {
width[iCol] = MulDiv(width[iCol], dpi, 96);
total += width[iCol];
ListView_SetColumnWidth(hwndList, iCol, MulDiv(width[iCol], dpi, 96));
@@ -4385,10 +4431,10 @@ static int
get_selected_drive(HWND hdlg, int id, int max)
{
int drive = -1;
int i, j = 0;
int j = 0;
HWND h;
for (i = 0; i < max; i++) {
for (int i = 0; i < max; i++) {
h = GetDlgItem(hdlg, id);
j = ListView_GetItemState(h, i, LVIS_SELECTED);
if (j)
@@ -4402,7 +4448,8 @@ static void
win_settings_floppy_drives_update_item(HWND hdlg, int i)
{
LVITEM lvI;
char s[256], *t;
char s[256];
char *t;
WCHAR szText[256];
HWND hwndList = GetDlgItem(hdlg, IDC_LIST_FLOPPY_DRIVES);
@@ -4642,10 +4689,9 @@ cdrom_add_locations(HWND hdlg)
static void
cdrom_recalc_location_controls(HWND hdlg, int assign_id)
{
int i = 0;
int bus = temp_cdrom[lv2_current_sel].bus_type;
for (i = IDT_CD_ID; i <= IDT_CD_CHANNEL; i++)
for (uint16_t i = IDT_CD_ID; i <= IDT_CD_CHANNEL; i++)
settings_show_window(hdlg, i, FALSE);
settings_show_window(hdlg, IDC_COMBO_CD_ID, FALSE);
settings_show_window(hdlg, IDC_COMBO_CD_CHANNEL_IDE, FALSE);
@@ -4725,10 +4771,9 @@ mo_add_locations(HWND hdlg)
static void
mo_recalc_location_controls(HWND hdlg, int assign_id)
{
int i = 0;
int bus = temp_mo_drives[lv1_current_sel].bus_type;
for (i = IDT_MO_ID; i <= (IDT_MO_CHANNEL); i++)
for (int i = IDT_MO_ID; i <= IDT_MO_CHANNEL; i++)
settings_show_window(hdlg, i, FALSE);
settings_show_window(hdlg, IDC_COMBO_MO_ID, FALSE);
settings_show_window(hdlg, IDC_COMBO_MO_CHANNEL_IDE, FALSE);
@@ -4789,11 +4834,9 @@ zip_add_locations(HWND hdlg)
static void
zip_recalc_location_controls(HWND hdlg, int assign_id)
{
int i = 0;
int bus = temp_zip_drives[lv2_current_sel].bus_type;
for (i = IDT_ZIP_ID; i <= (IDT_ZIP_LUN); i++)
for (int i = IDT_ZIP_ID; i <= IDT_ZIP_LUN; i++)
settings_show_window(hdlg, i, FALSE);
settings_show_window(hdlg, IDC_COMBO_ZIP_ID, FALSE);
settings_show_window(hdlg, IDC_COMBO_ZIP_CHANNEL_IDE, FALSE);
@@ -4885,7 +4928,9 @@ static BOOL CALLBACK
#endif
win_settings_floppy_and_cdrom_drives_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
int i = 0, old_sel = 0, b = 0, assign = 0;
int old_sel = 0;
int b = 0;
int assign = 0;
uint32_t b2 = 0;
WCHAR szText[256];
const uint8_t fd_icons[15] = { 248, 16, 16, 16, 16, 16, 16, 24, 24, 24, 24, 24, 24, 24, 0 };
@@ -4900,7 +4945,7 @@ win_settings_floppy_and_cdrom_drives_proc(HWND hdlg, UINT message, WPARAM wParam
image_list_init(hdlg, IDC_LIST_FLOPPY_DRIVES, (const uint8_t *) fd_icons);
win_settings_floppy_drives_recalc_list(hdlg);
settings_listview_select(hdlg, IDC_LIST_FLOPPY_DRIVES, 0);
for (i = 0; i < 14; i++) {
for (uint8_t i = 0; i < 14; i++) {
if (i == 0)
settings_add_string(hdlg, IDC_COMBO_FD_TYPE, win_get_string(IDS_5376));
else {
@@ -5076,7 +5121,9 @@ static BOOL CALLBACK
#endif
win_settings_other_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
int old_sel = 0, b = 0, assign = 0;
int old_sel = 0;
int b = 0;
int assign = 0;
uint32_t b2 = 0;
const uint8_t mo_icons[3] = { 251, 56, 0 };
const uint8_t zip_icons[3] = { 250, 48, 0 };
@@ -5303,7 +5350,8 @@ static BOOL CALLBACK
#endif
win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
int c, d;
int c;
int d;
int e;
LPTSTR lptsTemp;
char *stransi;
@@ -5477,12 +5525,11 @@ static BOOL
win_settings_main_insert_categories(HWND hwndList)
{
LVITEM lvI;
int i = 0;
lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE;
lvI.stateMask = lvI.iSubItem = lvI.state = 0;
for (i = 0; i < 11; i++) {
for (uint8_t i = 0; i < 11; i++) {
lvI.pszText = plat_get_string(IDS_2065 + i);
lvI.iItem = i;
lvI.iImage = i;
@@ -5568,7 +5615,8 @@ static BOOL CALLBACK
win_settings_main_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND h = NULL;
int category, i = 0, j = 0;
int category;
int j = 0;
const uint8_t cat_icons[12] = { 240, 241, 242, 243, 96, 244, 252, 80, 246, 247, 245, 0 };
hwndParentDialog = hdlg;
@@ -5588,7 +5636,7 @@ win_settings_main_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
case WM_NOTIFY:
if ((((LPNMHDR) lParam)->code == LVN_ITEMCHANGED) && (((LPNMHDR) lParam)->idFrom == IDC_SETTINGSCATLIST)) {
category = -1;
for (i = 0; i < 11; i++) {
for (uint8_t i = 0; i < 11; i++) {
h = GetDlgItem(hdlg, IDC_SETTINGSCATLIST);
j = ListView_GetItemState(h, i, LVIS_SELECTED);
if (j)

View File

@@ -39,12 +39,16 @@ static BOOL CALLBACK
#endif
SpecifyDimensionsDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND h, h2;
HWND h;
HWND h2;
HMENU hmenu;
UDACCEL accel, accel2;
UDACCEL accel;
UDACCEL accel2;
RECT r;
uint32_t temp_x = 0, temp_y = 0;
int dpi = 96, lock;
uint32_t temp_x = 0;
uint32_t temp_y = 0;
int dpi = 96;
int lock;
LPTSTR lptsTemp;
char *stransi;

View File

@@ -56,7 +56,8 @@
#include <86box/win.h>
HWND hwndSBAR;
int update_icons = 1, reset_occurred = 1;
int update_icons = 1;
int reset_occurred = 1;
static LONG_PTR OriginalProcedure;
static WCHAR **sbTips;
@@ -103,7 +104,7 @@ fdd_type_to_icon(int type)
break;
}
return (ret);
return ret;
}
/* FIXME: should be hdd_count() in hdd.c */
@@ -111,14 +112,13 @@ static int
hdd_count(int bus)
{
int c = 0;
int i;
for (i = 0; i < HDD_NUM; i++) {
for (uint8_t i = 0; i < HDD_NUM; i++) {
if (hdd[i].bus == bus)
c++;
}
return (c);
return c;
}
void
@@ -147,7 +147,7 @@ ui_sb_update_icon(int tag, int active)
if (!update_icons || !sb_ready)
return;
if (((tag & 0xf0) >= SB_TEXT))
if ((tag & 0xf0) >= SB_TEXT)
return;
found = sb_map[tag];
@@ -453,15 +453,13 @@ ui_sb_update_tip(int meaning)
static void
StatusBarDestroyTips(void)
{
int i;
if (sb_parts == 0)
return;
if (!sbTips)
return;
for (i = 0; i < sb_parts; i++) {
for (int i = 0; i < sb_parts; i++) {
if (sbTips[i]) {
free(sbTips[i]);
sbTips[i] = NULL;
@@ -879,7 +877,7 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
switch (message) {
case WM_COMMAND:
media_menu_proc(hwnd, message, wParam, lParam);
return (0);
return 0;
case WM_LBUTTONDOWN:
case WM_RBUTTONDOWN:
@@ -924,7 +922,7 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
hwnd, message, wParam, lParam));
}
return (0);
return 0;
}
/* API: Create and set up the Status Bar window. */

View File

@@ -46,7 +46,7 @@ int
thread_test_mutex(thread_t *arg)
{
if (arg == NULL)
return (0);
return 0;
return (WaitForSingleObject(arg, 0) == WAIT_OBJECT_0) ? 1 : 0;
}
@@ -55,12 +55,12 @@ int
thread_wait(thread_t *arg)
{
if (arg == NULL)
return (0);
return 0;
if (WaitForSingleObject(arg, INFINITE))
return (1);
return 1;
return (0);
return 0;
}
event_t *
@@ -101,18 +101,18 @@ thread_wait_event(event_t *arg, int timeout)
win_event_t *ev = (win_event_t *) arg;
if (arg == NULL)
return (0);
return 0;
if (ev->handle == NULL)
return (0);
return 0;
if (timeout == -1)
timeout = INFINITE;
if (WaitForSingleObject(ev->handle, timeout))
return (1);
return 1;
return (0);
return 0;
}
void
@@ -142,7 +142,7 @@ int
thread_wait_mutex(mutex_t *mutex)
{
if (mutex == NULL)
return (0);
return 0;
LPCRITICAL_SECTION critsec = (LPCRITICAL_SECTION) mutex;
@@ -155,7 +155,7 @@ int
thread_release_mutex(mutex_t *mutex)
{
if (mutex == NULL)
return (0);
return 0;
LPCRITICAL_SECTION critsec = (LPCRITICAL_SECTION) mutex;

View File

@@ -55,18 +55,20 @@
#define TIMER_1SEC 1 /* ID of the one-second timer */
/* Platform Public data, specific. */
HWND hwndMain = NULL, /* application main window */
hwndRender = NULL, /* machine render window */
hwndRender2 = NULL; /* machine second screen render window */
HWND hwndMain = NULL; /* application main window */
HWND hwndRender = NULL; /* machine render window */
HWND hwndRender2 = NULL; /* machine second screen render window */
HMENU menuMain; /* application main menu */
RECT oldclip; /* mouse rect */
int sbar_height = 23; /* statusbar height */
int tbar_height = 23; /* toolbar height */
int minimized = 0;
int infocus = 1, button_down = 0;
int infocus = 1;
int button_down = 0;
int rctrl_is_lalt = 0;
int user_resize = 0;
int fixed_size_x = 0, fixed_size_y = 0;
int fixed_size_x = 0;
int fixed_size_y = 0;
int kbd_req_capture = 0;
int hide_status_bar = 0;
int hide_tool_bar = 0;
@@ -77,9 +79,10 @@ extern WCHAR wopenfilestring[512];
/* Local data. */
static int manager_wm = 0;
static int save_window_pos = 0, pause_state = 0;
static int padded_frame = 0;
static int vis = -1;
static int save_window_pos = 0;
static int pause_state = 0;
static int padded_frame = 0;
static int vis = -1;
/* Per Monitor DPI Aware v2 APIs, Windows 10 v1703+ */
void *user32_handle = NULL;
@@ -463,12 +466,14 @@ input_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
break;
default:
return (1);
/* return(CallWindowProc((WNDPROC)input_orig_proc,
hwnd, message, wParam, lParam)); */
return 1;
#if 0
return(CallWindowProc((WNDPROC)input_orig_proc,
hwnd, message, wParam, lParam));
#endif
}
return (0);
return 0;
}
static LRESULT CALLBACK
@@ -476,12 +481,14 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HMENU hmenu;
int i;
RECT rect, *rect_p;
int i;
RECT rect;
RECT *rect_p;
WINDOWPOS *pos;
int temp_x, temp_y;
int temp_x;
int temp_y;
if (input_proc(hwnd, message, wParam, lParam) == 0)
return (0);
@@ -1136,14 +1143,14 @@ SubWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
return (DefWindowProc(hwnd, message, wParam, lParam));
}
return (0);
return 0;
}
static LRESULT CALLBACK
SDLMainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
if (input_proc(hwnd, message, wParam, lParam) == 0)
return (0);
return 0;
return (DefWindowProc(hwnd, message, wParam, lParam));
}
@@ -1183,7 +1190,8 @@ ui_init(int nCmdShow)
{IDCANCEL, MAKEINTRESOURCE(IDS_2120)}
};
uint32_t helper_lang;
static int fs_on_signal = 0, fs_off_signal = 0;
static int fs_on_signal = 0;
static int fs_off_signal = 0;
/* Load DPI related Windows 10 APIs */
user32_handle = dynld_module("user32.dll", user32_imports);
@@ -1550,7 +1558,7 @@ plat_pause(int p)
/* Update the actual menu. */
CheckMenuItem(menuMain, IDM_ACTION_PAUSE,
(dopause) ? MF_CHECKED : MF_UNCHECKED);
dopause ? MF_CHECKED : MF_UNCHECKED);
#ifdef DISCORD
/* Update Discord status */