From: sparky4 Date: Sat, 12 Sep 2015 20:21:09 +0000 (-0500) Subject: reverted it back to valley's version www X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=3905085894af7601c6c590f051dc20ca3db08bd9;p=16.git reverted it back to valley's version www modified: exmmtest.map modified: scroll.map modified: src/lib/vgmsnd/stdtype.h modified: src/lib/vgmsnd/vgmSnd.c modified: src/lib/vgmsnd/vgmSnd.h modified: vgmtest.exe --- diff --git a/exmmtest.map b/exmmtest.map index 436b9573..8b0da36c 100755 --- a/exmmtest.map +++ b/exmmtest.map @@ -1,6 +1,6 @@ Open Watcom Linker Version 1.9 Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved. -Created on: 15/09/12 12:47:11 +Created on: 15/09/12 15:21:02 Executable Image: exmmtest.exe creating a DOS executable @@ -495,4 +495,4 @@ Module: /usr/watcom/lib286/dos/clibc.lib(clearenv.c) Stack size: 8000 (32768.) Memory size: 00011e70 (73328.) Entry point address: 0000:47f4 -Link time: 00:00.01 +Link time: 00:00.00 diff --git a/scroll.map b/scroll.map index 22f0e800..e800b3d1 100755 --- a/scroll.map +++ b/scroll.map @@ -1,6 +1,6 @@ Open Watcom Linker Version 1.9 Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved. -Created on: 15/09/12 12:47:11 +Created on: 15/09/12 15:21:02 Executable Image: scroll.exe creating a DOS executable @@ -600,4 +600,4 @@ Module: /usr/watcom/lib286/dos/clibc.lib(hugeval.c) Stack size: 8000 (32768.) Memory size: 000164b0 (91312.) Entry point address: 0000:5fe4 -Link time: 00:00.02 +Link time: 00:00.01 diff --git a/src/lib/vgmsnd/stdtype.h b/src/lib/vgmsnd/stdtype.h index b0b55606..7672109d 100755 --- a/src/lib/vgmsnd/stdtype.h +++ b/src/lib/vgmsnd/stdtype.h @@ -9,8 +9,8 @@ typedef uint8_t UINT8; typedef int8_t INT8; typedef uint16_t UINT16; typedef int16_t INT16; -typedef uint32_t UINT32; -typedef int32_t INT32; +typedef signed long UINT32; +typedef unsigned long INT32; typedef uint64_t UINT64; typedef int64_t INT64; diff --git a/src/lib/vgmsnd/vgmSnd.c b/src/lib/vgmsnd/vgmSnd.c index d5e1cb2f..508f4609 100755 --- a/src/lib/vgmsnd/vgmSnd.c +++ b/src/lib/vgmsnd/vgmSnd.c @@ -21,55 +21,55 @@ typedef struct _vgm_file_header_base { - sdword fccVGM; // 00 - sdword lngEOFOffset; // 04 - sdword lngVersion; // 08 - sdword lngSkip1[2]; // 0C - sdword lngGD3Offset; // 14 - sdword lngTotalSamples; // 18 - sdword lngLoopOffset; // 1C - sdword lngLoopSamples; // 20 - sdword lngRate; // 24 - sdword lngSkip2[3]; // 28 - sdword lngDataOffset; // 34 - sdword lngSkip3[2]; // 38 + UINT32 fccVGM; // 00 + UINT32 lngEOFOffset; // 04 + UINT32 lngVersion; // 08 + UINT32 lngSkip1[2]; // 0C + UINT32 lngGD3Offset; // 14 + UINT32 lngTotalSamples; // 18 + UINT32 lngLoopOffset; // 1C + UINT32 lngLoopSamples; // 20 + UINT32 lngRate; // 24 + UINT32 lngSkip2[3]; // 28 + UINT32 lngDataOffset; // 34 + UINT32 lngSkip3[2]; // 38 } VGM_BASE_HDR; #define PBMODE_MUSIC 0x00 #define PBMODE_SFX 0x01 typedef struct _vgm_playback { - byte pbMode; - byte vgmEnd; // 00 - running, 01 - finished, FF - not loaded - sword/**/ curLoopCnt; - sdword vgmPos; - sdword vgmSmplPos; - sdword pbSmplPos; + UINT8 pbMode; + UINT8 vgmEnd; // 00 - running, 01 - finished, FF - not loaded + UINT16 curLoopCnt; + UINT32 vgmPos; + UINT32 vgmSmplPos; + UINT32 pbSmplPos; VGM_FILE* file; // oplChnMask: // Music: mask of channels used/overridden by SFX // SFX: ID of channel used by SFX (all commands are forces to it) - sword/**/ oplChnMask; - byte* oplRegCache; - byte workRAM[0x04]; + UINT16 oplChnMask; + UINT8* oplRegCache; + UINT8 workRAM[0x04]; } VGM_PBK; -INLINE sword/**/ ReadLE16(const byte* buffer) +INLINE UINT16 ReadLE16(const UINT8* buffer) { #ifdef QUICK_READ - return *(sword/**/*)buffer; + return *(UINT16*)buffer; #else return (buffer[0x00] << 0) | (buffer[0x01] << 8); #endif } -INLINE sdword ReadLE32(const byte* buffer) +INLINE UINT32 ReadLE32(const UINT8* buffer) { #ifdef QUICK_READ - return *(sword*)buffer; + return *(UINT32*)buffer; #else return (buffer[0x00] << 0) | (buffer[0x01] << 8) | (buffer[0x02] << 16) | (buffer[0x03] << 24); @@ -78,35 +78,35 @@ INLINE sdword ReadLE32(const byte* buffer) // Function Prototypes -//byte OpenVGMFile(const char* FileName, VGM_FILE* vgmFile); +//UINT8 OpenVGMFile(const char* FileName, VGM_FILE* vgmFile); //void FreeVGMFile(VGM_FILE* vgmFile); static boolean DoVgmLoop(VGM_PBK* vgmPlay); -static void UpdateVGM(VGM_PBK* vgmPlay, sword/**/ Samples); +static void UpdateVGM(VGM_PBK* vgmPlay, UINT16 Samples); //void InitEngine(void); //void DeinitEngine(void); -//byte PlayMusic(VGM_FILE* vgmFile); -//byte PlaySFX(VGM_FILE* vgmFile, byte sfxChnID); -//byte StopMusic(void); -//byte StopSFX(byte sfxChnID); // Note: sfxChnID == 0xFF -> stop all SFX -//byte PauseMusic(void); -//byte ResumeMusic(void); +//UINT8 PlayMusic(VGM_FILE* vgmFile); +//UINT8 PlaySFX(VGM_FILE* vgmFile, UINT8 sfxChnID); +//UINT8 StopMusic(void); +//UINT8 StopSFX(UINT8 sfxChnID); // Note: sfxChnID == 0xFF -> stop all SFX +//UINT8 PauseMusic(void); +//UINT8 ResumeMusic(void); static void StartPlayback(VGM_PBK* vgmPb); static void StopPlayback(VGM_PBK* vgmPb); -static void ym2413_write(VGM_PBK* vgmPb, byte reg, byte data); -static void ym3812_write(VGM_PBK* vgmPb, byte reg, byte data); -static void ym3512_write(VGM_PBK* vgmPb, byte reg, byte data); -static void ymf262_write(VGM_PBK* vgmPb, byte port, byte reg, byte data); +static void ym2413_write(VGM_PBK* vgmPb, UINT8 reg, UINT8 data); +static void ym3812_write(VGM_PBK* vgmPb, UINT8 reg, UINT8 data); +static void ym3512_write(VGM_PBK* vgmPb, UINT8 reg, UINT8 data); +static void ymf262_write(VGM_PBK* vgmPb, UINT8 port, UINT8 reg, UINT8 data); //void UpdateSoundEngine(void); // Functions that must be supplied by external library -extern void OPL2_Write(byte reg, byte data); -extern byte OPL2_ReadStatus(void); +extern void OPL2_Write(UINT8 reg, UINT8 data); +extern UINT8 OPL2_ReadStatus(void); @@ -119,32 +119,32 @@ extern byte OPL2_ReadStatus(void); static VGM_PBK vgmPbMusic; static VGM_PBK vgmPbSFX[SFX_CHN_COUNT]; -static byte oplRegs_Music[0x100]; -static byte oplRegs_SFX[SFX_CHN_COUNT][0x0D]; // 20 23 40 43 60 63 80 83 E0 E3 C0 A0 B0 +static UINT8 oplRegs_Music[0x100]; +static UINT8 oplRegs_SFX[SFX_CHN_COUNT][0x0D]; // 20 23 40 43 60 63 80 83 E0 E3 C0 A0 B0 -static const byte SFX_REGS[0x0D] = +static const UINT8 SFX_REGS[0x0D] = { 0x20, 0x23, 0x40, 0x43, 0x60, 0x63, 0x80, 0x83, 0xE0, 0xE3, 0xC0, 0xA0, 0xB0}; -static const byte SFX_REGS_REV[0x10] = // 20/30 -> 0, 40/50 -> 2, ... +static const UINT8 SFX_REGS_REV[0x10] = // 20/30 -> 0, 40/50 -> 2, ... { 0xFF, 0xFF, 0x00, 0x00, 0x02, 0x02, 0x04, 0x04, 0x06, 0x06, 0x0B, 0x0C, 0x0A, 0xFF, 0x08, 0x08}; -static const byte CHN_OPMASK[0x09] = +static const UINT8 CHN_OPMASK[0x09] = { 0x00, 0x01, 0x02, 0x08, 0x09, 0x0A, 0x10, 0x11, 0x12}; -static const byte CHN_OPMASK_REV[0x20] = +static const UINT8 CHN_OPMASK_REV[0x20] = { 0x00, 0x01, 0x02, 0x80, 0x81, 0x82, 0xFF, 0xFF, 0x03, 0x04, 0x05, 0x83, 0x84, 0x85, 0xFF, 0xFF, 0x06, 0x07, 0x08, 0x86, 0x87, 0x88, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; -byte OpenVGMFile(const char* FileName, VGM_FILE* vgmFile) +UINT8 OpenVGMFile(const char* FileName, VGM_FILE* vgmFile) { size_t hdrSize; size_t readEl; // 'elements' read from file size_t bytesToRead; VGM_BASE_HDR vgmBaseHdr; FILE* hFile; - sdword CurPos; + UINT32 CurPos; memset(vgmFile, 0x00, sizeof(VGM_FILE)); @@ -171,7 +171,7 @@ byte OpenVGMFile(const char* FileName, VGM_FILE* vgmFile) } vgmFile->dataLen = vgmBaseHdr.lngEOFOffset + 0x04; - vgmFile->data = (byte*)malloc(vgmFile->dataLen); + vgmFile->data = (UINT8*)malloc(vgmFile->dataLen); if (vgmFile->data == NULL) { fclose(hFile); @@ -206,7 +206,7 @@ byte OpenVGMFile(const char* FileName, VGM_FILE* vgmFile) CurPos = 0x40; hdrSize = sizeof(VGM_HEADER); if (hdrSize > CurPos) - memset((byte*)&vgmFile->header + CurPos, 0x00, hdrSize - CurPos); + memset((UINT8*)&vgmFile->header + CurPos, 0x00, hdrSize - CurPos); fclose(hFile); return 0x00; @@ -237,16 +237,16 @@ static boolean DoVgmLoop(VGM_PBK* vgmPlay) return true; } -static void UpdateVGM(VGM_PBK* vgmPlay, sword/**/ Samples) +static void UpdateVGM(VGM_PBK* vgmPlay, UINT16 Samples) { - const sdword vgmLen = vgmPlay->file->dataLen; - const byte* vgmData = vgmPlay->file->data; - const byte* VGMPnt; - sdword VGMPos; - sdword VGMSmplPos; - byte Command; - byte blockType; - sdword blockLen; + const UINT32 vgmLen = vgmPlay->file->dataLen; + const UINT8* vgmData = vgmPlay->file->data; + const UINT8* VGMPnt; + UINT32 VGMPos; + UINT32 VGMSmplPos; + UINT8 Command; + UINT8 blockType; + UINT32 blockLen; vgmPlay->pbSmplPos += Samples; VGMPos = vgmPlay->vgmPos; @@ -390,8 +390,8 @@ static void UpdateVGM(VGM_PBK* vgmPlay, sword/**/ Samples) void InitEngine(void) { - byte curSFX; - byte curReg; + UINT8 curSFX; + UINT8 curReg; memset(oplRegs_Music, 0x00, 0x100); memset(&vgmPbMusic, 0x00, sizeof(VGM_PBK)); @@ -429,7 +429,7 @@ void InitEngine(void) void DeinitEngine(void) { - byte curSFX; + UINT8 curSFX; StopPlayback(&vgmPbMusic); for (curSFX = 0; curSFX < SFX_CHN_COUNT; curSFX ++) @@ -441,7 +441,7 @@ void DeinitEngine(void) } -byte PlayMusic(VGM_FILE* vgmFile) +UINT8 PlayMusic(VGM_FILE* vgmFile) { VGM_PBK* vgmPb = &vgmPbMusic; @@ -455,7 +455,7 @@ byte PlayMusic(VGM_FILE* vgmFile) return 0x00; } -byte PlaySFX(VGM_FILE* vgmFile, byte sfxChnID) +UINT8 PlaySFX(VGM_FILE* vgmFile, UINT8 sfxChnID) { VGM_PBK* vgmPb; @@ -474,13 +474,13 @@ byte PlaySFX(VGM_FILE* vgmFile, byte sfxChnID) return 0x00; } -byte StopMusic(void) +UINT8 StopMusic(void) { StopPlayback(&vgmPbMusic); return 0x00; } -byte StopSFX(byte sfxChnID) +UINT8 StopSFX(UINT8 sfxChnID) { if (sfxChnID == 0xFF) { @@ -496,7 +496,7 @@ byte StopSFX(byte sfxChnID) return 0x00; } -byte PauseMusic(void) +UINT8 PauseMusic(void) { if (vgmPbMusic.vgmEnd == 0xFF) return 0xFF; // not playing @@ -511,7 +511,7 @@ byte PauseMusic(void) return 0x00; } -byte ResumeMusic(void) +UINT8 ResumeMusic(void) { if (vgmPbMusic.vgmEnd == 0xFF) return 0xFF; // not playing @@ -544,7 +544,7 @@ static void StartPlayback(VGM_PBK* vgmPb) if (vgmPb->pbMode == PBMODE_SFX) { - byte curReg; + UINT8 curReg; curReg = 0xB0 | vgmPb->oplChnMask; if (oplRegs_Music[curReg] & 0x20) @@ -563,8 +563,8 @@ static void StopPlayback(VGM_PBK* vgmPb) if (vgmPb->pbMode == PBMODE_MUSIC) { - byte curReg; - sword/**/ chnMask; + UINT8 curReg; + UINT16 chnMask; chnMask = 0x0001; for (curReg = 0xB0; curReg < 0xB9; curReg ++, chnMask <<= 1) @@ -588,9 +588,9 @@ static void StopPlayback(VGM_PBK* vgmPb) } else //if (vgmPb->pbMode == PBMODE_SFX) { - byte regID; - byte curReg; - byte opMask; + UINT8 regID; + UINT8 curReg; + UINT8 opMask; curReg = 0xB0 | vgmPb->oplChnMask; if (vgmPb->oplRegCache[0x0C] & 0x20) @@ -624,10 +624,10 @@ static void StopPlayback(VGM_PBK* vgmPb) -static void OPL_CachedWrite(VGM_PBK* vgmPb, byte reg, byte data) +static void OPL_CachedWrite(VGM_PBK* vgmPb, UINT8 reg, UINT8 data) { - byte regChn; - byte ramOfs; + UINT8 regChn; + UINT8 ramOfs; if (vgmPb->pbMode == PBMODE_MUSIC) { @@ -689,12 +689,12 @@ static void OPL_CachedWrite(VGM_PBK* vgmPb, byte reg, byte data) } -static void ym2413_write(VGM_PBK* vgmPb, byte reg, byte data) +static void ym2413_write(VGM_PBK* vgmPb, UINT8 reg, UINT8 data) { return; // unsupported for now } -static void ym3812_write(VGM_PBK* vgmPb, byte reg, byte data) +static void ym3812_write(VGM_PBK* vgmPb, UINT8 reg, UINT8 data) { if (reg == 0x01) { @@ -710,7 +710,7 @@ static void ym3812_write(VGM_PBK* vgmPb, byte reg, byte data) return; } -static void ym3512_write(VGM_PBK* vgmPb, byte reg, byte data) +static void ym3512_write(VGM_PBK* vgmPb, UINT8 reg, UINT8 data) { if ((reg & 0xE0) == 0xE0) { @@ -728,7 +728,7 @@ static void ym3512_write(VGM_PBK* vgmPb, byte reg, byte data) return; } -static void ymf262_write(VGM_PBK* vgmPb, byte port, byte reg, byte data) +static void ymf262_write(VGM_PBK* vgmPb, UINT8 port, UINT8 reg, UINT8 data) { return; // unsupported for now } @@ -737,8 +737,8 @@ static void ymf262_write(VGM_PBK* vgmPb, byte port, byte reg, byte data) void UpdateSoundEngine(void) { - byte tmrMask; - byte curSFX; + UINT8 tmrMask; + UINT8 curSFX; tmrMask = OPL2_ReadStatus(); if (! (tmrMask & 0x40)) diff --git a/src/lib/vgmsnd/vgmSnd.h b/src/lib/vgmsnd/vgmSnd.h index f48e2371..e351054c 100755 --- a/src/lib/vgmsnd/vgmSnd.h +++ b/src/lib/vgmsnd/vgmSnd.h @@ -6,75 +6,75 @@ extern "C" { #endif -//#include "src/lib/vgmsnd/stdtype.h" +#include "src/lib/vgmsnd/stdtype.h" #include "src/lib/16_head.h" typedef struct _vgm_file_header { - sdword fccVGM; - sdword lngEOFOffset; - sdword lngVersion; - sdword lngHzPSG; - sdword lngHzYM2413; - sdword lngGD3Offset; - sdword lngTotalSamples; - sdword lngLoopOffset; - sdword lngLoopSamples; - sdword lngRate; - byte bytPSGCfg[4]; - sdword lngHzYM2612; - sdword lngHzYM2151; - sdword lngDataOffset; - sdword lngHzSPCM; - sdword lngSPCMIntf; - sdword lngHzRF5C68; - sdword lngHzYM2203; - sdword lngHzYM2608; - sdword lngHzYM2610; - sdword lngHzYM3812; - sdword lngHzYM3526; - sdword lngHzY8950; - sdword lngHzYMF262; - sdword lngHzYMF278B; - sdword lngHzYMF271; - sdword lngHzYMZ280B; - sdword lngHzRF5C164; - sdword lngHzPWM; - sdword lngHzAY8910; - byte bytAYCfg[4]; - byte bytVolumeModifier; - byte bytReserved2; - char bytLoopBase; - byte bytLoopModifier; + UINT32 fccVGM; + UINT32 lngEOFOffset; + UINT32 lngVersion; + UINT32 lngHzPSG; + UINT32 lngHzYM2413; + UINT32 lngGD3Offset; + UINT32 lngTotalSamples; + UINT32 lngLoopOffset; + UINT32 lngLoopSamples; + UINT32 lngRate; + UINT8 bytPSGCfg[4]; + UINT32 lngHzYM2612; + UINT32 lngHzYM2151; + UINT32 lngDataOffset; + UINT32 lngHzSPCM; + UINT32 lngSPCMIntf; + UINT32 lngHzRF5C68; + UINT32 lngHzYM2203; + UINT32 lngHzYM2608; + UINT32 lngHzYM2610; + UINT32 lngHzYM3812; + UINT32 lngHzYM3526; + UINT32 lngHzY8950; + UINT32 lngHzYMF262; + UINT32 lngHzYMF278B; + UINT32 lngHzYMF271; + UINT32 lngHzYMZ280B; + UINT32 lngHzRF5C164; + UINT32 lngHzPWM; + UINT32 lngHzAY8910; + UINT8 bytAYCfg[4]; + UINT8 bytVolumeModifier; + UINT8 bytReserved2; + INT8 bytLoopBase; + UINT8 bytLoopModifier; } VGM_HEADER; typedef struct _vgm_file { - sdword dataLen; - byte* data; + UINT32 dataLen; + UINT8* data; VGM_HEADER header; } VGM_FILE; -byte OpenVGMFile(const char* FileName, VGM_FILE* vgmFile); +UINT8 OpenVGMFile(const char* FileName, VGM_FILE* vgmFile); void FreeVGMFile(VGM_FILE* vgmFile); void InitEngine(void); void DeinitEngine(void); -byte PlayMusic(VGM_FILE* vgmFile); -byte PlaySFX(VGM_FILE* vgmFile, byte sfxChnID); -byte StopMusic(void); -byte StopSFX(byte sfxChnID); -byte PauseMusic(void); -byte ResumeMusic(void); +UINT8 PlayMusic(VGM_FILE* vgmFile); +UINT8 PlaySFX(VGM_FILE* vgmFile, UINT8 sfxChnID); +UINT8 StopMusic(void); +UINT8 StopSFX(UINT8 sfxChnID); +UINT8 PauseMusic(void); +UINT8 ResumeMusic(void); void UpdateSoundEngine(void); // Functions that must be supplied by external library: -extern void OPL2_Write(byte reg, byte data); -extern byte OPL2_ReadStatus(void); +//extern void OPL2_Write(UINT8 reg, UINT8 data); +//extern UINT8 OPL2_ReadStatus(void); #ifdef __cplusplus diff --git a/vgmtest.exe b/vgmtest.exe index 4638ff72..073e1cbe 100755 Binary files a/vgmtest.exe and b/vgmtest.exe differ