Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
PUAE
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
PUAE
Commits
f18dcf46
Commit
f18dcf46
authored
May 08, 2011
by
CeRiAl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CYGWIN: Fixed compilation for cygwin (first steps in direction of wince build)
parent
41090d16
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
678 additions
and
133 deletions
+678
-133
build_cygwin_nojit.sh
build_cygwin_nojit.sh
+19
-0
configure.in
configure.in
+2
-1
custom.c
src/custom.c
+2
-1
debug.c
src/debug.c
+3
-3
fpp.c
src/fpp.c
+1
-1
fsdb.c
src/fsdb.c
+1
-1
hardfile.c
src/hardfile.c
+6
-0
bsdsocket.h
src/include/bsdsocket.h
+1
-1
cpummu.h
src/include/cpummu.h
+1
-1
newcpu.h
src/include/newcpu.h
+1
-1
picasso96.h
src/include/picasso96.h
+1
-1
inputrecord.c
src/inputrecord.c
+4
-0
main.c
src/main.c
+4
-4
m68kops.h
src/md-i386-gcc/m68kops.h
+1
-1
misc.c
src/misc.c
+75
-69
newcpu.c
src/newcpu.c
+2
-0
Makefile.am
src/od-win32/Makefile.am
+1
-1
fsdb_win32.c
src/od-win32/fsdb_win32.c
+22
-1
hardfile_win32.c
src/od-win32/hardfile_win32.c
+402
-38
main.c
src/od-win32/main.c
+4
-2
parser.c
src/od-win32/parser.c
+101
-0
writelog.c
src/od-win32/writelog.c
+17
-1
zfile.c
src/zfile.c
+6
-4
zfile_archive.c
src/zfile_archive.c
+1
-1
No files found.
build_cygwin_nojit.sh
0 → 100644
View file @
f18dcf46
# P-UAE
#
# 2006-2011 Mustafa TUFAN (aka GnoStiC/BRONX)
#
#
#
base
=
" --with-sdl --with-sdl-gfx --with-sdl-sound --enable-drvsnd "
cd32
=
" --enable-cd32 "
a600
=
" --enable-gayle "
#scsi=" --enable-scsi-device --enable-ncr --enable-a2091 "
scsi
=
""
other
=
" --with-caps --enable-amax --disable-jit"
#
#
./bootstrap.sh
./configure
$base
$cd32
$a600
$scsi
$other
CFLAGS
=
"-D_WIN32 -mno-cygwin -mwindows"
CPPFLAGS
=
"-D_WIN32 -mno-cygwin -mwindows"
LDFLAGS
=
"-D_WIN32 -mno-cygwin -mwindows"
make clean
make
configure.in
View file @
f18dcf46
...
@@ -373,7 +373,7 @@ case $host_os in
...
@@ -373,7 +373,7 @@ case $host_os in
HOST_OS=aros
HOST_OS=aros
OSDEP=od-amiga
OSDEP=od-amiga
;;
;;
mingw32*)
cygwin |
mingw32*)
HOST_OS=win32
HOST_OS=win32
OSDEP=od-win32
OSDEP=od-win32
esac
esac
...
@@ -633,6 +633,7 @@ else if [[ "$OSDEP" = "od-win32" ]]; then
...
@@ -633,6 +633,7 @@ else if [[ "$OSDEP" = "od-win32" ]]; then
TARGET=win32
TARGET=win32
TARGETDEP=t-win32.h
TARGETDEP=t-win32.h
WANT_BSDSOCK=no
WANT_BSDSOCK=no
MATHLIB=""
fi
fi
fi
fi
fi
fi
...
...
src/custom.c
View file @
f18dcf46
...
@@ -5754,13 +5754,14 @@ static void hsync_handler_post (bool isvsync)
...
@@ -5754,13 +5754,14 @@ static void hsync_handler_post (bool isvsync)
}
}
}
}
#endif
#endif
#ifdef BSDSOCKET
{
{
extern
void
bsdsock_fake_int_handler
(
void
);
extern
void
bsdsock_fake_int_handler
(
void
);
extern
int
volatile
bsd_int_requested
;
extern
int
volatile
bsd_int_requested
;
if
(
bsd_int_requested
)
if
(
bsd_int_requested
)
bsdsock_fake_int_handler
();
bsdsock_fake_int_handler
();
}
}
#endif
plfstrt_sprite
=
plfstrt
;
plfstrt_sprite
=
plfstrt
;
/* See if there's a chance of a copper wait ending this line. */
/* See if there's a chance of a copper wait ending this line. */
...
...
src/debug.c
View file @
f18dcf46
...
@@ -65,7 +65,7 @@ extern int inputdevice_logging;
...
@@ -65,7 +65,7 @@ extern int inputdevice_logging;
static
FILE
*
logfile
;
static
FILE
*
logfile
;
#if
ndef _WIN32
#if
defined(__MINGW32__) || !defined(_WIN32)
#define console_out printf
#define console_out printf
#define console_flush() fflush( stdout )
#define console_flush() fflush( stdout )
#define console_get( input, len ) fgets( input, len, stdin )
#define console_get( input, len ) fgets( input, len, stdin )
...
@@ -3307,7 +3307,7 @@ static bool debug_line (TCHAR *input)
...
@@ -3307,7 +3307,7 @@ static bool debug_line (TCHAR *input)
}
else
if
(
*
inptr
==
't'
)
{
}
else
if
(
*
inptr
==
't'
)
{
next_char
(
&
inptr
);
next_char
(
&
inptr
);
debugtest_set
(
&
inptr
);
debugtest_set
(
&
inptr
);
#if
def _WIN32
#if
defined(_WIN32) && !defined(__MINGW32__)
}
else
if
(
*
inptr
==
'g'
)
{
}
else
if
(
*
inptr
==
'g'
)
{
extern
void
update_disassembly
(
uae_u32
);
extern
void
update_disassembly
(
uae_u32
);
next_char
(
&
inptr
);
next_char
(
&
inptr
);
...
@@ -3476,7 +3476,7 @@ static bool debug_line (TCHAR *input)
...
@@ -3476,7 +3476,7 @@ static bool debug_line (TCHAR *input)
{
{
uae_u32
maddr
;
uae_u32
maddr
;
int
lines
;
int
lines
;
#if
def _WIN32
#if
defined(_WIN32) && !defined(__MINGW32__)
if
(
*
inptr
==
'g'
)
{
if
(
*
inptr
==
'g'
)
{
extern
void
update_memdump
(
uae_u32
);
extern
void
update_memdump
(
uae_u32
);
next_char
(
&
inptr
);
next_char
(
&
inptr
);
...
...
src/fpp.c
View file @
f18dcf46
...
@@ -115,7 +115,7 @@ float fp_1e0 = 1, fp_1e1 = 10, fp_1e2 = 100, fp_1e4 = 10000;
...
@@ -115,7 +115,7 @@ float fp_1e0 = 1, fp_1e1 = 10, fp_1e2 = 100, fp_1e4 = 10000;
static
__inline__
void
native_set_fpucw
(
uae_u32
m68k_cw
)
static
__inline__
void
native_set_fpucw
(
uae_u32
m68k_cw
)
{
{
#if
def _WIN32
#if
defined(_WIN32) && !defined(__MINGW32__)
// RN, RZ, RM, RP
// RN, RZ, RM, RP
static
unsigned
int
fp87_round
[
4
]
=
{
_RC_NEAR
,
_RC_CHOP
,
_RC_DOWN
,
_RC_UP
};
static
unsigned
int
fp87_round
[
4
]
=
{
_RC_NEAR
,
_RC_CHOP
,
_RC_DOWN
,
_RC_UP
};
// X, S, D, U
// X, S, D, U
...
...
src/fsdb.c
View file @
f18dcf46
...
@@ -44,7 +44,7 @@ TCHAR *nname_begin (TCHAR *nname)
...
@@ -44,7 +44,7 @@ TCHAR *nname_begin (TCHAR *nname)
return
nname
;
return
nname
;
}
}
#if
ndef _WIN32
#if
defined(__MINGW32__) || !defined(_WIN32)
/* Find the name REL in directory DIRNAME. If we find a file that
/* Find the name REL in directory DIRNAME. If we find a file that
* has exactly the same name, return REL. If we find a file that
* has exactly the same name, return REL. If we find a file that
* has the same name when compared case-insensitively, return a
* has the same name when compared case-insensitively, return a
...
...
src/hardfile.c
View file @
f18dcf46
...
@@ -371,6 +371,7 @@ static uae_u32 vhd_checksum (uae_u8 *p, int offset)
...
@@ -371,6 +371,7 @@ static uae_u32 vhd_checksum (uae_u8 *p, int offset)
return
~
sum
;
return
~
sum
;
}
}
#ifndef __MINGW32__
int
hdf_open
(
struct
hardfiledata
*
hfd
,
const
TCHAR
*
pname
)
int
hdf_open
(
struct
hardfiledata
*
hfd
,
const
TCHAR
*
pname
)
{
{
uae_u8
tmp
[
512
],
tmp2
[
512
];
uae_u8
tmp
[
512
],
tmp2
[
512
];
...
@@ -453,6 +454,7 @@ int hdf_dup (struct hardfiledata *dhfd, const struct hardfiledata *shfd)
...
@@ -453,6 +454,7 @@ int hdf_dup (struct hardfiledata *dhfd, const struct hardfiledata *shfd)
{
{
return
hdf_dup_target
(
dhfd
,
shfd
);
return
hdf_dup_target
(
dhfd
,
shfd
);
}
}
#endif
extern
int
get_guid_target
(
uae_u8
*
out
);
extern
int
get_guid_target
(
uae_u8
*
out
);
...
@@ -891,6 +893,7 @@ int hdf_read_rdb (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int le
...
@@ -891,6 +893,7 @@ int hdf_read_rdb (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int le
return
v
;
return
v
;
}
}
#ifndef __MINGW32__
int
hdf_read
(
struct
hardfiledata
*
hfd
,
void
*
buffer
,
uae_u64
offset
,
int
len
)
int
hdf_read
(
struct
hardfiledata
*
hfd
,
void
*
buffer
,
uae_u64
offset
,
int
len
)
{
{
int
v
;
int
v
;
...
@@ -906,6 +909,7 @@ int hdf_read (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len)
...
@@ -906,6 +909,7 @@ int hdf_read (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len)
hdf_byteswap
(
buffer
,
len
);
hdf_byteswap
(
buffer
,
len
);
return
v
;
return
v
;
}
}
#endif
static
int
hdf_write2
(
struct
hardfiledata
*
hfd
,
void
*
buffer
,
uae_u64
offset
,
int
len
)
static
int
hdf_write2
(
struct
hardfiledata
*
hfd
,
void
*
buffer
,
uae_u64
offset
,
int
len
)
{
{
...
@@ -917,6 +921,7 @@ static int hdf_write2 (struct hardfiledata *hfd, void *buffer, uae_u64 offset, i
...
@@ -917,6 +921,7 @@ static int hdf_write2 (struct hardfiledata *hfd, void *buffer, uae_u64 offset, i
return
hdf_write_target
(
hfd
,
buffer
,
offset
,
len
);
return
hdf_write_target
(
hfd
,
buffer
,
offset
,
len
);
}
}
#ifndef __MINGW32__
int
hdf_write
(
struct
hardfiledata
*
hfd
,
void
*
buffer
,
uae_u64
offset
,
int
len
)
int
hdf_write
(
struct
hardfiledata
*
hfd
,
void
*
buffer
,
uae_u64
offset
,
int
len
)
{
{
int
v
;
int
v
;
...
@@ -935,6 +940,7 @@ int hdf_write (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len)
...
@@ -935,6 +940,7 @@ int hdf_write (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len)
hdf_byteswap
(
buffer
,
len
);
hdf_byteswap
(
buffer
,
len
);
return
v
;
return
v
;
}
}
#endif
static
uae_u64
cmd_readx
(
struct
hardfiledata
*
hfd
,
uae_u8
*
dataptr
,
uae_u64
offset
,
uae_u64
len
)
static
uae_u64
cmd_readx
(
struct
hardfiledata
*
hfd
,
uae_u8
*
dataptr
,
uae_u64
offset
,
uae_u64
len
)
{
{
...
...
src/include/bsdsocket.h
View file @
f18dcf46
...
@@ -27,7 +27,7 @@ extern void deinit_socket_layer (void);
...
@@ -27,7 +27,7 @@ extern void deinit_socket_layer (void);
#define MAXADDRLEN 256
#define MAXADDRLEN 256
#if
def _WIN32
#if
defined(_WIN32) && !defined(__MINGW32__)
#define SOCKET_TYPE SOCKET
#define SOCKET_TYPE SOCKET
#else
#else
#define SOCKET_TYPE int
#define SOCKET_TYPE int
...
...
src/include/cpummu.h
View file @
f18dcf46
...
@@ -40,7 +40,7 @@
...
@@ -40,7 +40,7 @@
#define SAVE_EXCEPTION
#define SAVE_EXCEPTION
#define RESTORE_EXCEPTION
#define RESTORE_EXCEPTION
#if
def _WIN32
#if
defined(_WIN32) && !defined(__MINGW32__)
struct
m68k_exception
{
struct
m68k_exception
{
int
prb
;
int
prb
;
m68k_exception
(
int
exc
)
:
prb
(
exc
)
{}
m68k_exception
(
int
exc
)
:
prb
(
exc
)
{}
...
...
src/include/newcpu.h
View file @
f18dcf46
...
@@ -466,4 +466,4 @@ extern struct cpum2c m2cregs[];
...
@@ -466,4 +466,4 @@ extern struct cpum2c m2cregs[];
extern
bool
is_cpu_tracer
(
void
);
extern
bool
is_cpu_tracer
(
void
);
extern
bool
set_cpu_tracer
(
bool
force
);
extern
bool
set_cpu_tracer
(
bool
force
);
extern
bool
can_cpu_tracer
(
void
);
extern
bool
can_cpu_tracer
(
void
);
\ No newline at end of file
src/include/picasso96.h
View file @
f18dcf46
#if
def WIN32
#if
defined(_WIN32) && !defined(__MINGW32__)
#include "picasso96_win.h"
#include "picasso96_win.h"
...
...
src/inputrecord.c
View file @
f18dcf46
...
@@ -519,7 +519,11 @@ void inprec_close (bool clear)
...
@@ -519,7 +519,11 @@ void inprec_close (bool clear)
static
void
setwriteprotect
(
const
TCHAR
*
fname
,
bool
readonly
)
static
void
setwriteprotect
(
const
TCHAR
*
fname
,
bool
readonly
)
{
{
#ifdef __MINGW32__
struct
stat
st
;
#else
struct
stat64
st
;
struct
stat64
st
;
#endif
int
mode
,
oldmode
;
int
mode
,
oldmode
;
if
(
stat
(
fname
,
&
st
))
if
(
stat
(
fname
,
&
st
))
return
;
return
;
...
...
src/main.c
View file @
f18dcf46
...
@@ -444,7 +444,7 @@ void fixup_prefs (struct uae_prefs *p)
...
@@ -444,7 +444,7 @@ void fixup_prefs (struct uae_prefs *p)
#endif
#endif
#if !defined (SCSIEMU)
#if !defined (SCSIEMU)
p
->
scsi
=
0
;
p
->
scsi
=
0
;
#if
def _WIN32
#if
defined(_WIN32) && !defined(__MINGW32__)
p
->
win32_aspi
=
0
;
p
->
win32_aspi
=
0
;
#endif
#endif
#endif
#endif
...
@@ -811,7 +811,7 @@ void leave_program (void)
...
@@ -811,7 +811,7 @@ void leave_program (void)
do_leave_program
();
do_leave_program
();
}
}
#if (defined (_WIN32) || defined (_WIN64)) && !defined (NO_WIN32_EXCEPTION_HANDLER)
#if (defined (_WIN32) || defined (_WIN64)) && !defined (NO_WIN32_EXCEPTION_HANDLER)
&& !defined(__MINGW32__)
#ifndef JIT
#ifndef JIT
extern
int
DummyException
(
LPEXCEPTION_POINTERS
blah
,
int
n_except
)
extern
int
DummyException
(
LPEXCEPTION_POINTERS
blah
,
int
n_except
)
{
{
...
@@ -822,7 +822,7 @@ extern int DummyException (LPEXCEPTION_POINTERS blah, int n_except)
...
@@ -822,7 +822,7 @@ extern int DummyException (LPEXCEPTION_POINTERS blah, int n_except)
static
int
real_main2
(
int
argc
,
TCHAR
**
argv
)
static
int
real_main2
(
int
argc
,
TCHAR
**
argv
)
{
{
#if (defined (_WIN32) || defined (_WIN64)) && !defined (NO_WIN32_EXCEPTION_HANDLER)
#if (defined (_WIN32) || defined (_WIN64)) && !defined (NO_WIN32_EXCEPTION_HANDLER)
&& !defined(__MINGW32__)
extern
int
EvalException
(
LPEXCEPTION_POINTERS
blah
,
int
n_except
);
extern
int
EvalException
(
LPEXCEPTION_POINTERS
blah
,
int
n_except
);
__try
__try
#endif
#endif
...
@@ -975,7 +975,7 @@ static int real_main2 (int argc, TCHAR **argv)
...
@@ -975,7 +975,7 @@ static int real_main2 (int argc, TCHAR **argv)
}
}
}
}
#if (defined (_WIN32) || defined (_WIN64)) && !defined (NO_WIN32_EXCEPTION_HANDLER)
#if (defined (_WIN32) || defined (_WIN64)) && !defined (NO_WIN32_EXCEPTION_HANDLER)
&& !defined(__MINGW32__)
#ifdef JIT
#ifdef JIT
__except
(
EvalException
(
GetExceptionInformation
(),
GetExceptionCode
()
)
)
__except
(
EvalException
(
GetExceptionInformation
(),
GetExceptionCode
()
)
)
#else
#else
...
...
src/md-i386-gcc/m68kops.h
View file @
f18dcf46
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
*/
*/
/* Is there any way to do this without declaring *all* memory clobbered?
/* Is there any way to do this without declaring *all* memory clobbered?
I.e. any way to tell gcc that some byte-sized value is in %al? */
I.e. any way to tell gcc that some byte-sized value is in %al? */
#if
def __APPLE__
#if
defined(__APPLE__) || defined(_WIN32)
#define optflag_testl(v) \
#define optflag_testl(v) \
__asm__ __volatile__ ("andl %0,%0\n\t" \
__asm__ __volatile__ ("andl %0,%0\n\t" \
"lahf\n\t" \
"lahf\n\t" \
...
...
src/misc.c
View file @
f18dcf46
...
@@ -39,6 +39,10 @@ static int logging_started;
...
@@ -39,6 +39,10 @@ static int logging_started;
#define LOG_BOOT "puae_bootlog.txt"
#define LOG_BOOT "puae_bootlog.txt"
#define LOG_NORMAL "puae_log.txt"
#define LOG_NORMAL "puae_log.txt"
#ifdef __MINGW32__
#define lstat stat
#endif
static
int
tablet
;
static
int
tablet
;
static
int
axmax
,
aymax
,
azmax
;
static
int
axmax
,
aymax
,
azmax
;
static
int
xmax
,
ymax
,
zmax
;
static
int
xmax
,
ymax
,
zmax
;
...
@@ -334,7 +338,7 @@ static int driveclick_fdrawcmd_init(int drive)
...
@@ -334,7 +338,7 @@ static int driveclick_fdrawcmd_init(int drive)
// win32
// win32
uae_u32
emulib_target_getcpurate
(
uae_u32
v
,
uae_u32
*
low
)
uae_u32
emulib_target_getcpurate
(
uae_u32
v
,
uae_u32
*
low
)
{
{
#if
def _WIN32
#if
defined(_WIN32) && !defined(__MINGW32__)
*
low
=
0
;
*
low
=
0
;
if
(
v
==
1
)
{
if
(
v
==
1
)
{
LARGE_INTEGER
pf
;
LARGE_INTEGER
pf
;
...
@@ -552,7 +556,77 @@ char *ua_copy (char *dst, int maxlen, const char *src)
...
@@ -552,7 +556,77 @@ char *ua_copy (char *dst, int maxlen, const char *src)
return
dst
;
return
dst
;
}
}
TCHAR
start_path_data
[
MAX_DPATH
];
void
fetch_path
(
TCHAR
*
name
,
TCHAR
*
out
,
int
size
)
{
int
size2
=
size
;
_tcscpy
(
start_path_data
,
"./"
);
_tcscpy
(
out
,
start_path_data
);
if
(
!
name
)
return
;
/* if (!_tcscmp (name, "FloppyPath"))
_tcscat (out, "../shared/adf/");
if (!_tcscmp (name, "CDPath"))
_tcscat (out, "../shared/cd/");
if (!_tcscmp (name, "hdfPath"))
_tcscat (out, "../shared/hdf/");
if (!_tcscmp (name, "KickstartPath"))
_tcscat (out, "../shared/rom/");
if (!_tcscmp (name, "ConfigurationPath"))
_tcscat (out, "Configurations/");
*/
if
(
!
_tcscmp
(
name
,
"FloppyPath"
))
_tcscat
(
out
,
"./"
);
if
(
!
_tcscmp
(
name
,
"CDPath"
))
_tcscat
(
out
,
"./"
);
if
(
!
_tcscmp
(
name
,
"hdfPath"
))
_tcscat
(
out
,
"./"
);
if
(
!
_tcscmp
(
name
,
"KickstartPath"
))
_tcscat
(
out
,
"./"
);
if
(
!
_tcscmp
(
name
,
"ConfigurationPath"
))
_tcscat
(
out
,
"./"
);
}
// win32gui
// win32gui
void
fetch_saveimagepath
(
TCHAR
*
out
,
int
size
,
int
dir
)
{
/* assert (size > MAX_DPATH);
fetch_path ("SaveimagePath", out, size);
if (dir) {
out[_tcslen (out) - 1] = 0;
createdir (out);*/
fetch_path
(
"SaveimagePath"
,
out
,
size
);
// }
}
void
fetch_configurationpath
(
TCHAR
*
out
,
int
size
)
{
fetch_path
(
"ConfigurationPath"
,
out
,
size
);
}
void
fetch_screenshotpath
(
TCHAR
*
out
,
int
size
)
{
fetch_path
(
"ScreenshotPath"
,
out
,
size
);
}
void
fetch_ripperpath
(
TCHAR
*
out
,
int
size
)
{
fetch_path
(
"RipperPath"
,
out
,
size
);
}
void
fetch_statefilepath
(
TCHAR
*
out
,
int
size
)
{
fetch_path
(
"StatefilePath"
,
out
,
size
);
}
void
fetch_inputfilepath
(
TCHAR
*
out
,
int
size
)
{
fetch_path
(
"InputPath"
,
out
,
size
);
}
void
fetch_datapath
(
TCHAR
*
out
,
int
size
)
{
fetch_path
(
NULL
,
out
,
size
);
}
static
int
qs_override
;
static
int
qs_override
;
int
target_cfgfile_load
(
struct
uae_prefs
*
p
,
char
*
filename
,
int
type
,
int
isdefault
)
int
target_cfgfile_load
(
struct
uae_prefs
*
p
,
char
*
filename
,
int
type
,
int
isdefault
)
...
@@ -820,74 +894,6 @@ void target_fixup_options (struct uae_prefs *p)
...
@@ -820,74 +894,6 @@ void target_fixup_options (struct uae_prefs *p)
#endif
#endif
}
}
TCHAR
start_path_data
[
MAX_DPATH
];
void
fetch_path
(
TCHAR
*
name
,
TCHAR
*
out
,
int
size
)
{
int
size2
=
size
;
_tcscpy
(
start_path_data
,
"./"
);
_tcscpy
(
out
,
start_path_data
);
if
(
!
name
)
return
;
/* if (!_tcscmp (name, "FloppyPath"))
_tcscat (out, "../shared/adf/");
if (!_tcscmp (name, "CDPath"))
_tcscat (out, "../shared/cd/");
if (!_tcscmp (name, "hdfPath"))
_tcscat (out, "../shared/hdf/");
if (!_tcscmp (name, "KickstartPath"))
_tcscat (out, "../shared/rom/");
if (!_tcscmp (name, "ConfigurationPath"))
_tcscat (out, "Configurations/");
*/
if
(
!
_tcscmp
(
name
,
"FloppyPath"
))
_tcscat
(
out
,
"./"
);
if
(
!
_tcscmp
(
name
,
"CDPath"
))
_tcscat
(
out
,
"./"
);
if
(
!
_tcscmp
(
name
,
"hdfPath"
))
_tcscat
(
out
,
"./"
);
if
(
!
_tcscmp
(
name
,
"KickstartPath"
))
_tcscat
(
out
,
"./"
);
if
(
!
_tcscmp
(
name
,
"ConfigurationPath"
))
_tcscat
(
out
,
"./"
);
}
void
fetch_saveimagepath
(
TCHAR
*
out
,
int
size
,
int
dir
)
{
/* assert (size > MAX_DPATH);
fetch_path ("SaveimagePath", out, size);
if (dir) {
out[_tcslen (out) - 1] = 0;
createdir (out);*/
fetch_path
(
"SaveimagePath"
,
out
,
size
);
// }
}
void
fetch_configurationpath
(
TCHAR
*
out
,
int
size
)
{
fetch_path
(
"ConfigurationPath"
,
out
,
size
);
}
void
fetch_screenshotpath
(
TCHAR
*
out
,
int
size
)
{
fetch_path
(
"ScreenshotPath"
,
out
,
size
);
}
void
fetch_ripperpath
(
TCHAR
*
out
,
int
size
)
{
fetch_path
(
"RipperPath"
,
out
,
size
);
}
void
fetch_statefilepath
(
TCHAR
*
out
,
int
size
)
{
fetch_path
(
"StatefilePath"
,
out
,
size
);
}
void
fetch_inputfilepath
(
TCHAR
*
out
,
int
size
)
{
fetch_path
(
"InputPath"
,
out
,
size
);
}
void
fetch_datapath
(
TCHAR
*
out
,
int
size
)
{
fetch_path
(
NULL
,
out
,
size
);
}
// convert path to absolute or relative
// convert path to absolute or relative
void
fullpath
(
TCHAR
*
path
,
int
size
)
void
fullpath
(
TCHAR
*
path
,
int
size
)
{
{
...
...
src/newcpu.c
View file @
f18dcf46
...
@@ -3234,12 +3234,14 @@ STATIC_INLINE int do_specialties (int cycles)
...
@@ -3234,12 +3234,14 @@ STATIC_INLINE int do_specialties (int cycles)
}
}
}
}
#endif
#endif
#ifdef BSDSOCKET
{
{
extern
void
bsdsock_fake_int_handler
(
void
);
extern
void
bsdsock_fake_int_handler
(
void
);
extern
int
volatile
bsd_int_requested
;
extern
int
volatile
bsd_int_requested
;
if
(
bsd_int_requested
)
if
(
bsd_int_requested
)
bsdsock_fake_int_handler
();
bsdsock_fake_int_handler
();
}
}
#endif
if
(
cpu_tracer
>
0
)
{
if
(
cpu_tracer
>
0
)
{
cputrace
.
stopped
=
regs
.
stopped
;
cputrace
.
stopped
=
regs
.
stopped
;
...
...
src/od-win32/Makefile.am
View file @
f18dcf46
...
@@ -5,6 +5,6 @@ AM_CFLAGS = @UAE_CFLAGS@
...
@@ -5,6 +5,6 @@ AM_CFLAGS = @UAE_CFLAGS@
noinst_LIBRARIES
=
libosdep.a
noinst_LIBRARIES
=
libosdep.a
libosdep_a_SOURCES
=
main.c memory.c posixemu.c writelog.c fsdb_win32.c
\
libosdep_a_SOURCES
=
main.c memory.c posixemu.c writelog.c fsdb_win32.c
\
hardfile_win32.c bsdsock.c
hardfile_win32.c bsdsock.c
parser.c
noinst_HEADERS
=
memory.h hrtimer.h posixemu.h
noinst_HEADERS
=
memory.h hrtimer.h posixemu.h
src/od-win32/fsdb_win32.c
View file @
f18dcf46
...
@@ -129,7 +129,7 @@ int fsdb_set_file_attrs (a_inode *aino)
...
@@ -129,7 +129,7 @@ int fsdb_set_file_attrs (a_inode *aino)
/* Return nonzero if we can represent the amigaos_mode of AINO within the
/* Return nonzero if we can represent the amigaos_mode of AINO within the
* native FS. Return zero if that is not possible. */
* native FS. Return zero if that is not possible. */
int
fsdb_mode_representable_p
(
const
a_inode
*
aino
)
int
fsdb_mode_representable_p
(
const
a_inode
*
aino
,
int
dummy
)
{
{
int
mask
=
aino
->
amigaos_mode
;
int
mask
=
aino
->
amigaos_mode
;
int
m1
;
int
m1
;
...
@@ -225,4 +225,25 @@ int dos_errno (void)
...
@@ -225,4 +225,25 @@ int dos_errno (void)
return
ERROR_NOT_IMPLEMENTED
;
return
ERROR_NOT_IMPLEMENTED
;
}
}
}
}
/* return supported combination */
int
fsdb_mode_supported
(
const
a_inode
*
aino
)
{
int
mask
=
aino
->
amigaos_mode
;
if
(
0
&&
aino
->
dir
)
return
0
;
if
(
fsdb_mode_representable_p
(
aino
,
mask
))
return
mask
;
mask
&=
~
(
A_FIBF_SCRIPT
|
A_FIBF_READ
|
A_FIBF_EXECUTE
);
if
(
fsdb_mode_representable_p
(
aino
,
mask
))
return
mask
;
mask
&=
~
A_FIBF_WRITE
;
if
(
fsdb_mode_representable_p
(
aino
,
mask
))
return
mask
;
mask
&=
~
A_FIBF_DELETE
;
if
(
fsdb_mode_representable_p
(
aino
,
mask
))
return
mask
;
return
0
;
}
#endif
#endif
src/od-win32/hardfile_win32.c
View file @
f18dcf46
...
@@ -5,12 +5,15 @@
...
@@ -5,12 +5,15 @@
#include "sysconfig.h"
#include "sysconfig.h"
#include "sysdeps.h"
#include "sysdeps.h"
#include "zfile.h"
#include "options.h"
#include "threaddep/thread.h"
#include "threaddep/thread.h"
#include "filesys.h"
#include "filesys.h"
#include "blkdev.h"
#include "blkdev.h"
#define hfd_log write_log
#define hfd_log write_log
#include <windef.h>
#include <windef.h>
#include <winbase.h>
#include <winbase.h>
...
@@ -24,20 +27,42 @@
...
@@ -24,20 +27,42 @@
#include <cfgmgr32.h> // for SetupDiXxx functions.
#include <cfgmgr32.h> // for SetupDiXxx functions.
#endif
#endif
struct
hardfilehandle
{
int
zfile
;
struct
zfile
*
zf
;
FILE
*
h
;
};
struct
uae_driveinfo
{
struct
uae_driveinfo
{
uae_u64
offset2
;
char
vendor_id
[
128
];
uae_u64
size2
;
char
product_id
[
128
];
char
vendor_id
[
128
];
char
product_rev
[
128
];
char
product_id
[
128
];
char
product_serial
[
128
];
char
product_rev
[
128
];
char
device_name
[
2048
];
char
product_serial
[
128
];
char
device_path
[
2048
];
char
device_name
[
256
];
uae_u64
size
;
char
device_path
[
2048
];
uae_u64
offset
;
uae_u64
size
;
int
bytespersector
;
uae_u64
offset
;
int
removablemedia
;
int
bytespersector
;
int
nomedia
;
int
dangerous
;
int
readonly
;
};
};
#define HDF_HANDLE_WIN32 1
#define HDF_HANDLE_ZFILE 2
#define HDF_HANDLE_LINUX 3
#define INVALID_HANDLE_VALUE NULL
#define CACHE_SIZE 16384
#define CACHE_FLUSH_TIME 5
/* safety check: only accept drives that:
* - contain RDSK in block 0
* - block 0 is zeroed
*/
#define CACHE_SIZE 16384
#define CACHE_SIZE 16384
#define CACHE_FLUSH_TIME 5
#define CACHE_FLUSH_TIME 5
...
@@ -50,31 +75,30 @@ int harddrive_dangerous, do_rdbdump;
...
@@ -50,31 +75,30 @@ int harddrive_dangerous, do_rdbdump;
static
int
num_drives
;
static
int
num_drives
;
static
struct
uae_driveinfo
uae_drives
[
MAX_FILESYSTEM_UNITS
];
static
struct
uae_driveinfo
uae_drives
[
MAX_FILESYSTEM_UNITS
];
static
void
rdbdump
(
HANDLE
*
h
,
uae_u64
offset
,
uae_u8
*
buf
,
unsigned
int
blocksize
)
static
void
rdbdump
(
FILE
*
h
,
uae_u64
offset
,
uae_u8
*
buf
,
int
blocksize
)
{
{
static
int
cnt
=
1
;
static
int
cnt
=
1
;
int
i
,
blocks
;
int
i
,
blocks
;
char
name
[
100
];
char
name
[
100
];
FILE
*
f
;
FILE
*
f
;
blocks
=
(
buf
[
132
]
<<
24
)
|
(
buf
[
133
]
<<
16
)
|
(
buf
[
134
]
<<
8
)
|
(
buf
[
135
]
<<
0
);
blocks
=
(
buf
[
132
]
<<
24
)
|
(
buf
[
133
]
<<
16
)
|
(
buf
[
134
]
<<
8
)
|
(
buf
[
135
]
<<
0
);
if
(
blocks
<
0
||
blocks
>
100000
)
if
(
blocks
<
0
||
blocks
>
100000
)
return
;
return
;
sprintf
(
name
,
"rdb_dump_%d.rdb"
,
cnt
);
_stprintf
(
name
,
"rdb_dump_%d.rdb"
,
cnt
);
f
=
fopen
(
name
,
"wb"
);
f
=
fopen
(
name
,
"wb"
);
if
(
!
f
)
if
(
!
f
)
return
;
return
;
for
(
i
=
0
;
i
<=
blocks
;
i
++
)
{
for
(
i
=
0
;
i
<=
blocks
;
i
++
)
{
DWORD
outlen
,
high
;
long
outlen
;
high
=
(
DWORD
)(
offset
>>
32
);
if
(
fseek
(
h
,
(
long
)
offset
,
SEEK_SET
)
!=
0
)
if
(
SetFilePointer
(
h
,
(
DWORD
)
offset
,
&
high
,
FILE_BEGIN
)
==
INVALID_FILE_SIZE
)
break
;
break
;
outlen
=
fread
(
buf
,
1
,
blocksize
,
h
);
ReadFile
(
h
,
buf
,
blocksize
,
&
outlen
,
NULL
);
fwrite
(
buf
,
1
,
blocksize
,
f
);
fwrite
(
buf
,
1
,
blocksize
,
f
);
offset
+=
blocksize
;
offset
+=
blocksize
;
}
}
fclose
(
f
);
fclose
(
f
);
cnt
++
;
cnt
++
;
}
}
static
int
safetycheck
(
HANDLE
*
h
,
uae_u64
offset
,
uae_u8
*
buf
,
unsigned
int
blocksize
)
static
int
safetycheck
(
HANDLE
*
h
,
uae_u64
offset
,
uae_u8
*
buf
,
unsigned
int
blocksize
)
...
@@ -169,12 +193,15 @@ int hdf_open (struct hardfiledata *hfd, const char *name)
...
@@ -169,12 +193,15 @@ int hdf_open (struct hardfiledata *hfd, const char *name)
strncpy
(
hfd
->
vendor_id
,
udi
->
vendor_id
,
8
);
strncpy
(
hfd
->
vendor_id
,
udi
->
vendor_id
,
8
);
strncpy
(
hfd
->
product_id
,
udi
->
product_id
,
16
);
strncpy
(
hfd
->
product_id
,
udi
->
product_id
,
16
);
strncpy
(
hfd
->
product_rev
,
udi
->
product_rev
,
4
);
strncpy
(
hfd
->
product_rev
,
udi
->
product_rev
,
4
);
hfd
->
offset2
=
hfd
->
offset
=
udi
->
offset
;
//hfd->offset2 = hfd->offset = udi->offset;
hfd
->
offset
=
udi
->
offset
;
/*
hfd->size2 = hfd->size = udi->size;
hfd->size2 = hfd->size = udi->size;
if (hfd->offset != udi->offset2 || hfd->size != udi->size2) {
if (hfd->offset != udi->offset2 || hfd->size != udi->size2) {
gui_message ("Harddrive safety check: fatal memory corruption\n");
gui_message ("Harddrive safety check: fatal memory corruption\n");
abort ();
abort ();
}
}
*/
hfd
->
blocksize
=
udi
->
bytespersector
;
hfd
->
blocksize
=
udi
->
bytespersector
;
if
(
hfd
->
offset
==
0
)
{
if
(
hfd
->
offset
==
0
)
{
if
(
!
safetycheck
(
hfd
->
handle
,
0
,
hfd
->
cache
,
hfd
->
blocksize
))
{
if
(
!
safetycheck
(
hfd
->
handle
,
0
,
hfd
->
cache
,
hfd
->
blocksize
))
{
...
@@ -211,7 +238,7 @@ int hdf_open (struct hardfiledata *hfd, const char *name)
...
@@ -211,7 +238,7 @@ int hdf_open (struct hardfiledata *hfd, const char *name)
return
0
;
return
0
;
}
}
low
&=
~
(
hfd
->
blocksize
-
1
);
low
&=
~
(
hfd
->
blocksize
-
1
);
hfd
->
size
=
hfd
->
size2
=
((
uae_u64
)
high
<<
32
)
|
low
;
//
hfd->size = hfd->size2 = ((uae_u64)high << 32) | low;
}
else
{
}
else
{
write_log
(
"HDF '%s' failed to open. error = %d
\n
"
,
name
,
GetLastError
());
write_log
(
"HDF '%s' failed to open. error = %d
\n
"
,
name
,
GetLastError
());
}
}
...
@@ -260,6 +287,7 @@ static int hdf_seek (struct hardfiledata *hfd, uae_u64 offset)
...
@@ -260,6 +287,7 @@ static int hdf_seek (struct hardfiledata *hfd, uae_u64 offset)
{
{
DWORD
high
,
ret
;
DWORD
high
,
ret
;
/*
if (hfd->offset != hfd->offset2 || hfd->size != hfd->size2) {
if (hfd->offset != hfd->offset2 || hfd->size != hfd->size2) {
gui_message ("hd: memory corruption detected in seek");
gui_message ("hd: memory corruption detected in seek");
abort ();
abort ();
...
@@ -268,6 +296,7 @@ static int hdf_seek (struct hardfiledata *hfd, uae_u64 offset)
...
@@ -268,6 +296,7 @@ static int hdf_seek (struct hardfiledata *hfd, uae_u64 offset)
gui_message ("hd: tried to seek out of bounds! (%I64X >= %I64X)\n", offset, hfd->size);
gui_message ("hd: tried to seek out of bounds! (%I64X >= %I64X)\n", offset, hfd->size);
abort ();
abort ();
}
}
*/
offset
+=
hfd
->
offset
;
offset
+=
hfd
->
offset
;
if
(
offset
&
(
hfd
->
blocksize
-
1
))
{
if
(
offset
&
(
hfd
->
blocksize
-
1
))
{
gui_message
(
"hd: poscheck failed, offset not aligned to blocksize! (%I64X & %04.4X = %04.4X)
\n
"
,
offset
,
hfd
->
blocksize
,
offset
&
(
hfd
->
blocksize
-
1
));
gui_message
(
"hd: poscheck failed, offset not aligned to blocksize! (%I64X & %04.4X = %04.4X)
\n
"
,
offset
,
hfd
->
blocksize
,
offset
&
(
hfd
->
blocksize
-
1
));
...
@@ -285,10 +314,12 @@ static void poscheck (struct hardfiledata *hfd, int len)
...
@@ -285,10 +314,12 @@ static void poscheck (struct hardfiledata *hfd, int len)
DWORD
high
,
ret
,
err
;
DWORD
high
,
ret
,
err
;
uae_u64
pos
;
uae_u64
pos
;
/*
if (hfd->offset != hfd->offset2 || hfd->size != hfd->size2) {
if (hfd->offset != hfd->offset2 || hfd->size != hfd->size2) {
gui_message ("hd: memory corruption detected in poscheck");
gui_message ("hd: memory corruption detected in poscheck");
abort ();
abort ();
}
}
*/
high
=
0
;
high
=
0
;
ret
=
SetFilePointer
(
hfd
->
handle
,
0
,
&
high
,
FILE_CURRENT
);
ret
=
SetFilePointer
(
hfd
->
handle
,
0
,
&
high
,
FILE_CURRENT
);
err
=
GetLastError
();
err
=
GetLastError
();
...
@@ -305,10 +336,12 @@ static void poscheck (struct hardfiledata *hfd, int len)
...
@@ -305,10 +336,12 @@ static void poscheck (struct hardfiledata *hfd, int len)
gui_message
(
"hd: poscheck failed, offset out of bounds! (%I64d < %I64d)"
,
pos
,
hfd
->
offset
);
gui_message
(
"hd: poscheck failed, offset out of bounds! (%I64d < %I64d)"
,
pos
,
hfd
->
offset
);
abort
();
abort
();
}
}
/*
if (pos >= hfd->offset + hfd->size || pos >= hfd->offset + hfd->size + len) {
if (pos >= hfd->offset + hfd->size || pos >= hfd->offset + hfd->size + len) {
gui_message ("hd: poscheck failed, offset out of bounds! (%I64d >= %I64d, LEN=%d)", pos, hfd->offset + hfd->size, len);
gui_message ("hd: poscheck failed, offset out of bounds! (%I64d >= %I64d, LEN=%d)", pos, hfd->offset + hfd->size, len);
abort ();
abort ();
}
}
*/
if
(
pos
&
(
hfd
->
blocksize
-
1
))
{
if
(
pos
&
(
hfd
->
blocksize
-
1
))
{
gui_message
(
"hd: poscheck failed, offset not aligned to blocksize! (%I64X & %04.4X = %04.4X
\n
"
,
pos
,
hfd
->
blocksize
,
pos
&
hfd
->
blocksize
);
gui_message
(
"hd: poscheck failed, offset not aligned to blocksize! (%I64X & %04.4X = %04.4X
\n
"
,
pos
,
hfd
->
blocksize
,
pos
&
hfd
->
blocksize
);
abort
();
abort
();
...
@@ -366,8 +399,10 @@ int hdf_read (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len)
...
@@ -366,8 +399,10 @@ int hdf_read (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len)
return
len
;
return
len
;
}
}
hfd
->
cache_offset
=
offset
;
hfd
->
cache_offset
=
offset
;
/*
if (offset + CACHE_SIZE > hfd->offset + hfd->size)
if (offset + CACHE_SIZE > hfd->offset + hfd->size)
hfd->cache_offset = hfd->offset + hfd->size - CACHE_SIZE;
hfd->cache_offset = hfd->offset + hfd->size - CACHE_SIZE;
*/
hdf_seek
(
hfd
,
hfd
->
cache_offset
);
hdf_seek
(
hfd
,
hfd
->
cache_offset
);
poscheck
(
hfd
,
CACHE_SIZE
);
poscheck
(
hfd
,
CACHE_SIZE
);
ReadFile
(
hfd
->
handle
,
hfd
->
cache
,
CACHE_SIZE
,
&
outlen
,
NULL
);
ReadFile
(
hfd
->
handle
,
hfd
->
cache
,
CACHE_SIZE
,
&
outlen
,
NULL
);
...
@@ -769,7 +804,7 @@ int hdf_getnumharddrives (void)
...
@@ -769,7 +804,7 @@ int hdf_getnumharddrives (void)
return
num_drives
;
return
num_drives
;
}
}
char
*
hdf_getnameharddrive
(
int
index
,
int
flags
)
TCHAR
*
hdf_getnameharddrive
(
int
index
,
int
flags
,
int
*
sectorsize
,
int
*
dangerousdrive
)
{
{
static
char
name
[
512
];
static
char
name
[
512
];
char
tmp
[
32
];
char
tmp
[
32
];
...
@@ -786,4 +821,333 @@ char *hdf_getnameharddrive (int index, int flags)
...
@@ -786,4 +821,333 @@ char *hdf_getnameharddrive (int index, int flags)
return
uae_drives
[
index
].
device_name
;
return
uae_drives
[
index
].
device_name
;
}
}
static
TCHAR
*
hdz
[]
=
{
"hdz"
,
"zip"
,
"rar"
,
"7z"
,
NULL
};
int
hdf_open_target
(
struct
hardfiledata
*
hfd
,
const
char
*
pname
)
{
FILE
*
h
=
INVALID_HANDLE_VALUE
;
int
i
;
struct
uae_driveinfo
*
udi
;
char
*
name
=
strdup
(
pname
);
hfd
->
flags
=
0
;
hfd
->
drive_empty
=
0
;
hdf_close
(
hfd
);
hfd
->
cache
=
(
uae_u8
*
)
xmalloc
(
uae_u8
,
CACHE_SIZE
);
hfd
->
cache_valid
=
0
;
hfd
->
virtual_size
=
0
;
hfd
->
virtual_rdb
=
NULL
;
if
(
!
hfd
->
cache
)
{
write_log
(
"VirtualAlloc(%d) failed, error %d
\n
"
,
CACHE_SIZE
,
errno
);
goto
end
;
}
hfd
->
handle
=
xcalloc
(
struct
hardfilehandle
,
1
);
hfd
->
handle
->
h
=
INVALID_HANDLE_VALUE
;
hfd_log
(
"hfd open: '%s'
\n
"
,
name
);
if
(
_tcslen
(
name
)
>
4
&&
!
_tcsncmp
(
name
,
"HD_"
,
3
))
{
hdf_init_target
();
i
=
isharddrive
(
name
);
if
(
i
>=
0
)
{
long
r
;
udi
=
&
uae_drives
[
i
];
hfd
->
flags
=
HFD_FLAGS_REALDRIVE
;
if
(
udi
->
nomedia
)
hfd
->
drive_empty
=
-
1
;
if
(
udi
->
readonly
)
hfd
->
readonly
=
1
;
h
=
fopen
(
udi
->
device_path
,
hfd
->
readonly
?
"rb"
:
"r+b"
);
hfd
->
handle
->
h
=
h
;
if
(
h
==
INVALID_HANDLE_VALUE
)
goto
end
;
_tcsncpy
(
hfd
->
vendor_id
,
udi
->
vendor_id
,
8
);
_tcsncpy
(
hfd
->
product_id
,
udi
->
product_id
,
16
);
_tcsncpy
(
hfd
->
product_rev
,
udi
->
product_rev
,
4
);
hfd
->
offset
=
udi
->
offset
;
hfd
->
physsize
=
hfd
->
virtsize
=
udi
->
size
;
hfd
->
blocksize
=
udi
->
bytespersector
;
if
(
hfd
->
offset
==
0
&&
!
hfd
->
drive_empty
)
{
int
sf
=
safetycheck
(
hfd
->
handle
->
h
,
0
,
hfd
->
cache
,
hfd
->
blocksize
);
if
(
sf
>
0
)
goto
end
;
if
(
sf
==
0
&&
!
hfd
->
readonly
&&
harddrive_dangerous
!=
0x1234dead
)
{
write_log
(
"'%s' forced read-only, safetycheck enabled
\n
"
,
udi
->
device_path
);
hfd
->
dangerous
=
1
;
// clear GENERIC_WRITE
fclose
(
h
);
h
=
fopen
(
udi
->
device_path
,
"r+b"
);
hfd
->
handle
->
h
=
h
;
if
(
h
==
INVALID_HANDLE_VALUE
)
goto
end
;
}
}
hfd
->
handle_valid
=
HDF_HANDLE_LINUX
;
hfd
->
emptyname
=
strdup
(
name
);
}
else
{
hfd
->
flags
=
HFD_FLAGS_REALDRIVE
;
hfd
->
drive_empty
=
-
1
;
hfd
->
emptyname
=
strdup
(
name
);
}
}
else
{
int
zmode
=
0
;
char
*
ext
=
_tcsrchr
(
name
,
'.'
);
if
(
ext
!=
NULL
)
{
ext
++
;
for
(
i
=
0
;
hdz
[
i
];
i
++
)
{
if
(
!
_tcsicmp
(
ext
,
hdz
[
i
]))
zmode
=
1
;
}
}
h
=
fopen
(
name
,
hfd
->
readonly
?
"rb"
:
"r+b"
);
if
(
h
==
INVALID_HANDLE_VALUE
)
goto
end
;
hfd
->
handle
->
h
=
h
;
i
=
_tcslen
(
name
)
-
1
;
while
(
i
>=
0
)
{
if
((
i
>
0
&&
(
name
[
i
-
1
]
==
'/'
||
name
[
i
-
1
]
==
'\\'
))
||
i
==
0
)
{
_tcscpy
(
hfd
->
vendor_id
,
"UAE"
);
_tcsncpy
(
hfd
->
product_id
,
name
+
i
,
15
);
_tcscpy
(
hfd
->
product_rev
,
"0.3"
);
break
;
}
i
--
;
}
if
(
h
!=
INVALID_HANDLE_VALUE
)
{
size_t
ret
;
int
low
;
ret
=
fseek
(
h
,
0
,
SEEK_END
);
if
(
ret
)
goto
end
;
low
=
ftell
(
h
);
if
(
low
==
-
1
)
goto
end
;
low
&=
~
(
hfd
->
blocksize
-
1
);
hfd
->
physsize
=
hfd
->
virtsize
=
low
;
hfd
->
handle_valid
=
HDF_HANDLE_LINUX
;
if
(
hfd
->
physsize
<
64
*
1024
*
1024
&&
zmode
)
{
write_log
(
"HDF '%s' re-opened in zfile-mode
\n
"
,
name
);
fclose
(
h
);
hfd
->
handle
->
h
=
INVALID_HANDLE_VALUE
;
hfd
->
handle
->
zf
=
zfile_fopen
(
name
,
hfd
->
readonly
?
"rb"
:
"r+b"
,
ZFD_NORMAL
);
hfd
->
handle
->
zfile
=
1
;
if
(
!
h
)
goto
end
;
zfile_fseek
(
hfd
->
handle
->
zf
,
0
,
SEEK_END
);
hfd
->
physsize
=
hfd
->
virtsize
=
zfile_ftell
(
hfd
->
handle
->
zf
);
zfile_fseek
(
hfd
->
handle
->
zf
,
0
,
SEEK_SET
);
hfd
->
handle_valid
=
HDF_HANDLE_ZFILE
;
}
}
else
{
write_log
(
"HDF '%s' failed to open. error = %d
\n
"
,
name
,
errno
);
}
}
if
(
hfd
->
handle_valid
||
hfd
->
drive_empty
)
{
hfd_log
(
"HDF '%s' opened, size=%dK mode=%d empty=%d
\n
"
,
name
,
hfd
->
physsize
/
1024
,
hfd
->
handle_valid
,
hfd
->
drive_empty
);
return
1
;
}
end:
hdf_close
(
hfd
);
xfree
(
name
);
return
0
;
}
static
int
hdf_read_2
(
struct
hardfiledata
*
hfd
,
void
*
buffer
,
uae_u64
offset
,
int
len
)
{
long
outlen
=
0
;
int
coffset
;
if
(
offset
==
0
)
hfd
->
cache_valid
=
0
;
coffset
=
isincache
(
hfd
,
offset
,
len
);
if
(
coffset
>=
0
)
{
memcpy
(
buffer
,
hfd
->
cache
+
coffset
,
len
);
return
len
;
}
hfd
->
cache_offset
=
offset
;
if
(
offset
+
CACHE_SIZE
>
hfd
->
offset
+
(
hfd
->
physsize
-
hfd
->
virtual_size
))
hfd
->
cache_offset
=
hfd
->
offset
+
(
hfd
->
physsize
-
hfd
->
virtual_size
)
-
CACHE_SIZE
;
hdf_seek
(
hfd
,
hfd
->
cache_offset
);
poscheck
(
hfd
,
CACHE_SIZE
);
if
(
hfd
->
handle_valid
==
HDF_HANDLE_LINUX
)
outlen
=
fread
(
hfd
->
cache
,
1
,
CACHE_SIZE
,
hfd
->
handle
->
h
);
else
if
(
hfd
->
handle_valid
==
HDF_HANDLE_ZFILE
)
outlen
=
zfile_fread
(
hfd
->
cache
,
1
,
CACHE_SIZE
,
hfd
->
handle
->
zf
);
hfd
->
cache_valid
=
0
;
if
(
outlen
!=
CACHE_SIZE
)
return
0
;
hfd
->
cache_valid
=
1
;
coffset
=
isincache
(
hfd
,
offset
,
len
);
if
(
coffset
>=
0
)
{
memcpy
(
buffer
,
hfd
->
cache
+
coffset
,
len
);
return
len
;
}
write_log
(
"hdf_read: cache bug! offset=0x%llx len=%d
\n
"
,
offset
,
len
);
hfd
->
cache_valid
=
0
;
return
0
;
}
int
hdf_read_target
(
struct
hardfiledata
*
hfd
,
void
*
buffer
,
uae_u64
offset
,
int
len
)
{
int
got
=
0
;
uae_u8
*
p
=
(
uae_u8
*
)
buffer
;
if
(
hfd
->
drive_empty
)
return
0
;
if
(
offset
<
hfd
->
virtual_size
)
{
uae_u64
len2
=
offset
+
(
unsigned
)
len
<=
hfd
->
virtual_size
?
(
unsigned
)
len
:
hfd
->
virtual_size
-
offset
;
if
(
!
hfd
->
virtual_rdb
)
return
0
;
memcpy
(
buffer
,
hfd
->
virtual_rdb
+
offset
,
len2
);
return
len2
;
}
offset
-=
hfd
->
virtual_size
;
while
(
len
>
0
)
{
unsigned
int
maxlen
;
size_t
ret
;
if
(
hfd
->
physsize
<
CACHE_SIZE
)
{
hfd
->
cache_valid
=
0
;
hdf_seek
(
hfd
,
offset
);
poscheck
(
hfd
,
len
);
if
(
hfd
->
handle_valid
==
HDF_HANDLE_LINUX
)
{
ret
=
fread
(
hfd
->
cache
,
1
,
len
,
hfd
->
handle
->
h
);
memcpy
(
buffer
,
hfd
->
cache
,
ret
);
}
else
if
(
hfd
->
handle_valid
==
HDF_HANDLE_ZFILE
)
{
ret
=
zfile_fread
(
buffer
,
1
,
len
,
hfd
->
handle
->
zf
);
}
maxlen
=
len
;
}
else
{
maxlen
=
len
>
CACHE_SIZE
?
CACHE_SIZE
:
len
;
ret
=
hdf_read_2
(
hfd
,
p
,
offset
,
maxlen
);
}
got
+=
ret
;
if
(
ret
!=
maxlen
)
return
got
;
offset
+=
maxlen
;
p
+=
maxlen
;
len
-=
maxlen
;
}
return
got
;
}
void
hdf_close_target
(
struct
hardfiledata
*
hfd
)
{
//freehandle (hfd->handle);
xfree
(
hfd
->
handle
);
xfree
(
hfd
->
emptyname
);
hfd
->
emptyname
=
NULL
;
hfd
->
handle
=
NULL
;
hfd
->
handle_valid
=
0
;
if
(
hfd
->
cache
)
xfree
(
hfd
->
cache
);
xfree
(
hfd
->
virtual_rdb
);
hfd
->
virtual_rdb
=
0
;
hfd
->
virtual_size
=
0
;
hfd
->
cache
=
0
;
hfd
->
cache_valid
=
0
;
hfd
->
drive_empty
=
0
;
hfd
->
dangerous
=
0
;
}
int
hdf_dup_target
(
struct
hardfiledata
*
dhfd
,
const
struct
hardfiledata
*
shfd
)
{
if
(
!
shfd
->
handle_valid
)
return
0
;
return
0
;
}
int
hdf_resize_target
(
struct
hardfiledata
*
hfd
,
uae_u64
newsize
)
{
int
err
=
0
;
write_log
(
"hdf_resize_target: SetEndOfFile() %d
\n
"
,
err
);
return
0
;
}
static
int
hdf_write_2
(
struct
hardfiledata
*
hfd
,
void
*
buffer
,
uae_u64
offset
,
int
len
)
{
long
outlen
=
0
;
if
(
hfd
->
readonly
)
return
0
;
if
(
hfd
->
dangerous
)
return
0
;
hfd
->
cache_valid
=
0
;
hdf_seek
(
hfd
,
offset
);
poscheck
(
hfd
,
len
);
memcpy
(
hfd
->
cache
,
buffer
,
len
);
if
(
hfd
->
handle_valid
==
HDF_HANDLE_LINUX
)
{
outlen
=
fwrite
(
hfd
->
cache
,
1
,
len
,
hfd
->
handle
->
h
);
if
(
offset
==
0
)
{
long
outlen2
;
uae_u8
*
tmp
;
int
tmplen
=
512
;
tmp
=
(
uae_u8
*
)
xmalloc
(
uae_u8
,
tmplen
);
if
(
tmp
)
{
memset
(
tmp
,
0xa1
,
tmplen
);
hdf_seek
(
hfd
,
offset
);
outlen2
=
fread
(
tmp
,
1
,
tmplen
,
hfd
->
handle
->
h
);
if
(
memcmp
(
hfd
->
cache
,
tmp
,
tmplen
)
!=
0
||
outlen
!=
len
)
gui_message
(
"Harddrive
\n
%s
\n
block zero write failed!"
,
hfd
->
device_name
);
xfree
(
tmp
);
}
}
}
else
if
(
hfd
->
handle_valid
==
HDF_HANDLE_ZFILE
)
{
outlen
=
zfile_fwrite
(
hfd
->
cache
,
1
,
len
,
hfd
->
handle
->
zf
);
}
return
outlen
;
}
int
hdf_write_target
(
struct
hardfiledata
*
hfd
,
void
*
buffer
,
uae_u64
offset
,
int
len
)
{
int
got
=
0
;
uae_u8
*
p
=
(
uae_u8
*
)
buffer
;
if
(
hfd
->
drive_empty
)
return
0
;
if
(
offset
<
hfd
->
virtual_size
)
return
len
;
offset
-=
hfd
->
virtual_size
;
while
(
len
>
0
)
{
int
maxlen
=
len
>
CACHE_SIZE
?
CACHE_SIZE
:
len
;
int
ret
=
hdf_write_2
(
hfd
,
p
,
offset
,
maxlen
);
if
(
ret
<
0
)
return
ret
;
got
+=
ret
;
if
(
ret
!=
maxlen
)
return
got
;
offset
+=
maxlen
;
p
+=
maxlen
;
len
-=
maxlen
;
}
return
got
;
}
static
int
ismounted
(
int
hd
)
{
int
mounted
;
//mounted = 1;
return
mounted
;
}
static
int
hdf_init2
(
int
force
)
{
int
index
=
0
,
index2
=
0
,
drive
;
uae_u8
*
buffer
;
int
errormode
;
int
dwDriveMask
;
static
int
done
;
if
(
done
&&
!
force
)
return
num_drives
;
done
=
1
;
num_drives
=
0
;
return
num_drives
;
}
int
hdf_init_target
(
void
)
{
return
hdf_init2
(
0
);
}
#endif
#endif
src/od-win32/main.c
View file @
f18dcf46
...
@@ -37,7 +37,7 @@ static RETSIGTYPE sigbrkhandler (int foo)
...
@@ -37,7 +37,7 @@ static RETSIGTYPE sigbrkhandler (int foo)
void
setup_brkhandler
(
void
)
void
setup_brkhandler
(
void
)
{
{
#if defined(__unix) && !defined(__NeXT__)
#if defined(__unix) && !defined(__NeXT__)
&& !defined(__MINGW32__)
struct
sigaction
sa
;
struct
sigaction
sa
;
sa
.
sa_handler
=
sigbrkhandler
;
sa
.
sa_handler
=
sigbrkhandler
;
sa
.
sa_flags
=
0
;
sa
.
sa_flags
=
0
;
...
@@ -161,12 +161,14 @@ int main (int argc, char **argv)
...
@@ -161,12 +161,14 @@ int main (int argc, char **argv)
// hInst = hInstance;
// hInst = hInstance;
// argc = __argc; argv = __argv;
// argc = __argc; argv = __argv;
start_path
=
xmalloc
(
MAX_DPATH
);
start_path
=
xmalloc
(
char
,
MAX_DPATH
);
GetModuleFileName
(
NULL
,
start_path
,
MAX_DPATH
);
GetModuleFileName
(
NULL
,
start_path
,
MAX_DPATH
);
if
((
posn
=
strrchr
(
start_path
,
'\\'
)))
if
((
posn
=
strrchr
(
start_path
,
'\\'
)))
*
posn
=
0
;
*
posn
=
0
;
#ifndef __MINGW32__
init_sdl
();
init_sdl
();
#endif
real_main
(
argc
,
argv
);
real_main
(
argc
,
argv
);
...
...
src/od-win32/parser.c
0 → 100644
View file @
f18dcf46
/*
* UAE - The Un*x Amiga Emulator
*
* Not a parser, but parallel and serial emulation for Linux
*
* Copyright 2010 Mustafa TUFAN
*/
#include "sysconfig.h"
#undef SERIAL_ENET
#include "sysdeps.h"
#include "options.h"
#include "gensound.h"
#include "events.h"
#include "uae.h"
#include "include/memory.h"
#include "custom.h"
#include "autoconf.h"
#include "newcpu.h"
#include "traps.h"
#include "threaddep/thread.h"
#include "serial.h"
#include "savestate.h"
#include "xwin.h"
#include "drawing.h"
#define MIN_PRTBYTES 10
struct
uaeserialdata
{
long
hCom
;
long
evtr
,
evtw
,
evtt
,
evtwce
;
long
olr
,
olw
,
olwce
;
int
writeactive
;
void
*
readdata
,
*
writedata
;
volatile
int
threadactive
;
uae_sem_t
change_sem
,
sync_sem
;
void
*
user
;
};
int
uaeser_getdatalength
(
void
)
{
return
sizeof
(
struct
uaeserialdata
);
}
void
uaeser_initdata
(
void
*
vsd
,
void
*
user
)
{
}
int
uaeser_query
(
void
*
vsd
,
uae_u16
*
status
,
uae_u32
*
pending
)
{
return
0
;
}
int
uaeser_break
(
void
*
vsd
,
int
brklen
)
{
return
0
;
}
int
uaeser_setparams
(
void
*
vsd
,
int
baud
,
int
rbuffer
,
int
bits
,
int
sbits
,
int
rtscts
,
int
parity
,
uae_u32
xonxoff
)
{
return
0
;
}
void
uaeser_trigger
(
void
*
vsd
)
{
}
int
uaeser_write
(
void
*
vsd
,
uae_u8
*
data
,
uae_u32
len
)
{
return
0
;
}
int
uaeser_read
(
void
*
vsd
,
uae_u8
*
data
,
uae_u32
len
)
{
return
0
;
}
void
uaeser_clearbuffers
(
void
*
vsd
)
{
}
int
uaeser_open
(
void
*
vsd
,
void
*
user
,
int
unit
)
{
return
0
;
}
void
uaeser_close
(
void
*
vsd
)
{
}
#define SERIAL_WRITE_BUFFER 100
#define SERIAL_READ_BUFFER 100
static
uae_u8
outputbuffer
[
SERIAL_WRITE_BUFFER
];
static
uae_u8
outputbufferout
[
SERIAL_WRITE_BUFFER
];
static
uae_u8
inputbuffer
[
SERIAL_READ_BUFFER
];
static
int
datainoutput
;
static
int
dataininput
,
dataininputcnt
;
static
int
writepending
;
src/od-win32/writelog.c
View file @
f18dcf46
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
#include <windows.h>
#include <windows.h>
#define SHOW_CONSOLE
0
#define SHOW_CONSOLE
1
static
int
consoleopen
=
0
;
static
int
consoleopen
=
0
;
static
HANDLE
stdinput
;
static
HANDLE
stdinput
;
...
@@ -129,3 +129,19 @@ void f_out (void *f, const char *format, ...)
...
@@ -129,3 +129,19 @@ void f_out (void *f, const char *format, ...)
va_end
(
parms
);
va_end
(
parms
);
}
}
}
}
static
char
*
console_buffer
;
static
int
console_buffer_size
;
char
*
setconsolemode
(
char
*
buffer
,
int
maxlen
)
{
char
*
ret
=
NULL
;
if
(
buffer
)
{
console_buffer
=
buffer
;
console_buffer_size
=
maxlen
;
}
else
{
ret
=
console_buffer
;
console_buffer
=
NULL
;
}
return
ret
;
}
src/zfile.c
View file @
f18dcf46
...
@@ -7,7 +7,9 @@
...
@@ -7,7 +7,9 @@
* 2002-2007 Toni Wilen
* 2002-2007 Toni Wilen
*/
*/
#if defined(_WIN32) && !defined(__MINGW32__)
#define ZLIB_WINAPI
#define ZLIB_WINAPI
#endif
#define RECURSIVE_ARCHIVES 1
#define RECURSIVE_ARCHIVES 1
//#define ZFILE_DEBUG
//#define ZFILE_DEBUG
#define FSDB_DIR_SEPARATOR_S "\\"
#define FSDB_DIR_SEPARATOR_S "\\"
...
@@ -1540,7 +1542,7 @@ static struct zfile *zfile_fopen_2 (const TCHAR *name, const TCHAR *mode, int ma
...
@@ -1540,7 +1542,7 @@ static struct zfile *zfile_fopen_2 (const TCHAR *name, const TCHAR *mode, int ma
}
}
l
->
zfdmask
=
mask
;
l
->
zfdmask
=
mask
;
}
else
{
}
else
{
#if defined(__FreeBSD__)
#if defined(__FreeBSD__)
|| defined(__MINGW32__)
struct
stat
st
;
struct
stat
st
;
#else
#else
struct
stat64
st
;
struct
stat64
st
;
...
@@ -1566,7 +1568,7 @@ static struct zfile *zfile_fopen_2 (const TCHAR *name, const TCHAR *mode, int ma
...
@@ -1566,7 +1568,7 @@ static struct zfile *zfile_fopen_2 (const TCHAR *name, const TCHAR *mode, int ma
return
l
;
return
l
;
}
}
#if
def _WIN32
#if
defined(_WIN32) && !defined(__MINGW32__)
#include "win32.h"
#include "win32.h"
#define AF "%AMIGAFOREVERDATA%"
#define AF "%AMIGAFOREVERDATA%"
...
@@ -1652,7 +1654,7 @@ static struct zfile *zfile_fopen_x (const TCHAR *name, const TCHAR *mode, int ma
...
@@ -1652,7 +1654,7 @@ static struct zfile *zfile_fopen_x (const TCHAR *name, const TCHAR *mode, int ma
return
l
;
return
l
;
}
}
#if
def _WIN32
#if
defined(_WIN32) && !defined(__MINGW32__)
static
int
isinternetfile
(
const
TCHAR
*
name
)
static
int
isinternetfile
(
const
TCHAR
*
name
)
{
{
if
(
!
_tcsnicmp
(
name
,
"http://"
,
7
)
||
!
_tcsnicmp
(
name
,
"https://"
,
8
))
if
(
!
_tcsnicmp
(
name
,
"http://"
,
7
)
||
!
_tcsnicmp
(
name
,
"https://"
,
8
))
...
@@ -1758,7 +1760,7 @@ static struct zfile *zfile_fopenx2 (const TCHAR *name, const TCHAR *mode, int ma
...
@@ -1758,7 +1760,7 @@ static struct zfile *zfile_fopenx2 (const TCHAR *name, const TCHAR *mode, int ma
struct
zfile
*
f
;
struct
zfile
*
f
;
TCHAR
tmp
[
MAX_DPATH
];
TCHAR
tmp
[
MAX_DPATH
];
#if
def _WIN32
#if
defined(_WIN32) && !defined(__MINGW32__)
if
(
isinternetfile
(
name
))
if
(
isinternetfile
(
name
))
return
zfile_fopen_internet
(
name
,
mode
,
mask
);
return
zfile_fopen_internet
(
name
,
mode
,
mask
);
#endif
#endif
...
...
src/zfile_archive.c
View file @
f18dcf46
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
#include "sysconfig.h"
#include "sysconfig.h"
#include "sysdeps.h"
#include "sysdeps.h"
#if
def _WIN32
#if
defined(_WIN32) && !defined(__MINGW32__)
#include <windows.h>
#include <windows.h>
#include "win32.h"
#include "win32.h"
#endif
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment