Moved the config-load code to pc.c, and (for now) disabled LoadConfig and SaveConfig menu items for non-Dev builds.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Main include file for the application.
|
||||
*
|
||||
* Version: @(#)86box.h 1.0.12 2017/11/04
|
||||
* Version: @(#)86box.h 1.0.13 2017/11/19
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
@@ -119,6 +119,7 @@ extern void pclog(const char *format, ...);
|
||||
extern void fatal(const char *format, ...);
|
||||
extern void set_screen_size(int x, int y);
|
||||
extern void set_screen_size_natural(void);
|
||||
extern void pc_reload(wchar_t *fn);
|
||||
extern int pc_init_modules(void);
|
||||
extern int pc_init(int argc, wchar_t *argv[]);
|
||||
extern void pc_close(void *threadid);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/* Copyright holders: Sarah Walker, Tenshi
|
||||
see COPYING for more details
|
||||
*/
|
||||
#ifndef _MEM_H_
|
||||
#define _MEM_H_
|
||||
#ifndef EMU_MEM_H
|
||||
# define EMU_MEM_H
|
||||
|
||||
|
||||
extern uint8_t *ram;
|
||||
@@ -238,4 +238,5 @@ extern void port_92_clear_reset(void);
|
||||
extern void port_92_add(void);
|
||||
extern void port_92_remove(void);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /*EMU_MEM_H*/
|
||||
|
||||
54
src/pc.c
54
src/pc.c
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Main emulator module where most things are controlled.
|
||||
*
|
||||
* Version: @(#)pc.c 1.0.43 2017/11/18
|
||||
* Version: @(#)pc.c 1.0.44 2017/11/19
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -50,6 +50,9 @@
|
||||
#include "serial.h"
|
||||
#include "bugger.h"
|
||||
#include "cdrom/cdrom.h"
|
||||
#include "cdrom/cdrom.h"
|
||||
#include "cdrom/cdrom_image.h"
|
||||
#include "cdrom/cdrom_null.h"
|
||||
#include "disk/hdd.h"
|
||||
#include "disk/hdc.h"
|
||||
#include "disk/hdc_ide.h"
|
||||
@@ -485,6 +488,55 @@ pc_speed_changed(void)
|
||||
}
|
||||
|
||||
|
||||
/* Re-load system configuration and restart. */
|
||||
void
|
||||
pc_reload(wchar_t *fn)
|
||||
{
|
||||
int i;
|
||||
|
||||
config_write(config_file_default);
|
||||
|
||||
for (i=0; i<FDD_NUM; i++)
|
||||
floppy_close(i);
|
||||
for (i=0; i<CDROM_NUM; i++) {
|
||||
cdrom_drives[i].handler->exit(i);
|
||||
if (cdrom_drives[i].host_drive == 200)
|
||||
image_close(i);
|
||||
else if ((cdrom_drives[i].host_drive >= 'A') && (cdrom_drives[i].host_drive <= 'Z'))
|
||||
ioctl_close(i);
|
||||
else
|
||||
null_close(i);
|
||||
}
|
||||
|
||||
pc_reset_hard_close();
|
||||
|
||||
config_load(fn);
|
||||
|
||||
for (i=0; i<CDROM_NUM; i++) {
|
||||
if (cdrom_drives[i].bus_type)
|
||||
SCSIReset(cdrom_drives[i].scsi_device_id, cdrom_drives[i].scsi_device_lun);
|
||||
|
||||
if (cdrom_drives[i].host_drive == 200)
|
||||
image_open(i, cdrom_image[i].image_path);
|
||||
else if ((cdrom_drives[i].host_drive >= 'A') && (cdrom_drives[i].host_drive <= 'Z'))
|
||||
ioctl_open(i, cdrom_drives[i].host_drive);
|
||||
else
|
||||
cdrom_null_open(i, cdrom_drives[i].host_drive);
|
||||
}
|
||||
|
||||
floppy_load(0, floppyfns[0]);
|
||||
floppy_load(1, floppyfns[1]);
|
||||
floppy_load(2, floppyfns[2]);
|
||||
floppy_load(3, floppyfns[3]);
|
||||
|
||||
mem_resize();
|
||||
rom_load_bios(romset);
|
||||
network_init();
|
||||
|
||||
pc_reset_hard_init();
|
||||
}
|
||||
|
||||
|
||||
/* Initialize modules, ran once, after pc_init. */
|
||||
int
|
||||
pc_init_modules(void)
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
* Emulation of the EGA, Chips & Technologies SuperEGA, and
|
||||
* AX JEGA graphics cards.
|
||||
*
|
||||
* Version: @(#)vid_ega.h 1.0.2 2017/10/31
|
||||
* Version: @(#)vid_ega.h 1.0.3 2017/11/19
|
||||
*
|
||||
* Author: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* akm,
|
||||
*
|
||||
@@ -19,10 +19,22 @@
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
* Copyright 2017 akm.
|
||||
*/
|
||||
#ifndef VIDEO_EGA_H
|
||||
# define VIDEO_EGA_H
|
||||
|
||||
|
||||
typedef struct ega_t
|
||||
{
|
||||
#ifdef JEGA
|
||||
# define SBCS 0
|
||||
# define DBCS 1
|
||||
# define ID_LEN 6
|
||||
# define NAME_LEN 8
|
||||
# define SBCS19_LEN 256 * 19
|
||||
# define DBCS16_LEN 65536 * 32
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(EMU_MEM_H) && defined(EMU_ROM_H)
|
||||
typedef struct ega_t {
|
||||
mem_mapping_t mapping;
|
||||
|
||||
rom_t bios_rom;
|
||||
@@ -99,29 +111,32 @@ typedef struct ega_t
|
||||
int chr_left, chr_wide;
|
||||
#endif
|
||||
} ega_t;
|
||||
#endif
|
||||
|
||||
extern int update_overscan;
|
||||
|
||||
void ega_out(uint16_t addr, uint8_t val, void *p);
|
||||
uint8_t ega_in(uint16_t addr, void *p);
|
||||
void ega_poll(void *p);
|
||||
void ega_recalctimings(struct ega_t *ega);
|
||||
void ega_write(uint32_t addr, uint8_t val, void *p);
|
||||
uint8_t ega_read(uint32_t addr, void *p);
|
||||
void ega_init(ega_t *ega);
|
||||
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern device_t ega_device;
|
||||
extern device_t cpqega_device;
|
||||
extern device_t sega_device;
|
||||
|
||||
#endif
|
||||
#ifdef JEGA
|
||||
#define SBCS 0
|
||||
#define DBCS 1
|
||||
#define ID_LEN 6
|
||||
#define NAME_LEN 8
|
||||
#define SBCS19_LEN 256 * 19
|
||||
#define DBCS16_LEN 65536 * 32
|
||||
|
||||
extern uint8_t jfont_sbcs_19[SBCS19_LEN]; /* 256 * 19( * 8) */
|
||||
extern uint8_t jfont_dbcs_16[DBCS16_LEN]; /* 65536 * 16 * 2 (* 8) */
|
||||
#endif
|
||||
|
||||
extern int update_overscan;
|
||||
|
||||
|
||||
#if defined(EMU_MEM_H) && defined(EMU_ROM_H)
|
||||
extern void ega_init(ega_t *ega);
|
||||
extern void ega_recalctimings(struct ega_t *ega);
|
||||
#endif
|
||||
|
||||
extern void ega_out(uint16_t addr, uint8_t val, void *p);
|
||||
extern uint8_t ega_in(uint16_t addr, void *p);
|
||||
extern void ega_poll(void *p);
|
||||
extern void ega_write(uint32_t addr, uint8_t val, void *p);
|
||||
extern uint8_t ega_read(uint32_t addr, void *p);
|
||||
|
||||
|
||||
#endif /*VIDEO_EGA_H*/
|
||||
|
||||
@@ -29,21 +29,11 @@
|
||||
#include <wchar.h>
|
||||
#include "../86box.h"
|
||||
#include "../config.h"
|
||||
#include "../machine/machine.h"
|
||||
#include "../mem.h" // because of load_config
|
||||
#include "../rom.h" // because of load_config
|
||||
#include "../device.h"
|
||||
#include "../mouse.h"
|
||||
#include "../keyboard.h"
|
||||
#include "../cdrom/cdrom.h"
|
||||
#include "../cdrom/cdrom_image.h"
|
||||
#include "../cdrom/cdrom_null.h"
|
||||
#include "../floppy/floppy.h"
|
||||
#include "../scsi/scsi.h"
|
||||
#include "../network/network.h"
|
||||
#include "../video/video.h"
|
||||
#include "../video/vid_ega.h" // for update_overscan
|
||||
#include "../sound/sound.h"
|
||||
#include "../plat.h"
|
||||
#include "../plat_mouse.h"
|
||||
#include "../plat_midi.h"
|
||||
@@ -116,6 +106,12 @@ video_toggle_option(HMENU h, int *val, int id)
|
||||
static void
|
||||
ResetAllMenus(void)
|
||||
{
|
||||
#ifndef DEV_BRANCH
|
||||
/* FIXME: until we fix these.. --FvK */
|
||||
EnableMenuItem(menuMain, IDM_CONFIG_LOAD, MF_DISABLED);
|
||||
EnableMenuItem(menuMain, IDM_CONFIG_SAVE, MF_DISABLED);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_LOG_TOGGLES
|
||||
# ifdef ENABLE_BUSLOGIC_LOG
|
||||
CheckMenuItem(menuMain, IDM_LOG_BUSLOGIC, MF_UNCHECKED);
|
||||
@@ -252,7 +248,6 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HMENU hmenu;
|
||||
RECT rect;
|
||||
int i = 0;
|
||||
|
||||
switch (message) {
|
||||
case WM_CREATE:
|
||||
@@ -490,47 +485,10 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
case IDM_CONFIG_LOAD:
|
||||
plat_pause(1);
|
||||
if (! file_dlg_st(hwnd, IDS_2160, "", 0)) {
|
||||
if (ui_msgbox(MBX_QUESTION, (wchar_t *)IDS_2051) == IDYES) {
|
||||
config_write(config_file_default);
|
||||
for (i = 0; i < FDD_NUM; i++)
|
||||
floppy_close(i);
|
||||
for (i = 0; i < CDROM_NUM; i++)
|
||||
{
|
||||
cdrom_drives[i].handler->exit(i);
|
||||
if (cdrom_drives[i].host_drive == 200)
|
||||
image_close(i);
|
||||
else if ((cdrom_drives[i].host_drive >= 'A') && (cdrom_drives[i].host_drive <= 'Z'))
|
||||
ioctl_close(i);
|
||||
else
|
||||
null_close(i);
|
||||
}
|
||||
pc_reset_hard_close();
|
||||
config_load(wopenfilestring);
|
||||
for (i = 0; i < CDROM_NUM; i++)
|
||||
{
|
||||
if (cdrom_drives[i].bus_type)
|
||||
SCSIReset(cdrom_drives[i].scsi_device_id, cdrom_drives[i].scsi_device_lun);
|
||||
|
||||
if (cdrom_drives[i].host_drive == 200)
|
||||
image_open(i, cdrom_image[i].image_path);
|
||||
else if ((cdrom_drives[i].host_drive >= 'A') && (cdrom_drives[i].host_drive <= 'Z'))
|
||||
ioctl_open(i, cdrom_drives[i].host_drive);
|
||||
else
|
||||
cdrom_null_open(i, cdrom_drives[i].host_drive);
|
||||
}
|
||||
|
||||
floppy_load(0, floppyfns[0]);
|
||||
floppy_load(1, floppyfns[1]);
|
||||
floppy_load(2, floppyfns[2]);
|
||||
floppy_load(3, floppyfns[3]);
|
||||
|
||||
mem_resize();
|
||||
rom_load_bios(romset);
|
||||
network_init();
|
||||
if (!file_dlg_st(hwnd, IDS_2160, "", 0) &&
|
||||
(ui_msgbox(MBX_QUESTION, (wchar_t *)IDS_2051) == IDYES)) {
|
||||
pc_reload(wopenfilestring);
|
||||
ResetAllMenus();
|
||||
pc_reset_hard_init();
|
||||
}
|
||||
}
|
||||
plat_pause(0);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user