Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add argument to specify path to ROMs #65

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions src/mcu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,7 @@ int main(int argc, char *argv[])
{
(void)argc;
std::string basePath;
std::string romPath;

int port = 0;
int audioDeviceIndex = -1;
Expand All @@ -1312,6 +1313,13 @@ int main(int argc, char *argv[])
{
audioDeviceIndex = atoi(argv[i] + 3);
}
else if (!strncmp(argv[i], "-d:", 3))
{
romPath = argv[i] + 3;
while (romPath.find_last_of("/") == romPath.length()-1) {
romPath.erase(romPath.length()-1);
}
}
else if (!strncmp(argv[i], "-ab:", 4))
{
char* pColon = argv[i] + 3;
Expand Down Expand Up @@ -1387,6 +1395,8 @@ int main(int argc, char *argv[])
printf(" -a:<device_number> Set Audio Device index.\n");
printf(" -ab:<page_size>:[page_count] Set Audio Buffer size.\n");
printf("\n");
printf(" -d:<rom_path> Set ROM directory.\n");
printf("\n");
printf(" -mk2 Use SC-55mk2 ROM set.\n");
Copy link
Contributor

@UnBeatWaterGH UnBeatWaterGH May 3, 2024

Choose a reason for hiding this comment

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

I would maybe separate -d: from the others since directories aren't related to audio. Something like this:

...
-a:<device_number>             Set Audio Device index.
-ab:<page_size>:[page_count]   Set Audio Buffer size.

-d:<rom_path>                  Set ROM directory.

-mk2                           Use SC-55mk2 ROM set.
-st                            Use SC-55st ROM set.
...

Copy link
Author

Choose a reason for hiding this comment

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

Good idea. Changed & force pushed.

printf(" -st Use SC-55st ROM set.\n");
printf(" -mk1 Use SC-55mk1 ROM set.\n");
Expand Down Expand Up @@ -1419,6 +1429,11 @@ int main(int argc, char *argv[])
if(Files::dirExists(basePath + "/../share/nuked-sc55"))
basePath += "/../share/nuked-sc55";

if (romPath.empty()) {
romPath = basePath;
}
printf("ROM path is: %s\n", romPath.c_str());

if (autodetect)
{
for (size_t i = 0; i < ROM_SET_COUNT; i++)
Expand All @@ -1428,7 +1443,7 @@ int main(int argc, char *argv[])
{
if (roms[i][j][0] == '\0')
continue;
std::string path = basePath + "/" + roms[i][j];
std::string path = romPath + "/" + roms[i][j];
auto h = Files::utf8_fopen(path.c_str(), "rb");
if (!h)
{
Expand Down Expand Up @@ -1487,7 +1502,7 @@ int main(int argc, char *argv[])
rpaths[i] = "";
continue;
}
rpaths[i] = basePath + "/" + roms[romset][i];
rpaths[i] = romPath + "/" + roms[romset][i];
s_rf[i] = Files::utf8_fopen(rpaths[i].c_str(), "rb");
bool optional = mcu_jv880 && i == 4;
r_ok &= optional || (s_rf[i] != nullptr);
Expand Down