rewrite the emulator to use UTF-8 internally
This commit is contained in:
@@ -69,14 +69,14 @@ mt32emu_return_code mt32_check(const char* func, mt32emu_return_code ret, mt32em
|
||||
int mt32_available()
|
||||
{
|
||||
if (roms_present[0] < 0)
|
||||
roms_present[0] = (rom_present(L"roms/sound/mt32/mt32_control.rom") && rom_present(L"roms/sound/mt32/mt32_pcm.rom"));
|
||||
roms_present[0] = (rom_present("roms/sound/mt32/mt32_control.rom") && rom_present("roms/sound/mt32/mt32_pcm.rom"));
|
||||
return roms_present[0];
|
||||
}
|
||||
|
||||
int cm32l_available()
|
||||
{
|
||||
if (roms_present[1] < 0)
|
||||
roms_present[1] = (rom_present(L"roms/sound/cm32l/cm32l_control.rom") && rom_present(L"roms/sound/cm32l/cm32l_pcm.rom"));
|
||||
roms_present[1] = (rom_present("roms/sound/cm32l/cm32l_control.rom") && rom_present("roms/sound/cm32l/cm32l_pcm.rom"));
|
||||
return roms_present[1];
|
||||
}
|
||||
|
||||
@@ -165,19 +165,16 @@ void mt32_sysex(uint8_t* data, unsigned int len)
|
||||
if (context) mt32_check("mt32emu_play_sysex", mt32emu_play_sysex(context, data, len), MT32EMU_RC_OK);
|
||||
}
|
||||
|
||||
void* mt32emu_init(wchar_t *control_rom, wchar_t *pcm_rom)
|
||||
void* mt32emu_init(char *control_rom, char *pcm_rom)
|
||||
{
|
||||
midi_device_t* dev;
|
||||
wchar_t s[512];
|
||||
char fn[512];
|
||||
|
||||
context = mt32emu_create_context(handler, NULL);
|
||||
|
||||
if (!rom_getfile(control_rom, s, 512)) return 0;
|
||||
wcstombs(fn, s, (wcslen(s) << 1) + 2);
|
||||
if (!rom_getfile(control_rom, fn, 512)) return 0;
|
||||
if (!mt32_check("mt32emu_add_rom_file", mt32emu_add_rom_file(context, fn), MT32EMU_RC_ADDED_CONTROL_ROM)) return 0;
|
||||
if (!rom_getfile(pcm_rom, s, 512)) return 0;
|
||||
wcstombs(fn, s, (wcslen(s) << 1) + 2);
|
||||
if (!rom_getfile(pcm_rom, fn, 512)) return 0;
|
||||
if (!mt32_check("mt32emu_add_rom_file", mt32emu_add_rom_file(context, fn), MT32EMU_RC_ADDED_PCM_ROM)) return 0;
|
||||
|
||||
if (!mt32_check("mt32emu_open_synth", mt32emu_open_synth(context), MT32EMU_RC_OK)) return 0;
|
||||
@@ -229,12 +226,12 @@ void* mt32emu_init(wchar_t *control_rom, wchar_t *pcm_rom)
|
||||
|
||||
void *mt32_init(const device_t *info)
|
||||
{
|
||||
return mt32emu_init(L"roms/sound/mt32/mt32_control.rom", L"roms/sound/mt32/mt32_pcm.rom");
|
||||
return mt32emu_init("roms/sound/mt32/mt32_control.rom", "roms/sound/mt32/mt32_pcm.rom");
|
||||
}
|
||||
|
||||
void *cm32l_init(const device_t *info)
|
||||
{
|
||||
return mt32emu_init(L"roms/sound/cm32l/cm32l_control.rom", L"roms/sound/cm32l/cm32l_pcm.rom");
|
||||
return mt32emu_init("roms/sound/cm32l/cm32l_control.rom", "roms/sound/cm32l/cm32l_pcm.rom");
|
||||
}
|
||||
|
||||
void mt32_close(void* p)
|
||||
|
||||
@@ -776,7 +776,7 @@ void *adgold_init(const device_t *info)
|
||||
for (; c >= 0; c--)
|
||||
attenuation[c] = 0;
|
||||
|
||||
f = nvr_fopen(L"adgold.bin", L"rb");
|
||||
f = nvr_fopen("adgold.bin", "rb");
|
||||
if (f)
|
||||
{
|
||||
if (fread(adgold->adgold_eeprom, 1, 0x1a, f) != 0x1a)
|
||||
@@ -817,7 +817,7 @@ void adgold_close(void *p)
|
||||
FILE *f;
|
||||
adgold_t *adgold = (adgold_t *)p;
|
||||
|
||||
f = nvr_fopen(L"adgold.bin", L"wb");
|
||||
f = nvr_fopen("adgold.bin", "wb");
|
||||
if (f)
|
||||
{
|
||||
fwrite(adgold->adgold_eeprom, 0x1a, 1, f);
|
||||
|
||||
@@ -888,7 +888,7 @@ static void *
|
||||
azt_init(const device_t *info)
|
||||
{
|
||||
FILE *f;
|
||||
wchar_t *fn = NULL;
|
||||
char *fn = NULL;
|
||||
int i;
|
||||
int loaded_from_eeprom = 0;
|
||||
uint16_t addr_setting;
|
||||
@@ -899,13 +899,13 @@ azt_init(const device_t *info)
|
||||
azt2316a->type = info->local;
|
||||
|
||||
if (azt2316a->type == SB_SUBTYPE_CLONE_AZT1605_0X0C) {
|
||||
fn = L"azt1605.nvr";
|
||||
fn = "azt1605.nvr";
|
||||
} else if (azt2316a->type == SB_SUBTYPE_CLONE_AZT2316A_0X11) {
|
||||
fn = L"azt2316a.nvr";
|
||||
fn = "azt2316a.nvr";
|
||||
}
|
||||
|
||||
/* config */
|
||||
f = nvr_fopen(fn, L"rb");
|
||||
f = nvr_fopen(fn, "rb");
|
||||
if (f) {
|
||||
uint8_t checksum = 0x7f;
|
||||
uint8_t saved_checksum;
|
||||
@@ -1191,19 +1191,19 @@ static void
|
||||
azt_close(void *p)
|
||||
{
|
||||
azt2316a_t *azt2316a = (azt2316a_t *)p;
|
||||
wchar_t *fn = NULL;
|
||||
char *fn = NULL;
|
||||
FILE *f;
|
||||
uint8_t checksum = 0x7f;
|
||||
int i;
|
||||
|
||||
if (azt2316a->type == SB_SUBTYPE_CLONE_AZT1605_0X0C) {
|
||||
fn = L"azt1605.nvr";
|
||||
fn = "azt1605.nvr";
|
||||
} else if (azt2316a->type == SB_SUBTYPE_CLONE_AZT2316A_0X11) {
|
||||
fn = L"azt2316a.nvr";
|
||||
fn = "azt2316a.nvr";
|
||||
}
|
||||
|
||||
/* always save to eeprom (recover from bad values) */
|
||||
f = nvr_fopen(fn, L"wb");
|
||||
f = nvr_fopen(fn, "wb");
|
||||
if (f) {
|
||||
for (i = 0; i < AZTECH_EEPROM_SIZE; i++)
|
||||
checksum += azt2316a->sb->dsp.azt_eeprom[i];
|
||||
|
||||
@@ -2160,7 +2160,7 @@ void emu8k_init(emu8k_t *emu8k, uint16_t emu_addr, int onboard_ram)
|
||||
int c;
|
||||
double out;
|
||||
|
||||
f = rom_fopen(L"roms/sound/awe32.raw", L"rb");
|
||||
f = rom_fopen("roms/sound/awe32.raw", "rb");
|
||||
if (!f)
|
||||
fatal("AWE32.RAW not found\n");
|
||||
|
||||
|
||||
@@ -1688,7 +1688,7 @@ sb_16_pnp_init(const device_t *info)
|
||||
static int
|
||||
sb_awe32_available()
|
||||
{
|
||||
return rom_present(L"roms/sound/awe32.raw");
|
||||
return rom_present("roms/sound/awe32.raw");
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user