Author Topic: Need some help with my libretro port  (Read 47773 times)

Offline iq_132

  • Administrator
  • *****
  • Posts: 3728
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
Re: Need some help with my libretro port
« Reply #75 on: September 13, 2015, 03:49:34 PM »
All those games have problems :
-> dynduke games froze on first screen (white with some writings on top-right)
-> raiden 1 games blinked white and black
-> raiden 2 games froze on a black screen (and unlike the other 2, my rpi2 seemed irresponsive for a few seconds)
I do NOT write endian safe code, nor do I test it with anything but a 32-bit depth or 44100/48000hz frequency. It's just not something I keep in mind, so I would start with that, for sure.


Offline Arcadez

  • Expert
  • *****
  • Posts: 558
  • Karma: +15/-0
  • Arcade Addict
Re: Need some help with my libretro port
« Reply #76 on: September 13, 2015, 03:58:43 PM »
All those games have problems :
-> dynduke games froze on first screen (white with some writings on top-right)
-> raiden 1 games blinked white and black
-> raiden 2 games froze on a black screen (and unlike the other 2, my rpi2 seemed irresponsive for a few seconds)

Right ive got an idea what might be causing this i'll PM ya shortly

Offline barbudreadmon

  • Administrator
  • *****
  • Posts: 1091
  • Karma: +59/-1
  • Helper
Re: Need some help with my libretro port
« Reply #77 on: September 13, 2015, 04:01:47 PM »
Linux on arm is supposed to be little endian, same as windows on x86/x86_64

Offline barbudreadmon

  • Administrator
  • *****
  • Posts: 1091
  • Karma: +59/-1
  • Helper
Re: Need some help with my libretro port
« Reply #78 on: September 13, 2015, 05:37:50 PM »
It also seems to be unrelated to samplerate and color-depth (hardcoded to 16 bits / 32 Khz in the libretro port but causing no issues on libretro-fba x86_64).

Offline dink

  • Administrator
  • *****
  • Posts: 5014
  • Karma: +449/-1
  • pie? I nearly bought one!
Re: Need some help with my libretro port
« Reply #79 on: September 13, 2015, 07:04:26 PM »
try a little test, put this in DrvFrame(); of d_m72.cpp, and run any game:
Code: [Select]
#ifdef LSB_FIRST
bprintf(0, _T("lf"));
#else
bprintf(0, _T("ll"));
#endif

Offline barbudreadmon

  • Administrator
  • *****
  • Posts: 1091
  • Karma: +59/-1
  • Helper
Re: Need some help with my libretro port
« Reply #80 on: September 14, 2015, 02:58:01 PM »
I had to replace this code with
Code: [Select]
#ifdef LSB_FIRST
printf("%s", "lf");
#else
printf("%s", "ll");
#endif
since bprintf wouldn't print anything on retroarch, and it's printing "lf" as expected.

Offline barbudreadmon

  • Administrator
  • *****
  • Posts: 1091
  • Karma: +59/-1
  • Helper
Re: Need some help with my libretro port
« Reply #81 on: September 17, 2015, 02:05:41 AM »
Ok, so what we know :
- It is not endian related
- It is not x86 specific instruction related (no ASM code)
- It is probably related to nec V30 cpu (all affected games uses this cpu)
- The cpu emulator is not necessarily the culprit since m90 emulation (which also uses V30) is working

Btw, i saw some INT64 in m72 DrvFrame function, is that not supposed to work only on 64bits machines ?

Offline barbudreadmon

  • Administrator
  • *****
  • Posts: 1091
  • Karma: +59/-1
  • Helper
Re: Need some help with my libretro port
« Reply #82 on: November 09, 2015, 01:43:11 AM »
After reading some documentation about what could go wrong when you build x86 targeted code on arm, i've been trying to fix those nec v30 games again.
So right now i'm trying to fix "undefined behavior" in cpu/nec, but it seems i'm doing it wrong, for example i tried replacing
Code: [Select]
#define FETCH() cpu_readop_arg((Sreg(PS)<<4) + sChipsPtr->ip++)by
Code: [Select]
#define FETCH() ({ cpu_readop_arg((Sreg(PS)<<4) + sChipsPtr->ip); sChipsPtr->ip++; })or
Code: [Select]
#define FETCH() ({ sChipsPtr->ip++; cpu_readop_arg((Sreg(PS)<<4) + sChipsPtr->ip); })First threw me a runtime error, second threw me a black screen, any guess on what i should actually write ?

