Skip to content

Commit

Permalink
update to 0.40.9
Browse files Browse the repository at this point in the history
wothke committed Jun 8, 2019
1 parent a797c02 commit cc0a9ba
Showing 119 changed files with 13,652 additions and 4,776 deletions.
Binary file modified emscripten/built/chips.bc
Binary file not shown.
Binary file modified emscripten/built/main.bc
Binary file not shown.
20 changes: 10 additions & 10 deletions emscripten/htdocs/backend_vgm.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions emscripten/makeEmscripten.bat
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ rem POOR MAN'S DOS PROMPT BUILD SCRIPT.. make sure to delete the respective *.b
rem existing *.bc files will not be recompiled. Unfortunately the script occasionally
rem fails for no good reason - this must be the wonderful world of DOS/Win... ;-)

rem XXX why -DVGM_BIG_ENDIAN??
setlocal enabledelayedexpansion

SET ERRORLEVEL
@@ -14,7 +15,7 @@ if not exist "built/thirdparty.bc" (
)

if not exist "built/chips.bc" (
call emcc.bat %OPT% ../src/chips/x1_010.c ../src/chips/ws_audio.c ../src/chips/vsu.c ../src/chips/saa1099.c ../src/chips/iremga20.c ../src/chips/es5506.c ../src/chips/es5503.c ../src/chips/c352.c ../src/chips/262intf.c ../src/chips/2151intf.c ../src/chips/2203intf.c ../src/chips/2413intf.c ../src/chips/2608intf.c ../src/chips/2610intf.c ../src/chips/2612intf.c ../src/chips/3526intf.c ../src/chips/3812intf.c ../src/chips/8950intf.c ../src/chips/adlibemu_opl2.c ../src/chips/adlibemu_opl3.c ../src/chips/ay8910.c ../src/chips/ay_intf.c ../src/chips/c140.c ../src/chips/c6280.c ../src/chips/c6280intf.c ../src/chips/dac_control.c ../src/chips/emu2149.c ../src/chips/emu2413.c ../src/chips/fm2612.c ../src/chips/fm.c ../src/chips/fmopl.c ../src/chips/gb.c ../src/chips/k051649.c ../src/chips/k053260.c ../src/chips/k054539.c ../src/chips/multipcm.c ../src/chips/nes_apu.c ../src/chips/nes_intf.c ../src/chips/np_nes_apu.c ../src/chips/np_nes_dmc.c ../src/chips/np_nes_fds.c ../src/chips/okim6258.c ../src/chips/okim6295.c ../src/chips/Ootake_PSG.c ../src/chips/panning.c ../src/chips/pokey.c ../src/chips/pwm.c ../src/chips/qsound.c ../src/chips/rf5c68.c ../src/chips/segapcm.c ../src/chips/scd_pcm.c ../src/chips/scsp.c ../src/chips/scspdsp.c ../src/chips/sn76489.c ../src/chips/sn76496.c ../src/chips/sn764intf.c ../src/chips/upd7759.c ../src/chips/ym2151.c ../src/chips/ym2413.c ../src/chips/ym2612.c ../src/chips/ymdeltat.c ../src/chips/ymf262.c ../src/chips/ymf271.c ../src/chips/ymf278b.c ../src/chips/ymz280b.c ../src/chips/ay8910_opl.c ../src/chips/sn76496_opl.c ../src/chips/ym2413hd.c ../src/chips/ym2413_opl.c -o built/chips.bc
call emcc.bat %OPT% ../src/chips/x1_010.c ../src/chips/ws_audio.c ../src/chips/vsu.c ../src/chips/saa1099.c ../src/chips/iremga20.c ../src/chips/es5506.c ../src/chips/es5503.c ../src/chips/c352.c ../src/chips/262intf.c ../src/chips/2151intf.c ../src/chips/2203intf.c ../src/chips/2413intf.c ../src/chips/2608intf.c ../src/chips/2610intf.c ../src/chips/2612intf.c ../src/chips/3526intf.c ../src/chips/3812intf.c ../src/chips/8950intf.c ../src/chips/adlibemu_opl2.c ../src/chips/adlibemu_opl3.c ../src/chips/ay8910.c ../src/chips/ay_intf.c ../src/chips/c140.c ../src/chips/c6280.c ../src/chips/c6280intf.c ../src/chips/dac_control.c ../src/chips/emu2149.c ../src/chips/emu2413.c ../src/chips/fm2612.c ../src/chips/fm.c ../src/chips/fmopl.c ../src/chips/gb.c ../src/chips/k051649.c ../src/chips/k053260.c ../src/chips/k054539.c ../src/chips/multipcm.c ../src/chips/nes_apu.c ../src/chips/nes_intf.c ../src/chips/np_nes_apu.c ../src/chips/np_nes_dmc.c ../src/chips/np_nes_fds.c ../src/chips/okim6258.c ../src/chips/okim6295.c ../src/chips/Ootake_PSG.c ../src/chips/panning.c ../src/chips/pokey.c ../src/chips/pwm.c ../src/chips/qsound_mame.c ../src/chips/qsound_intf.c ../src/chips/qsound_ctr.c ../src/chips/rf5c68.c ../src/chips/segapcm.c ../src/chips/scd_pcm.c ../src/chips/scsp.c ../src/chips/scspdsp.c ../src/chips/sn76489.c ../src/chips/sn76496.c ../src/chips/sn764intf.c ../src/chips/upd7759.c ../src/chips/ym2151.c ../src/chips/ym2413.c ../src/chips/ym2612.c ../src/chips/ymdeltat.c ../src/chips/ymf262.c ../src/chips/ymf271.c ../src/chips/ymf278b.c ../src/chips/ymz280b.c ../src/chips/ay8910_opl.c ../src/chips/sn76496_opl.c ../src/chips/ym3438.c ../src/chips/ym2413hd.c ../src/chips/ym2413_opl.c -o built/chips.bc
IF !ERRORLEVEL! NEQ 0 goto :END
)

