Thysbelon / gbaconv-web

The Libretro VBA save to standard sav converter gbaconv compiled to WebAssembly.
https://thysbelon.github.io/gbaconv-web/
11 stars 1 forks source link

Won't work on iOS #5

Open WafflyChar01 opened 1 year ago

WafflyChar01 commented 1 year ago

I put the .4gs file in and then it says no file chosen. I have tried safari, chrome, etc. idk what to do

Thysbelon commented 1 year ago

Can you choose a file on this website?

WafflyChar01 commented 1 year ago

Yes, I can

WafflyChar01 commented 1 year ago

For more clarity, I can select a file and for a split-second it shows my file and then says no file chosen

WafflyChar01 commented 1 year ago

Is there anything I can do? I was wanting to play on my gba tonight

Thysbelon commented 1 year ago

Sorry for not saying much, and thank you for being patient with me. I don't have an iPhone, so I don't think I'll ever be able to fix this issue. The fact that this doesn't seem to happen on all iPhones would make it even more difficult to solve.

It would be very helpful to see what the Console says when the website fails. The problem with that is I don't think you can view the iPhone browser Console without connecting a Mac. I tried redirecting all console.log commands to a visible part of the webpage, but doing that didn't redirect the logs made by the Emscripten module (which is the code that does most of the conversion work).

Unless you have a Mac and are willing to help, I don't think I can fix this bug.

I noticed that your comment said "pc" before you edited it. Do you have a PC? If you do, maybe you can work around this bug by copying the 4gs file to your pc, then using the website on your pc.

WafflyChar01 commented 1 year ago

No worries, I have a of that I'll try, I'll let you know the results

euan-forrester commented 1 year ago

@Thysbelon There's a couple options to get C log messages to the browser console that you might want to try:

#include <emscripten.h>

emscripten_run_script("console.log('Hello from C!')");

or

#include <emscripten.h>

EM_JS(void, call_console_log, (), {
  console.log('Hello from C!');
});

int main() {
  call_console_log();
  return 0;
}

https://emscripten.org/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.html#calling-javascript-from-c-c

Thysbelon commented 1 year ago

Thank you for your help @euan-forrester. I have created a "debug mode" that redirects most console messages to html. Hopefully it helps.

euan-forrester commented 1 year ago

No problem! I hope it helps! I wonder if the issue will end up being the file I/O

For reference, when I did something similar (for decrypting PSP saves -- the code for that is all in C) I did all the file I/O in javascript and just passed the C stuff an array of bytes:

https://github.com/euan-forrester/save-file-converter/blob/main/frontend/src/save-formats/PSP/Savefile.js#L85

Then I wrote a wrapper in C that translated that array of bytes into what the rest of the C code was expecting:

https://github.com/euan-forrester/psp-encryption-webassembly/blob/main/src/Tools/SaveTool/decrypt.cpp#L117