Offline barbudreadmon

  • Administrator
  • *****
  • Posts: 1091
  • Karma: +59/-1
  • Helper
Re: Need some help with my libretro port
« Reply #83 on: November 11, 2015, 04:15:13 AM »
Ok, the right way to write this without having "undefined behavior" was to write the following :
Code: [Select]
#define FETCH() ({ UINT8 retval; retval = cpu_readop_arg((Sreg(PS)<<4) + sChipsPtr->ip); sChipsPtr->ip++; retval; })I'll try to fix all those "undefined behavior" warnings (btw, you can enable those warnings by adding "-fsanitize=undefined -Wall" to cflags/cxxflags/ldflags) and see if it fix v30 emulation on arm. I'll propose a patch if it's a success.

Offline barbudreadmon

  • Administrator
  • *****
  • Posts: 1091
  • Karma: +59/-1
  • Helper
Re: Need some help with my libretro port
« Reply #84 on: April 26, 2016, 03:38:55 AM »
Hi !

We found a new issue on libretro-fba (the irem on arm issue is still unresolved btw), ironclad will display a black screen with controls and sound working, any idea where i could start searching ?

Offline Arcadez

  • Expert
  • *****
  • Posts: 558
  • Karma: +15/-0
  • Arcade Addict
Re: Need some help with my libretro port
« Reply #85 on: April 26, 2016, 09:06:05 AM »
Hi !

We found a new issue on libretro-fba (the irem on arm issue is still unresolved btw), ironclad will display a black screen with controls and sound working, any idea where i could start searching ?

It's a Neogeo Bios issue the game will only work if the Bios are set to USA or Japan anything else and it wont work correctly

Offline barbudreadmon

  • Administrator
  • *****
  • Posts: 1091
  • Karma: +59/-1
  • Helper
Re: Need some help with my libretro port
« Reply #86 on: April 26, 2016, 10:37:40 AM »
Thanks for the quick answer :), this game indeed works with a usa/japan bios.

Offline barbudreadmon

  • Administrator
  • *****
  • Posts: 1091
  • Karma: +59/-1
  • Helper
Re: Need some help with my libretro port
« Reply #87 on: May 05, 2016, 06:09:03 AM »
Someone at github told me neounidefaultDIPList was not updated with new unibios 3.2 and it could cause some issues with some demo (spiderman, ...), we applied some fix on libretro-fba there : https://github.com/libretro/libretro-fba/pull/72/commits/96d95eb4dee47216cc1a4c029f078401f5cb01fb

Offline barbudreadmon

  • Administrator
  • *****
  • Posts: 1091
  • Karma: +59/-1
  • Helper
Re: Need some help with my libretro port
« Reply #88 on: May 17, 2016, 07:16:00 AM »
I have a new question ! :)

PAGE_SHIFT, PAGE_MASK, PAGE_SIZE, ... are used as constant/macro in a lot of files, but it is causing warnings/errors depending on the platform/toolchain we use to compile libretro-fba, because those names are used by some macro in those toolchains. Would it be safe to prefix all those PAGE_* variables ? Perhaps it would be a good thing to do upstream to improve portability ?

Btw, anyone took a look at my last post ? Don't know if there is actually an issue on fba standalone, but it is worth a look.

Offline dink

  • Administrator
  • *****
  • Posts: 5014
  • Karma: +449/-1
  • pie? I nearly bought one!
Re: Need some help with my libretro port
« Reply #89 on: May 17, 2016, 07:27:43 AM »
Hi, Regarding the previous to the last post, the unibios problem was solved a few weeks back.  I guess it wouldn't hurt to change the defines for the PAGE_* so they don't conflict with system-related things. 

best regards,
- dink