@@ -23,6 +24,6 @@ if not exist "built/main.bc" (
IF !ERRORLEVEL! NEQ 0 goto :END
)

call emcc.bat %OPT% -s TOTAL_MEMORY=67108864 --closure 1 --llvm-lto 1 built/thirdparty.bc built/chips.bc built/main.bc -s EXPORTED_FUNCTIONS="['_alloc', '_emu_init','_emu_get_sample_rate','_emu_get_position','_emu_get_max_position','_emu_seek_position','_emu_teardown','_emu_set_subsong','_emu_get_track_info','_emu_get_audio_buffer','_emu_get_audio_buffer_length','_emu_compute_audio_samples', '_malloc', '_free']" -o htdocs/vgm.js -s SINGLE_FILE=0 -s EXTRA_EXPORTED_RUNTIME_METHODS="['ccall', 'Pointer_stringify']" -s BINARYEN_ASYNC_COMPILATION=1 -s BINARYEN_TRAP_MODE='clamp' && copy /b shell-pre.js + htdocs\vgm.js + shell-post.js htdocs\vgmPlay3.js && del htdocs\vgm.js && copy /b htdocs\vgmPlay3.js + vgm_adapter.js htdocs\backend_vgm.js && del htdocs\vgmPlay3.js
call emcc.bat %OPT% -s TOTAL_MEMORY=67108864 --closure 1 --llvm-lto 1 built/thirdparty.bc built/chips.bc built/main.bc -s EXPORTED_FUNCTIONS="['_alloc', '_emu_init','_emu_get_sample_rate','_emu_get_position','_emu_get_max_position','_emu_seek_position','_emu_teardown','_emu_set_subsong','_emu_get_track_info','_emu_get_audio_buffer','_emu_get_audio_buffer_length','_emu_compute_audio_samples', '_malloc', '_free']" -o htdocs/vgm.js -s SINGLE_FILE=0 -s EXTRA_EXPORTED_RUNTIME_METHODS="['ccall', 'Pointer_stringify']" -s BINARYEN_ASYNC_COMPILATION=1 -s BINARYEN_TRAP_MODE='clamp' && copy /b shell-pre.js + htdocs\vgm.js + shell-post.js htdocs\vgmPlay3.js && del htdocs\vgm.js && copy /b htdocs\vgmPlay3.js + vgm_adapter.js htdocs\backend_vgm.js && del htdocs\vgmPlay3.js

:END
2 changes: 1 addition & 1 deletion emscripten/makeEmscriptenStripped.bat
Original file line number Diff line number Diff line change
@@ -24,6 +24,6 @@ if not exist "built/main.bc" (
IF !ERRORLEVEL! NEQ 0 goto :END
)

