EmulatorJS Bug EJS_dontExtractBIOS Issue With Path Handling
Hey everyone,
We've got a bug report here concerning the EJS_dontExtractBIOS
functionality within EmulatorJS. It seems there's an issue when the BiosUrl
includes a forward slash ('/') in its path. Let's dive into the details so we can get this sorted out!
Understanding the Bug
The core problem revolves around how EmulatorJS handles BIOS files when EJS_dontExtractBIOS
is set to true
. Ideally, this setting should allow the emulator to directly use the BIOS file from the specified URL without attempting to extract it. However, it appears that when the BiosUrl
contains a path (e.g., roms/bios.zip
), the emulator gets stuck during the BIOS download step, preventing the game from loading.
Steps to Reproduce
To recreate this issue, follow these steps:
- Set up your environment with a
roms/
subfolder containing both the ROM and BIOS files. - Load the provided
test_EJS_dontExtractBIOS.html
file (attached in the original report). This HTML file is configured withEJS_dontExtractBIOS
set totrue
. - Observe that the game fails to load and gets stuck at the Download BIOS stage.
Expected Behavior
When EJS_dontExtractBIOS
is enabled, EmulatorJS should directly load the BIOS file from the provided URL, regardless of whether the path includes forward slashes. The game should proceed to load without any issues.
Actual Behavior
Currently, the emulator fails to load the game and gets stuck during the BIOS download process when the BiosUrl
contains a path with forward slashes. This indicates a potential issue with how EmulatorJS parses or handles paths when EJS_dontExtractBIOS
is active.
Log Analysis
The attached localhost-1754064101431.log
file may contain valuable information about the error occurring during the BIOS download. Analyzing this log could provide insights into the root cause of the problem.
Workaround
Fortunately, there's a workaround that can help you bypass this issue temporarily:
- Place both the ROM and BIOS files at the root level of your server.
- Modify the paths in your HTML file to reflect the new location of the files.
- Reload the game.
By placing the files at the root level, you eliminate the forward slashes in the BiosUrl
, allowing EmulatorJS to load the BIOS correctly and the game to run.
Why This Workaround Works
This workaround suggests that the issue lies in how EmulatorJS handles paths when EJS_dontExtractBIOS
is enabled. By removing the path, we bypass the problematic code, allowing the emulator to function as expected.
Impact
This bug significantly impacts the usability of EJS_dontExtractBIOS
in projects like romm, where organized file structures are crucial. For example, running NeoGeo games often requires specific BIOS files, and this issue prevents users from easily managing these files within subfolders.
Real-World Scenario
Imagine you're building a retro gaming platform using EmulatorJS. You want to organize your ROMs and BIOS files into separate folders for better management. With this bug, you're forced to keep all your BIOS files in the root directory, which can quickly become messy and disorganized. This limits the flexibility and scalability of your project.
Proposed Solution and Next Steps
It appears a user has already identified a fix for this issue and is willing to submit a pull request. This is excellent news! A pull request will allow the community to review the proposed solution and ensure it effectively addresses the bug without introducing any regressions.
Potential Fix
The fix likely involves adjusting how EmulatorJS parses and handles the BiosUrl
when EJS_dontExtractBIOS
is set. It may require updating the code to correctly resolve paths with forward slashes or modifying the logic to ensure the BIOS file is loaded directly from the specified URL.
Contributing to the Solution
If you're interested in helping, you can:
- Review the pull request once it's submitted.
- Test the fix on your own setup to ensure it resolves the issue.
- Provide feedback to the developer on the pull request.
Test Case: test_EJS_dontExtractBIOS.html
The attached EJS_dontExtractBIOS_html.txt
file serves as a crucial test case for this bug. It demonstrates the issue clearly and provides a standardized way to reproduce the problem. When testing fixes, ensure they work correctly with this test case.
Importance of Test Cases
Test cases like this are invaluable in software development. They allow developers to quickly verify if a fix is working as expected and prevent regressions in the future. By providing a clear and concise test case, the reporter has significantly contributed to resolving this issue.
Conclusion
The EJS_dontExtractBIOS
bug is a significant issue that affects users who rely on organized file structures for their ROMs and BIOS files. The provided workaround offers a temporary solution, but a proper fix is needed to fully resolve the problem. With a fix in the works and community involvement, we can hopefully get this bug squashed soon!
Thanks to the user who reported this bug and offered a potential fix. Your contribution is greatly appreciated!
Let's keep the discussion going and work together to make EmulatorJS even better!