More cleanups to separate main code from platform support and UI support, plus a few bugfixes.

This commit is contained in:
waltje
2017-10-12 14:25:17 -04:00
parent aa7e85d0d7
commit 724e5c44df
46 changed files with 217 additions and 259 deletions

View File

@@ -9,7 +9,7 @@
* Implementation of the CD-ROM drive with SCSI(-like)
* commands, for both ATAPI and SCSI usage.
*
* Version: @(#)cdrom.c 1.0.15 2017/10/10
* Version: @(#)cdrom.c 1.0.16 2017/10/12
*
* Author: Miran Grca, <mgrca8@gmail.com>
*
@@ -989,16 +989,16 @@ void cdrom_mode_sense_load(uint8_t id)
switch(id)
{
case 0:
f = _wfopen(nvr_path(L"cdrom_1_mode_sense.bin"), L"rb");
f = plat_fopen(nvr_path(L"cdrom_1_mode_sense.bin"), L"rb");
break;
case 1:
f = _wfopen(nvr_path(L"cdrom_2_mode_sense.bin"), L"rb");
f = plat_fopen(nvr_path(L"cdrom_2_mode_sense.bin"), L"rb");
break;
case 2:
f = _wfopen(nvr_path(L"cdrom_3_mode_sense.bin"), L"rb");
f = plat_fopen(nvr_path(L"cdrom_3_mode_sense.bin"), L"rb");
break;
case 3:
f = _wfopen(nvr_path(L"cdrom_4_mode_sense.bin"), L"rb");
f = plat_fopen(nvr_path(L"cdrom_4_mode_sense.bin"), L"rb");
break;
default:
return;
@@ -1017,16 +1017,16 @@ void cdrom_mode_sense_save(uint8_t id)
switch(id)
{
case 0:
f = _wfopen(nvr_path(L"cdrom_1_mode_sense.bin"), L"wb");
f = plat_fopen(nvr_path(L"cdrom_1_mode_sense.bin"), L"wb");
break;
case 1:
f = _wfopen(nvr_path(L"cdrom_2_mode_sense.bin"), L"wb");
f = plat_fopen(nvr_path(L"cdrom_2_mode_sense.bin"), L"wb");
break;
case 2:
f = _wfopen(nvr_path(L"cdrom_3_mode_sense.bin"), L"wb");
f = plat_fopen(nvr_path(L"cdrom_3_mode_sense.bin"), L"wb");
break;
case 3:
f = _wfopen(nvr_path(L"cdrom_4_mode_sense.bin"), L"wb");
f = plat_fopen(nvr_path(L"cdrom_4_mode_sense.bin"), L"wb");
break;
default:
return;

View File

@@ -20,7 +20,10 @@
#define _LARGEFILE_SOURCE
#define _LARGEFILE64_SOURCE
#define _GNU_SOURCE
#ifdef WIN32
//FIXME: should not be needed. */
# define _GNU_SOURCE
#endif
#include <stdio.h>
#include <cctype>

View File

@@ -9,9 +9,10 @@
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
#include <wchar.h>
#include "../config.h"
#include "../plat.h"
#include "cdrom_dosbox.h"
#include "cdrom.h"
#include "cdrom_image.h"
@@ -990,10 +991,10 @@ int image_open(uint8_t id, wchar_t *fn)
if (!cdrom_image[id].image_inited || cdrom_image[id].image_changed)
{
_swprintf(cdrom_image[id].image_path, L"%ws", fn);
swprintf(cdrom_image[id].image_path, sizeof(cdrom_image[id].image_path)/sizeof(wchar_t), L"%ws", fn);
}
if (!wcsicmp(get_extension_w(fn), L"ISO"))
if (! wcscasecmp(get_extension_w(fn), L"ISO"))
{
cdrom_image[id].image_is_iso = 1;
}