libretro / px68k-libretro

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

D88 disk fix. #20

Closed Tatsuya79 closed 7 years ago

Tatsuya79 commented 7 years ago

Fix made by @retro-wertz

They seem to run fine now, but he's not sure if that's the best way to do it?

ghost commented 7 years ago

This does not seem to work under Linux though(Linux Lite based on Ubuntu 16.04 x64), or im not entirely sure this is the way to initialize such typedef layout.

i got this error when doing RESET with d88 fdd inserted

func = rm_buserr addr = bffffc flag = 0 func = rm_buserr addr = bffffd flag = 1 func = cpu_readmem24_word addr = bffffd flag = 1 BusError: bffffd func = rm_buserr addr = bffffe flag = 0 func = rm_buserr addr = bfffff flag = 1 func = cpu_readmem24_word addr = bfffff flag = 1 BusError: bfffff

Using different IPL rom gives different bus range errors but still within 200000 - bfffff. from x68000 reference docs, this seems to be main memory area.

ghost commented 7 years ago

i did some more linux tests. error is caused by this line here(it fails the "if" conditions),

for might & magic (19xx)(starcraft): https://github.com/libretro/px68k-libretro/blob/master/x68k/disk_d88.c#L77

for phantasie iii the wrath of nikademus (19xx)(starcraft): https://github.com/libretro/px68k-libretro/blob/master/x68k/disk_d88.c#L81

(i only have 2 D88 roms to test, @Tatsuya79 have more D88 but does not have linux)

also an update for windows build. if you remove NULL from this line, https://github.com/libretro/px68k-libretro/blob/master/x68k/disk_d88.c#L76, make it to "D88_SECTINFO si, oldsi;", it also fixes windows build for D88 loading.

ghost commented 7 years ago

final fix updated which should now work for D88 disks for both Windows and Linux(x64).

one thing needed for clarrification though is the proper way to NULL-ify *oldsi or if we really needed to: https://github.com/libretro/px68k-libretro/blob/master/x68k/disk_d88.c#L76

adding NULL to oldsi causes segfault/crash when core runs here: https://github.com/libretro/px68k-libretro/blob/master/x68k/disk_d88.c#L85

but if we add malloc to oldsi also does the same thing as removing NULL from it as far as fixing D88 load issues.

r-type commented 7 years ago

That didn't work for me on linux with the only d88 i have (os9_x68000_2.4_d88.zip). but if it works or you it should be fine.

Tatsuya79 commented 7 years ago

The 2 os9 disks are the only ones not working, even on winx68k, bad choice! :) They work on XM6.