skarsnik / qusb2snes Goto Github PK
View Code? Open in Web Editor NEWA Qt based webserver for usb2snes. Users: go check usb2snes.com
Home Page: https://skarsnik.github.io/QUsb2snes/
License: GNU General Public License v3.0
A Qt based webserver for usb2snes. Users: go check usb2snes.com
Home Page: https://skarsnik.github.io/QUsb2snes/
License: GNU General Public License v3.0
I've been trying to play alttpr multiworld with a friend, but qusb2snes keeps getting suspended.
Emulator: snes9x 1.6
OS: Windows 10
Has been trying to execute it but no luck, the icon appears on the system try but when i hover with mouse the icon disappears, seeing the task manager i see the application gets closed almost immeadiately.
Windows 10 Profesional
Spanish locale (it could be that?)
What is says on the tin. I can get QUSB2Snes running fine on (Arch) Linux, and QFile2Snes works great as well. The issue however, is when developing ROMs, it would be nice to have a simple command to deploy, and then run a ROM from the command-line. For those who use editors like VS Code, or what have you, being able to use something like a Task to assemble, deploy, and run a ROM on hardware in one go would be invaluable.
Is the already a low-level option to do this, or would this essentially be a feature request?
Like HAS_NO_ROM_WRITE, HAS_FILE_SUPPORT and such maybe
So, using https://github.com/Berserker66/MultiWorld-Utilities/releases of version 2.2.1 apparently this works fine with SD2SNES. Releases since only work with emulator bridges and SD2SNES bridges specifically crash when receiving an item (write to memory).
I don't have more data than that, lacking an SD2SNES myself.
To not leave them busy if not needed
Hello!
I git cloned QUsb2snes & compiled it on my local system, following the Linux ReadMe worked fine, along with the stty command. I have 1.10.3-usb-v11 firmware on my sd2snes in a SuperNT. I can start up the web socket server (no difference as my user or root) & qfile2snes, and get the initial listing of top level directories correctly (so far so good). However, if I attempt to browse / click into a directory I get the following error from QUsb2snes:
WSServer : "QFile2Snes" received "{\n \"Opcode\": \"List\",\n \"Operands\": [\n \"/Kaizo\"\n ],\n \"Space\": \"SNES\"\n}\n"
WSServer : Request is USB2SnesWS::List
WSServer : Device is ADevice::READY
WSServer : Executing request : 8 Created at QTime("04:51:56.058") - USB2SnesWS::List SD2Snes::SNES () ("/Kaizo") WSServer::RequestState::NEW for "QFile2Snes"
SD2SNES : CMD : SD2Snes::LS SD2Snes::FILE 0 "/Kaizo"
SD2SNES : >> "5553424104000000" - 252-272 : "000000002f4b61697a6f00000000000000000000"
SD2SNES : Written : 512 bytes
WSServer : Request executed
SD2SNES : SP Received: 128 ( 512 )
SD2SNES : Protocol error: "\x00\x00\x00\x00\x00\x00"
WSServer : Device Error "SD2SNES ttyACM0"
WSServer : Cleaning up device "SD2SNES ttyACM0"
WSServer : Error with a ws client "QFile2Snes" WSServer::DeviceError "Device closed"
WSServer : Websocket disconnected "QFile2Snes"
WSServer : Cleaning up wsocket "QFile2Snes"
SD2SNESFactory : Delete "SD2SNES ttyACM0"
I receive a largely similar issue using other web socket client programs. I'm hoping I've messed up in a known way! Otherwise, what should I do to look into this problem further?
Accessing CGRAM or other non-WRAM, non-ROM addresses with a hirom ROM crashes the RetroArch device connection:
2020-06-11T22:19:28 WSServer - Debug: Device is ADevice::READY
2020-06-11T22:19:28 WSServer - Debug: Executing request : 116 Created at QTime("22:19:28.379") - USB2SnesWS::GetAddress SD2Snes::SNES () ("F90000", "200") WSServer::RequestState::NEW for "MemoryViewer"
2020-06-11T22:19:28 RETROARCH - Debug: GetAddress SD2Snes::SNES 16318464 512
2020-06-11T22:19:28 WSServer - Debug: Device Error "RetroArch 94dde6262e4f4fe4be027c47"
RetroArchDevice::addr_to_addr seems confused about how to handle this situation:
if (addr >= 0xE00000)
{
if (!hasRomAccess)
return addr - 0xE00000 + 0x20000;
if (romType == LoROM)
return addr - 0xE00000 + 0x700000;
return lorom_sram_pc_to_snes(addr2 - 0xE00000);
}
Update the doc to reflect the change in RA
Segfault happens in appui.cpp:566 statusString = dev->name();
when trying to open tray icon -> Devices with retroarch with snes9x core connecting/disconnecting/reconnecting (not sure what state it is actually in when crashing).
Can easily be reproduced with evertracker because it will auto-reconnect after QUsb2Snes closes connection when trying to read ROM on RA+snes9x.
I use Linux and don't normally use a system tray. It took me a long time to realize that the only interface to configure QUsb2snes is a system tray icon, since there was nothing visible. It would be nice to have an interface that din't require a tray.
Current release does not work, because os X framework packaging seems not that straight forward
The 'New Directory' button doesn't do anything when pressed. Also, when you drag and drop a folder onto the window, instead of a new directory showing up, a file shows up with the filename matching the directory name (no file extension) and doesn't function as a directory. The contents of which are unknown, but unusable. The only way I'm able to get a new directory onto the SD card is by pulling the SD card out of the SD2SNES and plugging it into a card reader and creating the directory thru Windows.
I've tried every version after 7.11 up until the latest 7.16.1. All of which crash every time I attempt to transfer a ROM to the console thru QFile2Snes, both thru the context menu and thru the actual app. I am running on SD2Snes Pro and SuperNT. I've made sure to close out of all programs that could have the potential of interfering, including firewall and AV.
I've been excited to utilize some of the new features, however, none of the updates seemed to have fixed this issue. So I've been stuck on 7.11 in the meantime.
I'm running QUsb2snes on Manjaro Linux. Since upgrading to v0.7.19, memory checks are returning incorrect and rapidly changing results when connecting to an SD2SNES. I've attached the debug log below.
Reverting to v0.7.18 returns functionality to normal.
As of now, anyone running QUsb2snes has a WebSocket server running accessible from ANY web page without authentication.
This means it is possible to hijack, remove files or crash games easily using targeted attacks.
It is very useful to be able to control it from web pages (for example to build trackers for randomizers), but not in this manner.
Overall, I find the protocol to be quite badly designed, could we get around and fix it? Probably making a v2 would be a better choice.
It works if I open it directly from the apps folder so perhaps there's a problem with the working directory when opened from the toolbar?
Should be very easy to do
Special flags are just ignored currently x)
Right click tray icon and select Exit.
The app does close properly, but the tray icon remains until you hover your mouse cursor over it.
This crash happens regularly about 30 seconds after loading the multibridge.lua file. It says the lua file connects correctly. I'm attempting to open a A Link to the Past randomized rom, I've tried multiple roms and it crashes on all of them. Sometimes snes9x glitches to have no video output, and in that case the lua file does not crash. I've attached the debug logs created by using the debug option from the tray. Also attached is the event viewer error, and the expanded data from the report.wer file created when it crashes. Any help would be greatly appreciated.
log-debug.txt
event_viewer_error.txt
event_viewer_crash_log.txt
On Ubuntu 20.04, trying to play alltp / super metroid crossover multiworld.
When I try to select the Retroarch device, I'm unable to because the "devices" list is blank.
No communication with retroarch appears to occur.
Here's the console output from starting it:
default : Runing QUsb2Snes version ""
default : Compiled against Qt 5.12.8 , running 5.12.8
WSServer : Adding Device Factory "SD2Snes"
WSServer : WebSocket server started : listenning QHostAddress(QHostAddress::Any) port : 8080
So it stops checking serial port device for nothing with emulator users
When attempting to use EmoTracker with QUSB2SNES the app just silently crashes. This is on the latest release (v0.7.12). I have not done any checking with older versions yet.
Emulator: RetroArch
Core: bsnes-mercury balanced
Game: Link to the Past (Randomized)
BML attached (https://gist.github.com/shinji257/cc34042d02bee8062312744004618b3d)
I am trying to do MSU1 support with this core. If I do a normal copy of the game with MSU1 patched in it works fine with a manifest.bml that is already out there (rom size is set to 0x180000). However it seems multiple things change when a randomized copy is generated and so unless I increase the size it just results in silent audio for reasons I don't entirely understand. Bumping it to 0x200000 in the manifest allows MSU1 to work but causes this crash to happen. Any thoughts on what might be going on?
2019-12-04T00:08:09 APPUI - Info: Scanning "H:/QUsb2Snes/apps/QFile2Snes"
2019-12-04T00:08:09 APPUI - Info: Found an application Name : "QFile2Snes" Description : "A basic file explorer for the usb2snes firmware" Folder : "H:/QUsb2Snes/apps/QFile2Snes" Icon : "icone.png" Exe : "QFile2Snes" QtApp : true
2019-12-04T00:08:09 WSServer - Info: WebSocket server started : listenning QHostAddress("::1") port : 8080
2019-12-04T00:08:19 qt.network.ssl - Warning: QSslSocket: cannot resolve SSL_CTX_set_ciphersuites
2019-12-04T00:08:19 qt.network.ssl - Warning: QSslSocket: cannot resolve SSL_set_psk_use_session_callback
2019-12-04T00:08:19 WSServer - Info: New connection from ""
2019-12-04T00:08:19 WSServer - Info: New connection accepted "Websocket 7ffabe8a55f0" "" QHostAddress("::1")
2019-12-04T00:08:20 WSServer - Info: Executing request : 0 Created at QTime("00:08:20.566") - USB2SnesWS::DeviceList SD2Snes::SNES () () WSServer::RequestState::NEW for "Websocket 7ffabe8a55f0"
2019-12-04T00:08:20 WSServer - Info: Server request finished - 0 Created at QTime("00:08:20.566") - USB2SnesWS::DeviceList SD2Snes::SNES () () WSServer::RequestState::NEW processed in 21 ms
2019-12-04T00:08:20 WSServer - Info: Executing request : 1 Created at QTime("00:08:20.591") - USB2SnesWS::Attach SD2Snes::SNES () ("RetroArch 5e441572b7134e149a8e9f85") WSServer::RequestState::NEW for "Websocket 7ffabe8a55f0"
2019-12-04T00:08:20 WSServer - Info: Server request finished - 1 Created at QTime("00:08:20.591") - USB2SnesWS::Attach SD2Snes::SNES () ("RetroArch 5e441572b7134e149a8e9f85") WSServer::RequestState::NEW processed in 0 ms
2019-12-04T00:08:20 WSServer - Info: Executing request : 2 Created at QTime("00:08:20.591") - USB2SnesWS::Name SD2Snes::SNES () ("EmoTracker 2.3.6.8") WSServer::RequestState::NEW for "Websocket 7ffabe8a55f0"
2019-12-04T00:08:20 WSServer - Info: Server request finished - 2 Created at QTime("00:08:20.591") - USB2SnesWS::Name SD2Snes::SNES () ("EmoTracker 2.3.6.8") WSServer::RequestState::NEW processed in 0 ms
2019-12-04T00:08:20 WSServer - Info: Executing request : 3 Created at QTime("00:08:20.593") - USB2SnesWS::GetAddress SD2Snes::SNES () ("F50000", "1") WSServer::RequestState::NEW for "EmoTracker 2.3.6.8"
2019-12-04T00:08:20 WSServer - Info: Device request finished - 3 Created at QTime("00:08:20.593") - USB2SnesWS::GetAddress SD2Snes::SNES () ("F50000", "1") WSServer::RequestState::DONE processed in 11 ms
2019-12-04T00:08:20 WSServer - Info: Executing request : 4 Created at QTime("00:08:20.616") - USB2SnesWS::GetAddress SD2Snes::SNES () ("F50010", "90") WSServer::RequestState::NEW for "EmoTracker 2.3.6.8"
2019-12-04T00:08:20 WSServer - Info: Device request finished - 4 Created at QTime("00:08:20.616") - USB2SnesWS::GetAddress SD2Snes::SNES () ("F50010", "90") WSServer::RequestState::DONE processed in 5 ms
2019-12-04T00:08:20 WSServer - Info: Executing request : 5 Created at QTime("00:08:20.623") - USB2SnesWS::GetAddress SD2Snes::SNES () ("F5F340", "90") WSServer::RequestState::NEW for "EmoTracker 2.3.6.8"
2019-12-04T00:08:20 WSServer - Info: Device Error "RetroArch 5e441572b7134e149a8e9f85"
2019-12-04T00:08:20 WSServer - Info: Error with a ws client "EmoTracker 2.3.6.8" WSServer::DeviceError "Device closed"
2019-12-04T00:08:20 WSServer - Info: Websocket disconnected "EmoTracker 2.3.6.8"
2019-12-04T00:08:22 WSServer - Info: New connection from ""
2019-12-04T00:08:22 WSServer - Info: New connection accepted "Websocket 7ffabe8a55f0" "" QHostAddress("::1")
2019-12-04T00:08:23 WSServer - Info: Executing request : 6 Created at QTime("00:08:23.140") - USB2SnesWS::DeviceList SD2Snes::SNES () () WSServer::RequestState::NEW for "Websocket 7ffabe8a55f0"
2019-12-04T00:08:23 WSServer - Info: Server request finished - 6 Created at QTime("00:08:23.140") - USB2SnesWS::DeviceList SD2Snes::SNES () () WSServer::RequestState::NEW processed in 33 ms
2019-12-04T00:08:23 WSServer - Info: Executing request : 7 Created at QTime("00:08:23.174") - USB2SnesWS::Attach SD2Snes::SNES () ("RetroArch 35a6610d54d748918bbaf42e") WSServer::RequestState::NEW for "Websocket 7ffabe8a55f0"
There are two problems:
Nothing happens when opening the application from the toolbar. (same issue as input viewer?)
If I open zeldahud directly from apps folder it opens fine but can't connect over qusb2snes. (It tries to connect but times out after 5 or so seconds)
If I switch to vanilla usb2snes then it connects fine.
usb2snes firmware can eat lot of addresses (even if they probably does not make sense), but the other support not.
QUsb2Snes should probably close the connection on funky address resquest
I've managed to figure out the necessary steps to get SendToSd2snes to compile to .exe, which is good. However, I'm running into an issue where file IO operations are infinitely freezing. If I had to guess, it might be due to file IO operations happening back to back, but I have no clue.
So far, I've only modified transfertFile() method, here is what I modified it to:
void SendToDialog::transfertFile()
{
QFile fi(fileInfos.absoluteFilePath());
qDebug() << "Opening file" << fi.open(QIODevice::ReadOnly);
QByteArray data = fi.readAll();
sendingFile = true;
// 6 mb take 60 sec
int sizeInMb = 1;
if (data.size() > 1024 * 1024)
sizeInMb = (data.size() / (1024 * 1024)) + 0.5;
bool replaceFile = false;
if (fileInfos.fileName().endsWith(".sfc") && usb2snes->getFile(ui->dirLineEdit->text() + "/alttp_msu.sfc") > 0)
{
setStatusLabel("Deleting old ROM");
usb2snes->deleteFile(ui->dirLineEdit->text() + "/alttp_msu.sfc");
replaceFile = true;
}
setStatusLabel(tr("Transferring file - Estimated time is %1 seconds").arg(sizeInMb * 10));
progressStep = 80 / (sizeInMb * 10);
if (replaceFile)
{
usb2snes->sendFile(ui->dirLineEdit->text() + "/alttp_msu.sfc", data);
}
else
{
usb2snes->sendFile(ui->dirLineEdit->text() + "/" + fileInfos.fileName(), data);
}
}
Essentially what I'm trying to do is if the file getting transferred is a ROM file AND a specific pre-determined ROM filename already exists. I want it to delete this old ROM file and replace it with another new ROM. This is particularly a desirable feature when running randomizer games with MSU-1 where the ROM file must have the same prefix. I'm hoping you might be able to quickly see any problems with the above code, as I'm no expert in Qt dev nor these usb2snes libraries. Also, this might even be made simpler if overwriting files worked in SendToSd2snes, but as it currently is, it does not.
Check of the device reset correctly canoe pid when it's closed
QUSB2SNES in SNES Classic mode doesn't work if either USB Host or Wifi is in use due to their reliance on OTG functionality through the micro USB port. Currently it seems that QUSB2SNES is relying on a direct connection to the back of the SNES Classic right now.
Can we extend this to allow a connection over Wifi at all? I don't know how feasible this would be at all but asking none the less.
To be able to map properly sd2snes address to the memory.read function of the emulator.
Make list device full async to remove most of the blocking code.
I recently installed a Super Storage so that I could use MSU on the snes classic, but when I tried to do a multiworld I couldn't get QUsb2snes to connect. I assume this is because it only works with the default emulator, canoe. Would it be possible to add support for snes9x?
For now it's a mess, the UI do a List device (that is blocking) and it's not always accurate
The last few lines of the debug log are these:
2020-06-10T07:37:37 WSServer - Debug: "Websocket 169713a8280" >> "{\n \"Results\": [\n \"RetroArch mars\"\n ]\n}\n"
2020-06-10T07:37:37 WSServer - Debug: Server request finished - 0 Created at QTime("07:37:37.700") - USB2SnesWS::DeviceList SD2Snes::SNES () () WSServer::RequestState::NEW processed in 51 ms
2020-06-10T07:37:37 WSServer - Debug: "Websocket 169713a8280" received "{\n \"Opcode\": \"Attach\",\n \"Operands\": [\n \"RetroArch mars\"\n ],\n \"Space\": \"SNES\"\n}\n"
2020-06-10T07:37:37 WSServer - Debug: Request is USB2SnesWS::Attach
2020-06-10T07:37:37 WSServer - Debug: Executing request : 1 Created at QTime("07:37:37.752") - USB2SnesWS::Attach SD2Snes::SNES () ("RetroArch mars") WSServer::RequestState::NEW for "Websocket 169713a8280"
2020-06-10T07:37:37 WSServer - Debug: "SD2Snes"
2020-06-10T07:37:37 WSServer - Debug: "RetroArch"
However, I don't think any of that is useful. As far as I can tell, the problem comes from RetroArchFactory::attach, which does not check if the device is a null pointer. Now, whether or not it should be a null pointer or not for unconnected devices is a question I don't know the answer to. Changing the code in question to add a nullptr check appears to fix the crash, but I haven't been able to confirm if anything else is broken yet, and I sure don't know if this is the proper fix.
ADevice *RetroArchFactory::attach(QString deviceName)
{
QMapIterator<QString, RAHost> i(raHosts);
while (i.hasNext())
{
i.next();
if (i.value().device != nullptr && i.value().device->name() == deviceName)
return i.value().device;
}
return nullptr;
}
Launched from toolbar menu the app crashes immediately afterwards.
To avoid something like this to happen :
SD2SNES - Debug: Error QSerialPort::ResourceError "The I/O operation has been aborted because of either a thread exit or an application request."2019-05-19T18:13:54
Need to check if all user strings are tagged for translation and maybe fix typo/bad english.
Is there a way to disable this check? It keeps asking me. I can assure right-clicking already has the appropriate option.
Probably just need to be its own binary put aside qusb2snes
A new multiworld service for ALTTP Randomizer will be accessing the sd2snes bridge on 64213, instead of 8080. We feel that 8080 is too common of a port and more often than not causes conflicts with those running services also listening on port 8080.
If qusb2snes could also be set up to listen on 64213/tcp, that would be awesome. It would align with the ports the Crowd Control usb2snes service listens on as well (8080 and 64213).
If you have any questions, please let me know.
Been having problems with Autotracking using retroarch + bsnes since the new versions (worked fine in 0.7.11). Drilled into changes and narrowed the problem to the following 2 lines/changes in devices/retroarchfactory.cpp
line 63 m_sock->write(QByteArray("READ_CORE_RAM 40FFC0 32"));
line 88 hasSnesLoromMap = rInfos->type == LoROM;
Reverting these to the following resolved the problem for me. Not sure if it's proper, but it resolves my issues.
line 63 m_sock->write(QByteArray("READ_CORE_RAM FFC0 32"));
line 88 hasSnesLoromMap = !rom_info_make_sense(rInfos, HiROM);
There are a couple requests that I would like to see be added/considered:
Ability to view files by order of modified date. I have a ton of similarly named ROM files (aLttP rando seeds) in a folder. On Windows, I simply order the folder contents by modified date and I see the last seed I generated on the top of the list.
Fix the alphanumeric ordering to show folder contents in the correct order. Currently, all my folders that have an underscore prefix (ie. "_ROMs") show at the bottom of the list, these should be showing on the top of the list.
Drag and drop from an external Windows Explorer. It'd be nice, if one could simply drag and drop a file from an outside window to the Snes folder. That way my first suggestions would become moot. Edit Ignore this one, I just learned of the "Send To" functionality, this is awesome, although drag and drop would be a nice alternative as well.
Add a refresh button, so that if you change a folder's contents (from Explorer) and the changes can be viewed in the program without having to close and reopen the program. Edit Thsi too is basically solved by hitting the "." directory.
Fix issue when accidentally dragging and dropping an item from the left side and prematurely letting go (user error) and dropping on the left side and freezing the program.
Fix inconsistency issues where the program freezes for no apparent reason during a file transfer and freezes the program, forcing the user to kill the app.
Have the ability to reconnect to a new QUsb2Snes instance if the previous instance has crashed/exited and/or ability to connect to the SD2Snes if powered on after QFile2Snes was ran, or more specifically, if the console needs a reset.
For the "Send To" functionality, it'd be nice to be able to rename the destination filename. I have a folder with a bunch of MSU-1 tracks and have a need to rename the .sfc rom to a static filename each time. But instead, I have to open the main app to rename the destination file.
I've seen an issue where my file uploads to my SD2Snes are not completing. This started in v0.7.16.1 and is still present in v0.7.17. I've attached an example debug log of this issue occurring.
EDIT: One detail that may or may not be relevant is that this is an SD2Snes running in an Analogue Super Nt, not a regular SNES. I'm not sure if that matters.
Anybody who has ever done webdev will tell you that port 8080 is really crowded, and should only be used for local dev, and not in the release build of an app, in order to avoid conflicts. The websocket server port should definitely be changed to something else. KatDevsGames has implemented a USB2SNES websocket server into the Crowd Control client using port 64213, so for the sake of interoperability, I would suggest using that. I've also filed an issue with https://github.com/RedGuyyyy/usb2snesw/issues/2 as well, so hopefully this change can be adopted as the new standard port across the board.
This is a mess with some bugs
To speed up a bit these requests.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.