Commit 757e2ea2 authored by GnoStiC's avatar GnoStiC

puae 2.3.1

parent f73bdd59
# P-UAE
#
# 2010 Mustafa TUFAN (aka GnoStiC/BRONX)
#
#
#
base=" --with-sdl --with-sdl-gl --with-sdl-gfx --with-sdl-sound --enable-drvsnd "
cd32=" --enable-cd32 "
a600=" --enable-gayle "
scsi=" --enable-scsi-device --enable-ncr --enable-a2091 "
other=" --with-caps --enable-amax --disable-jit"
#
#
./bootstrap.sh ./bootstrap.sh
./configure --with-sdl --with-sdl-gl --with-sdl-gfx --with-sdl-sound --with-caps --enable-drvsnd --enable-amax --enable-cd32 --enable-scsi-device --enable-a2091 --enable-gayle --enable-ncr --disable-jit ./configure $base $cd32 $a600 $scsi $other
make clean make clean
make make
...@@ -1436,7 +1436,7 @@ static void audio_state_channel2 (int nr, bool perfin) ...@@ -1436,7 +1436,7 @@ static void audio_state_channel2 (int nr, bool perfin)
#ifdef DEBUG_AUDIO #ifdef DEBUG_AUDIO
if (debugchannel (nr)) if (debugchannel (nr))
write_log ("%d: IDLE\n", nr); write_log ("%d: IDLE\n", nr);
#endif #endif
zerostate (nr); zerostate (nr);
return; return;
} }
...@@ -2016,12 +2016,6 @@ void audio_vsync (void) ...@@ -2016,12 +2016,6 @@ void audio_vsync (void)
#endif #endif
} }
int audio_setup (void) { return setup_sound (); }
void audio_close (void) { close_sound (); }
void audio_pause (void) { pause_sound (); }
void audio_resume (void) { resume_sound (); }
void audio_volume (int volume) { sound_volume (volume); }
#ifdef SAVESTATE #ifdef SAVESTATE
void restore_audio_finish (void) void restore_audio_finish (void)
{ {
......
...@@ -37,13 +37,6 @@ extern void set_audio (void); ...@@ -37,13 +37,6 @@ extern void set_audio (void);
extern int audio_activate (void); extern int audio_activate (void);
extern void audio_vsync (void); extern void audio_vsync (void);
extern int audio_setup (void);
extern void audio_close (void);
extern void audio_reset (void);
extern void audio_pause (void);
extern void audio_resume (void);
extern void audio_volume (int);
void switch_audio_interpol (void); void switch_audio_interpol (void);
extern int sound_available; extern int sound_available;
......
...@@ -781,6 +781,8 @@ void read_inputdevice_config (struct uae_prefs *pr, const TCHAR *option, TCHAR * ...@@ -781,6 +781,8 @@ void read_inputdevice_config (struct uae_prefs *pr, const TCHAR *option, TCHAR *
pr->input_analog_joystick_mult = _tstol (value); pr->input_analog_joystick_mult = _tstol (value);
if (!strcasecmp (p, "analog_joystick_offset")) if (!strcasecmp (p, "analog_joystick_offset"))
pr->input_analog_joystick_offset = _tstol (value); pr->input_analog_joystick_offset = _tstol (value);
if (!strcasecmp (p, "contact_bounce"))
pr->input_contact_bounce = _tstol (value);
idnum = _tstol (p); idnum = _tstol (p);
if (idnum <= 0 || idnum > MAX_INPUT_SETTINGS) if (idnum <= 0 || idnum > MAX_INPUT_SETTINGS)
...@@ -2451,16 +2453,16 @@ void inputdevice_handle_inputcode (void) ...@@ -2451,16 +2453,16 @@ void inputdevice_handle_inputcode (void)
sound_volume (1); sound_volume (1);
break; break;
case AKS_VOLMUTE: case AKS_VOLMUTE:
//sound_mute (-1); sound_mute (-1);
break; break;
case AKS_MVOLDOWN: case AKS_MVOLDOWN:
//master_sound_volume (-1); master_sound_volume (-1);
break; break;
case AKS_MVOLUP: case AKS_MVOLUP:
//master_sound_volume (1); master_sound_volume (1);
break; break;
case AKS_MVOLMUTE: case AKS_MVOLMUTE:
//master_sound_volume (0); master_sound_volume (0);
break; break;
case AKS_QUIT: case AKS_QUIT:
uae_quit (); uae_quit ();
...@@ -5618,9 +5620,9 @@ void warpmode (int mode) ...@@ -5618,9 +5620,9 @@ void warpmode (int mode)
if (currprefs.turbo_emulation) { if (currprefs.turbo_emulation) {
if (!currprefs.cpu_cycle_exact && !currprefs.blitter_cycle_exact) if (!currprefs.cpu_cycle_exact && !currprefs.blitter_cycle_exact)
changed_prefs.gfx_framerate = currprefs.gfx_framerate = 10; changed_prefs.gfx_framerate = currprefs.gfx_framerate = 10;
audio_pause (); pause_sound ();
} else { } else {
audio_resume (); resume_sound ();
} }
compute_vsynctime (); compute_vsynctime ();
#ifdef RETROPLATFORM #ifdef RETROPLATFORM
......
...@@ -853,7 +853,7 @@ static int real_main2 (int argc, TCHAR **argv) ...@@ -853,7 +853,7 @@ static int real_main2 (int argc, TCHAR **argv)
fixup_prefs (&currprefs); fixup_prefs (&currprefs);
} }
if (! audio_setup ()) { if (! setup_sound ()) {
write_log ("Sound driver unavailable: Sound output disabled\n"); write_log ("Sound driver unavailable: Sound output disabled\n");
currprefs.produce_sound = 0; currprefs.produce_sound = 0;
} }
......
...@@ -171,8 +171,6 @@ static int REGPARAM3 dummy_check (uaecptr addr, uae_u32 size) REGPARAM; ...@@ -171,8 +171,6 @@ static int REGPARAM3 dummy_check (uaecptr addr, uae_u32 size) REGPARAM;
static void dummylog (int rw, uaecptr addr, int size, uae_u32 val, int ins) static void dummylog (int rw, uaecptr addr, int size, uae_u32 val, int ins)
{ {
if (M68K_GETPC == 0xf81a16)
activate_debugger ();
if (illegal_count >= MAX_ILG) if (illegal_count >= MAX_ILG)
return; return;
/* ignore Zorro3 expansion space */ /* ignore Zorro3 expansion space */
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#define f_out fprintf #define f_out fprintf
#define console_out printf #define console_out printf
#ifdef JIT #ifdef JIT
//extern uae_u8* compiled_code;
#include "compemu.h" #include "compemu.h"
#else #else
/* Need to have these somewhere */ /* Need to have these somewhere */
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "options.h" #include "options.h"
#include "gensound.h" #include "gensound.h"
#include "sounddep/sound.h" #include "sounddep/sound.h"
#include "driveclick.h"
#include <alsa/asoundlib.h> #include <alsa/asoundlib.h>
...@@ -34,6 +35,8 @@ int paula_sndbufsize; ...@@ -34,6 +35,8 @@ int paula_sndbufsize;
snd_pcm_t *alsa_playback_handle = 0; snd_pcm_t *alsa_playback_handle = 0;
int bytes_per_frame; int bytes_per_frame;
static struct sound_data sdpaula;
static struct sound_data *sdp = &sdpaula;
void close_sound (void) void close_sound (void)
{ {
...@@ -299,3 +302,67 @@ int audio_parse_option (struct uae_prefs *p, const char *option, const char *val ...@@ -299,3 +302,67 @@ int audio_parse_option (struct uae_prefs *p, const char *option, const char *val
return (cfgfile_string (option, value, "device", alsa_device, 256) return (cfgfile_string (option, value, "device", alsa_device, 256)
|| cfgfile_yesno (option, value, "verbose", &alsa_verbose)); || cfgfile_yesno (option, value, "verbose", &alsa_verbose));
} }
void set_volume_sound_device (struct sound_data *sd, int volume, int mute)
{
}
void set_volume (int volume, int mute)
{
set_volume_sound_device (sdp, volume, mute);
config_changed = 1;
}
static int setget_master_volume_linux (int setvolume, int *volume, int *mute)
{
unsigned int ok = 0;
if (setvolume) {
;//set
} else {
;//get
}
return ok;
}
static int set_master_volume (int volume, int mute)
{
return setget_master_volume_linux (1, &volume, &mute);
}
static int get_master_volume (int *volume, int *mute)
{
*volume = 0;
*mute = 0;
return setget_master_volume_linux (0, volume, mute);
}
void master_sound_volume (int dir)
{
int vol, mute, r;
r = get_master_volume (&vol, &mute);
if (!r)
return;
if (dir == 0)
mute = mute ? 0 : 1;
vol += dir * (65536 / 10);
if (vol < 0)
vol = 0;
if (vol > 65535)
vol = 65535;
set_master_volume (vol, mute);
config_changed = 1;
}
void sound_mute (int newmute)
{
if (newmute < 0)
sdp->mute = sdp->mute ? 0 : 1;
else
sdp->mute = newmute;
set_volume (currprefs.sound_volume, sdp->mute);
config_changed = 1;
}
...@@ -19,6 +19,20 @@ extern int paula_sndbufsize; ...@@ -19,6 +19,20 @@ extern int paula_sndbufsize;
extern snd_pcm_t *alsa_playback_handle; extern snd_pcm_t *alsa_playback_handle;
extern int bytes_per_frame; extern int bytes_per_frame;
struct sound_data
{
int waiting_for_buffer;
int devicetype;
int obtainedfreq;
int paused;
int mute;
int channels;
int freq;
int samplesize;
int sndbufsize;
struct sound_dp *data;
};
/* alsa_xrun_recovery() function is copied from ALSA manual. why the hell did /* alsa_xrun_recovery() function is copied from ALSA manual. why the hell did
they make ALSA this hard?! i bet 95% of ALSA programmers would like a they make ALSA this hard?! i bet 95% of ALSA programmers would like a
simpler way to do error handling.. let the 5% use tricky APIs. simpler way to do error handling.. let the 5% use tricky APIs.
...@@ -73,12 +87,12 @@ static void check_sound_buffers (void) ...@@ -73,12 +87,12 @@ static void check_sound_buffers (void)
STATIC_INLINE void clear_sound_buffers (void) STATIC_INLINE void clear_sound_buffers (void)
{ {
memset (paula_sndbuffer, 0, paula_sndbufsize); memset (paula_sndbuffer, 0, paula_sndbufsize);
paula_sndbufpt = paula_sndbuffer; paula_sndbufpt = paula_sndbuffer;
} }
STATIC_INLINE void set_sound_buffers (void) STATIC_INLINE void set_sound_buffers (void)
{ {
} }
#define PUT_SOUND_WORD(b) do { *(uae_u16 *)paula_sndbufpt = b; paula_sndbufpt = (uae_u16 *)(((uae_u8 *)paula_sndbufpt) + 2); } while (0) #define PUT_SOUND_WORD(b) do { *(uae_u16 *)paula_sndbufpt = b; paula_sndbufpt = (uae_u16 *)(((uae_u8 *)paula_sndbufpt) + 2); } while (0)
......
...@@ -61,3 +61,11 @@ int audio_parse_option (struct uae_prefs *p, const char *option, const char *val ...@@ -61,3 +61,11 @@ int audio_parse_option (struct uae_prefs *p, const char *option, const char *val
{ {
return 0; return 0;
} }
void master_sound_volume (int dir)
{
}
void sound_mute (int newmute)
{
}
/* /*
* UAE - The Un*x Amiga Emulator * UAE - The Un*x Amiga Emulator
* *
* Support for SDL sound * Support for SDL sound
* *
* Copyright 1997 Bernd Schmidt * Copyright 1997 Bernd Schmidt
* Copyright 2003-2006 Richard Drummond * Copyright 2003-2006 Richard Drummond
* Copyright 2009-2010 Mustafa TUFAN * Copyright 2009-2010 Mustafa TUFAN
*/ */
#include "sysconfig.h" #include "sysconfig.h"
#include "sysdeps.h" #include "sysdeps.h"
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "custom.h" #include "custom.h"
#include "gui.h" #include "gui.h"
#include "gensound.h" #include "gensound.h"
#include "driveclick.h"
#include "sounddep/sound.h" #include "sounddep/sound.h"
#include "threaddep/thread.h" #include "threaddep/thread.h"
#include <SDL_audio.h> #include <SDL_audio.h>
...@@ -33,6 +34,9 @@ static SDL_AudioSpec spec; ...@@ -33,6 +34,9 @@ static SDL_AudioSpec spec;
static smp_comm_pipe to_sound_pipe; static smp_comm_pipe to_sound_pipe;
static uae_sem_t data_available_sem, callback_done_sem, sound_init_sem; static uae_sem_t data_available_sem, callback_done_sem, sound_init_sem;
static struct sound_data sdpaula;
static struct sound_data *sdp = &sdpaula;
static int in_callback, closing_sound; static int in_callback, closing_sound;
static void clearbuffer (void) static void clearbuffer (void)
...@@ -43,26 +47,25 @@ static void clearbuffer (void) ...@@ -43,26 +47,25 @@ static void clearbuffer (void)
/* This shouldn't be necessary . . . */ /* This shouldn't be necessary . . . */
static void dummy_callback (void *userdata, Uint8 *stream, int len) static void dummy_callback (void *userdata, Uint8 *stream, int len)
{ {
return; return;
} }
static void sound_callback (void *userdata, Uint8 *stream, int len) static void sound_callback (void *userdata, Uint8 *stream, int len)
{ {
if (closing_sound) if (closing_sound)
return; return;
in_callback = 1; in_callback = 1;
/* Wait for data to finish. */ /* Wait for data to finish. */
uae_sem_wait (&data_available_sem); uae_sem_wait (&data_available_sem);
if (!closing_sound) { if (!closing_sound) {
memcpy (stream, paula_sndbuffer, paula_sndbufsize); memcpy (stream, paula_sndbuffer, paula_sndbufsize);
/* Notify writer that we're done. */ /* Notify writer that we're done. */
uae_sem_post (&callback_done_sem); uae_sem_post (&callback_done_sem);
} }
in_callback = 0;
in_callback = 0;
} }
void finish_sound_buffer (void) void finish_sound_buffer (void)
...@@ -81,16 +84,16 @@ void finish_sound_buffer (void) ...@@ -81,16 +84,16 @@ void finish_sound_buffer (void)
} }
if (gui_data.sndbuf_status == 3) if (gui_data.sndbuf_status == 3)
gui_data.sndbuf_status = 0; gui_data.sndbuf_status = 0;
uae_sem_post (&data_available_sem); uae_sem_post (&data_available_sem);
uae_sem_wait (&callback_done_sem); uae_sem_wait (&callback_done_sem);
} }
/* Try to determine whether sound is available. */ /* Try to determine whether sound is available. */
int setup_sound (void) int setup_sound (void)
{ {
int success = 0; int success = 0;
if (SDL_InitSubSystem (SDL_INIT_AUDIO) == 0) { if (SDL_InitSubSystem (SDL_INIT_AUDIO) == 0) {
spec.freq = currprefs.sound_freq; spec.freq = currprefs.sound_freq;
spec.format = AUDIO_S16SYS; spec.format = AUDIO_S16SYS;
spec.channels = currprefs.sound_stereo ? 2 : 1; spec.channels = currprefs.sound_stereo ? 2 : 1;
...@@ -106,11 +109,10 @@ int setup_sound (void) ...@@ -106,11 +109,10 @@ int setup_sound (void)
success = 1; success = 1;
SDL_CloseAudio (); SDL_CloseAudio ();
} }
} }
sound_available = success;
return sound_available; sound_available = success;
return sound_available;
} }
static int open_sound (void) static int open_sound (void)
...@@ -119,27 +121,27 @@ static int open_sound (void) ...@@ -119,27 +121,27 @@ static int open_sound (void)
return 0; return 0;
config_changed = 1; config_changed = 1;
spec.freq = currprefs.sound_freq; spec.freq = currprefs.sound_freq;
spec.format = AUDIO_S16SYS; spec.format = AUDIO_S16SYS;
spec.channels = currprefs.sound_stereo ? 2 : 1; spec.channels = currprefs.sound_stereo ? 2 : 1;
spec.samples = spec.freq * currprefs.sound_latency / 1000; spec.samples = spec.freq * currprefs.sound_latency / 1000;
spec.callback = sound_callback; spec.callback = sound_callback;
spec.userdata = 0; spec.userdata = 0;
clearbuffer(); clearbuffer();
if (SDL_OpenAudio (&spec, NULL) < 0) { if (SDL_OpenAudio (&spec, NULL) < 0) {
write_log ("SDL: Couldn't open audio: %s\n", SDL_GetError()); write_log ("SDL: Couldn't open audio: %s\n", SDL_GetError());
return 0; return 0;
} }
init_sound_table16 (); init_sound_table16 ();
sample_handler = currprefs.sound_stereo ? sample16s_handler : sample16_handler; sample_handler = currprefs.sound_stereo ? sample16s_handler : sample16_handler;
obtainedfreq = currprefs.sound_freq; obtainedfreq = currprefs.sound_freq;
write_log ("SDL: sound driver found and configured at %d Hz, buffer is %d ms (%d bytes).\n", spec.freq, spec.samples * 1000 / spec.freq, paula_sndbufsize); write_log ("SDL: sound driver found and configured at %d Hz, buffer is %d ms (%d bytes).\n", spec.freq, spec.samples * 1000 / spec.freq, paula_sndbufsize);
have_sound = 1; have_sound = 1;
sound_available = 1; sound_available = 1;
update_sound (fake_vblank_hz, 1, currprefs.ntscmode); update_sound (fake_vblank_hz, 1, currprefs.ntscmode);
paula_sndbufsize = spec.samples * 2 * spec.channels; paula_sndbufsize = spec.samples * 2 * spec.channels;
paula_sndbufpt = paula_sndbuffer; paula_sndbufpt = paula_sndbuffer;
...@@ -147,24 +149,24 @@ static int open_sound (void) ...@@ -147,24 +149,24 @@ static int open_sound (void)
driveclick_init(); driveclick_init();
#endif #endif
return 1; return 1;
} }
static void *sound_thread (void *dummy) static void *sound_thread (void *dummy)
{ {
for (;;) { for (;;) {
int cmd = read_comm_pipe_int_blocking (&to_sound_pipe); int cmd = read_comm_pipe_int_blocking (&to_sound_pipe);
switch (cmd) { switch (cmd) {
case 0: case 0:
open_sound (); open_sound ();
uae_sem_post (&sound_init_sem); uae_sem_post (&sound_init_sem);
break; break;
case 1: case 1:
uae_sem_post (&sound_init_sem); uae_sem_post (&sound_init_sem);
return 0; return 0;
} }
} }
} }
/* We need a thread for this, since communication between finish_sound_buffer /* We need a thread for this, since communication between finish_sound_buffer
...@@ -173,13 +175,13 @@ static void *sound_thread (void *dummy) ...@@ -173,13 +175,13 @@ static void *sound_thread (void *dummy)
* context. But we don't want to depend on SDL's internals too much. */ * context. But we don't want to depend on SDL's internals too much. */
static void init_sound_thread (void) static void init_sound_thread (void)
{ {
uae_thread_id tid; uae_thread_id tid;
init_comm_pipe (&to_sound_pipe, 20, 1); init_comm_pipe (&to_sound_pipe, 20, 1);
uae_sem_init (&data_available_sem, 0, 0); uae_sem_init (&data_available_sem, 0, 0);
uae_sem_init (&callback_done_sem, 0, 0); uae_sem_init (&callback_done_sem, 0, 0);
uae_sem_init (&sound_init_sem, 0, 0); uae_sem_init (&sound_init_sem, 0, 0);
uae_start_thread ("Sound", sound_thread, NULL, &tid); uae_start_thread ("Sound", sound_thread, NULL, &tid);
} }
void close_sound (void) void close_sound (void)
...@@ -187,22 +189,23 @@ void close_sound (void) ...@@ -187,22 +189,23 @@ void close_sound (void)
config_changed = 1; config_changed = 1;
gui_data.sndbuf = 0; gui_data.sndbuf = 0;
gui_data.sndbuf_status = 3; gui_data.sndbuf_status = 3;
if (!have_sound) if (!have_sound)
return; return;
SDL_PauseAudio (1); SDL_PauseAudio (1);
clearbuffer(); clearbuffer();
if (in_callback) { if (in_callback) {
closing_sound = 1; closing_sound = 1;
uae_sem_post (&data_available_sem); uae_sem_post (&data_available_sem);
} }
write_comm_pipe_int (&to_sound_pipe, 1, 1);
uae_sem_wait (&sound_init_sem); write_comm_pipe_int (&to_sound_pipe, 1, 1);
SDL_CloseAudio (); uae_sem_wait (&sound_init_sem);
uae_sem_destroy (&data_available_sem); SDL_CloseAudio ();
uae_sem_destroy (&sound_init_sem); uae_sem_destroy (&data_available_sem);
uae_sem_destroy (&callback_done_sem); uae_sem_destroy (&sound_init_sem);
have_sound = 0; uae_sem_destroy (&callback_done_sem);
have_sound = 0;
} }
int init_sound (void) int init_sound (void)
...@@ -216,38 +219,38 @@ int init_sound (void) ...@@ -216,38 +219,38 @@ int init_sound (void)
if (have_sound) if (have_sound)
return 1; return 1;
in_callback = 0; in_callback = 0;
closing_sound = 0; closing_sound = 0;
init_sound_thread (); init_sound_thread ();
write_comm_pipe_int (&to_sound_pipe, 0, 1); write_comm_pipe_int (&to_sound_pipe, 0, 1);
uae_sem_wait (&sound_init_sem); uae_sem_wait (&sound_init_sem);
SDL_PauseAudio (0); SDL_PauseAudio (0);
#ifdef DRIVESOUND #ifdef DRIVESOUND
driveclick_reset (); driveclick_reset ();
#endif #endif
return have_sound; return have_sound;
} }
void pause_sound (void) void pause_sound (void)
{ {
if (!have_sound) if (!have_sound)
return; return;
SDL_PauseAudio (1); SDL_PauseAudio (1);
} }
void resume_sound (void) void resume_sound (void)
{ {
if (!have_sound) if (!have_sound)
return; return;
clearbuffer(); clearbuffer();
SDL_PauseAudio (0); SDL_PauseAudio (0);
} }
void reset_sound (void) void reset_sound (void)
{ {
clearbuffer(); clearbuffer();
return; return;
} }
void sound_volume (int dir) void sound_volume (int dir)
...@@ -272,5 +275,68 @@ void audio_save_options (FILE *f, const struct uae_prefs *p) ...@@ -272,5 +275,68 @@ void audio_save_options (FILE *f, const struct uae_prefs *p)
int audio_parse_option (struct uae_prefs *p, const char *option, const char *value) int audio_parse_option (struct uae_prefs *p, const char *option, const char *value)
{ {
return 0; return 0;
}
void set_volume_sound_device (struct sound_data *sd, int volume, int mute)
{
}
void set_volume (int volume, int mute)
{
set_volume_sound_device (sdp, volume, mute);
config_changed = 1;
}
static int setget_master_volume_linux (int setvolume, int *volume, int *mute)
{
unsigned int ok = 0;
if (setvolume) {
;//set
} else {
;//get
}
return ok;
}
static int set_master_volume (int volume, int mute)
{
return setget_master_volume_linux (1, &volume, &mute);
}
static int get_master_volume (int *volume, int *mute)
{
*volume = 0;
*mute = 0;
return setget_master_volume_linux (0, volume, mute);
}
void master_sound_volume (int dir)
{
int vol, mute, r;
r = get_master_volume (&vol, &mute);
if (!r)
return;
if (dir == 0)
mute = mute ? 0 : 1;
vol += dir * (65536 / 10);
if (vol < 0)
vol = 0;
if (vol > 65535)
vol = 65535;
set_master_volume (vol, mute);
config_changed = 1;
}
void sound_mute (int newmute)
{
if (newmute < 0)
sdp->mute = sdp->mute ? 0 : 1;
else
sdp->mute = newmute;
set_volume (currprefs.sound_volume, sdp->mute);
config_changed = 1;
} }
...@@ -107,7 +107,7 @@ static uae_u32 REGPARAM2 uaeexe_server (TrapContext *context) ...@@ -107,7 +107,7 @@ static uae_u32 REGPARAM2 uaeexe_server (TrapContext *context)
{ {
int len; int len;
TCHAR *cmd; TCHAR *cmd;
char *dst; char *dst, *s;
if (ARG (0) && !running) { if (ARG (0) && !running) {
running = 1; running = 1;
...@@ -124,8 +124,10 @@ static uae_u32 REGPARAM2 uaeexe_server (TrapContext *context) ...@@ -124,8 +124,10 @@ static uae_u32 REGPARAM2 uaeexe_server (TrapContext *context)
dst = (char*)get_real_address (ARG (0)); dst = (char*)get_real_address (ARG (0));
len = ARG (1); len = ARG (1);
strncpy (dst, cmd, len); s = ua (cmd);
strncpy (dst, s, len);
write_log ("Sending '%s' to remote cli\n", cmd); write_log ("Sending '%s' to remote cli\n", cmd);
xfree (s);
xfree (cmd); xfree (cmd);
return ARG (0); return ARG (0);
} }
...@@ -246,8 +246,10 @@ static uae_u32 emulib_GetUaeConfig (uaecptr place) ...@@ -246,8 +246,10 @@ static uae_u32 emulib_GetUaeConfig (uaecptr place)
put_byte (place + 35, 1); put_byte (place + 35, 1);
for (j = 0; j < 4; j++) { for (j = 0; j < 4; j++) {
char *s = ua (currprefs.floppyslots[j].df);
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
put_byte (place + 36 + i + j * 256, currprefs.floppyslots[j].df[i]); put_byte (place + 36 + i + j * 256, s[i]);
xfree (s);
} }
return 1; return 1;
} }
...@@ -338,6 +340,7 @@ static uae_u32 emulib_Minimize (void) ...@@ -338,6 +340,7 @@ static uae_u32 emulib_Minimize (void)
static int native_dos_op (uae_u32 mode, uae_u32 p1, uae_u32 p2, uae_u32 p3) static int native_dos_op (uae_u32 mode, uae_u32 p1, uae_u32 p2, uae_u32 p3)
{ {
TCHAR tmp[MAX_DPATH]; TCHAR tmp[MAX_DPATH];
char *s;
int v, i; int v, i;
if (mode) if (mode)
...@@ -348,10 +351,12 @@ static int native_dos_op (uae_u32 mode, uae_u32 p1, uae_u32 p2, uae_u32 p3) ...@@ -348,10 +351,12 @@ static int native_dos_op (uae_u32 mode, uae_u32 p1, uae_u32 p2, uae_u32 p3)
v = get_native_path (p1, tmp); v = get_native_path (p1, tmp);
if (v) if (v)
return v; return v;
for (i = 0; i <= strlen (tmp) && i < p3 - 1; i++) { s = ua (tmp);
put_byte (p2 + i, tmp[i]); for (i = 0; i <= strlen (s) && i < p3 - 1; i++) {
put_byte (p2 + i, s[i]);
put_byte (p2 + i + 1, 0); put_byte (p2 + i + 1, 0);
} }
xfree (s);
return 0; return 0;
} }
#ifndef UAEGFX_INTERNAL #ifndef UAEGFX_INTERNAL
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment