mirror of
https://github.com/Oibaf66/uae-wii.git
synced 2024-11-25 12:06:55 +01:00
Added ZIP, DMS and floppy sound support
This commit is contained in:
parent
b5feec8512
commit
e1cf346493
@ -56,6 +56,7 @@ src/tools/genlinetoscr.exe:
|
||||
clean:
|
||||
@echo Cleaning $(OBJ_DIR)
|
||||
@rm -rf $(OBJS) $(OBJ_DIR) src/machdep src/target.h src/md-fpp.h src/sysconfig.h $(SYMLINKS)
|
||||
@rm -rf dist
|
||||
@rm -f src/blit.h src/blitfunc.c src/blitfunc.h src/blittable.c src/linetoscr.c
|
||||
@rm -f uae.dol uae.elf
|
||||
cd src/tools/ && make -f Makefile.wii clean
|
||||
@ -143,7 +144,7 @@ COMMON_FLAGS := -g -O3 -G8 -mrvl -Wall -D__inline__=__inline__ $(MACHDEP) -Wno-u
|
||||
INCLUDES := -Isrc/md-generic/ -Isrc/include -Isrc -I$(DEVKITPRO)/libogc/include -I$(DEVKITPRO)/libogc/include/SDL -I$(PORTLIBS)/include
|
||||
DEFINES := -DOS_WITHOUT_MEMORY_MANAGEMENT -DSAVESTATE -DUSE_SDL -DSUPPORT_THREADS -DCPUEMU_0 -DCPUEMU_5 -DCPUEMU_6 \
|
||||
-DFPUEMU -DAGA -DAUTOCONFIG -DFILESYS \
|
||||
-DTD_START_HEIGHT=16
|
||||
-DTD_START_HEIGHT=16 -DDRIVESOUND
|
||||
CFLAGS := $(COMMON_FLAGS) $(INCLUDES) $(DEFINES)
|
||||
|
||||
#unused defines; -DFDI2RAW
|
||||
@ -181,6 +182,7 @@ distsource:
|
||||
cd .. && cp -r uae-wii uae-wii-v
|
||||
cd ../uae-wii-v && find . -name ".svn" | xargs rm -rf
|
||||
cd .. && tar -czf uae-wii-v.tar.gz uae-wii-v
|
||||
cd .. && rm -fr uae-wii-v
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
|
@ -21,17 +21,18 @@
|
||||
#include "custom_private.h"
|
||||
#include "newcpu.h"
|
||||
#include "gensound.h"
|
||||
#include "driveclick.h"
|
||||
#include "sounddep/sound.h"
|
||||
#include "events.h"
|
||||
#include "audio.h"
|
||||
#include "savestate.h"
|
||||
#include "driveclick.h"
|
||||
#ifdef AVIOUTPUT
|
||||
# include "avioutput.h"
|
||||
#endif
|
||||
#include "sinctable.h"
|
||||
#include "gui.h" /* for gui_ledstate */
|
||||
|
||||
|
||||
#define MAX_EV ~0ul
|
||||
//#define DEBUG_AUDIO
|
||||
#define DEBUG_CHANNEL_MASK 15
|
||||
|
138
src/driveclick.c
138
src/driveclick.c
@ -13,14 +13,21 @@
|
||||
|
||||
#include "uae.h"
|
||||
#include "options.h"
|
||||
#include "driveclick.h"
|
||||
#include "sounddep/sound.h"
|
||||
#include "zfile.h"
|
||||
#include "events.h"
|
||||
|
||||
#include "driveclick.h"
|
||||
|
||||
#include "fsdb.h"
|
||||
|
||||
#include "resource/drive_click.c"
|
||||
#include "resource/drive_snatch.c"
|
||||
#include "resource/drive_spin.c"
|
||||
#include "resource/drive_startup.c"
|
||||
|
||||
|
||||
|
||||
static struct drvsample drvs[4][DS_END];
|
||||
static int freq = 44100;
|
||||
|
||||
@ -51,7 +58,18 @@ uae_s16 *decodewav (uae_u8 *s, int *lenp)
|
||||
s += 4;
|
||||
len = s[0] | (s[1] << 8) | (s[2] << 16) | (s[3] << 24);
|
||||
dst = xmalloc (len);
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
{
|
||||
int i;
|
||||
uae_u8* d = (uae_u8*) dst;
|
||||
for (i = 0; i < len; i+= 2) {
|
||||
d[i] = s[i + 5];
|
||||
d[i+1] = s[i + 4];
|
||||
}
|
||||
}
|
||||
#else
|
||||
memcpy (dst, s + 4, len);
|
||||
#endif
|
||||
*lenp = len / 2;
|
||||
return dst;
|
||||
}
|
||||
@ -65,24 +83,77 @@ static int loadsample (const char *path, struct drvsample *ds)
|
||||
struct zfile *f;
|
||||
uae_u8 *buf;
|
||||
int size;
|
||||
int i;
|
||||
|
||||
f = zfile_fopen (path, "rb");
|
||||
if (!f) {
|
||||
write_log ("driveclick: can't open '%s'\n", path);
|
||||
return 0;
|
||||
}
|
||||
// ("driveclick: loading '%s'\n", path);
|
||||
zfile_fseek (f, 0, SEEK_END);
|
||||
size = zfile_ftell (f);
|
||||
buf = malloc (size);
|
||||
zfile_fseek (f, 0, SEEK_SET);
|
||||
zfile_fread (buf, size, 1, f);
|
||||
zfile_fclose (f);
|
||||
|
||||
/*
|
||||
printf("size=%i \n", size);
|
||||
for (i = 0; i < size; i++) {
|
||||
printf("0x%02x,", buf[i]);
|
||||
if (i % 20 == 19) {
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
flush(NULL);
|
||||
}
|
||||
*/
|
||||
|
||||
ds->len = size;
|
||||
ds->p = decodewav (buf, &ds->len);
|
||||
|
||||
free (buf);
|
||||
return 1;
|
||||
}
|
||||
|
||||
//The same function as load sample, but the wav data is already in memory.
|
||||
//No read, just decode.
|
||||
static int loadsample_resource(int resId, struct drvsample *ds) {
|
||||
uae_u8* buf = NULL;
|
||||
int size;
|
||||
switch (resId) {
|
||||
case DS_CLICK: {
|
||||
buf = res_drive_click;
|
||||
size = res_drive_click_size;
|
||||
} break;
|
||||
case DS_SPIN :
|
||||
case DS_SPINND: {
|
||||
buf = res_drive_spin;
|
||||
size = res_drive_spin_size;
|
||||
} break;
|
||||
case DS_START: {
|
||||
buf = res_drive_startup;
|
||||
size = res_drive_startup_size;
|
||||
} break;
|
||||
case DS_SNATCH: {
|
||||
buf = res_drive_snatch;
|
||||
size = res_drive_snatch_size;
|
||||
} break;
|
||||
|
||||
default: return 0;
|
||||
} //end of switch
|
||||
|
||||
|
||||
//write_log("loading click resource %i \n", resId);
|
||||
ds->len = size;
|
||||
ds->p = decodewav (buf, &ds->len);
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
static void freesample (struct drvsample *s)
|
||||
{
|
||||
free (s->p);
|
||||
@ -94,45 +165,70 @@ extern char *start_path;
|
||||
void driveclick_init (void)
|
||||
{
|
||||
int v, vv, i, j;
|
||||
char tmp[1000];
|
||||
static char tmp_path[1024];
|
||||
|
||||
driveclick_free ();
|
||||
vv = 0;
|
||||
|
||||
write_log("driveclick init...\n");
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (currprefs.dfxclick[i]) {
|
||||
/* TODO: Implement location of sample data */
|
||||
#if 0
|
||||
if (currprefs.dfxclick[i] > 0) {
|
||||
v = 0;
|
||||
if (driveclick_loadresource (drvs[i], currprefs.dfxclick[i]))
|
||||
v = 3;
|
||||
} else if (currprefs.dfxclick[i] == -1) {
|
||||
sprintf (tmp, "%suae_data%cdrive_click_%s", start_path, FSDB_DIR_SEPARATOR, currprefs.dfxclickexternal[i]);
|
||||
v = loadsample (tmp, &drvs[i][DS_CLICK]);
|
||||
sprintf (tmp, "%suae_data%cdrive_spin_%s", start_path, FSDB_DIR_SEPARATOR, currprefs.dfxclickexternal[i]);
|
||||
v += loadsample (tmp, &drvs[i][DS_SPIN]);
|
||||
sprintf (tmp, "%suae_data%cdrive_spinnd_%s", start_path, FSDB_DIR_SEPARATOR, currprefs.dfxclickexternal[i]);
|
||||
v += loadsample (tmp, &drvs[i][DS_SPINND]);
|
||||
sprintf (tmp, "%suae_data%cdrive_startup_%s", start_path, FSDB_DIR_SEPARATOR, currprefs.dfxclickexternal[i]);
|
||||
v += loadsample (tmp, &drvs[i][DS_START]);
|
||||
sprintf (tmp, "%suae_data%cdrive_snatch_%s", start_path, FSDB_DIR_SEPARATOR, currprefs.dfxclickexternal[i]);
|
||||
v += loadsample (tmp, &drvs[i][DS_SNATCH]);
|
||||
//load from resource
|
||||
if (currprefs.dfxclick[i] > 0) { // > 0
|
||||
v = loadsample_resource(DS_CLICK, &drvs[i][DS_CLICK]);
|
||||
v += loadsample_resource(DS_SPIN, &drvs[i][DS_SPIN]);
|
||||
v += loadsample_resource(DS_SPINND, &drvs[i][DS_SPINND]);
|
||||
v += loadsample_resource(DS_SNATCH, &drvs[i][DS_SNATCH]);
|
||||
v += loadsample_resource(DS_START, &drvs[i][DS_START]);
|
||||
|
||||
} else
|
||||
//load from file
|
||||
if (currprefs.dfxclick[i] == -1) {
|
||||
#ifdef GEKKO //currprefs.dfxclickexternal[i] is the path to the wav directory (path contains trailing separator)
|
||||
sprintf (tmp_path, "%sdrive_click.wav", currprefs.dfxclickexternal[i]);
|
||||
v = loadsample (tmp_path, &drvs[i][DS_CLICK]);
|
||||
sprintf (tmp_path, "%sdrive_spin.wav", currprefs.dfxclickexternal[i]);
|
||||
v += loadsample (tmp_path, &drvs[i][DS_SPIN]);
|
||||
sprintf (tmp_path, "%sdrive_spinnd.wav", currprefs.dfxclickexternal[i]);
|
||||
v += loadsample (tmp_path, &drvs[i][DS_SPINND]);
|
||||
sprintf (tmp_path, "%sdrive_startup.wav", currprefs.dfxclickexternal[i]);
|
||||
v += loadsample (tmp_path, &drvs[i][DS_START]);
|
||||
sprintf (tmp_path, "%sdrive_snatch.wav", currprefs.dfxclickexternal[i]);
|
||||
v += loadsample (tmp_path, &drvs[i][DS_SNATCH]);
|
||||
#else
|
||||
char * start_path = "."; //TODO - ??? set correct path
|
||||
sprintf (tmp_path, "%suae_data%cdrive_click_%s", start_path, FSDB_DIR_SEPARATOR, currprefs.dfxclickexternal[i]);
|
||||
v = loadsample (tmp_path, &drvs[i][DS_CLICK]);
|
||||
sprintf (tmp_path, "%suae_data%cdrive_spin_%s", start_path, FSDB_DIR_SEPARATOR, currprefs.dfxclickexternal[i]);
|
||||
v += loadsample (tmp_path, &drvs[i][DS_SPIN]);
|
||||
sprintf (tmp_path, "%suae_data%cdrive_spinnd_%s", start_path, FSDB_DIR_SEPARATOR, currprefs.dfxclickexternal[i]);
|
||||
v += loadsample (tmp_path, &drvs[i][DS_SPINND]);
|
||||
sprintf (tmp_path, "%suae_data%cdrive_startup_%s", start_path, FSDB_DIR_SEPARATOR, currprefs.dfxclickexternal[i]);
|
||||
v += loadsample (tmp_path, &drvs[i][DS_START]);
|
||||
sprintf (tmp_path, "%suae_data%cdrive_snatch_%s", start_path, FSDB_DIR_SEPARATOR, currprefs.dfxclickexternal[i]);
|
||||
v += loadsample (tmp_path, &drvs[i][DS_SNATCH]);
|
||||
#endif /* GEKKO */
|
||||
}
|
||||
if (v == 0) {
|
||||
int j;
|
||||
for (j = 0; j < DS_END; j++)
|
||||
for (j = 0; j < DS_END; j++) {
|
||||
freesample (&drvs[i][j]);
|
||||
}
|
||||
currprefs.dfxclick[i] = changed_prefs.dfxclick[i] = 0;
|
||||
}
|
||||
for (j = 0; j < DS_END; j++)
|
||||
for (j = 0; j < DS_END; j++) {
|
||||
drvs[i][j].len <<= DS_SHIFT;
|
||||
}
|
||||
drvs[i][DS_CLICK].pos = drvs[i][DS_CLICK].len;
|
||||
drvs[i][DS_SNATCH].pos = drvs[i][DS_SNATCH].len;
|
||||
vv += currprefs.dfxclick[i];
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
if (vv > 0) {
|
||||
write_log("reset driveclick \n");
|
||||
driveclick_reset ();
|
||||
click_initialized = 1;
|
||||
}
|
||||
|
@ -149,18 +149,16 @@ static const char *graphic_messages[] = {
|
||||
|
||||
/*00*/ "Correct aspect",
|
||||
/*01*/ "^|off|100%|95%|93%|90%|custom",
|
||||
/*02*/ " ",
|
||||
/*03*/ "Scanlines",
|
||||
/*04*/ "^|on|off",
|
||||
/*05*/ " ",
|
||||
/*06*/ "Leds",
|
||||
/*02*/ "Scanlines",
|
||||
/*03*/ "^|on|off",
|
||||
/*04*/ "Leds",
|
||||
/*05*/ "^|on|off",
|
||||
/*06*/ "Floppy sound",
|
||||
/*07*/ "^|on|off",
|
||||
/*08*/ " ",
|
||||
/*09*/ "Port",
|
||||
/*10*/ "^|SD|USB|SMB",
|
||||
/*11*/ " ",
|
||||
/*12*/ "Rumble",
|
||||
/*13*/ "^|on|off",
|
||||
/*08*/ "Port",
|
||||
/*09*/ "^|SD|USB|SMB",
|
||||
/*10*/ "Rumble",
|
||||
/*11*/ "^|on|off",
|
||||
NULL
|
||||
};
|
||||
|
||||
@ -538,6 +536,25 @@ cfgfile_save(&changed_prefs, user_options, 0);
|
||||
msgInfo("Configurations saved",3000,NULL);
|
||||
}
|
||||
|
||||
int get_dfxclick(void)
|
||||
{
|
||||
int sounddf_on = 0;
|
||||
int i;
|
||||
|
||||
for (i=0; i < 4; i++)
|
||||
if (changed_prefs.dfxclick[i]&&(changed_prefs.dfxtype[i]>=0)) sounddf_on =1;
|
||||
|
||||
return sounddf_on;
|
||||
}
|
||||
|
||||
void set_dfxclick(int sounddf_on)
|
||||
{
|
||||
int i;
|
||||
for (i=0; i < 4; i++)
|
||||
if ((changed_prefs.dfxtype[i]>=0)&&(changed_prefs.dfxclick[i]!=sounddf_on))
|
||||
changed_prefs.dfxclick[i] = sounddf_on;
|
||||
}
|
||||
|
||||
static void emulation_options(void)
|
||||
{
|
||||
int submenus[7];
|
||||
@ -571,7 +588,7 @@ static void emulation_options(void)
|
||||
|
||||
static void graphic_options(void)
|
||||
{
|
||||
int submenus[5];
|
||||
int submenus[6];
|
||||
int opt;
|
||||
|
||||
memset(submenus, 0, sizeof(submenus));
|
||||
@ -580,8 +597,9 @@ static void graphic_options(void)
|
||||
submenus[0] = get_gfx_aspect_ratio();
|
||||
submenus[1] = !(changed_prefs.gfx_linedbl == 2) ;
|
||||
submenus[2] = !changed_prefs.leds_on_screen;
|
||||
submenus[3] = changed_prefs.Port;
|
||||
submenus[4] = !changed_prefs.rumble;
|
||||
submenus[3] = !get_dfxclick();
|
||||
submenus[4] = changed_prefs.Port;
|
||||
submenus[5] = !changed_prefs.rumble;
|
||||
|
||||
opt = menu_select_title("Other options menu",
|
||||
graphic_messages, submenus);
|
||||
@ -591,8 +609,9 @@ static void graphic_options(void)
|
||||
set_gfx_aspect_ratio(submenus[0]);
|
||||
changed_prefs.gfx_linedbl = submenus[1] ? 1 : 2;
|
||||
changed_prefs.leds_on_screen = !submenus[2];
|
||||
set_Port(submenus[3]);
|
||||
changed_prefs.rumble = !submenus[4];
|
||||
set_dfxclick(!submenus[3]);
|
||||
set_Port(submenus[4]);
|
||||
changed_prefs.rumble = !submenus[5];
|
||||
currprefs.leds_on_screen = changed_prefs.leds_on_screen;
|
||||
currprefs.rumble = changed_prefs.rumble;
|
||||
}
|
||||
|
@ -21,6 +21,14 @@
|
||||
#include "menu.h"
|
||||
#include "VirtualKeyboard.h"
|
||||
|
||||
struct joyinfo {
|
||||
SDL_Joystick *joy;
|
||||
unsigned int axles;
|
||||
unsigned int buttons;
|
||||
};
|
||||
|
||||
extern unsigned int nr_joysticks;
|
||||
extern struct joyinfo joys[];
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -269,7 +277,7 @@ static const char **get_file_list(const char *base_dir)
|
||||
{
|
||||
char buf[255];
|
||||
const char *exts[] = {".adf", ".ADF", ".adz", ".ADZ", ".ipf", ".IPF", ".fdi", ".FDI",
|
||||
".sav", ".SAV", ".uss", ".USS", ".rom", ".ROM", NULL};
|
||||
".sav", ".SAV", ".uss", ".USS", ".rom", ".ROM", ".zip",".ZIP",".dms", ".DMS",NULL};
|
||||
struct stat st;
|
||||
|
||||
snprintf(buf, 255, "%s/%s", base_dir, de->d_name);
|
||||
@ -687,8 +695,8 @@ uint32_t menu_wait_key_press(void)
|
||||
static int joy_keys_last;
|
||||
|
||||
/* Wii-specific, sorry */
|
||||
for (nr = 0; nr < SDL_NumJoysticks(); nr++) {
|
||||
joy = SDL_JoystickOpen(nr);
|
||||
for (nr = 0; nr < nr_joysticks; nr++) {
|
||||
joy = joys[nr].joy;
|
||||
if (!joy)
|
||||
continue;
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
extern int gui_is_active;
|
||||
|
||||
static unsigned int nr_joysticks;
|
||||
unsigned int nr_joysticks;
|
||||
static int initialized;
|
||||
|
||||
struct joyinfo {
|
||||
@ -31,7 +31,7 @@ struct joyinfo {
|
||||
unsigned int buttons;
|
||||
};
|
||||
|
||||
static struct joyinfo joys[MAX_INPUT_DEVICES];
|
||||
struct joyinfo joys[MAX_INPUT_DEVICES];
|
||||
|
||||
//Wiimote Rumble
|
||||
#ifdef GEKKO
|
||||
|
@ -186,6 +186,10 @@ int init_sound (void)
|
||||
uae_sem_wait (&sound_init_sem);
|
||||
SDL_PauseAudio (0);
|
||||
|
||||
#ifdef DRIVESOUND
|
||||
driveclick_init();
|
||||
#endif
|
||||
|
||||
return have_sound;
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,9 @@ extern void reset_sound (void);
|
||||
STATIC_INLINE void check_sound_buffers (void)
|
||||
{
|
||||
if ((char *)sndbufpt - (char *)sndbuffer >= sndbufsize) {
|
||||
#ifdef DRIVESOUND
|
||||
driveclick_mix ((uae_s16*)sndbuffer, sndbufsize >> 1);
|
||||
#endif
|
||||
finish_sound_buffer ();
|
||||
sndbufpt = sndbuffer;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user