Fixed YMF-278B playback.
parent
fbe9ae50dd
commit
70805327d2
|
@ -301,6 +301,7 @@
|
||||||
83BB5ED21C0842A600734457 /* VGMPlay.h in Headers */ = {isa = PBXBuildFile; fileRef = 83BB5E3E1C0842A600734457 /* VGMPlay.h */; };
|
83BB5ED21C0842A600734457 /* VGMPlay.h in Headers */ = {isa = PBXBuildFile; fileRef = 83BB5E3E1C0842A600734457 /* VGMPlay.h */; };
|
||||||
83BB5ED31C0842A600734457 /* resampler.c in Sources */ = {isa = PBXBuildFile; fileRef = 83BB5E3F1C0842A600734457 /* resampler.c */; };
|
83BB5ED31C0842A600734457 /* resampler.c in Sources */ = {isa = PBXBuildFile; fileRef = 83BB5E3F1C0842A600734457 /* resampler.c */; };
|
||||||
83BB5ED41C0842A600734457 /* resampler.h in Headers */ = {isa = PBXBuildFile; fileRef = 83BB5E401C0842A600734457 /* resampler.h */; };
|
83BB5ED41C0842A600734457 /* resampler.h in Headers */ = {isa = PBXBuildFile; fileRef = 83BB5E401C0842A600734457 /* resampler.h */; };
|
||||||
|
83EE0C8C1DDECB0C00534509 /* yrw801.h in Headers */ = {isa = PBXBuildFile; fileRef = 83EE0C8B1DDECB0C00534509 /* yrw801.h */; };
|
||||||
83FC5D5E181B47FB00B917E5 /* dsp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83FC5D3B181B47FB00B917E5 /* dsp.cpp */; };
|
83FC5D5E181B47FB00B917E5 /* dsp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83FC5D3B181B47FB00B917E5 /* dsp.cpp */; };
|
||||||
83FC5D5F181B47FB00B917E5 /* dsp.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 83FC5D3C181B47FB00B917E5 /* dsp.hpp */; };
|
83FC5D5F181B47FB00B917E5 /* dsp.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 83FC5D3C181B47FB00B917E5 /* dsp.hpp */; };
|
||||||
83FC5D78181B47FB00B917E5 /* smp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83FC5D57181B47FB00B917E5 /* smp.cpp */; };
|
83FC5D78181B47FB00B917E5 /* smp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83FC5D57181B47FB00B917E5 /* smp.cpp */; };
|
||||||
|
@ -614,6 +615,7 @@
|
||||||
83BB5E3E1C0842A600734457 /* VGMPlay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VGMPlay.h; path = vgmplay/VGMPlay.h; sourceTree = "<group>"; };
|
83BB5E3E1C0842A600734457 /* VGMPlay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VGMPlay.h; path = vgmplay/VGMPlay.h; sourceTree = "<group>"; };
|
||||||
83BB5E3F1C0842A600734457 /* resampler.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = resampler.c; path = vgmplay/resampler.c; sourceTree = "<group>"; };
|
83BB5E3F1C0842A600734457 /* resampler.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = resampler.c; path = vgmplay/resampler.c; sourceTree = "<group>"; };
|
||||||
83BB5E401C0842A600734457 /* resampler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = resampler.h; path = vgmplay/resampler.h; sourceTree = "<group>"; };
|
83BB5E401C0842A600734457 /* resampler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = resampler.h; path = vgmplay/resampler.h; sourceTree = "<group>"; };
|
||||||
|
83EE0C8B1DDECB0C00534509 /* yrw801.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = yrw801.h; sourceTree = "<group>"; };
|
||||||
83FC5D3B181B47FB00B917E5 /* dsp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = dsp.cpp; sourceTree = "<group>"; };
|
83FC5D3B181B47FB00B917E5 /* dsp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = dsp.cpp; sourceTree = "<group>"; };
|
||||||
83FC5D3C181B47FB00B917E5 /* dsp.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = dsp.hpp; sourceTree = "<group>"; };
|
83FC5D3C181B47FB00B917E5 /* dsp.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = dsp.hpp; sourceTree = "<group>"; };
|
||||||
83FC5D57181B47FB00B917E5 /* smp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = smp.cpp; sourceTree = "<group>"; };
|
83FC5D57181B47FB00B917E5 /* smp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = smp.cpp; sourceTree = "<group>"; };
|
||||||
|
@ -712,6 +714,7 @@
|
||||||
17C8F1860CBED26C008D969D /* Source */ = {
|
17C8F1860CBED26C008D969D /* Source */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
83EE0C8B1DDECB0C00534509 /* yrw801.h */,
|
||||||
83BB5DAB1C08427700734457 /* vgmplay */,
|
83BB5DAB1C08427700734457 /* vgmplay */,
|
||||||
83FC5D35181B47FB00B917E5 /* higan */,
|
83FC5D35181B47FB00B917E5 /* higan */,
|
||||||
8370B68D17F615FD001A4D7A /* Ay_Core.cpp */,
|
8370B68D17F615FD001A4D7A /* Ay_Core.cpp */,
|
||||||
|
@ -1120,6 +1123,7 @@
|
||||||
8370B75617F615FE001A4D7A /* Hes_Core.h in Headers */,
|
8370B75617F615FE001A4D7A /* Hes_Core.h in Headers */,
|
||||||
83BB5EA51C0842A600734457 /* scd_pcm.h in Headers */,
|
83BB5EA51C0842A600734457 /* scd_pcm.h in Headers */,
|
||||||
83FC5D79181B47FB00B917E5 /* smp.hpp in Headers */,
|
83FC5D79181B47FB00B917E5 /* smp.hpp in Headers */,
|
||||||
|
83EE0C8C1DDECB0C00534509 /* yrw801.h in Headers */,
|
||||||
8370B73617F615FE001A4D7A /* Blip_Buffer_impl2.h in Headers */,
|
8370B73617F615FE001A4D7A /* Blip_Buffer_impl2.h in Headers */,
|
||||||
83BB5E6A1C0842A600734457 /* emu2149.h in Headers */,
|
83BB5E6A1C0842A600734457 /* emu2149.h in Headers */,
|
||||||
8370B78117F615FE001A4D7A /* Opl_Apu.h in Headers */,
|
8370B78117F615FE001A4D7A /* Opl_Apu.h in Headers */,
|
||||||
|
|
|
@ -144,6 +144,7 @@ typedef struct
|
||||||
UINT32 RAMSize;
|
UINT32 RAMSize;
|
||||||
UINT8 *ram;
|
UINT8 *ram;
|
||||||
int clock;
|
int clock;
|
||||||
|
int rom_allocated;
|
||||||
|
|
||||||
INT32 volume[256*4]; // precalculated attenuation values with some marging for enveloppe and pan levels
|
INT32 volume[256*4]; // precalculated attenuation values with some marging for enveloppe and pan levels
|
||||||
|
|
||||||
|
@ -540,7 +541,7 @@ INLINE UINT8 ymf278b_readMem(YMF278BChip* chip, offs_t address)
|
||||||
if (address < chip->ROMSize)
|
if (address < chip->ROMSize)
|
||||||
return chip->rom[address&0x3fffff];
|
return chip->rom[address&0x3fffff];
|
||||||
else if (address < chip->ROMSize + chip->RAMSize)
|
else if (address < chip->ROMSize + chip->RAMSize)
|
||||||
return chip->ram[address - chip->ROMSize&0x3fffff];
|
return chip->ram[address - (chip->ROMSize&0x3fffff)];
|
||||||
else
|
else
|
||||||
return 255; // TODO check
|
return 255; // TODO check
|
||||||
}
|
}
|
||||||
|
@ -550,7 +551,7 @@ INLINE UINT8* ymf278b_readMemAddr(YMF278BChip* chip, offs_t address)
|
||||||
if (address < chip->ROMSize)
|
if (address < chip->ROMSize)
|
||||||
return &chip->rom[address&0x3fffff];
|
return &chip->rom[address&0x3fffff];
|
||||||
else if (address < chip->ROMSize + chip->RAMSize)
|
else if (address < chip->ROMSize + chip->RAMSize)
|
||||||
return &chip->ram[address - chip->ROMSize&0x3fffff];
|
return &chip->ram[address - (chip->ROMSize&0x3fffff)];
|
||||||
else
|
else
|
||||||
return NULL; // TODO check
|
return NULL; // TODO check
|
||||||
}
|
}
|
||||||
|
@ -698,12 +699,11 @@ void ymf278b_pcm_update(void *_info, stream_sample_t** outputs, int samples)
|
||||||
{
|
{
|
||||||
sl->stepptr -= 0x10000;
|
sl->stepptr -= 0x10000;
|
||||||
sl->sample1 = sl->sample2;
|
sl->sample1 = sl->sample2;
|
||||||
|
|
||||||
|
if (sl->pos > sl->endaddr)
|
||||||
|
sl->pos = sl->pos - (sl->endaddr+1) + sl->loopaddr;
|
||||||
sl->sample2 = ymf278b_getSample(chip, sl);
|
sl->sample2 = ymf278b_getSample(chip, sl);
|
||||||
if (sl->pos == sl->endaddr)
|
sl->pos++;
|
||||||
sl->pos = sl->pos - sl->endaddr + sl->loopaddr;
|
|
||||||
else
|
|
||||||
sl->pos ++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ymf278b_advance(chip);
|
ymf278b_advance(chip);
|
||||||
|
@ -1089,11 +1089,13 @@ void ymf278b_clearRam(YMF278BChip* chip)
|
||||||
memset(chip->ram, 0, chip->RAMSize);
|
memset(chip->ram, 0, chip->RAMSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include "../../yrw801.h"
|
||||||
|
|
||||||
static void ymf278b_load_rom(YMF278BChip *chip)
|
static void ymf278b_load_rom(YMF278BChip *chip)
|
||||||
{
|
{
|
||||||
chip->ROMSize = 0x00200000;
|
chip->ROMSize = 0x00200000;
|
||||||
chip->rom = (UINT8*)malloc(chip->ROMSize);
|
chip->rom_allocated = 0;
|
||||||
memset(chip->rom, 0xFF, chip->ROMSize);
|
chip->rom = (UINT8*) yrw801_rom; /* Make Chip Music Great Again *barf* */
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1110,6 +1112,7 @@ static int ymf278b_init(YMF278BChip *chip, int clock, void (*cb)(int))
|
||||||
chip->FMEnabled = 0x00;
|
chip->FMEnabled = 0x00;
|
||||||
|
|
||||||
chip->rom = NULL;
|
chip->rom = NULL;
|
||||||
|
chip->rom_allocated = 1;
|
||||||
chip->irq_callback = cb;
|
chip->irq_callback = cb;
|
||||||
//chip->timer_a = timer_alloc(device->machine, ymf278b_timer_a_tick, chip);
|
//chip->timer_a = timer_alloc(device->machine, ymf278b_timer_a_tick, chip);
|
||||||
//chip->timer_b = timer_alloc(device->machine, ymf278b_timer_b_tick, chip);
|
//chip->timer_b = timer_alloc(device->machine, ymf278b_timer_b_tick, chip);
|
||||||
|
@ -1161,6 +1164,7 @@ void device_stop_ymf278b(void *_info)
|
||||||
YMF278BChip* chip = (YMF278BChip *)_info;
|
YMF278BChip* chip = (YMF278BChip *)_info;
|
||||||
|
|
||||||
ymf262_shutdown(chip->fmchip);
|
ymf262_shutdown(chip->fmchip);
|
||||||
|
if (chip->rom_allocated)
|
||||||
free(chip->rom); chip->rom = NULL;
|
free(chip->rom); chip->rom = NULL;
|
||||||
|
|
||||||
free(chip);
|
free(chip);
|
||||||
|
@ -1193,6 +1197,10 @@ void ymf278b_write_rom(void *_info, offs_t ROMSize, offs_t DataStart, offs_t Dat
|
||||||
const UINT8* ROMData)
|
const UINT8* ROMData)
|
||||||
{
|
{
|
||||||
YMF278BChip *chip = (YMF278BChip *)_info;
|
YMF278BChip *chip = (YMF278BChip *)_info;
|
||||||
|
|
||||||
|
if (!chip->rom_allocated)
|
||||||
|
chip->rom = NULL;
|
||||||
|
chip->rom_allocated = 1;
|
||||||
|
|
||||||
if (chip->ROMSize != ROMSize)
|
if (chip->ROMSize != ROMSize)
|
||||||
{
|
{
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue