Skip to content

Detect when OPL4 playback needs YRW801 ROM - #152

Merged
ValleyBell merged 1 commit into
ValleyBell:masterfrom
niekvlessert:opl4_yrw801.rom_requirement_more_accurate
Jun 24, 2026
Merged

Detect when OPL4 playback needs YRW801 ROM#152
ValleyBell merged 1 commit into
ValleyBell:masterfrom
niekvlessert:opl4_yrw801.rom_requirement_more_accurate

Conversation

@niekvlessert

Copy link
Copy Markdown
Contributor

Avoid requesting yrw801.rom for YMF278B/OPL4 VGMs that only use the FM part or rely solely on embedded custom wave data. Add a pre-scan of OPL4 commands that tracks wave-table usage, distinguishing custom sample tables from YRW/GM wave entries.

Also make the sample tools report and request missing external ROM files more clearly.

Comment thread player/vgmplayer.cpp Outdated
{
case 0x66: // end of command data
_opl4YRW801Req = yrwUse & ~fileRom;
return;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer if you just exit the while loop here instead of copying the "set variable + return" code.

Comment thread player/vgmplayer.cpp Outdated
if (_CMD_INFO[curCmd].cmdLen == 0)
return;
if (filePos + _CMD_INFO[curCmd].cmdLen > _fileHdr.dataEnd)
return;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe just quit the while-loop here as well instead of doing a hard return

Comment thread player/vgmplayer.cpp Outdated

if (chipDev->romWrite == NULL)
return;
emu_logf(&_logger, PLRLOG_INFO, "OPL4 requires external sample ROM %s.\n", romFile);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

either remove or set to PLRLOG_DEBUG

I don't want this to spam the VGMPlay terminal window by default.

Comment thread player/vgmplayer.cpp
{
if (_fileReqCbFunc == NULL)
{
emu_logf(&_logger, PLRLOG_WARN, "No file request callback available for %s.\n", romFile);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this warning is OK.

Comment thread player/vgmplayer.cpp
DATA_LOADER* romDLoad = _fileReqCbFunc(_fileReqCbParam, this, romFile);
if (romDLoad == NULL)
{
emu_logf(&_logger, PLRLOG_WARN, "Couldn't load %s.\n", romFile);

@ValleyBell ValleyBell Jun 22, 2026

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this warning makes sense, because it would effectively duplicate the warning output that the callback itself is supposed to do.

(Right now I am unsure if the callback itself should issue the warning/error or the OPL4 ROM loader function here. I guess keeping the warning here makes it easier for the logging system to keep track of it.)

Comment thread player.cpp Outdated
fflush(stdout);

char filePath[0x400];
if (fgets(filePath, sizeof(filePath), stdin) == NULL)

@ValleyBell ValleyBell Jun 22, 2026

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, but I am against user input here.
You are not supposed to block the audio render thread to wait for the user to input things. It should just fail.

Please remove this new RequestFileCallback function and just rename TryLoadExternalFile back to RequestFileCallback.

Comment thread vgm2wav.cpp Outdated
fprintf(stderr, "Enter path to \"%s\" (empty to skip): ", fileName);
fflush(stderr);

if (fgets(filePath, sizeof(filePath), stdin) == NULL) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as in player.cpp - please don't wait for user input inside callbacks

Avoid requesting yrw801.rom for YMF278B/OPL4 VGMs that only use
the FM part or rely solely on embedded custom wave data. Add a
pre-scan of OPL4 commands that tracks wave-table usage, distinguishing
custom sample tables from YRW/GM wave entries.

Also make the sample tools report and request missing external ROM files
more clearly.
@niekvlessert
niekvlessert force-pushed the opl4_yrw801.rom_requirement_more_accurate branch from 8fbf77f to 867223e Compare June 23, 2026 21:02
@niekvlessert

Copy link
Copy Markdown
Contributor Author

Ok, a bunch of changes based on your reviewpoints, thanks for that btw!

@ValleyBell
ValleyBell merged commit 867223e into ValleyBell:master Jun 24, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants