libretro / px68k-libretro

Portable SHARP X68000 Emulator for Libretro
http://hissorii.blog45.fc2.com
GNU General Public License v2.0
45 stars 41 forks source link

Cannot Load Game in iOS #40

Open SpiralCut opened 7 years ago

SpiralCut commented 7 years ago

Using iOS 10.3.3, Retroarch 1.6.4 and an August 9th ish build of this core I've been unable to actually load a game. I've verified my bios and games work on the PC version of Retroarch, however when I load in iOS all I get is the black screen that you can L2 to the px68k menu. If I restart i just get a black screen, and if I try to select discs it will usually crash to the iOS homescreen.

ghost commented 7 years ago

no idea how this core will behave on iOS, try deleting /keropi/config and try again. if this still goes black, note that some multi-floppy games sometimes only want floppy1 to be inserted in order to boot. test for now games that are only 1 floppy (chorensha, twinbee, etc) for easier troubleshooting.

SpiralCut commented 7 years ago

Thanks for the help. I still see the same thing after deleting keropi/config and I've tried switching to twinbee. I don't know how you get logs in iOS, but from Xcode it looks like I'm getting EXC_BAD_ACCESS (code=1, address=0x20) under current_core.retro_run(); in core_impl.c whenever I try to load a floppy from the L2 menu.

ghost commented 7 years ago

see if you can directly edit keropi/config. then modify StartDir= and add an accessable location on directory in your Ios, preferably something writeable:

e.g.: StartDir=/run/media/retro/HDD1SYSTEM/EMULATORS/ConsoleRoms/x68000

see if this helps...

SpiralCut commented 7 years ago

I can set the the StartDir ok and that lets me navigate around and assign files to the fd and hd values, however I'm still only getting a black screen when I boot/reset the system from the menu.

SpiralCut commented 7 years ago

