1 diff -aur srcs/Makefile srcs_new/Makefile
2 --- srcs/Makefile 2007-05-08 08:23:46.000000000 -0700
3 +++ srcs_new/Makefile 2008-07-25 04:27:08.000000000 -0700
5 #---[ UNIX/GCC ]---------------------------------------
9 +ifneq ($(LOCALBUILD), yes)
13 +DATADIR = share/$(PRODUCT)
14 +DOCSDIR = share/doc/$(PRODUCT)
31 -DEF_OS = -DUNIX -DX86_ASM -DASM_SYMBOLS_REQUIRE_UNDERSCORE
32 +ifneq ($(LOCALBUILD), yes)
33 +DEF_OPT = -DDATA_DIR="\"$(PREFIX)/$(DATADIR)\"" -DDOCS_DIR="\"$(PREFIX)/$(DOCSDIR)\"" -DCONFDIR
35 +DEF_OS = -DUNIX -DX86_ASM -DASM_SYMBOLS_REQUIRE_UNDERSCORE $(DEF_OPT)
36 INC_OS = -Ilibs -I../include # This may require an update
40 #-----------------------------------------------------
42 #-----------------------------------------------------
43 -INCLUDES = -I. -I./tools -I./sound $(INC_OS)
44 +INCLUDES += -I. -I./tools -I./sound $(INC_OS)
46 #-----------------------------------------------------
47 # Preprocessor Definitions
49 #-----------------------------------------------------
51 #-----------------------------------------------------
52 -CFLAGS = $(INCLUDES) $(DEFINES)
53 +CFLAGS += $(INCLUDES) $(DEFINES)
55 ifeq ($(SYSTEM), win32)
60 ifeq ($(BUILD), release)
61 -CFLAGS += -Wall -march=pentium -O6 -ffast-math -fno-strength-reduce -funroll-all-loops -fomit-frame-pointer
62 +CFLAGS += -Wall -ffast-math -fno-strength-reduce -funroll-all-loops -fomit-frame-pointer
65 ifeq ($(BUILD), debug)
69 @echo " exe - Build executable"
70 + @echo " install - Install files on UNIX distribution"
71 @echo " dist - Build all distributions"
72 @echo " dist_src - Build sources distribution"
73 @echo " dist_bin_dos - Build binary DOS distribution"
75 # Not sure if this still work
76 ifeq ($(SYSTEM), unix)
78 - @echo Creating Dist/mekanix.tgz
79 + make install DESTDIR=./Dist/$(PRODUCT) LOCALBUILD=yes
80 + @echo Creating ./Dist/$(PRODUCT).tar.gz
83 + -upx -9 ./Dist/$(PRODUCT)/meka
86 - -mkdir ./Dist/mekanix/
87 - cp meka meka.blt meka.cfg meka.dat meka.inp meka.msg meka.nam meka.pat meka.thm icons.zip ./mekanix/
88 - cp meka.txt mekanix.txt changes.txt compat.txt debugger.txt multi.txt tech.txt ./mekanix/
89 - cp -R Themes ./mekanix/
90 - tar cvzf Dist/mekanix.tgz ./mekanix
92 + cd ./Dist && tar cvzf $(PRODUCT).tar.gz $(PRODUCT)
93 + $(RM) -fR ./Dist/$(PRODUCT)
95 - @echo -- Check MEKA.BLT ! --
96 - @echo -- Check MEKA.INP ! Joypad auto, on --
97 + @echo -- Check meka.blt ! --
98 + @echo -- Check meka.inp ! Joypad auto, on --
102 +ifeq ($(SYSTEM), unix)
104 + $(MKDIR) $(DESTDIR)$(PREFIX)/$(BINDIR)
105 + $(MKDIR) $(DESTDIR)$(PREFIX)/$(DATADIR)
106 +# $(MKDIR) $(DESTDIR)$(PREFIX)/$(DOCSDIR)
107 + $(MKDIR) $(DESTDIR)$(PREFIX)/$(DATADIR)/Themes
108 + $(CP) $(EXE) $(DESTDIR)$(PREFIX)/$(BINDIR)/
109 + chmod +x $(DESTDIR)$(PREFIX)/$(BINDIR)/meka
110 + $(CP) ../*.{blt,dat,inp,msg,nam,pat,thm} $(DESTDIR)$(PREFIX)/$(DATADIR)/
111 + $(CP) ../icons.zip $(DESTDIR)$(PREFIX)/$(DATADIR)/
112 + $(CP) ../Themes/*.{txt,png} $(DESTDIR)$(PREFIX)/$(DATADIR)/Themes/
113 +# $(CP) ../*.txt $(DESTDIR)$(PREFIX)/$(DOCSDIR)
116 # Cleaning rules -------------------------------------
117 diff -aur srcs/config.c srcs_new/config.c
118 --- srcs/config.c 2007-05-08 12:23:38.000000000 -0700
119 +++ srcs_new/config.c 2008-07-25 04:18:57.000000000 -0700
120 @@ -441,10 +441,15 @@
125 + if (!file_exists (g_Env.Paths.ConfigurationDirectory, 0xFF, NULL)) {
126 + meka_mkdir(g_Env.Paths.ConfigurationDirectory); }
127 + sprintf (value, g_Env.Paths.ConfigurationFile);
129 StrCpyPathRemoved(value, g_Env.Paths.ConfigurationFile);
134 ConsolePrintf (Msg_Get(MSG_Config_Loading), value);
136 // Open and read file
137 diff -aur srcs/file.c srcs_new/file.c
138 --- srcs/file.c 2007-05-12 14:17:40.000000000 -0700
139 +++ srcs_new/file.c 2008-07-25 04:18:57.000000000 -0700
140 @@ -111,62 +111,78 @@
141 // ConsolePrintf ("g_Env.Paths.EmulatorDirectory = %s\n", g_Env.Paths.EmulatorDirectory);
142 // ConsolePrintf ("argv[0] = %s\n", g_Env.argv[0]);
144 + // Set configuration directory
146 + sprintf (g_Env.Paths.ConfigurationDirectory, "%s/.config/mekanix", getenv ("HOME"));
148 + sprintf (g_Env.Paths.ConfigurationDirectory, g_Env.Paths.EmulatorDirectory);
151 + // Set data directory
153 + sprintf (g_Env.Paths.DataDirectory, DATA_DIR);
155 + sprintf (g_Env.Paths.DataDirectory, g_Env.Paths.EmulatorDirectory);
158 + // Set documentation directory
160 + sprintf (g_Env.Paths.DocumentationDirectory, DOCS_DIR);
162 + sprintf (g_Env.Paths.DocumentationDirectory, g_Env.Paths.EmulatorDirectory);
169 - char temp[FILENAME_LEN];
170 - strcpy (temp, g_Env.Paths.EmulatorDirectory);
171 - realpath (temp, g_Env.Paths.EmulatorDirectory);
172 - len = strlen (g_Env.Paths.EmulatorDirectory);
173 - g_Env.Paths.EmulatorDirectory [len] = '/';
174 - g_Env.Paths.EmulatorDirectory [len + 1] = EOSTR;
176 + Get_NixRealPath (g_Env.Paths.EmulatorDirectory);
177 + Get_NixRealPath (g_Env.Paths.DataDirectory);
178 + Get_NixRealPath (g_Env.Paths.ConfigurationDirectory);
179 + Get_NixRealPath (g_Env.Paths.DocumentationDirectory);
181 strlwr (g_Env.Paths.EmulatorDirectory);
182 + strlwr (g_Env.Paths.DataDirectory);
183 + strlwr (g_Env.Paths.ConfigurationDirectory);
184 + strlwr (g_Env.Paths.DocumentationDirectory);
188 - sprintf (g_Env.Paths.DataFile, "%s/meka.dat", g_Env.Paths.EmulatorDirectory);
189 - sprintf (g_Env.Paths.DataBaseFile, "%s/meka.nam", g_Env.Paths.EmulatorDirectory);
190 - sprintf (g_Env.Paths.SkinFile, "%s/meka.thm", g_Env.Paths.EmulatorDirectory);
192 - sprintf (Patches.filename, "%s/meka.pat", g_Env.Paths.EmulatorDirectory);
193 - sprintf (VLFN_DataBase.filename, "%s/meka.fdb", g_Env.Paths.EmulatorDirectory);
194 - sprintf (Blitters.filename, "%s/meka.blt", g_Env.Paths.EmulatorDirectory);
195 + sprintf (g_Env.Paths.DataFile, "%s/meka.dat", g_Env.Paths.DataDirectory);
196 + sprintf (g_Env.Paths.DataBaseFile, "%s/meka.nam", g_Env.Paths.DataDirectory);
197 + sprintf (g_Env.Paths.SkinFile, "%s/meka.thm", g_Env.Paths.DataDirectory);
199 + sprintf (Patches.filename, "%s/meka.pat", g_Env.Paths.DataDirectory);
200 + sprintf (VLFN_DataBase.filename, "%s/meka.fdb", g_Env.Paths.ConfigurationDirectory);
201 + sprintf (Blitters.filename, "%s/meka.blt", g_Env.Paths.DataDirectory);
202 //sprintf (registered.filename [0], "%s/meka.reg", g_Env.Paths.EmulatorDirectory);
203 //sprintf (registered.filename [1], "%s/meka.key", g_Env.Paths.EmulatorDirectory);
204 - sprintf (Desktop.filename, "%s/meka.dsk", g_Env.Paths.EmulatorDirectory);
205 - sprintf (Inputs.FileName, "%s/meka.inp", g_Env.Paths.EmulatorDirectory);
206 - sprintf (Messages.FileName, "%s/meka.msg", g_Env.Paths.EmulatorDirectory);
207 + sprintf (Desktop.filename, "%s/meka.dsk", g_Env.Paths.DataDirectory);
208 + sprintf (Inputs.FileName, "%s/meka.inp", g_Env.Paths.DataDirectory);
209 + sprintf (Messages.FileName, "%s/meka.msg", g_Env.Paths.DataDirectory);
212 - sprintf (g_Env.Paths.DocumentationMain, "%s/meka.txt", g_Env.Paths.EmulatorDirectory);
213 + sprintf (g_Env.Paths.DocumentationMain, "%s/meka.txt", g_Env.Paths.DocumentationDirectory);
215 - sprintf (g_Env.Paths.DocumentationMainW, "%s/mekaw.txt", g_Env.Paths.EmulatorDirectory);
216 + sprintf (g_Env.Paths.DocumentationMainW, "%s/mekaw.txt", g_Env.Paths.DocumentationDirectory);
218 - sprintf (g_Env.Paths.DocumentationMainU, "%s/mekanix.txt", g_Env.Paths.EmulatorDirectory);
219 + sprintf (g_Env.Paths.DocumentationMainU, "%s/mekanix.txt", g_Env.Paths.DocumentationDirectory);
221 - sprintf (g_Env.Paths.DocumentationCompat, "%s/compat.txt", g_Env.Paths.EmulatorDirectory);
222 - sprintf (g_Env.Paths.DocumentationMulti, "%s/multi.txt", g_Env.Paths.EmulatorDirectory);
223 - sprintf (g_Env.Paths.DocumentationChanges, "%s/changes.txt", g_Env.Paths.EmulatorDirectory);
224 - sprintf (g_Env.Paths.DocumentationDebugger, "%s/debugger.txt", g_Env.Paths.EmulatorDirectory);
225 + sprintf (g_Env.Paths.DocumentationCompat, "%s/compat.txt", g_Env.Paths.DocumentationDirectory);
226 + sprintf (g_Env.Paths.DocumentationMulti, "%s/multi.txt", g_Env.Paths.DocumentationDirectory);
227 + sprintf (g_Env.Paths.DocumentationChanges, "%s/changes.txt", g_Env.Paths.DocumentationDirectory);
228 + sprintf (g_Env.Paths.DocumentationDebugger, "%s/debugger.txt", g_Env.Paths.DocumentationDirectory);
230 // Configuration file
232 - sprintf (g_Env.Paths.ConfigurationFile, "%s/mekaw.cfg", g_Env.Paths.EmulatorDirectory);
233 + sprintf (g_Env.Paths.ConfigurationFile, "%s/mekaw.cfg", g_Env.Paths.ConfigurationDirectory);
235 - sprintf (g_Env.Paths.ConfigurationFile, "%s/meka.cfg", g_Env.Paths.EmulatorDirectory);
236 + sprintf (g_Env.Paths.ConfigurationFile, "%s/meka.cfg", g_Env.Paths.ConfigurationDirectory);
241 - sprintf (g_Env.Paths.ScreenshotDirectory, "%s/Shots", g_Env.Paths.EmulatorDirectory);
243 - sprintf (g_Env.Paths.ScreenshotDirectory, "%s/Screenshots", g_Env.Paths.EmulatorDirectory);
245 - sprintf (g_Env.Paths.SavegameDirectory, "%s/Saves", g_Env.Paths.EmulatorDirectory);
246 - sprintf (g_Env.Paths.MusicDirectory, "%s/Music", g_Env.Paths.EmulatorDirectory);
247 - sprintf (g_Env.Paths.DebugDirectory, "%s/Debug", g_Env.Paths.EmulatorDirectory);
248 + sprintf (g_Env.Paths.ScreenshotDirectory, "%s/Shots", g_Env.Paths.ConfigurationDirectory);
249 + sprintf (g_Env.Paths.SavegameDirectory, "%s/Saves", g_Env.Paths.ConfigurationDirectory);
250 + sprintf (g_Env.Paths.MusicDirectory, "%s/Music", g_Env.Paths.ConfigurationDirectory);
251 + sprintf (g_Env.Paths.DebugDirectory, "%s/Debug", g_Env.Paths.ConfigurationDirectory);
254 strcpy (g_Env.Paths.MediaImageFile, "");
260 +void Get_NixRealPath (char * path) {
262 + char temp[FILENAME_LEN];
263 + strcpy (temp, path);
264 + realpath (temp, path);
265 + len = strlen (path);
266 + path [len] = EOSTR;
267 +// path [len] = '/';
268 +// path [len + 1] = EOSTR;
272 //-----------------------------------------------------------------------------
273 diff -aur srcs/file.h srcs_new/file.h
274 --- srcs/file.h 2006-07-03 19:04:51.000000000 -0700
275 +++ srcs_new/file.h 2008-07-25 04:18:57.000000000 -0700
278 void Filenames_Init (void); // Initialize filenames used by emulator (path to config files, etc.)
279 void Filenames_Init_ROM (void); // Initialize filenames for current ROM
281 +void Get_NixRealPath (char * path);
284 -//-----------------------------------------------------------------------------
286 +//-----------------------------------------------------------------------------
287 \ No newline at end of file
288 diff -aur srcs/meka.h srcs_new/meka.h
289 --- srcs/meka.h 2007-05-08 11:47:24.000000000 -0700
290 +++ srcs_new/meka.h 2008-07-25 04:18:57.000000000 -0700
292 // Max tiles (in video mode 5)
293 #define MAX_TILES (512)
296 -//// FIXME: Currently call makecol(), should refer to a precomputed table
298 +//// FIXME: Currently call makecol(), should refer to a precomputed table
299 #define COLOR_BLACK (0x00000000) //makecol(0,0,0)
300 #define COLOR_WHITE (0xFFFFFFFF) //makecol(255,255,255)
303 char EmulatorDirectory [FILENAME_LEN];
304 char StartingDirectory [FILENAME_LEN];
305 char ConfigurationFile [FILENAME_LEN];
306 + char ConfigurationDirectory [FILENAME_LEN];
307 + char DataDirectory [FILENAME_LEN];
308 char DataBaseFile [FILENAME_LEN];
309 char DataFile [FILENAME_LEN];
310 + char DocumentationDirectory [FILENAME_LEN];
311 char SkinFile [FILENAME_LEN];
312 char ScreenshotDirectory [FILENAME_LEN];
313 char SavegameDirectory [FILENAME_LEN];
315 int video_mode_gui_access_mode; // Make obsolete
318 - const char * capture_filename_template;
319 - bool capture_automatic_crop_align;
320 + const char * capture_filename_template;
321 + bool capture_automatic_crop_align;
324 } t_meka_configuration;
325 diff -aur srcs/skin.c srcs_new/skin.c
326 --- srcs/skin.c 2006-12-25 12:21:29.000000000 -0800
327 +++ srcs_new/skin.c 2008-07-25 04:18:58.000000000 -0700
329 if (Skins.skin_current->background_picture != NULL)
331 char filename[FILENAME_LEN];
332 - sprintf(filename, "%s/%s", g_Env.Paths.EmulatorDirectory, Skins.skin_current->background_picture);
333 + sprintf(filename, "%s/%s", g_Env.Paths.DataDirectory, Skins.skin_current->background_picture);
334 Skins.background_picture = load_bitmap(filename, NULL);
335 if (Skins.background_picture == NULL)
337 diff -aur srcs/sound/sasound.h srcs_new/sound/sasound.h
338 --- srcs/sound/sasound.h 2006-07-03 19:04:51.000000000 -0700
339 +++ srcs_new/sound/sasound.h 2008-07-25 04:18:57.000000000 -0700
342 void saUpdateSound (int nowclock);
343 int saGetSoundCard (int soundcard);
344 -BOOL saInitSoundCard (int soundcard, int buffer_mode, int sample_rate);
345 +BOOL2 saInitSoundCard (int soundcard, int buffer_mode, int sample_rate);
346 void saSetupSound (SoundRecEntry *rec);
347 void saAddSound (SoundRecEntry *rec);
348 void saDestroySound (void);
349 diff -aur srcs/sound/sound.h srcs_new/sound/sound.h
350 --- srcs/sound/sound.h 2006-07-03 19:04:51.000000000 -0700
351 +++ srcs_new/sound/sound.h 2008-07-25 04:18:57.000000000 -0700
353 //-----------------------------------------------------------------------------
355 -// Sound Engine - Headers
357 +// Sound Engine - Headers
358 //-----------------------------------------------------------------------------
359 -// Hiromitsu Shioya, 1998-1999
360 -// Omar Cornut, 1999+
361 +// Hiromitsu Shioya, 1998-1999
362 +// Omar Cornut, 1999+
363 //-----------------------------------------------------------------------------
365 -//-----------------------------------------------------------------------------
367 -//-----------------------------------------------------------------------------
369 -// Include SEAL library headers
373 -// Uncomment the appropriate:
374 -#include "audio.h" // Official SEAL distribute name
375 -// #include "seal.h" // Debian package header file was renamed to seal.h
376 -// FIXME: Need to automate this of use some Makefile trickery to detect.
379 -//-----------------------------------------------------------------------------
381 -//-----------------------------------------------------------------------------
383 -#define SOUND_SOUNDCARD_SELECT (-1)
384 -#define SOUND_SOUNDCARD_NONE (0)
385 -#define SOUND_VOICES_MAX (16)
387 -#define SOUND_MACHINE_SN76496 (0)
388 -#define SOUND_MACHINE_YM2413HD (1)
389 -#define SOUND_MACHINE_EMU2413 (2)
391 -#define FM_EMULATOR_NONE (0x00)
392 -#define FM_EMULATOR_YM2413HD (0x01) // Hiromitsu Shioya / through OPL
393 -#define FM_EMULATOR_EMU2413 (0x02) // Mitsutaka Okazaki / digital
395 -//-----------------------------------------------------------------------------
397 -//-----------------------------------------------------------------------------
404 -#include "s_opl.h" // S_OPL.H OPL
407 -//-----------------------------------------------------------------------------
408 -// INCLUDES (more. note the unordered mess)
409 -//-----------------------------------------------------------------------------
411 -#include "vgm.h" // VGM.H : for VGM file creation
412 -#include "wav.h" // WAV.H : for WAV file creation
414 -//-----------------------------------------------------------------------------
416 -//-----------------------------------------------------------------------------
418 -// SaSound voice (legacy)
421 - HAC hVoice; // SEAL voice handler
422 - LPAUDIOWAVE lpWave;
423 - LPBYTE vstreambuf; // use bufferedstream mode: stock buffer
424 - int vstreambuf_chunk_ready[3];
425 - int playing; // TRUE/FALSE
426 - // Variables below are unclear...
428 - int vchan; // use bufferedstream mode : write butter counter
429 - int ventry; // use bufferedstream mode : entry SEAL buffer counter
430 - int vlen; // buffer length
431 - int vruncount; // use bufferedstream mode : stock "sound_freerun_count"
432 - int * vpan; // Pan buffer
433 - int vrestart; // Error restart flag
436 -// t_sound, hold all variables/configurations stuff for the sound part
442 - int SoundCard; // Seal SoundCard ID
443 - int SampleRate; // In Hz
444 - int Paused; // Paused stack. Sounds play only when this is zero
445 - int MasterVolume; // Master Volume (0-128)
448 - int FM_Enabled; // FM Emulation enabled (emulated machine)
449 - int FM_Emulator_Current; // FM Emulators, currently used (host machine)
450 - int FM_Emulator_Available; // FM Emulators, mask of available type(s), zero if none
455 - int OPL_Address; // 220h, 230h, etc... 0 if none
458 - // Voices (SaSound legacy...)
464 - int LogWav_SizeData;
465 - char * LogWav_FileName_Template;
468 - int LogVGM_Logging_Accuracy;
469 - char * LogVGM_FileName_Template;
474 -int Sound_CycleCounter; // Number of cycle elapsed since last sound sync.
476 -//-----------------------------------------------------------------------------
478 -//-----------------------------------------------------------------------------
480 -void Sound_Init_Config (void); // Initialize sound structure with its default values
481 -int Sound_Init_SEAL (void); // Initialize SEAL
482 -int Sound_Init (void); // Initialize sound engine
483 -void Sound_Close (void); // Close sound engine
485 -void Sound_Update_Frame (void); // Miscellaneous things to do on each frame
487 -void Sound_Playback_Start (void); // Start sound playback
488 -void Sound_Playback_Stop (void); // Stop sound playback
490 -void Sound_Playback_Mute (void); // Mute sound playback
491 -void Sound_Playback_Resume (void); // Resume sound playback
493 -void Sound_MasterVolume_Set (int v); // Change Master Volume
495 -//-----------------------------------------------------------------------------
496 -// All ununderstandable stuff from old engine
497 -//-----------------------------------------------------------------------------
499 -#define INSTALL_SOUND_TIMER
500 -#define INSTALL_CALC_SOUNDCPU_CLOCK
502 -//#define DEF_STREAM_BUFFER_MAXA (3)
503 -#define DEF_MODEB_FRAME_SIZE (60)
504 -#define DEF_MODEB_UPDATE_COUNT (3)
505 -#define DEF_STREAM_BUFFER_MAXB ((DEF_FRAME_SIZE / DEF_MODEB_UPDATE_COUNT))
506 -#define DEF_STREAM_UPDATE_ERROR_MAX (16) // error wait is 16 seconds.
508 -int STREAM_BUFFER_MAXA;
509 -int STREAM_BUFFER_MAXB;
510 -int MODEB_UPDATE_COUNT;
511 -int MODEB_FRAME_SIZE;
513 -int MODEB_ERROR_MAX;
515 -int sound_stream_mode;
517 -#define SOUND_STREAM_NORMAL (0)
518 -#define SOUND_STREAM_WAIT (1)
520 -//-----------------------------------------------------------------------------
521 -// INCLUDES (even more. note the unordered mess)
522 -//-----------------------------------------------------------------------------
524 -#include "s_log.h" // S_LOG.H Sound logging
525 -#include "s_misc.h" // S_MISC.H Miscellaenous
527 -#include "psg.h" // PSG.H PSG SN-76496 emulator
529 -#include "fmunit.h" // FMUNIT.H FM Unit wrapper to emulators
530 -#include "fmeditor.h" // FMEDITOR.H FM instrument editor applet
531 -#include "ym2413hd.h" // YM2413HD.H FM emulator / OPL
532 -#include "emu2413/mekaintf.h" // EMU2413.H... FM emulator / Digital
533 -#include "sasound.h" // SASOUND.H Sound system (by Hiroshi)
535 -//-----------------------------------------------------------------------------
539 +//-----------------------------------------------------------------------------
541 +//-----------------------------------------------------------------------------
543 +// Include SEAL library headers
547 +// Uncomment the appropriate:
548 +// #include "audio.h" // Official SEAL distribute name
549 +#include "seal.h" // Debian package header file was renamed to seal.h
550 +// FIXME: Need to automate this of use some Makefile trickery to detect.
553 +//-----------------------------------------------------------------------------
555 +//-----------------------------------------------------------------------------
557 +#define SOUND_SOUNDCARD_SELECT (-1)
558 +#define SOUND_SOUNDCARD_NONE (0)
559 +#define SOUND_VOICES_MAX (16)
561 +#define SOUND_MACHINE_SN76496 (0)
562 +#define SOUND_MACHINE_YM2413HD (1)
563 +#define SOUND_MACHINE_EMU2413 (2)
565 +#define FM_EMULATOR_NONE (0x00)
566 +#define FM_EMULATOR_YM2413HD (0x01) // Hiromitsu Shioya / through OPL
567 +#define FM_EMULATOR_EMU2413 (0x02) // Mitsutaka Okazaki / digital
569 +//-----------------------------------------------------------------------------
571 +//-----------------------------------------------------------------------------
578 +#include "s_opl.h" // S_OPL.H OPL
581 +//-----------------------------------------------------------------------------
582 +// INCLUDES (more. note the unordered mess)
583 +//-----------------------------------------------------------------------------
585 +#include "vgm.h" // VGM.H : for VGM file creation
586 +#include "wav.h" // WAV.H : for WAV file creation
588 +//-----------------------------------------------------------------------------
590 +//-----------------------------------------------------------------------------
592 +// SaSound voice (legacy)
595 + HAC hVoice; // SEAL voice handler
596 + LPAUDIOWAVE lpWave;
597 + LPBYTE vstreambuf; // use bufferedstream mode: stock buffer
598 + int vstreambuf_chunk_ready[3];
599 + int playing; // TRUE/FALSE
600 + // Variables below are unclear...
602 + int vchan; // use bufferedstream mode : write butter counter
603 + int ventry; // use bufferedstream mode : entry SEAL buffer counter
604 + int vlen; // buffer length
605 + int vruncount; // use bufferedstream mode : stock "sound_freerun_count"
606 + int * vpan; // Pan buffer
607 + int vrestart; // Error restart flag
610 +// t_sound, hold all variables/configurations stuff for the sound part
616 + int SoundCard; // Seal SoundCard ID
617 + int SampleRate; // In Hz
618 + int Paused; // Paused stack. Sounds play only when this is zero
619 + int MasterVolume; // Master Volume (0-128)
622 + int FM_Enabled; // FM Emulation enabled (emulated machine)
623 + int FM_Emulator_Current; // FM Emulators, currently used (host machine)
624 + int FM_Emulator_Available; // FM Emulators, mask of available type(s), zero if none
629 + int OPL_Address; // 220h, 230h, etc... 0 if none
632 + // Voices (SaSound legacy...)
638 + int LogWav_SizeData;
639 + char * LogWav_FileName_Template;
642 + int LogVGM_Logging_Accuracy;
643 + char * LogVGM_FileName_Template;
648 +int Sound_CycleCounter; // Number of cycle elapsed since last sound sync.
650 +//-----------------------------------------------------------------------------
652 +//-----------------------------------------------------------------------------
654 +void Sound_Init_Config (void); // Initialize sound structure with its default values
655 +int Sound_Init_SEAL (void); // Initialize SEAL
656 +int Sound_Init (void); // Initialize sound engine
657 +void Sound_Close (void); // Close sound engine
659 +void Sound_Update_Frame (void); // Miscellaneous things to do on each frame
661 +void Sound_Playback_Start (void); // Start sound playback
662 +void Sound_Playback_Stop (void); // Stop sound playback
664 +void Sound_Playback_Mute (void); // Mute sound playback
665 +void Sound_Playback_Resume (void); // Resume sound playback
667 +void Sound_MasterVolume_Set (int v); // Change Master Volume
669 +//-----------------------------------------------------------------------------
670 +// All ununderstandable stuff from old engine
671 +//-----------------------------------------------------------------------------
673 +#define INSTALL_SOUND_TIMER
674 +#define INSTALL_CALC_SOUNDCPU_CLOCK
676 +//#define DEF_STREAM_BUFFER_MAXA (3)
677 +#define DEF_MODEB_FRAME_SIZE (60)
678 +#define DEF_MODEB_UPDATE_COUNT (3)
679 +#define DEF_STREAM_BUFFER_MAXB ((DEF_FRAME_SIZE / DEF_MODEB_UPDATE_COUNT))
680 +#define DEF_STREAM_UPDATE_ERROR_MAX (16) // error wait is 16 seconds.
682 +int STREAM_BUFFER_MAXA;
683 +int STREAM_BUFFER_MAXB;
684 +int MODEB_UPDATE_COUNT;
685 +int MODEB_FRAME_SIZE;
687 +int MODEB_ERROR_MAX;
689 +int sound_stream_mode;
691 +#define SOUND_STREAM_NORMAL (0)
692 +#define SOUND_STREAM_WAIT (1)
694 +//-----------------------------------------------------------------------------
695 +// INCLUDES (even more. note the unordered mess)
696 +//-----------------------------------------------------------------------------
698 +#include "s_log.h" // S_LOG.H Sound logging
699 +#include "s_misc.h" // S_MISC.H Miscellaenous
701 +#include "psg.h" // PSG.H PSG SN-76496 emulator
703 +#include "fmunit.h" // FMUNIT.H FM Unit wrapper to emulators
704 +#include "fmeditor.h" // FMEDITOR.H FM instrument editor applet
705 +#include "ym2413hd.h" // YM2413HD.H FM emulator / OPL
706 +#include "emu2413/mekaintf.h" // EMU2413.H... FM emulator / Digital
707 +#include "sasound.h" // SASOUND.H Sound system (by Hiroshi)
709 +//-----------------------------------------------------------------------------