diff --git a/src/VIDEO/vid_ega.c b/src/VIDEO/vid_ega.c index 49cf3358a..33a3397bf 100644 --- a/src/VIDEO/vid_ega.c +++ b/src/VIDEO/vid_ega.c @@ -45,6 +45,7 @@ static int old_overscan_color = 0; int update_overscan = 0; +#ifdef JEGA uint8_t jfont_sbcs_19[SBCS19_LEN]; /* 256 * 19( * 8) */ uint8_t jfont_dbcs_16[DBCS16_LEN]; /* 65536 * 16 * 2 (* 8) */ @@ -146,6 +147,7 @@ void ega_jega_read_font(ega_t *ega) ega->font_index++; ega->RSTAT |= 0x02; } +#endif void ega_out(uint16_t addr, uint8_t val, void *p) { @@ -259,7 +261,11 @@ void ega_out(uint16_t addr, uint8_t val, void *p) return; case 0x3d1: case 0x3d5: +#ifdef JEGA if ((ega->crtcreg < 0xb9) || !ega->is_jega) +#else + if (ega->crtcreg < 0xb9) +#endif { crtcreg = ega->crtcreg & 0x1f; if (crtcreg <= 7 && ega->crtc[0x11] & 0x80) return; @@ -274,6 +280,7 @@ void ega_out(uint16_t addr, uint8_t val, void *p) } } } +#ifdef JEGA else { switch(ega->crtcreg) @@ -331,6 +338,7 @@ void ega_out(uint16_t addr, uint8_t val, void *p) break; } } +#endif break; } } @@ -391,11 +399,16 @@ uint8_t ega_in(uint16_t addr, void *p) return ega->crtcreg; case 0x3d1: case 0x3d5: +#ifdef JEGA if ((ega->crtcreg < 0xb9) || !ega->is_jega) +#else + if (ega->crtcreg < 0xb9) +#endif { crtcreg = ega->crtcreg & 0x1f; return ega->crtc[crtcreg]; } +#ifdef JEGA else { switch(ega->crtcreg) @@ -434,6 +447,8 @@ uint8_t ega_in(uint16_t addr, void *p) return 0x00; } } +#endif + return 0xff; case 0x3da: ega->attrff = 0; ega->stat ^= 0x30; /*Fools IBM EGA video BIOS self-test*/ @@ -534,6 +549,7 @@ void ega_poll(void *p) { if (fullchange) { +#ifdef JEGA if (ega_jega_enabled(ega)) { ega_render_text_jega(ega, drawcursor); @@ -542,6 +558,9 @@ void ega_poll(void *p) { ega_render_text_standard(ega, drawcursor); } +#else + ega_render_text_standard(ega, drawcursor); +#endif } } else @@ -1016,7 +1035,9 @@ void ega_common_defaults(ega_t *ega) update_overscan = 0; +#ifdef JEGA ega->is_jega = 0; +#endif } void *ega_standalone_init() @@ -1138,6 +1159,7 @@ void *sega_standalone_init() return ega; } +#ifdef JEGA uint16_t chrtosht(FILE *fp) { uint16_t i, j; @@ -1243,6 +1265,7 @@ void *jega_standalone_init() return ega; } +#endif static int ega_standalone_available() { @@ -1337,6 +1360,7 @@ device_t sega_device = ega_config }; +#ifdef JEGA device_t jega_device = { "AX JEGA", @@ -1349,3 +1373,4 @@ device_t jega_device = NULL, ega_config }; +#endif diff --git a/src/VIDEO/vid_ega.h b/src/VIDEO/vid_ega.h index e7b30b32b..e9835d1fb 100644 --- a/src/VIDEO/vid_ega.h +++ b/src/VIDEO/vid_ega.h @@ -91,11 +91,13 @@ typedef struct ega_t int video_res_x, video_res_y, video_bpp; +#ifdef JEGA uint8_t RMOD1, RMOD2, RDAGS, RDFFB, RDFSB, RDFAP, RPESL, RPULP, RPSSC, RPSSU, RPSSL; uint8_t RPPAJ; uint8_t RCMOD, RCCLH, RCCLL, RCCSL, RCCEL, RCSKW, ROMSL, RSTAT; int is_jega, font_index; int chr_left, chr_wide; +#endif } ega_t; extern int update_overscan; @@ -113,6 +115,7 @@ extern device_t ega_device; extern device_t cpqega_device; extern device_t sega_device; +#ifdef JEGA #define SBCS 0 #define DBCS 1 #define ID_LEN 6 @@ -122,3 +125,4 @@ extern device_t sega_device; extern uint8_t jfont_sbcs_19[SBCS19_LEN]; /* 256 * 19( * 8) */ extern uint8_t jfont_dbcs_16[DBCS16_LEN]; /* 65536 * 16 * 2 (* 8) */ +#endif diff --git a/src/VIDEO/vid_ega_render.c b/src/VIDEO/vid_ega_render.c index 66c3f2f65..50ef6139e 100644 --- a/src/VIDEO/vid_ega_render.c +++ b/src/VIDEO/vid_ega_render.c @@ -146,6 +146,7 @@ void ega_render_text_standard(ega_t *ega, int drawcursor) } } +#ifdef JEGA static __inline int is_kanji1(uint8_t chr) { return (chr >= 0x81 && chr <= 0x9f) || (chr >= 0xe0 && chr <= 0xfc); @@ -374,6 +375,7 @@ void ega_render_text_jega(ega_t *ega, int drawcursor) } } } +#endif void ega_render_2bpp_lowres(ega_t *ega) { diff --git a/src/VIDEO/vid_ega_render.h b/src/VIDEO/vid_ega_render.h index b833128a9..3ff9a5412 100644 --- a/src/VIDEO/vid_ega_render.h +++ b/src/VIDEO/vid_ega_render.h @@ -29,7 +29,9 @@ extern uint8_t edatlookup[4][4]; void ega_render_blank(ega_t *ega); void ega_render_text_standard(ega_t *ega, int drawcursor); +#ifdef JEGA void ega_render_text_jega(ega_t *ega, int drawcursor); +#endif void ega_render_2bpp_lowres(ega_t *ega); void ega_render_2bpp_highres(ega_t *ega); diff --git a/src/config.c b/src/config.c index 6bc9bf1f6..bc3d84ba2 100644 --- a/src/config.c +++ b/src/config.c @@ -1,5 +1,23 @@ -/* Copyright holders: Sarah Walker - * see COPYING for more details +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * Configuration file handler. + * + * Version: @(#)config.c 1.0.0 2017/07/26 + * + * Authors: Sarah Walker, + * Miran Grca, + * Fred N. van Kempen, + * Overdoze, + * Copyright 2008-2017 Sarah Walker. + * Copyright 2016-2017 Miran Grca. + * Copyright 2017-2017 Fred N. van Kempen. + * Copyright 2017-2017 Overdoze. * * NOTE: Forcing config files to be in Unicode encoding breaks it on * Windows XP, and possibly also Vista. Use -DANSI_CFG for use @@ -83,17 +101,14 @@ typedef struct entry_t #define list_delete(old, head) \ { \ - struct list_t *cur = head; \ struct list_t *next = head; \ \ - while (next->next != old) \ + while ((next)->next != old) \ { \ - cur = next; \ - next = next->next; \ + next = (next)->next; \ } \ \ - cur->next = next->next; \ - free(next); \ + (next)->next = (old)->next; \ } @@ -487,6 +502,7 @@ void config_delete_var(char *head, char *name) return; list_delete(&entry->list, §ion->entry_head); + free(entry); return; } @@ -504,6 +520,7 @@ void config_delete_section_if_empty(char *head) if (entries_num(section) == 0) { list_delete(§ion->list, &config_head); + free(section); } return; diff --git a/src/config.h b/src/config.h index 8d1db0b7b..a7c15383f 100644 --- a/src/config.h +++ b/src/config.h @@ -1,8 +1,24 @@ -/* Copyright holders: Sarah Walker - see COPYING for more details -*/ - - +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * Configuration file handler header. + * + * Version: @(#)config.h 1.0.0 2017/07/26 + * + * Authors: Sarah Walker, + * Miran Grca, + * Fred N. van Kempen, + * Overdoze, + * Copyright 2008-2017 Sarah Walker. + * Copyright 2016-2017 Miran Grca. + * Copyright 2017-2017 Fred N. van Kempen. + * Copyright 2017-2017 Overdoze. + */ extern wchar_t config_file_default[256];