aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm
diff options
context:
space:
mode:
authorMax Horn2010-10-23 15:46:50 +0000
committerMax Horn2010-10-23 15:46:50 +0000
commit3534cff8ef88b5e6a87e4f561146e52288456fa1 (patch)
tree5df229a8ffc35eb40462f362ecb7ab09ff7db238 /engines/scumm
parentefcfb40da92eedc2a22e595b26369f960efd434e (diff)
downloadscummvm-rg350-3534cff8ef88b5e6a87e4f561146e52288456fa1.tar.gz
scummvm-rg350-3534cff8ef88b5e6a87e4f561146e52288456fa1.tar.bz2
scummvm-rg350-3534cff8ef88b5e6a87e4f561146e52288456fa1.zip
ALL: Fix indention (whitespaces -> tabs)
svn-id: r53738
Diffstat (limited to 'engines/scumm')
-rw-r--r--engines/scumm/akos.cpp8
-rw-r--r--engines/scumm/file_nes.cpp2
-rw-r--r--engines/scumm/gfx.cpp2
-rw-r--r--engines/scumm/he/logic_he.cpp2
-rw-r--r--engines/scumm/he/resource_he.cpp172
-rw-r--r--engines/scumm/player_pce.cpp324
6 files changed, 255 insertions, 255 deletions
diff --git a/engines/scumm/akos.cpp b/engines/scumm/akos.cpp
index d5d6b6182b..354a1d4491 100644
--- a/engines/scumm/akos.cpp
+++ b/engines/scumm/akos.cpp
@@ -1087,10 +1087,10 @@ void AkosRenderer::akos16SetupBitReader(const byte *src) {
}
#define AKOS16_FILL_BITS() \
- if (_akos16.numbits <= 8) { \
- _akos16.bits |= (*_akos16.dataptr++) << _akos16.numbits; \
- _akos16.numbits += 8; \
- }
+ if (_akos16.numbits <= 8) { \
+ _akos16.bits |= (*_akos16.dataptr++) << _akos16.numbits; \
+ _akos16.numbits += 8; \
+ }
#define AKOS16_EAT_BITS(n) \
_akos16.numbits -= (n); \
diff --git a/engines/scumm/file_nes.cpp b/engines/scumm/file_nes.cpp
index 0caf63b410..cd761db81a 100644
--- a/engines/scumm/file_nes.cpp
+++ b/engines/scumm/file_nes.cpp
@@ -1077,7 +1077,7 @@ uint16 ScummNESFile::extractResource(Common::WriteStream *output, const Resource
case NES_PREPLIST:
len = res->length;
- reslen += write_word(output, 0x002A);
+ reslen += write_word(output, 0x002A);
reslen += write_byte(output, ' ');
for (i = 1; i < 8; i++)
diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp
index fcc4dd093e..8daee06a88 100644
--- a/engines/scumm/gfx.cpp
+++ b/engines/scumm/gfx.cpp
@@ -2457,7 +2457,7 @@ void ScummEngine::decodeNESBaseTiles() {
}
static const int v1MMNEScostTables[2][6] = {
- /* desc lens offs data gfx pal */
+ /* desc lens offs data gfx pal */
{ 25, 27, 29, 31, 33, 35},
{ 26, 28, 30, 32, 34, 36}
};
diff --git a/engines/scumm/he/logic_he.cpp b/engines/scumm/he/logic_he.cpp
index 8d1b1e941a..36aeaf4a3c 100644
--- a/engines/scumm/he/logic_he.cpp
+++ b/engines/scumm/he/logic_he.cpp
@@ -232,7 +232,7 @@ int32 LogicHErace::op_1101(int32 *args) {
int32 retval;
float temp;
- temp = args[0] / _userData[532];
+ temp = args[0] / _userData[532];
if (_userData[519] != temp) {
_userData[519] = temp;
op_sub3(temp);
diff --git a/engines/scumm/he/resource_he.cpp b/engines/scumm/he/resource_he.cpp
index b85bef9e02..92ec699657 100644
--- a/engines/scumm/he/resource_he.cpp
+++ b/engines/scumm/he/resource_he.cpp
@@ -257,7 +257,7 @@ char *Win32ResExtractor::WinResource::get_resource_id_quoted() {
}
int Win32ResExtractor::extract_resources(WinLibrary *fi, WinResource *wr,
- WinResource *type_wr, WinResource *name_wr,
+ WinResource *type_wr, WinResource *name_wr,
WinResource *lang_wr, byte **data) {
int size;
bool free_it;
@@ -295,7 +295,7 @@ int Win32ResExtractor::extract_resources(WinLibrary *fi, WinResource *wr,
* Extract a resource, returning pointer to data.
*/
byte *Win32ResExtractor::extract_resource(WinLibrary *fi, WinResource *wr, int *size,
- bool *free_it, char *type, char *lang, bool raw) {
+ bool *free_it, char *type, char *lang, bool raw) {
char *str;
int32 intval;
@@ -335,7 +335,7 @@ byte *Win32ResExtractor::extract_resource(WinLibrary *fi, WinResource *wr, int *
* or cursor group.
*/
byte *Win32ResExtractor::extract_group_icon_cursor_resource(WinLibrary *fi, WinResource *wr, char *lang,
- int *ressize, bool is_icon) {
+ int *ressize, bool is_icon) {
Win32CursorIconDir *icondir;
Win32CursorIconFileDir *fileicondir;
byte *memory;
@@ -376,20 +376,20 @@ byte *Win32ResExtractor::extract_group_icon_cursor_resource(WinLibrary *fi, WinR
}
if (get_resource_entry(fi, fwr, &iconsize) != NULL) {
- if (iconsize == 0) {
+ if (iconsize == 0) {
debugC(DEBUG_RESOURCE, "%s: icon resource `%s' is empty, skipping", _fileName.c_str(), name);
skipped++;
continue;
- }
- if ((uint32)iconsize != FROM_LE_32(icondir->entries[c].bytes_in_res)) {
+ }
+ if ((uint32)iconsize != FROM_LE_32(icondir->entries[c].bytes_in_res)) {
debugC(DEBUG_RESOURCE, "%s: mismatch of size in icon resource `%s' and group (%d != %d)",
_fileName.c_str(), name, iconsize, FROM_LE_32(icondir->entries[c].bytes_in_res));
- }
- size += iconsize; /* size += FROM_LE_32(icondir->entries[c].bytes_in_res); */
+ }
+ size += iconsize; /* size += FROM_LE_32(icondir->entries[c].bytes_in_res); */
- /* cursor resources have two additional WORDs that contain
- * hotspot info */
- if (!is_icon)
+ /* cursor resources have two additional WORDs that contain
+ * hotspot info */
+ if (!is_icon)
size -= sizeof(uint16)*2;
}
}
@@ -430,8 +430,8 @@ byte *Win32ResExtractor::extract_group_icon_cursor_resource(WinLibrary *fi, WinR
return NULL;
}
if (size == 0) {
- skipped++;
- continue;
+ skipped++;
+ continue;
}
/* copy ICONDIRENTRY (not including last dwImageOffset) */
@@ -748,8 +748,8 @@ bool Win32ResExtractor::read_library(WinLibrary *fi) {
* module. Returns -1 if file was too small.
*/
int Win32ResExtractor::calc_vma_size(WinLibrary *fi) {
- Win32ImageSectionHeader *seg;
- int c, segcount, size;
+ Win32ImageSectionHeader *seg;
+ int c, segcount, size;
size = 0;
RETURN_IF_BAD_POINTER(-1, PE_HEADER(fi->memory)->file_header.number_of_sections);
@@ -764,7 +764,7 @@ int Win32ResExtractor::calc_vma_size(WinLibrary *fi) {
seg = PE_SECTIONS(fi->memory);
RETURN_IF_BAD_POINTER(-1, *seg);
- for (c = 0 ; c < segcount ; c++) {
+ for (c = 0 ; c < segcount ; c++) {
RETURN_IF_BAD_POINTER(0, *seg);
fix_win32_image_section_header(seg);
@@ -772,9 +772,9 @@ int Win32ResExtractor::calc_vma_size(WinLibrary *fi) {
/* I have no idea what misc.virtual_size is for... */
size = MAX((uint32)size, seg->virtual_address + seg->misc.virtual_size);
seg++;
- }
+ }
- return size;
+ return size;
}
Win32ResExtractor::WinResource *Win32ResExtractor::find_with_resource_array(WinLibrary *fi, WinResource *wr, const char *id) {
@@ -918,8 +918,8 @@ int Win32ResExtractor::convertIcons(byte *data, int datasize, byte **cursor, int
if (entries[c].dib_size != bitmap.size + image_size + mask_size + palette_count * sizeof(Win32RGBQuad))
debugC(DEBUG_RESOURCE, "incorrect total size of bitmap (%d specified; %d real)",
- entries[c].dib_size,
- (int)(bitmap.size + image_size + mask_size + palette_count * sizeof(Win32RGBQuad))
+ entries[c].dib_size,
+ (int)(bitmap.size + image_size + mask_size + palette_count * sizeof(Win32RGBQuad))
);
image_data = (byte *)malloc(image_size);
@@ -981,9 +981,9 @@ int Win32ResExtractor::convertIcons(byte *data, int datasize, byte **cursor, int
row[4*x+2] = (color >> 0) & 0xFF;
}
if (bitmap.bit_count == 32)
- row[4*x+3] = (color >> 24) & 0xFF;
+ row[4*x+3] = (color >> 24) & 0xFF;
else
- row[4*x+3] = simple_vec(mask_data, x + mmod, 1) ? 0 : 0xFF;
+ row[4*x+3] = simple_vec(mask_data, x + mmod, 1) ? 0 : 0xFF;
*/
}
@@ -1055,93 +1055,93 @@ uint32 Win32ResExtractor::simple_vec(byte *data, uint32 ofs, byte size) {
}
void Win32ResExtractor::fix_win32_cursor_icon_file_dir_endian(Win32CursorIconFileDir *obj) {
- LE16(obj->reserved);
+ LE16(obj->reserved);
LE16(obj->type);
- LE16(obj->count);
+ LE16(obj->count);
}
void Win32ResExtractor::fix_win32_bitmap_info_header_endian(Win32BitmapInfoHeader *obj) {
- LE32(obj->size);
- LE32(obj->width);
- LE32(obj->height);
- LE16(obj->planes);
- LE16(obj->bit_count);
- LE32(obj->compression);
- LE32(obj->size_image);
- LE32(obj->x_pels_per_meter);
- LE32(obj->y_pels_per_meter);
- LE32(obj->clr_used);
- LE32(obj->clr_important);
+ LE32(obj->size);
+ LE32(obj->width);
+ LE32(obj->height);
+ LE16(obj->planes);
+ LE16(obj->bit_count);
+ LE32(obj->compression);
+ LE32(obj->size_image);
+ LE32(obj->x_pels_per_meter);
+ LE32(obj->y_pels_per_meter);
+ LE32(obj->clr_used);
+ LE32(obj->clr_important);
}
void Win32ResExtractor::fix_win32_cursor_icon_file_dir_entry_endian(Win32CursorIconFileDirEntry *obj) {
- LE16(obj->hotspot_x);
- LE16(obj->hotspot_y);
- LE32(obj->dib_size);
- LE32(obj->dib_offset);
+ LE16(obj->hotspot_x);
+ LE16(obj->hotspot_y);
+ LE32(obj->dib_size);
+ LE32(obj->dib_offset);
}
void Win32ResExtractor::fix_win32_image_section_header(Win32ImageSectionHeader *obj) {
- LE32(obj->misc.physical_address);
- LE32(obj->virtual_address);
- LE32(obj->size_of_raw_data);
- LE32(obj->pointer_to_raw_data);
- LE32(obj->pointer_to_relocations);
- LE32(obj->pointer_to_linenumbers);
- LE16(obj->number_of_relocations);
- LE16(obj->number_of_linenumbers);
- LE32(obj->characteristics);
+ LE32(obj->misc.physical_address);
+ LE32(obj->virtual_address);
+ LE32(obj->size_of_raw_data);
+ LE32(obj->pointer_to_raw_data);
+ LE32(obj->pointer_to_relocations);
+ LE32(obj->pointer_to_linenumbers);
+ LE16(obj->number_of_relocations);
+ LE16(obj->number_of_linenumbers);
+ LE32(obj->characteristics);
}
/* fix_win32_image_header_endian:
* NOTE: This assumes that the optional header is always available.
*/
void Win32ResExtractor::fix_win32_image_header_endian(Win32ImageNTHeaders *obj) {
- LE32(obj->signature);
- LE16(obj->file_header.machine);
- LE16(obj->file_header.number_of_sections);
- LE32(obj->file_header.time_date_stamp);
- LE32(obj->file_header.pointer_to_symbol_table);
- LE32(obj->file_header.number_of_symbols);
- LE16(obj->file_header.size_of_optional_header);
- LE16(obj->file_header.characteristics);
+ LE32(obj->signature);
+ LE16(obj->file_header.machine);
+ LE16(obj->file_header.number_of_sections);
+ LE32(obj->file_header.time_date_stamp);
+ LE32(obj->file_header.pointer_to_symbol_table);
+ LE32(obj->file_header.number_of_symbols);
+ LE16(obj->file_header.size_of_optional_header);
+ LE16(obj->file_header.characteristics);
// FIXME: Does this assert ever trigger? If so, we should modify this function
// to properly deal with it.
assert(obj->file_header.size_of_optional_header >= sizeof(obj->optional_header));
- LE16(obj->optional_header.magic);
- LE32(obj->optional_header.size_of_code);
- LE32(obj->optional_header.size_of_initialized_data);
- LE32(obj->optional_header.size_of_uninitialized_data);
- LE32(obj->optional_header.address_of_entry_point);
- LE32(obj->optional_header.base_of_code);
- LE32(obj->optional_header.base_of_data);
- LE32(obj->optional_header.image_base);
- LE32(obj->optional_header.section_alignment);
- LE32(obj->optional_header.file_alignment);
- LE16(obj->optional_header.major_operating_system_version);
- LE16(obj->optional_header.minor_operating_system_version);
- LE16(obj->optional_header.major_image_version);
- LE16(obj->optional_header.minor_image_version);
- LE16(obj->optional_header.major_subsystem_version);
- LE16(obj->optional_header.minor_subsystem_version);
- LE32(obj->optional_header.win32_version_value);
- LE32(obj->optional_header.size_of_image);
- LE32(obj->optional_header.size_of_headers);
- LE32(obj->optional_header.checksum);
- LE16(obj->optional_header.subsystem);
- LE16(obj->optional_header.dll_characteristics);
- LE32(obj->optional_header.size_of_stack_reserve);
- LE32(obj->optional_header.size_of_stack_commit);
- LE32(obj->optional_header.size_of_heap_reserve);
- LE32(obj->optional_header.size_of_heap_commit);
- LE32(obj->optional_header.loader_flags);
- LE32(obj->optional_header.number_of_rva_and_sizes);
+ LE16(obj->optional_header.magic);
+ LE32(obj->optional_header.size_of_code);
+ LE32(obj->optional_header.size_of_initialized_data);
+ LE32(obj->optional_header.size_of_uninitialized_data);
+ LE32(obj->optional_header.address_of_entry_point);
+ LE32(obj->optional_header.base_of_code);
+ LE32(obj->optional_header.base_of_data);
+ LE32(obj->optional_header.image_base);
+ LE32(obj->optional_header.section_alignment);
+ LE32(obj->optional_header.file_alignment);
+ LE16(obj->optional_header.major_operating_system_version);
+ LE16(obj->optional_header.minor_operating_system_version);
+ LE16(obj->optional_header.major_image_version);
+ LE16(obj->optional_header.minor_image_version);
+ LE16(obj->optional_header.major_subsystem_version);
+ LE16(obj->optional_header.minor_subsystem_version);
+ LE32(obj->optional_header.win32_version_value);
+ LE32(obj->optional_header.size_of_image);
+ LE32(obj->optional_header.size_of_headers);
+ LE32(obj->optional_header.checksum);
+ LE16(obj->optional_header.subsystem);
+ LE16(obj->optional_header.dll_characteristics);
+ LE32(obj->optional_header.size_of_stack_reserve);
+ LE32(obj->optional_header.size_of_stack_commit);
+ LE32(obj->optional_header.size_of_heap_reserve);
+ LE32(obj->optional_header.size_of_heap_commit);
+ LE32(obj->optional_header.loader_flags);
+ LE32(obj->optional_header.number_of_rva_and_sizes);
}
void Win32ResExtractor::fix_win32_image_data_directory(Win32ImageDataDirectory *obj) {
- LE32(obj->virtual_address);
- LE32(obj->size);
+ LE32(obj->virtual_address);
+ LE32(obj->size);
}
diff --git a/engines/scumm/player_pce.cpp b/engines/scumm/player_pce.cpp
index a17aab4d59..4236fb2d6b 100644
--- a/engines/scumm/player_pce.cpp
+++ b/engines/scumm/player_pce.cpp
@@ -152,7 +152,7 @@ static const uint16 sounds[13][6] = {
// 0xB2A1
static const byte data_table[482] = {
/* 0*/ 0xE2, 0x0A, 0xE1, 0x0D, 0xE6, 0xED, 0xE0, 0x0F, 0xE2, 0x00, 0xE1, 0x00,
- 0xF2, 0xF2, 0xB2, 0xE1, 0x01, 0xF2, 0xF2, 0xB2, 0xE1, 0x02, 0xF2, 0xF2,
+ 0xF2, 0xF2, 0xB2, 0xE1, 0x01, 0xF2, 0xF2, 0xB2, 0xE1, 0x02, 0xF2, 0xF2,
0xB2, 0xE1, 0x03, 0xF2, 0xF2, 0xB2, 0xE1, 0x04, 0xF2, 0xF2, 0xB2, 0xE1,
0x05, 0xF2, 0xF2, 0xB2, 0xE1, 0x06, 0xF2, 0xF2, 0xB2, 0xE1, 0x07, 0xF2,
0xF2, 0xB2, 0xE1, 0x08, 0xF2, 0xF2, 0xB2, 0xE1, 0x09, 0xF2, 0xF2, 0xB2,
@@ -208,10 +208,10 @@ static const byte data_table[482] = {
/*395*/ 0xE2, 0x0C, 0xE1, 0x00, 0xE0, 0x04, 0xE6, 0xED, 0xD4, 0x0B, 0xE8, 0x0B, 0xFF,
/*408*/ 0xE2, 0x0C, 0xE1, 0x03, 0xE0, 0x04, 0xE6, 0xED, 0xD4, 0xF0, 0x0C, 0x00,
- 0xE8, 0x10, 0xE8, 0x00, 0xE8, 0x10, 0xE8, 0x00, 0xE8, 0x10, 0xE8, 0x00,
- 0xE8, 0x10, 0xE8, 0x00, 0xE8, 0x10, 0xE8, 0x00, 0xE8, 0x10, 0xE8, 0x00,
- 0xE8, 0x10, 0xE8, 0x00, 0xE8, 0x10, 0xE8, 0x00, 0xE8, 0x10, 0xE8, 0x00,
- 0xE8, 0x10, 0xE8, 0x00, 0xE8, 0x10, 0xE8, 0x00, 0xE8, 0x10, 0xFF,
+ 0xE8, 0x10, 0xE8, 0x00, 0xE8, 0x10, 0xE8, 0x00, 0xE8, 0x10, 0xE8, 0x00,
+ 0xE8, 0x10, 0xE8, 0x00, 0xE8, 0x10, 0xE8, 0x00, 0xE8, 0x10, 0xE8, 0x00,
+ 0xE8, 0x10, 0xE8, 0x00, 0xE8, 0x10, 0xE8, 0x00, 0xE8, 0x10, 0xE8, 0x00,
+ 0xE8, 0x10, 0xE8, 0x00, 0xE8, 0x10, 0xE8, 0x00, 0xE8, 0x10, 0xFF,
/*467*/ 0xE2, 0x0C, 0xE1, 0x00, 0xE0, 0x04, 0xE6, 0xED, 0xD4, 0x1B, 0xE8, 0x1B, 0xFF,
/*480*/ 0xFF,
@@ -238,11 +238,11 @@ private:
double _clock;
double _rate;
uint8 _select;
- uint8 _balance;
- channel_t _channel[8];
- int16 _volumeTable[32];
- uint32 _noiseFreqTable[32];
- uint32 _waveFreqTable[4096];
+ uint8 _balance;
+ channel_t _channel[8];
+ int16 _volumeTable[32];
+ uint32 _noiseFreqTable[32];
+ uint32 _waveFreqTable[4096];
public:
void init();
@@ -255,180 +255,180 @@ public:
PSG_HuC6280::PSG_HuC6280(double clock, double samplerate) {
_clock = clock;
- _rate = samplerate;
+ _rate = samplerate;
- // Initialize PSG_HuC6280 emulator
- init();
+ // Initialize PSG_HuC6280 emulator
+ init();
}
void PSG_HuC6280::init() {
- int i;
- double step;
+ int i;
+ double step;
- // Loudest volume level for table
- double level = 65535.0 / 6.0 / 32.0;
+ // Loudest volume level for table
+ double level = 65535.0 / 6.0 / 32.0;
- // Clear context
+ // Clear context
reset();
- // Make waveform frequency table
- for(i = 0; i < 4096; i++) {
- step = ((_clock / _rate) * 4096) / (i+1);
- _waveFreqTable[(1 + i) & 0xFFF] = (uint32)step;
- }
-
- // Make noise frequency table
- for(i = 0; i < 32; i++) {
- step = ((_clock / _rate) * 32) / (i+1);
- _noiseFreqTable[i] = (uint32)step;
- }
-
- // Make volume table
- // PSG_HuC6280 has 48dB volume range spread over 32 steps
- step = 48.0 / 32.0;
- for(i = 0; i < 31; i++) {
- _volumeTable[i] = (uint16)level;
- level /= pow(10.0, step / 20.0);
- }
- _volumeTable[31] = 0;
+ // Make waveform frequency table
+ for(i = 0; i < 4096; i++) {
+ step = ((_clock / _rate) * 4096) / (i+1);
+ _waveFreqTable[(1 + i) & 0xFFF] = (uint32)step;
+ }
+
+ // Make noise frequency table
+ for(i = 0; i < 32; i++) {
+ step = ((_clock / _rate) * 32) / (i+1);
+ _noiseFreqTable[i] = (uint32)step;
+ }
+
+ // Make volume table
+ // PSG_HuC6280 has 48dB volume range spread over 32 steps
+ step = 48.0 / 32.0;
+ for(i = 0; i < 31; i++) {
+ _volumeTable[i] = (uint16)level;
+ level /= pow(10.0, step / 20.0);
+ }
+ _volumeTable[31] = 0;
}
void PSG_HuC6280::reset() {
_select = 0;
- _balance = 0xFF;
- memset(_channel, 0, sizeof(_channel));
- memset(_volumeTable, 0, sizeof(_volumeTable));
- memset(_noiseFreqTable, 0, sizeof(_noiseFreqTable));
- memset(_waveFreqTable, 0, sizeof(_waveFreqTable));
+ _balance = 0xFF;
+ memset(_channel, 0, sizeof(_channel));
+ memset(_volumeTable, 0, sizeof(_volumeTable));
+ memset(_noiseFreqTable, 0, sizeof(_noiseFreqTable));
+ memset(_waveFreqTable, 0, sizeof(_waveFreqTable));
}
void PSG_HuC6280::write(int offset, byte data) {
- channel_t *chan = &_channel[_select];
-
- switch(offset & 0x0F) {
- case 0x00: // Channel select
- _select = data & 0x07;
- break;
-
- case 0x01: // Global balance
- _balance = data;
- break;
-
- case 0x02: // Channel frequency (LSB)
- chan->frequency = (chan->frequency & 0x0F00) | data;
- chan->frequency &= 0x0FFF;
- break;
-
- case 0x03: // Channel frequency (MSB)
- chan->frequency = (chan->frequency & 0x00FF) | (data << 8);
- chan->frequency &= 0x0FFF;
- break;
-
- case 0x04: // Channel control (key-on, DDA mode, volume)
- // 1-to-0 transition of DDA bit resets waveform index
- if((chan->control & 0x40) && ((data & 0x40) == 0)) {
- chan->index = 0;
- }
- chan->control = data;
- break;
-
- case 0x05: // Channel balance
- chan->balance = data;
- break;
-
- case 0x06: // Channel waveform data
- switch(chan->control & 0xC0) {
- case 0x00:
- chan->waveform[chan->index & 0x1F] = data & 0x1F;
- chan->index = (chan->index + 1) & 0x1F;
- break;
-
- case 0x40:
- break;
-
- case 0x80:
- chan->waveform[chan->index & 0x1F] = data & 0x1F;
- chan->index = (chan->index + 1) & 0x1F;
- break;
-
- case 0xC0:
- chan->dda = data & 0x1F;
- break;
- }
-
- break;
-
- case 0x07: // Noise control (enable, frequency)
- case 0x08: // LFO frequency
- case 0x09: // LFO control (enable, mode)
- break;
-
- default:
- break;
- }
+ channel_t *chan = &_channel[_select];
+
+ switch(offset & 0x0F) {
+ case 0x00: // Channel select
+ _select = data & 0x07;
+ break;
+
+ case 0x01: // Global balance
+ _balance = data;
+ break;
+
+ case 0x02: // Channel frequency (LSB)
+ chan->frequency = (chan->frequency & 0x0F00) | data;
+ chan->frequency &= 0x0FFF;
+ break;
+
+ case 0x03: // Channel frequency (MSB)
+ chan->frequency = (chan->frequency & 0x00FF) | (data << 8);
+ chan->frequency &= 0x0FFF;
+ break;
+
+ case 0x04: // Channel control (key-on, DDA mode, volume)
+ // 1-to-0 transition of DDA bit resets waveform index
+ if((chan->control & 0x40) && ((data & 0x40) == 0)) {
+ chan->index = 0;
+ }
+ chan->control = data;
+ break;
+
+ case 0x05: // Channel balance
+ chan->balance = data;
+ break;
+
+ case 0x06: // Channel waveform data
+ switch(chan->control & 0xC0) {
+ case 0x00:
+ chan->waveform[chan->index & 0x1F] = data & 0x1F;
+ chan->index = (chan->index + 1) & 0x1F;
+ break;
+
+ case 0x40:
+ break;
+
+ case 0x80:
+ chan->waveform[chan->index & 0x1F] = data & 0x1F;
+ chan->index = (chan->index + 1) & 0x1F;
+ break;
+
+ case 0xC0:
+ chan->dda = data & 0x1F;
+ break;
+ }
+
+ break;
+
+ case 0x07: // Noise control (enable, frequency)
+ case 0x08: // LFO frequency
+ case 0x09: // LFO control (enable, mode)
+ break;
+
+ default:
+ break;
+ }
}
void PSG_HuC6280::update(int16* samples, int sampleCnt) {
- static const int scale_tab[] = {
- 0x00, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
- 0x10, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F
- };
- int ch;
- int i;
+ static const int scale_tab[] = {
+ 0x00, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
+ 0x10, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F
+ };
+ int ch;
+ int i;
- int lmal = (_balance >> 4) & 0x0F;
- int rmal = (_balance >> 0) & 0x0F;
- int vll, vlr;
+ int lmal = (_balance >> 4) & 0x0F;
+ int rmal = (_balance >> 0) & 0x0F;
+ int vll, vlr;
- lmal = scale_tab[lmal];
- rmal = scale_tab[rmal];
+ lmal = scale_tab[lmal];
+ rmal = scale_tab[rmal];
- // Clear buffer
+ // Clear buffer
memset(samples, 0, 2 * sampleCnt * sizeof(int16));
- for(ch = 0; ch < 6; ch++) {
- // Only look at enabled channels
- if(_channel[ch].control & 0x80) {
- int lal = (_channel[ch].balance >> 4) & 0x0F;
- int ral = (_channel[ch].balance >> 0) & 0x0F;
- int al = _channel[ch].control & 0x1F;
-
- lal = scale_tab[lal];
- ral = scale_tab[ral];
-
- // Calculate volume just as the patent says
- vll = (0x1F - lal) + (0x1F - al) + (0x1F - lmal);
- if(vll > 0x1F) vll = 0x1F;
-
- vlr = (0x1F - ral) + (0x1F - al) + (0x1F - rmal);
- if(vlr > 0x1F) vlr = 0x1F;
-
- vll = _volumeTable[vll];
- vlr = _volumeTable[vlr];
-
- // Check channel mode
- if(_channel[ch].control & 0x40) {
- /* DDA mode */
- for(i = 0; i < sampleCnt; i++) {
- samples[2*i] += (int16)(vll * (_channel[ch].dda - 16));
- samples[2*i + 1] += (int16)(vlr * (_channel[ch].dda - 16));
- }
- } else {
- /* Waveform mode */
- uint32 step = _waveFreqTable[_channel[ch].frequency];
- for(i = 0; i < sampleCnt; i += 1) {
- int offset;
- int16 data;
- offset = (_channel[ch].counter >> 12) & 0x1F;
- _channel[ch].counter += step;
- _channel[ch].counter &= 0x1FFFF;
- data = _channel[ch].waveform[offset];
- samples[2*i] += (int16)(vll * (data - 16));
- samples[2*i + 1] += (int16)(vlr * (data - 16));
- }
- }
- }
- }
+ for(ch = 0; ch < 6; ch++) {
+ // Only look at enabled channels
+ if(_channel[ch].control & 0x80) {
+ int lal = (_channel[ch].balance >> 4) & 0x0F;
+ int ral = (_channel[ch].balance >> 0) & 0x0F;
+ int al = _channel[ch].control & 0x1F;
+
+ lal = scale_tab[lal];
+ ral = scale_tab[ral];
+
+ // Calculate volume just as the patent says
+ vll = (0x1F - lal) + (0x1F - al) + (0x1F - lmal);
+ if(vll > 0x1F) vll = 0x1F;
+
+ vlr = (0x1F - ral) + (0x1F - al) + (0x1F - rmal);
+ if(vlr > 0x1F) vlr = 0x1F;
+
+ vll = _volumeTable[vll];
+ vlr = _volumeTable[vlr];
+
+ // Check channel mode
+ if(_channel[ch].control & 0x40) {
+ /* DDA mode */
+ for(i = 0; i < sampleCnt; i++) {
+ samples[2*i] += (int16)(vll * (_channel[ch].dda - 16));
+ samples[2*i + 1] += (int16)(vlr * (_channel[ch].dda - 16));
+ }
+ } else {
+ /* Waveform mode */
+ uint32 step = _waveFreqTable[_channel[ch].frequency];
+ for(i = 0; i < sampleCnt; i += 1) {
+ int offset;
+ int16 data;
+ offset = (_channel[ch].counter >> 12) & 0x1F;
+ _channel[ch].counter += step;
+ _channel[ch].counter &= 0x1FFFF;
+ data = _channel[ch].waveform[offset];
+ samples[2*i] += (int16)(vll * (data - 16));
+ samples[2*i + 1] += (int16)(vlr * (data - 16));
+ }
+ }
+ }
+ }
}
@@ -466,7 +466,7 @@ void Player_PCE::procA541(channel_t *channel) {
channel->controlVec24 = false;
channel->controlVec21 = 0;
- channel->waveformCtrl = 0x80;
+ channel->waveformCtrl = 0x80;
}
// A592