From 929d34d4b42b4c90381d2e12d108e7ad688a0688 Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 15 Aug 2016 03:26:37 +0200 Subject: [PATCH] Removed all references to PCem; Added Japanese FDI support; Added more extensions to floppy image selection. --- src/allegro-gui-configure.c | 2 +- src/allegro-gui-deviceconfig.c | 2 +- src/allegro-gui-hdconf.c | 4 +- src/allegro-gui.c | 10 ++-- src/allegro-keyboard.c | 6 +-- src/allegro-main.c | 2 +- src/disc.c | 8 +++- src/disc_fdi.c | 15 ++++++ src/disc_img.c | 87 ++++++++++++++++++++++++++-------- src/ibm.h | 6 ++- src/ide.c | 10 ++-- src/pc.c | 4 +- src/plat-keyboard.h | 2 +- src/win-config.c | 2 +- src/win-d3d-fs.cc | 4 +- src/win-deviceconfig.c | 2 +- src/win-hdconf.c | 34 ++++++------- src/win-keyboard.cc | 8 ++-- src/win.c | 46 +++++++++--------- src/win.h | 4 +- 20 files changed, 165 insertions(+), 93 deletions(-) diff --git a/src/allegro-gui-configure.c b/src/allegro-gui-configure.c index 689284c46..f70641118 100644 --- a/src/allegro-gui-configure.c +++ b/src/allegro-gui-configure.c @@ -582,7 +582,7 @@ pclog("video_card_available : %i\n", c); new_SSI2001 != SSI2001 || new_sndcard != sound_card_current || new_voodoo != voodoo_enabled || new_dynarec != cpu_use_dynarec || new_fda != fdd_get_type(0) || new_fdb != fdd_get_type(1)) { - if (alert("This will reset PCem!", "Okay to continue?", NULL, "OK", "Cancel", 0, 0) != 1) + if (alert("This will reset 86Box!", "Okay to continue?", NULL, "OK", "Cancel", 0, 0) != 1) continue; model = new_model; diff --git a/src/allegro-gui-deviceconfig.c b/src/allegro-gui-deviceconfig.c index cc87058db..6301e50a5 100644 --- a/src/allegro-gui-deviceconfig.c +++ b/src/allegro-gui-deviceconfig.c @@ -245,7 +245,7 @@ void deviceconfig_open(device_t *device) if (!changed) return; - if (alert("This will reset PCem!", "Okay to continue?", NULL, "OK", "Cancel", 0, 0) != 1) + if (alert("This will reset 86Box!", "Okay to continue?", NULL, "OK", "Cancel", 0, 0) != 1) continue; dialog_pos = 1; diff --git a/src/allegro-gui-hdconf.c b/src/allegro-gui-hdconf.c index 1dcf2aa1f..760cd7fdf 100644 --- a/src/allegro-gui-hdconf.c +++ b/src/allegro-gui-hdconf.c @@ -23,7 +23,7 @@ static char hd_size_new[20]; static int new_cdrom_channel; -static PcemHDC hdc_new[4]; +static hard_disk_t hdc_new[4]; static DIALOG hdparams_dialog[]= { @@ -484,7 +484,7 @@ int disc_hdconf() if (c == 1) { - if (alert("This will reset PCem!", "Okay to continue?", NULL, "OK", "Cancel", 0, 0) == 1) + if (alert("This will reset 86Box!", "Okay to continue?", NULL, "OK", "Cancel", 0, 0) == 1) { hdc[0] = hdc_new[0]; hdc[1] = hdc_new[1]; diff --git a/src/allegro-gui.c b/src/allegro-gui.c index e29f8d1f9..b2a4f582a 100644 --- a/src/allegro-gui.c +++ b/src/allegro-gui.c @@ -118,7 +118,7 @@ static int cdrom_disabled() if (!cdrom_enabled) return D_O_K; - if (alert("This will reset PCem!", "Okay to continue?", NULL, "OK", "Cancel", 0, 0) == 1) + if (alert("This will reset 86Box!", "Okay to continue?", NULL, "OK", "Cancel", 0, 0) == 1) { atapi->exit(); cdrom_enabled = 0; @@ -140,7 +140,7 @@ static int cdrom_empty() return D_O_K; } - if (alert("This will reset PCem!", "Okay to continue?", NULL, "OK", "Cancel", 0, 0) == 1) + if (alert("This will reset 86Box!", "Okay to continue?", NULL, "OK", "Cancel", 0, 0) == 1) { cdrom_drive = -1; cdrom_enabled = 1; @@ -161,7 +161,7 @@ static int cdrom_dev() return D_O_K; } - if (alert("This will reset PCem!", "Okay to continue?", NULL, "OK", "Cancel", 0, 0) == 1) + if (alert("This will reset 86Box!", "Okay to continue?", NULL, "OK", "Cancel", 0, 0) == 1) { cdrom_drive = 1; cdrom_enabled = 1; @@ -195,7 +195,7 @@ static MENU main_menu[]= {NULL,NULL,NULL,0,NULL} }; -static DIALOG pcem_gui[]= +static DIALOG main_windows_gui[]= { {d_menu_proc, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, main_menu, NULL, NULL}, {d_yield_proc, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, NULL, NULL, NULL}, @@ -208,7 +208,7 @@ void gui_enter() int x = 1; infocus = 0; - dp = init_dialog(pcem_gui, 0); + dp = init_dialog(main_windows_gui, 0); show_mouse(screen); while (x && !(mouse_b & 2) && !key[KEY_ESC]) { diff --git a/src/allegro-keyboard.c b/src/allegro-keyboard.c index 04c36c39d..f689d966b 100644 --- a/src/allegro-keyboard.c +++ b/src/allegro-keyboard.c @@ -1,7 +1,7 @@ #include "allegro-main.h" #include "plat-keyboard.h" -int pcem_key[272]; +int recv_key[272]; int rawinputkey[272]; static int key_convert[128] = @@ -43,7 +43,7 @@ void keyboard_poll_host() if (key_idx == -1) continue; - if (key[c] != pcem_key[key_idx]) - pcem_key[key_idx] = key[c]; + if (key[c] != recv_key[key_idx]) + recv_key[key_idx] = key[c]; } } diff --git a/src/allegro-main.c b/src/allegro-main.c index cf8407925..8647ce82a 100644 --- a/src/allegro-main.c +++ b/src/allegro-main.c @@ -76,7 +76,7 @@ int main(int argc, char *argv[]) } if (c == ROM_MAX) { - printf("No ROMs present!\nYou must have at least one romset to use PCem."); + printf("No ROMs present!\nYou must have at least one romset to use 86Box."); return 0; } diff --git a/src/disc.c b/src/disc.c index e8af4ce4c..46a6648ba 100644 --- a/src/disc.c +++ b/src/disc.c @@ -59,9 +59,15 @@ static struct } loaders[]= { + {"12", img_load, img_close, -1}, + {"144", img_load, img_close, -1}, + {"360", img_load, img_close, -1}, + {"720", img_load, img_close, -1}, + {"DSK", img_load, img_close, -1}, + {"FLP", img_load, img_close, -1}, {"IMG", img_load, img_close, -1}, {"IMA", img_load, img_close, -1}, - {"360", img_load, img_close, -1}, + {"VFD", img_load, img_close, -1}, {"XDF", img_load, img_close, -1}, {"FDI", fdi_load, fdi_close, -1}, {0,0,0} diff --git a/src/disc_fdi.c b/src/disc_fdi.c index ad327f130..575b7e023 100644 --- a/src/disc_fdi.c +++ b/src/disc_fdi.c @@ -2,6 +2,7 @@ #include #include "ibm.h" #include "disc.h" +#include "disc_img.h" #include "disc_fdi.h" #include "fdi2raw.h" @@ -99,9 +100,23 @@ int fdi_hole(int drive) void fdi_load(int drive, char *fn) { + char header[26]; + writeprot[drive] = fwriteprot[drive] = 1; fdi[drive].f = fopen(fn, "rb"); if (!fdi[drive].f) return; + + fread(char_header, 1, 25, f); + fseek(f, 0, SEEK_SET); + char_header[25] = 0; + if (strmp(char_header, "Formatted Disk Image file") != 0) + { + /* This is a Japanese FDI file. */ + pclog("fdi_load(): Japanese FDI file detected, redirecting to IMG loader\n"); + img_load(drive, *fn); + return; + } + fdi[drive].h = fdi2raw_header(fdi[drive].f); // if (!fdih[drive]) printf("Failed to load!\n"); fdi[drive].lasttrack = fdi2raw_get_last_track(fdi[drive].h); diff --git a/src/disc_img.c b/src/disc_img.c index 5d09fceba..d08017716 100644 --- a/src/disc_img.c +++ b/src/disc_img.c @@ -16,6 +16,7 @@ static struct int hole; int byte_period; double bitcell_period_300rpm; + uint32_t base; } img[2]; #if 0 @@ -249,10 +250,17 @@ void img_load(int drive, char *fn) uint32_t bpt; uint8_t max_spt; /* Used for XDF detection. */ int temp_rate; + char ext[4]; + int fdi; if (!xdf_maps_initialized) initialize_xdf_maps(); /* Initialize XDF maps, will need them to properly register sectors in tracks. */ - - writeprot[drive] = 0; + + ext[0] = fn[strlen(fn) - 3] | 0x60; + ext[1] = fn[strlen(fn) - 2] | 0x60; + ext[2] = fn[strlen(fn) - 1] | 0x60; + ext[3] = 0; + + writeprot[drive] = 0; img[drive].f = fopen(fn, "rb+"); if (!img[drive].f) { @@ -263,20 +271,48 @@ void img_load(int drive, char *fn) } fwriteprot[drive] = writeprot[drive]; - /* Read the BPB */ - fseek(img[drive].f, 0x0B, SEEK_SET); - fread(&bpb_bps, 1, 2, img[drive].f); - fseek(img[drive].f, 0x13, SEEK_SET); - fread(&bpb_total, 1, 2, img[drive].f); - fseek(img[drive].f, 0x15, SEEK_SET); - bpb_mid = fgetc(img[drive].f); - fseek(img[drive].f, 0x18, SEEK_SET); - bpb_sectors = fgetc(img[drive].f); - fseek(img[drive].f, 0x1A, SEEK_SET); - bpb_sides = fgetc(img[drive].f); + if (strcmp(ext, "fdi") == 0) + { + /* This is a Japanese FDI image, so let's read the header */ + pclog("img_load(): File is a Japanese FDI image...\n"); + fseek(img[drive].f, 0x10, SEEK_SET); + fread(&bpb_bps, 1, 2, img[drive].f); + fseek(img[drive].f, 0x0C, SEEK_SET); + fread(&size, 1, 4, img[drive].f); + bpb_total = size / bpb_bps; + fseek(img[drive].f, 0x08, SEEK_SET); + fread(&(img[drive].base), 1, 4, img[drive].f); + fseek(img[drive].f, base + 0x15, SEEK_SET); + bpb_mid = fgetc(img[drive].f); + if (bpb_mid < 0xF0) bpb_mid = 0xF0; + fseek(img[drive].f, 0x14, SEEK_SET); + bpb_sectors = fgetc(img[drive].f); + fseek(img[drive].f, 0x18, SEEK_SET); + bpb_sides = fgetc(img[drive].f); - fseek(img[drive].f, -1, SEEK_END); - size = ftell(img[drive].f) + 1; + fdi = 1; + } + else + { + /* Read the BPB */ + pclog("img_load(): File is a raw image...\n"); + fseek(img[drive].f, 0x0B, SEEK_SET); + fread(&bpb_bps, 1, 2, img[drive].f); + fseek(img[drive].f, 0x13, SEEK_SET); + fread(&bpb_total, 1, 2, img[drive].f); + fseek(img[drive].f, 0x15, SEEK_SET); + bpb_mid = fgetc(img[drive].f); + fseek(img[drive].f, 0x18, SEEK_SET); + bpb_sectors = fgetc(img[drive].f); + fseek(img[drive].f, 0x1A, SEEK_SET); + bpb_sides = fgetc(img[drive].f); + + base = 0; + fdi = 0; + + fseek(img[drive].f, -1, SEEK_END); + size = ftell(img[drive].f) + 1; + } img[drive].sides = 2; img[drive].sector_size = 512; @@ -285,7 +321,7 @@ void img_load(int drive, char *fn) pclog("BPB reports %i sides and %i bytes per sector\n", bpb_sides, bpb_bps); - if ((bpb_sides < 1) || (bpb_sides > 2) || (bpb_bps < 128) || (bpb_bps > 2048)) + if (((bpb_sides < 1) || (bpb_sides > 2) || (bpb_bps < 128) || (bpb_bps > 2048)) && !fdi) { /* The BPB is giving us a wacky number of sides and/or bytes per sector, therefore it is most probably not a BPB at all, so we have to guess the parameters from file size. */ @@ -358,7 +394,16 @@ void img_load(int drive, char *fn) { /* The BPB readings appear to be valid, so let's set the values. */ /* Number of tracks = number of total sectors divided by sides times sectors per track. */ - img[drive].tracks = ((uint32_t) bpb_total) / (((uint32_t) bpb_sides) * ((uint32_t) bpb_sectors)); + if (fdi) + { + /* The image is a Japanese FDI, therefore we read the number of tracks from the header. */ + fseek(img[drive].f, 0x1C, SEEK_SET); + fread(&(img[drive].tracks), 1, 4, img[drive].f); + } + else + { + img[drive].tracks = ((uint32_t) bpb_total) / (((uint32_t) bpb_sides) * ((uint32_t) bpb_sectors)); + } /* The rest we just set directly from the BPB. */ img[drive].sectors = bpb_sectors; img[drive].sides = bpb_sides; @@ -585,7 +630,7 @@ void img_seek(int drive, int track) if (img[drive].sides == 2) { - fseek(img[drive].f, track * img[drive].sectors * img[drive].sector_size * 2, SEEK_SET); + fseek(img[drive].f, base + (track * img[drive].sectors * img[drive].sector_size * 2), SEEK_SET); // pclog("Seek: Current file position (H0) is: %08X\n", ftell(img[drive].f)); fread(img[drive].track_data[0], img[drive].sectors * img[drive].sector_size, 1, img[drive].f); // pclog("Seek: Current file position (H1) is: %08X\n", ftell(img[drive].f)); @@ -593,7 +638,7 @@ void img_seek(int drive, int track) } else { - fseek(img[drive].f, track * img[drive].sectors * img[drive].sector_size, SEEK_SET); + fseek(img[drive].f, base + (track * img[drive].sectors * img[drive].sector_size), SEEK_SET); fread(img[drive].track_data[0], img[drive].sectors * img[drive].sector_size, 1, img[drive].f); } @@ -742,13 +787,13 @@ void img_writeback(int drive, int track) if (img[drive].sides == 2) { - fseek(img[drive].f, track * img[drive].sectors * img[drive].sector_size * 2, SEEK_SET); + fseek(img[drive].f, base + (track * img[drive].sectors * img[drive].sector_size * 2), SEEK_SET); fwrite(img[drive].track_data[0], img[drive].sectors * img[drive].sector_size, 1, img[drive].f); fwrite(img[drive].track_data[1], img[drive].sectors * img[drive].sector_size, 1, img[drive].f); } else { - fseek(img[drive].f, track * img[drive].sectors * img[drive].sector_size, SEEK_SET); + fseek(img[drive].f, base + (track * img[drive].sectors * img[drive].sector_size), SEEK_SET); fwrite(img[drive].track_data[0], img[drive].sectors * img[drive].sector_size, 1, img[drive].f); } } diff --git a/src/ibm.h b/src/ibm.h index 369387b43..fcc877d37 100644 --- a/src/ibm.h +++ b/src/ibm.h @@ -503,9 +503,9 @@ typedef struct FILE *f; int spt,hpc; /*Sectors per track, heads per cylinder*/ int tracks; -} PcemHDC; +} hard_disk_t; -PcemHDC hdc[4]; +hard_disk_t hdc[4]; /*Keyboard*/ int64_t keybsenddelay; @@ -568,4 +568,6 @@ extern uint32_t eip_msr; /* For the AMD K6. */ extern uint64_t star; +#define emulator_version "1.00" + #define FPU_CW_Reserved_Bits (0xe0c0) diff --git a/src/ide.c b/src/ide.c index ddad8a9da..aa2e74441 100644 --- a/src/ide.c +++ b/src/ide.c @@ -510,7 +510,7 @@ static void ide_identify(IDE *ide) #ifdef RPCEMU_IDE ide_padstr((char *) (ide->buffer + 27), "RPCemuHD", 40); /* Model */ #else - ide_padstr((char *) (ide->buffer + 27), "PCemHD", 40); /* Model */ + ide_padstr((char *) (ide->buffer + 27), "86BoxHD", 40); /* Model */ #endif ide->buffer[20] = 3; /*Buffer type*/ ide->buffer[21] = 512; /*Buffer size*/ @@ -548,7 +548,7 @@ static void ide_atapi_identify(IDE *ide) #ifdef RPCEMU_IDE ide_padstr((char *) (ide->buffer + 27), "RPCemuCD", 40); /* Model */ #else - ide_padstr((char *) (ide->buffer + 27), "PCemCD", 40); /* Model */ + ide_padstr((char *) (ide->buffer + 27), "86BoxCD", 40); /* Model */ #endif ide->buffer[49] = 0x200; /* LBA supported */ } @@ -3082,10 +3082,10 @@ static void atapicommand(int ide_board) ide_padstr8(idebufferb + 8, 8, "RPCemu"); /* Vendor */ ide_padstr8(idebufferb + 16, 16, "RPCemuCD"); /* Product */ #else - ide_padstr8(idebufferb + 8, 8, "PCem"); /* Vendor */ - ide_padstr8(idebufferb + 16, 16, "PCemCD"); /* Product */ + ide_padstr8(idebufferb + 8, 8, "86Box"); /* Vendor */ + ide_padstr8(idebufferb + 16, 16, "86BoxCD"); /* Product */ #endif - ide_padstr8(idebufferb + 32, 4, "1.0"); /* Revision */ + ide_padstr8(idebufferb + 32, 4, emulator_version); /* Revision */ idx = 36; } diff --git a/src/pc.c b/src/pc.c index 0566e3f1e..c3caf86cc 100644 --- a/src/pc.c +++ b/src/pc.c @@ -234,7 +234,7 @@ void initpc(int argc, char *argv[]) joystick_init(); midi_init(); - append_filename(config_file_default, pcempath, "pcem.cfg", 511); + append_filename(config_file_default, pcempath, "86box.cfg", 511); loadconfig(config_file); pclog("Config loaded\n"); @@ -512,7 +512,7 @@ void runpc() if (win_title_update) { win_title_update=0; - sprintf(s, "86Box v1 - %i%% - %s - %s - %s", fps, model_getname(), models[model].cpu[cpu_manufacturer].cpus[cpu].name, (!mousecapture) ? "Click to capture mouse" : "Press F12-F8 or middle button to release mouse"); + sprintf(s, "86Box v%s - %i%% - %s - %s - %s", emulator_version, fps, model_getname(), models[model].cpu[cpu_manufacturer].cpus[cpu].name, (!mousecapture) ? "Click to capture mouse" : "Press F12-F8 or middle button to release mouse"); set_window_title(s); } done++; diff --git a/src/plat-keyboard.h b/src/plat-keyboard.h index 6dad21d6e..cb3561753 100644 --- a/src/plat-keyboard.h +++ b/src/plat-keyboard.h @@ -4,7 +4,7 @@ extern "C" { void keyboard_init(); void keyboard_close(); void keyboard_poll_host(); - extern int pcem_key[272]; + extern int recv_key[272]; extern int rawinputkey[272]; #ifndef __unix diff --git a/src/win-config.c b/src/win-config.c index 38c83b5d9..c60342edc 100644 --- a/src/win-config.c +++ b/src/win-config.c @@ -369,7 +369,7 @@ static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR temp_voodoo != voodoo_enabled || temp_dynarec != cpu_use_dynarec || temp_always_serial != mouse_always_serial || temp_fda_type != fdd_get_type(0) || temp_fdb_type != fdd_get_type(1) || temp_network_card_current != network_card_current) { - if (MessageBox(NULL,"This will reset PCem!\nOkay to continue?","PCem",MB_OKCANCEL)==IDOK) + if (MessageBox(NULL,"This will reset 86Box!\nOkay to continue?","86Box",MB_OKCANCEL)==IDOK) { savenvr(); model = temp_model; diff --git a/src/win-d3d-fs.cc b/src/win-d3d-fs.cc index 58e9df9b9..bd32bca0c 100644 --- a/src/win-d3d-fs.cc +++ b/src/win-d3d-fs.cc @@ -77,6 +77,7 @@ void d3d_fs_init(HWND h) { int c; HRESULT hr; + char *emulator_title; d3d_fs_w = GetSystemMetrics(SM_CXSCREEN); d3d_fs_h = GetSystemMetrics(SM_CYSCREEN); @@ -86,10 +87,11 @@ void d3d_fs_init(HWND h) d3d_hwnd = h; + sprintf(emulator_title, "86Box v%s", emulator_version); d3d_device_window = CreateWindowEx ( 0, szSubClassName, - "86Box v1", + emulator_title, WS_POPUP, CW_USEDEFAULT, CW_USEDEFAULT, diff --git a/src/win-deviceconfig.c b/src/win-deviceconfig.c index ede50e060..87b79860a 100644 --- a/src/win-deviceconfig.c +++ b/src/win-deviceconfig.c @@ -138,7 +138,7 @@ static BOOL CALLBACK deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam return TRUE; } - if (MessageBox(NULL, "This will reset PCem!\nOkay to continue?", "PCem", MB_OKCANCEL) != IDOK) + if (MessageBox(NULL, "This will reset 86Box!\nOkay to continue?", "86Box", MB_OKCANCEL) != IDOK) { EndDialog(hdlg, 0); return TRUE; diff --git a/src/win-hdconf.c b/src/win-hdconf.c index 5ef584445..03cc678ed 100644 --- a/src/win-hdconf.c +++ b/src/win-hdconf.c @@ -45,7 +45,7 @@ static BOOL CALLBACK hdnew_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARA char s[260]; HWND h; int c; - PcemHDC hd[4]; + hard_disk_t hd[4]; FILE *f; uint8_t buf[512]; switch (message) @@ -77,7 +77,7 @@ static BOOL CALLBACK hdnew_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARA SendMessage(h, WM_GETTEXT, 511, (LPARAM)hd_new_name); if (!hd_new_name[0]) { - MessageBox(ghwnd,"Please enter a valid filename","PCem error",MB_OK); + MessageBox(ghwnd,"Please enter a valid filename","86Box error",MB_OK); return TRUE; } h = GetDlgItem(hdlg, IDC_EDIT1); @@ -92,24 +92,24 @@ static BOOL CALLBACK hdnew_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARA if (hd_new_spt > 63) { - MessageBox(ghwnd, "Drive has too many sectors (maximum is 63)", "PCem error", MB_OK); + MessageBox(ghwnd, "Drive has too many sectors (maximum is 63)", "86Box error", MB_OK); return TRUE; } if (hd_new_hpc > 16) { - MessageBox(ghwnd, "Drive has too many heads (maximum is 16)", "PCem error", MB_OK); + MessageBox(ghwnd, "Drive has too many heads (maximum is 16)", "86Box error", MB_OK); return TRUE; } if (hd_new_cyl > 16383) { - MessageBox(ghwnd, "Drive has too many cylinders (maximum is 16383)", "PCem error", MB_OK); + MessageBox(ghwnd, "Drive has too many cylinders (maximum is 16383)", "86Box error", MB_OK); return TRUE; } f = fopen64(hd_new_name, "wb"); if (!f) { - MessageBox(ghwnd, "Can't open file for write", "PCem error", MB_OK); + MessageBox(ghwnd, "Can't open file for write", "86Box error", MB_OK); return TRUE; } memset(buf, 0, 512); @@ -117,7 +117,7 @@ static BOOL CALLBACK hdnew_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARA fwrite(buf, 512, 1, f); fclose(f); - MessageBox(ghwnd, "Remember to partition and format the new drive", "PCem", MB_OK); + MessageBox(ghwnd, "Remember to partition and format the new drive", "86Box", MB_OK); EndDialog(hdlg, 1); return TRUE; @@ -159,7 +159,7 @@ BOOL CALLBACK hdsize_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPar { char s[260]; HWND h; - PcemHDC hd[2]; + hard_disk_t hd[2]; switch (message) { case WM_INITDIALOG: @@ -193,17 +193,17 @@ BOOL CALLBACK hdsize_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPar if (hd_new_spt > 63) { - MessageBox(ghwnd,"Drive has too many sectors (maximum is 63)","PCem error",MB_OK); + MessageBox(ghwnd,"Drive has too many sectors (maximum is 63)","86Box error",MB_OK); return TRUE; } if (hd_new_hpc > 16) { - MessageBox(ghwnd,"Drive has too many heads (maximum is 16)","PCem error",MB_OK); + MessageBox(ghwnd,"Drive has too many heads (maximum is 16)","86Box error",MB_OK); return TRUE; } if (hd_new_cyl > 16383) { - MessageBox(ghwnd,"Drive has too many cylinders (maximum is 16383)","PCem error",MB_OK); + MessageBox(ghwnd,"Drive has too many cylinders (maximum is 16383)","86Box error",MB_OK); return TRUE; } @@ -239,7 +239,7 @@ static BOOL CALLBACK hdconf_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR { char s[260]; HWND h; - PcemHDC hd[4]; + hard_disk_t hd[4]; FILE *f; off64_t sz; switch (message) @@ -327,7 +327,7 @@ static BOOL CALLBACK hdconf_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR case IDOK: if (hd_changed || cdrom_channel != new_cdrom_channel) { - if (MessageBox(NULL, "This will reset PCem!\nOkay to continue?", "PCem", MB_OKCANCEL) == IDOK) + if (MessageBox(NULL, "This will reset 86Box!\nOkay to continue?", "86Box", MB_OKCANCEL) == IDOK) { h = GetDlgItem(hdlg, IDC_EDIT_C_SPT); SendMessage(h, WM_GETTEXT, 255, (LPARAM)s); @@ -468,7 +468,7 @@ static BOOL CALLBACK hdconf_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR f = fopen64(openfilestring, "rb"); if (!f) { - MessageBox(ghwnd,"Can't open file for read","PCem error",MB_OK); + MessageBox(ghwnd,"Can't open file for read","86Box error",MB_OK); return TRUE; } fseeko64(f, -1, SEEK_END); @@ -530,7 +530,7 @@ static BOOL CALLBACK hdconf_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR f = fopen64(openfilestring, "rb"); if (!f) { - MessageBox(ghwnd,"Can't open file for read","PCem error",MB_OK); + MessageBox(ghwnd,"Can't open file for read","86Box error",MB_OK); return TRUE; } fseeko64(f, -1, SEEK_END); @@ -592,7 +592,7 @@ static BOOL CALLBACK hdconf_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR f = fopen64(openfilestring, "rb"); if (!f) { - MessageBox(ghwnd,"Can't open file for read","PCem error",MB_OK); + MessageBox(ghwnd,"Can't open file for read","86Box error",MB_OK); return TRUE; } fseeko64(f, -1, SEEK_END); @@ -654,7 +654,7 @@ static BOOL CALLBACK hdconf_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR f = fopen64(openfilestring, "rb"); if (!f) { - MessageBox(ghwnd,"Can't open file for read","PCem error",MB_OK); + MessageBox(ghwnd,"Can't open file for read","86Box error",MB_OK); return TRUE; } fseeko64(f, -1, SEEK_END); diff --git a/src/win-keyboard.cc b/src/win-keyboard.cc index 6cd5723e6..928825e4b 100644 --- a/src/win-keyboard.cc +++ b/src/win-keyboard.cc @@ -9,7 +9,7 @@ #include "win.h" #include "video.h" -extern "C" int pcem_key[272]; +extern "C" int recv_key[272]; extern "C" void fatal(const char *format, ...); extern "C" void pclog(const char *format, ...); @@ -18,13 +18,13 @@ extern "C" void keyboard_init(); extern "C" void keyboard_close(); extern "C" void keyboard_poll(); -int pcem_key[272]; +int recv_key[272]; void keyboard_init() { atexit(keyboard_close); - memset(pcem_key, 0, sizeof(pcem_key)); + memset(recv_key, 0, sizeof(recv_key)); pclog("Keyboard initialized!\n"); } @@ -38,7 +38,7 @@ void keyboard_poll_host() int c; for (c = 0; c < 272; c++) - pcem_key[c] = rawinputkey[c]; + recv_key[c] = rawinputkey[c]; if ((rawinputkey[0x1D] || rawinputkey[0x9D]) && (rawinputkey[0x38] || rawinputkey[0xB8]) && diff --git a/src/win.c b/src/win.c index 24841e5a3..186e101c8 100644 --- a/src/win.c +++ b/src/win.c @@ -521,6 +521,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance, MSG messages; /* Here messages to the application are saved */ WNDCLASSEX wincl; /* Data structure for the windowclass */ int c, d, bRet; + char *emulator_title; LARGE_INTEGER qpc_freq; HACCEL haccel; /* Handle to accelerator table */ @@ -557,11 +558,12 @@ int WINAPI WinMain (HINSTANCE hThisInstance, menu = LoadMenu(hThisInstance, TEXT("MainMenu")); initmenu(); + sprintf(emulator_title, "86Box v%s", emulator_version); /* The class is registered, let's create the program*/ hwnd = CreateWindowEx ( 0, /* Extended possibilites for variation */ szClassName, /* Classname */ - "86Box v1", /* Title Text */ + emulator_version, /* Title Text */ WS_OVERLAPPEDWINDOW&~WS_SIZEBOX, /* default window */ CW_USEDEFAULT, /* Windows decides the position */ CW_USEDEFAULT, /* where the window ends up on the screen */ @@ -642,7 +644,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance, } if (c == ROM_MAX) { - MessageBox(hwnd,"No ROMs present!\nYou must have at least one romset to use PCem.","PCem fatal error",MB_OK); + MessageBox(hwnd,"No ROMs present!\nYou must have at least one romset to use 86Box.","86Box fatal error",MB_OK); return 0; } @@ -651,7 +653,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance, if (!c) { - if (romset!=-1) MessageBox(hwnd,"Configured romset not available.\nDefaulting to available romset.","PCem error",MB_OK); + if (romset!=-1) MessageBox(hwnd,"Configured romset not available.\nDefaulting to available romset.","86Box error",MB_OK); for (c=0;c= 0; c--) { if (gfx_present[c]) @@ -743,9 +745,9 @@ int WINAPI WinMain (HINSTANCE hThisInstance, } //; else // sleep(0); - // if ((pcem_key[KEY_LCONTROL] || pcem_key[KEY_RCONTROL]) && pcem_key[KEY_END] && mousecapture) - // if ((pcem_key[KEY_LCONTROL] || pcem_key[KEY_RCONTROL]) && pcem_key[0x58] && mousecapture) - // if (pcem_key[0x58] && pcem_key[0x42] && mousecapture) + // if ((recv_key[KEY_LCONTROL] || recv_key[KEY_RCONTROL]) && recv_key[KEY_END] && mousecapture) + // if ((recv_key[KEY_LCONTROL] || recv_key[KEY_RCONTROL]) && recv_key[0x58] && mousecapture) + // if (recv_key[0x58] && recv_key[0x42] && mousecapture) { ClipCursor(&oldclip); mousecapture=0; @@ -765,18 +767,18 @@ int WINAPI WinMain (HINSTANCE hThisInstance, TranslateMessage(&messages); DispatchMessage(&messages); } - // if ((pcem_key[KEY_LCONTROL] || pcem_key[KEY_RCONTROL]) && pcem_key[KEY_END] && mousecapture) + // if ((recv_key[KEY_LCONTROL] || recv_key[KEY_RCONTROL]) && recv_key[KEY_END] && mousecapture) - if (pcem_key[0x58] && pcem_key[0x42] && mousecapture) + if (recv_key[0x58] && recv_key[0x42] && mousecapture) { ClipCursor(&oldclip); ShowCursor(TRUE); mousecapture=0; } - if ((pcem_key[0x1D] || pcem_key[0x9D]) && - (pcem_key[0x38] || pcem_key[0xB8]) && - (pcem_key[0x51] || pcem_key[0xD1]) && + if ((recv_key[0x1D] || recv_key[0x9D]) && + (recv_key[0x38] || recv_key[0xB8]) && + (recv_key[0x51] || recv_key[0xD1]) && video_fullscreen) { leave_fullscreen(); @@ -987,7 +989,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM PostQuitMessage (0); /* send a WM_QUIT to the message queue */ break; case IDM_DISC_A: - if (!getfile(hwnd,"Disc image (*.IMG;*.IMA;*.FDI)\0*.IMG;*.IMA;*.FDI\0All files (*.*)\0*.*\0",discfns[0])) + if (!getfile(hwnd,"Disc image (*.12;*.144;*.360;*.720;*.DSK;*.IMG;*.IMA;*.FDI;*.FLP;*.XDF;*.VFD)\0*.12;*.144;*.360;*.720;*.DSK;*.IMG;*.IMA;*.FDI;*.FLP;*.XDF;*.VFD\0All files (*.*)\0*.*\0",discfns[0])) { disc_close(0); disc_load(0, openfilestring); @@ -995,7 +997,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM } break; case IDM_DISC_B: - if (!getfile(hwnd,"Disc image (*.IMG;*.IMA;*.FDI)\0*.IMG;*.IMA;*.FDI\0All files (*.*)\0*.*\0",discfns[1])) + if (!getfile(hwnd,"Disc image (*.12;*.144;*.360;*.720;*.DSK;*.IMG;*.IMA;*.FDI;*.FLP;*.XDF;*.VFD)\0*.12;*.144;*.360;*.720;*.DSK;*.IMG;*.IMA;*.FDI;*.FLP;*.XDF;*.VFD\0All files (*.*)\0*.*\0",discfns[1])) { disc_close(1); disc_load(1, openfilestring); @@ -1060,7 +1062,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM if (video_fullscreen_first) { video_fullscreen_first = 0; - MessageBox(hwnd, "Use CTRL + ALT + PAGE DOWN to return to windowed mode", "PCem", MB_OK); + MessageBox(hwnd, "Use CTRL + ALT + PAGE DOWN to return to windowed mode", "86Box", MB_OK); } startblit(); video_wait_for_blit(); @@ -1092,7 +1094,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM pause = 1; if (!getfile(hwnd, "Configuration (*.CFG)\0*.CFG\0All files (*.*)\0*.*\0", "")) { - if (MessageBox(NULL, "This will reset PCem!\nOkay to continue?", "PCem", MB_OKCANCEL) == IDOK) + if (MessageBox(NULL, "This will reset 86Box!\nOkay to continue?", "86Box", MB_OKCANCEL) == IDOK) { loadconfig(openfilestring); config_save(config_file_default); @@ -1114,7 +1116,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM case IDM_CDROM_DISABLED: if (cdrom_enabled) { - if (MessageBox(NULL,"This will reset PCem!\nOkay to continue?","PCem",MB_OKCANCEL) != IDOK) + if (MessageBox(NULL,"This will reset 86Box!\nOkay to continue?","86Box",MB_OKCANCEL) != IDOK) break; } if (!cdrom_enabled) @@ -1145,7 +1147,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM case IDM_CDROM_EMPTY: if (!cdrom_enabled) { - if (MessageBox(NULL,"This will reset PCem!\nOkay to continue?","PCem",MB_OKCANCEL) != IDOK) + if (MessageBox(NULL,"This will reset 86Box!\nOkay to continue?","86Box",MB_OKCANCEL) != IDOK) break; } if ((cdrom_drive == 0) && cdrom_enabled) @@ -1184,7 +1186,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM { if (!cdrom_enabled) { - if (MessageBox(NULL,"This will reset PCem!\nOkay to continue?","PCem",MB_OKCANCEL) != IDOK) + if (MessageBox(NULL,"This will reset 86Box!\nOkay to continue?","86Box",MB_OKCANCEL) != IDOK) break; } old_cdrom_drive = cdrom_drive; @@ -1225,7 +1227,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM { if (!cdrom_enabled) { - if (MessageBox(NULL,"This will reset PCem!\nOkay to continue?","PCem",MB_OKCANCEL) != IDOK) + if (MessageBox(NULL,"This will reset 86Box!\nOkay to continue?","86Box",MB_OKCANCEL) != IDOK) break; } new_cdrom_drive = LOWORD(wParam)-IDM_CDROM_REAL; @@ -1316,7 +1318,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM if (!(scancode & 0xf00)) { rawinputkey[scancode & 0x1ff] = !(rawKB.Flags & RI_KEY_BREAK); - pcem_key[scancode & 0x1ff] = rawinputkey[scancode & 0x1ff]; + recv_key[scancode & 0x1ff] = rawinputkey[scancode & 0x1ff]; } } else @@ -1327,7 +1329,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM if (!(scancode & 0xf00)) { rawinputkey[scancode & 0x1ff] = !(rawKB.Flags & RI_KEY_BREAK); - pcem_key[scancode & 0x1ff] = rawinputkey[scancode & 0x1ff]; + recv_key[scancode & 0x1ff] = rawinputkey[scancode & 0x1ff]; } } } diff --git a/src/win.h b/src/win.h index 4aff67266..8dcec28dd 100644 --- a/src/win.h +++ b/src/win.h @@ -6,8 +6,8 @@ extern int mousecapture; extern "C" { #endif -#define szClassName "PCemMainWnd" -#define szSubClassName "PCemSubWnd" +#define szClassName "86BoxMainWnd" +#define szSubClassName "86BoxSubWnd" void leave_fullscreen();