sidplayfp icon indicating copy to clipboard operation
sidplayfp copied to clipboard

ini file `Engine`/`m_driver.output` overridden on startup

Open LouDnl opened this issue 5 months ago • 6 comments

When using the ini file Engine configuration setting under Emulation the m_driver.output variable gets overriden. This applies to the code snippet below in ConsolePlayer::ConsolePlayer. If I use the commandline argument to enable the specific emulation engine the settings are applied correct. Both the argument parser and ConsolePlayer creation set m_driver.sid and m_driver.output, except without the command line argument m_driver.output gets reset to default.

As temporary workaround to fix this I added m_driver.output = output_t::NONE; at the end of the argument parser - which ofcourse disables any regular audio output - made the ini setting work as expected.

ConsolePlayer::ConsolePlayer: https://github.com/libsidplayfp/sidplayfp/blob/1e4f258f5f74f6277deb14c0b6a49eb7560e71b9/src/player.cpp#L419-L439

I figure that the ini setting gets overridden due to this line in args.cpp that gets called after ini parsing and overrides any previous setting. https://github.com/libsidplayfp/sidplayfp/blob/1e4f258f5f74f6277deb14c0b6a49eb7560e71b9/src/args.cpp#L171

LouDnl avatar Nov 07 '25 16:11 LouDnl

If I understood correctly fix is in #91

drfiemost avatar Nov 09 '25 13:11 drfiemost

Have just tested, doesn't work yet. I'll check if I can pinpoint why

LouDnl avatar Nov 09 '25 18:11 LouDnl

Okay, I've found out what is wrong. My ini file has USBSID in capital letters like the other emulation engine types. The comparison lines all check for an emulation engine in capital letters, but emulation.engine is in lowercase letters. I've checked this with some debug prints:

cout << "EM:" << emulation.engine << endl;
cout << "EM:" << emulation.engine.compare(TEXT("USBSID")) << endl;
cout << "EM:" << emulation.engine.compare(TEXT("usbsid")) << endl;

output:

EM:usbsid
EM:32
EM:0

My knowledge of the codebase is not extensive enough to pinpoint why the ini file setting gets converted to lowercase though.

LouDnl avatar Nov 09 '25 18:11 LouDnl

Works fine here

EM:USBSID
EM:0
EM:-1

maybe it's reading a different ini file? You can check with -v2

drfiemost avatar Nov 09 '25 20:11 drfiemost

right, the ini file was correct. It seems the Engine engine line does get read correct. I had it set to lowercase for testing. For some strange reason, having it in lowercase makes it work but having it in uppercase does not? Output now:

EM:USBSID
EM:0
EM:-32

LouDnl avatar Nov 09 '25 20:11 LouDnl

Sorry I don't get it. The setting should be uppercase, there is no case conversion performed in software. std::string.compare returns 0 when strings match.

drfiemost avatar Nov 16 '25 19:11 drfiemost