I've been trying to track down the issue and it seems like what's causing the iOS bug is a problem in winx68k.cpp with the lines: fp = File_OpenCurDir((char *)BIOSFILE[i]); and later fp = File_OpenCurDir((char *)FONTFILE); From what I can tell it looks like File_OpenCurDir is either not properly converted to Libretro and is using the bios locations designed for non-libretto px68k instead of the Libretro System directory, or it is referencing the file using indirect paths (./keropi/*) instead of the full path (which is needed for iOS as it doesn't seem to support indirect paths).

These lines should be instead be something like (in pseudocode) fp = loadFile(winx68k_ini + slash + BIOSFILE[i]) Which I think should get you the full path to RetroArch/System/keropi/BIOSFILES if I understand the code correctly. This seems to be the way px68k is creating/reading the keropi/config file which IS working correctly in iOS.

Unfortunately, I know arse about programming in C++ so someone else will need to actually fix this (I tried to bungle my way through but all I got were compilation errors)

SpiralCut commented 6 years ago

Ok, I think I'm getting closer to the cause on this. After playing with it a bit while I could see the log in Xcode, it seems like it's looking for the system data in "/var/mobile/px68k/"

Nov 18 22:29:36 RetroArch[758] <Notice>: cur_dir_str /var/mobile/px68k/ 18

Full Log

Following this back to the source, it looks like the problem is in winui.c where it doesn't seem to be redefining CUR_DIR_STR for iOS for libretro (to the current system sandbox address) and is instead looking in "/var/mobile/px68k/". I tried setting line 242 to the current RA system directory but I do not have the C++ knowledge to make figure out how to get that directory as it changes every time I recompile (you have to get it from the libretro API.

Could you take a look in winui.c and see if there's something easy in there you can do to fix the libretro iOS builds?

ghost commented 6 years ago

we may need help from @r-type regarding your findings as i have no way to test for ios nor not sure if core is ios-capable. hope it is...

SpiralCut commented 6 years ago

Sure, let me know if you need me to test anything. Based on the readme It looks like the original source from hisori could be built and run on iOS so hopefully the core works as well.

ghost commented 6 years ago

you mentioned "compile", are you able to recompile this core?

SpiralCut commented 6 years ago

Yeah, I usually compile RA and all my cores for iOS.

ghost commented 6 years ago

im not sure about this.. but again why do you think CUR_DIR_STR or cur_dir_str is the suspect? it seems to read something from there.. is that folder existing?

SpiralCut commented 6 years ago

During the loading sequence as part of winx68k.cpp under WinX68k_LoadROMs it looks like it's loading the bios files from that directory using File_OpenCurDir(). The problem with iOS is that it's not loading the bios so I'm hoping it's the definition of current directory that's causing the issue.

SpiralCut commented 6 years ago

Sorry, posted early--I've fixed the comment.

ghost commented 6 years ago

i think the bios is loaded...

Nov 18 22:29:36 RetroArch[758] <Notice>: fp:12805412 (iplrom.dat)

that would appear fp:0 if iplrom.dat was not found.

i think the problem is at the end of that log, that CA restriction stuff... seeing the line fps:55.45 soundrate:44100** means that it has at least looped once on retro_run, so the core loaded fine but somewhere else is the problem.

Nov 18 22:29:36 RetroArch[758] : fps:55.45 soundrate:44100 2017-11-18 22:29:39.689285+0900 RetroArchiOS10[758:111600] [App] if we're in the real pre-commit handler we can't actually add any new fences due to CA restriction 2017-11-18 22:29:39.689387+0900 RetroArchiOS10[758:111600] [App] if we're in the real pre-commit handler we can't actually add any new fences due to CA restriction

SpiralCut commented 6 years ago

Hmm, then I've got nothing. This link here makes it seem like it's a non-fatal warning but I'm not knowledgeable enough to vouch for it. The core itself is loading (I get to the black screen where you can hit f12 to manipulate your disks), it's just not actually starting the bios to load the game.

ghost commented 6 years ago

me too :D not to mention its IOS... anyways if you are able to hit F12, then i think it should not be a big problem(hopefully) when you load a disk, and restart what do you see on log? and what game is this? maybe try a game using only 1 .dim perhaps, probably chorensha 1.01

ghost commented 6 years ago

if the rom would work fine, based on your log, the next viewaable entry there is suppose to be regarding Autoconfig of controllers.. and then some cheevos stuff..

SpiralCut commented 6 years ago

OK, tried the method recommended and had some issues. Full log is here

I wasn't able to load a new rom from the F12 menu as it was not showing the directory to be loaded (I just got an empty black square where you would normally get the file list to choose a file--this is after setting my start directory to the current RA roms directory.

So, what you are seeing in the log is: 1) start the core with the game Akazukin Cha Cha Cha v1.04 (just the first 1-disk game I had available--this is also what I used last time) 2) open the F12 menu and try to load a new game but seeing the black screen 3) close Akazukin, update my keropi/config file for the start directory to be the Retroarch base folder to see if that showed something 4) re-open Akazukin 5) retry the F12 menu but again, black box 6) close Akazukin 7) Open chorensha 1.01 8) Restart the core just to try 9) Close chorensha 1.01

Through all of that all I could see was a black screen and I could open the f12 menu.

ghost commented 6 years ago

make sure that StartDir= ends with the correct / or \ for your device (not sure for ios)

StartDir=/home/retrowertz/EMULATORS/ConsoleRoms/x68000/

PS: my internet is so slow atm, but will try to keep responding....

looks like your StartDir should be StartDir=/var/mobile/Containers/Data/Application/2154CF14-4C4D-487E-BA83-E4EFB5D4B14D/Documents/RetroArch/roms/

note the additional "/" at the end.

SpiralCut commented 6 years ago

Thanks, this time I was able to switch games though I'm still only getting the black screen

Full Log

Sequence of events 1) load Akazukin Cha Cha Cha 1.04 2) F12->load Chorensha 1.01 (and eject whatever disk was in fdd2 to prevent any conflicts 3) Press reset in F12 menu 4) when that just gave me a black screen, pressing restart in the RA quick menu.

ghost commented 6 years ago

im having a hard time reading this log.. too much happening and there seems to be failed to create directory stuff.

anyways i would try with default config, or something without shaders and stuff. and other extras.

SpiralCut commented 6 years ago

That log is from a default config. One of the quirks of iOS is that the absolute directory locations change each time you recompile/reinstall, and the only way to get logs on iOS is to recompile and pull the logs from the recompiler as it's running the first time. So, each time I'm creating a log I delete the confit beforehand as otherwise all the directories will be messed up.

ghost commented 6 years ago

there seems to be a lot more going on that last log compared to others. anyways try with a clean retroarch.cfg

SpiralCut commented 6 years ago

Sorry, for the delay. I think I might have figured out the issue with the logs as it didn't look like Xcode was clearing the old logs after each test.

Anyway, here is a log from a clean config

Sequence of events is the same but the full sequence is: 1) Start RA 2) Go to settings and turn on advanced settings and debug logs 3) Start Akazukin from the load content menu 4) Go to the F12 menu, load chorensha 1.01 delete whatever was in fdd2, and reset from the F12 menu 5) Go to the RA quick menu and reset from there.

ghost commented 6 years ago

ok. do not reset from quick menu. Use the F12 menu > System > Reset method... this just makes sure that the fdd is properly inserted and we could possibly get a better log view.

and YES, clear your logs after each test.. looking at log now while you try that above and get new log.

EDIT: logs ddnt really show possible indication why it just does not run with your setup... it just stops for some reason.. can you try other formats? or .HDF (HDD images) probably?

Also something to test, you seem to be browsing a lot of folders, edit your StartDir="" to point directly to the roms for x68000/ as this would also limit lines the log will generate.

SpiralCut commented 6 years ago

Ok, here you go

Sequence of the events is the same except that I did not do step 5. Also note that I did not exit RA or the core or anything before taking the log so the log ends at the moment after I reset through the F12 menu. From there it's just the black screen again (and I can still go to the F12 menu if I want) and there are have been no updates to the log since then during the time I've been writing this post (about two minutes).

SpiralCut commented 6 years ago

Also, thank you for all your help so far! (Sorry, accidentally hit close button)

ghost commented 6 years ago

looks like its not even able to emulate the first frame. after the last line from log, which is [libretro INFO] ** drv:-1 ***, what follows should be [libretro INFO] TextDotX: 768 and [libretro INFO] TextDotY: 512 which is the size of the 1st frame to generate.

sadly tracing from that, with nothing more from log showing issue is out of my league, most importantly I dont have an ios device to test out and try trace where the code stopped..

i would still try to check with other system like windows/linux perhaps and check if those roms are playable also with px68k core(not necessary to compare it with other x68000 emu since they handle rom file differently).

btw, not sure if you already are using latest retroarch but you may want to try latest version...

SpiralCut commented 6 years ago

Ok, thanks for your help. I'll look around a bit more and if I don't see anything I'll see if there's an iPhone dev on the forums who can look at it more.

ghost commented 5 years ago

this is a late reply (never knew its this long already) but i hope px68k has been working for you now. just incase this could happen again with anyone (as i did since i returned tinkering with px68k a few weeks ago), when loading single-disk game, always eject disks from the other fdd drive.

also, StartDir= should always end with \ (or / on windows) and system/keropi/config file should always be used, with StartDir= pointing to your roms folder for easier browsing of them. i have PR on my repo which has also allows to how direction pad to browse faster.

negativeExponent commented 3 days ago

please test with latest (not nightly) retroarch and px68k. will be waiting for a update.