call emcc.bat %OPT% --closure 1 --llvm-lto 1 -s TOTAL_MEMORY=67108864 built/thirdparty.bc built/chips.bc built/main.bc -s EXPORTED_FUNCTIONS="['_alloc', '_emu_init','_emu_get_sample_rate','_emu_get_position','_emu_get_max_position','_emu_seek_position','_emu_teardown','_emu_set_subsong','_emu_get_track_info','_emu_get_audio_buffer','_emu_get_audio_buffer_length','_emu_compute_audio_samples', '_malloc', '_free']" -o htdocs/vgm.js -s SINGLE_FILE=0 -s EXTRA_EXPORTED_RUNTIME_METHODS="['ccall', 'Pointer_stringify']" -s BINARYEN_ASYNC_COMPILATION=1 -s BINARYEN_TRAP_MODE='clamp' && copy /b shell-pre.js + htdocs\vgm.js + shell-post.js htdocs\vgmPlay3.js && del htdocs\vgm.js && copy /b htdocs\vgmPlay3.js + vgm_adapter.js htdocs\backend_vgm.js && del htdocs\vgmPlay3.js
call emcc.bat %OPT% --closure 1 --llvm-lto 1 -s TOTAL_MEMORY=67108864 built/chips.bc built/main.bc -s EXPORTED_FUNCTIONS="['_alloc', '_emu_init','_emu_get_sample_rate','_emu_get_position','_emu_get_max_position','_emu_seek_position','_emu_teardown','_emu_set_subsong','_emu_get_track_info','_emu_get_audio_buffer','_emu_get_audio_buffer_length','_emu_compute_audio_samples', '_malloc', '_free']" -o htdocs/vgm.js -s SINGLE_FILE=0 -s EXTRA_EXPORTED_RUNTIME_METHODS="['ccall', 'Pointer_stringify']" -s BINARYEN_ASYNC_COMPILATION=1 -s BINARYEN_TRAP_MODE='clamp' && copy /b shell-pre.js + htdocs\vgm.js + shell-post.js htdocs\vgmPlay3.js && del htdocs\vgm.js && copy /b htdocs\vgmPlay3.js + vgm_adapter.js htdocs\backend_vgm.js && del htdocs\vgmPlay3.js

:END
4 changes: 4 additions & 0 deletions src/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/obj
/vgm2pcm
/vgmplay
/vgm2wav
26 changes: 21 additions & 5 deletions src/ChipMapper.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ChipMapper.c - Handles Chip Write (including OPL Hardware Support)

#include <stdio.h>
#include <memory.h>
#include <string.h>
#include <math.h>
#include "stdbool.h"

@@ -12,16 +12,30 @@
#endif

#ifdef WIN32

#include <conio.h>
#include <windows.h> // for QueryPerformance###

#else

#ifndef DISABLE_HW_SUPPORT
#include <unistd.h>
#ifdef __APPLE__
#include <architecture/i386/io.h>
#else
#include <sys/io.h>
#endif
#endif // DISABLE_HW_SUPPORT

#include <time.h>
#endif

#ifdef __APPLE__
#define ioperm(x,y,z)
#define outb(x,y)
#define inb(x)
#endif

#include "chips/mamedef.h"

#include "chips/ChipIncl.h"
@@ -71,6 +85,7 @@ extern bool WINNT_MODE;
extern UINT16 FMPort;
extern UINT8 PlayingMode;
extern bool FMBreakFade;
extern bool FMOPL2Pan;
extern float FinalVol;

#ifdef WIN32
@@ -84,7 +99,8 @@ extern float FinalVol;
#define DELAY_OPL2_REG 3.3f
#define DELAY_OPL2_DATA 23.0f
#define DELAY_OPL3_REG 0.0f
#define DELAY_OPL3_DATA 0.28f
//#define DELAY_OPL3_DATA 0.28f // fine for ISA cards (like SoundBlaster 16)
#define DELAY_OPL3_DATA 13.3f // required for PCI cards (CMI8738)
#ifdef WIN32
INT64 HWusTime;
#endif
@@ -726,14 +742,14 @@ void chip_reg_write(UINT8 ChipType, UINT8 ChipID,
}
break;
case 0x09: // YM3812
if ((Offset & 0xF0) == 0xC0 && ! (Data & 0x30))
if ((Offset & 0xF0) == 0xC0 && (! FMOPL2Pan || ! (Data & 0x30)))
Data |= 0x30;
else if ((Offset & 0xF0) == 0xE0)
Data &= 0xF3;
OPL_RegMapper((ChipID << 8) | Offset, Data);
break;
case 0x0A: // YM3526
if ((Offset & 0xF0) == 0xC0 && ! (Data & 0x30))
if ((Offset & 0xF0) == 0xC0 && (! FMOPL2Pan || ! (Data & 0x30)))
Data |= 0x30;
else if ((Offset & 0xF0) == 0xE0)
Data &= 0xF0;
@@ -742,7 +758,7 @@ void chip_reg_write(UINT8 ChipType, UINT8 ChipID,
case 0x0B: // Y8950
if (Offset == 0x07 || (Offset >= 0x09 && Offset <= 0x17))
break;
if ((Offset & 0xF0) == 0xC0 && ! (Data & 0x30))
if ((Offset & 0xF0) == 0xC0 && (! FMOPL2Pan || ! (Data & 0x30)))
Data |= 0x30;
else if ((Offset & 0xF0) == 0xE0)
Data &= 0xF0;
Loading

0 comments on commit cc0a9ba

Please sign in to comment.