Author Topic: New libretro patch - Android/Xbox 1 support - sync to mainline  (Read 10277 times)

Offline Twinaphex

  • Jr. Member
  • **
  • Posts: 81
  • Karma: +8/-0
New libretro patch - Android/Xbox 1 support - sync to mainline
« on: November 13, 2012, 08:04:20 AM »
Here is the latest patch for the libretro FBA port - click on 'Raw' to get a raw diff file that you can save somewhere - from there it can be applied to the repository.

https://gist.github.com/4065706

Hopefully this can be synced upstream. It contains JNI Makefiles for  building the Android port and an Xbox 1 solution as well. The other libretro targets have been updated as well.

The 'include' changes to the cpu/ folder files were necessary for the Xbox 1 port - MSVC 2003 seemed to have issues with the sheer number of include paths - cutting that down to just one or two includes for the CPU directories seemed to fix all the issues. Overall, I think it's more sustainable to do this as well rather than 'including' every new cpu folder that might get added - so I hope you guys won't mind.

So, to recap - libretro FBA now supports the following platforms as of this patch:

* PS3
* Xbox 360
* Xbox 1
* Wii
* Gamecube
* Android
* PC (Windows/Linux)
* Mac (OSX)
* Raspberry Pi
* Pandora
« Last Edit: November 13, 2012, 09:22:40 AM by Twinaphex »

Offline niabi

  • Newbies
  • *
  • Posts: 33
  • Karma: +0/-0
Re: New libretro patch - Android/Xbox 1 support - sync to mainline
« Reply #1 on: November 13, 2012, 04:00:44 PM »
Awesome! :D

Offline destronger

  • Newbies
  • *
  • Posts: 43
  • Karma: +7/-3
Re: New libretro patch - Android/Xbox 1 support - sync to mainline
« Reply #2 on: November 15, 2012, 07:51:32 PM »
thanks!
+ T +: Every time you mention Midway games in Final Burn, iq_132 kills a kitten!

Offline Barry Harris

  • dontbeabarry
  • *
  • Posts: 1785
  • Karma: +0/-65535
  • I'm Barry Harris and I like to f*** people over
Re: New libretro patch - Android/Xbox 1 support - sync to mainline
« Reply #3 on: November 17, 2012, 03:27:32 AM »
Thanks for this - I'm going to look through it over the weekend with a view to committing.
Account of Barry Harris; the traitor.
Send me an e-mail at barry@fbalpha.com letting me know how big of a piece of sh** I am.

Offline Twinaphex

  • Jr. Member
  • **
  • Posts: 81
  • Karma: +8/-0
Re: New libretro patch - Android/Xbox 1 support - sync to mainline
« Reply #4 on: November 23, 2012, 02:49:49 PM »
Treblewinner - Would be real nice if you could merge this into mainline this weekend, because I have another patch coming up that will add PSP libretro support as well - but first this patch still needs to be merged in.

Offline KaNyErO

  • Member
  • ***
  • Posts: 142
  • Karma: +4/-0
Re: New libretro patch - Android/Xbox 1 support - sync to mainline
« Reply #5 on: November 24, 2012, 09:09:34 PM »
Would it be possible to add opendingux and dingoo a-320 native os support ?

Thanks !

Offline Twinaphex

  • Jr. Member
  • **
  • Posts: 81
  • Karma: +8/-0
Re: New libretro patch - Android/Xbox 1 support - sync to mainline
« Reply #6 on: November 24, 2012, 10:58:54 PM »
Would it be possible to add opendingux and dingoo a-320 native os support ?

Thanks !

I don't own those devices.

Offline fosamax

  • Newbies
  • *
  • Posts: 13
  • Karma: +0/-0
Re: New libretro patch - Android/Xbox 1 support - sync to mainline
« Reply #7 on: November 28, 2012, 11:53:39 AM »
Currently Dimitri Smagin started an open dingux port (A port of Final Burn Alpha to Dingoo a320 (OpenDingux), based on legacy fba 0.2.96.71 (ezxfba, fba2x and fba-pandora).

https://github.com/dmitrysmagin/fba-a320

A native port seems quite harder due to a320 limited amount of RAM (32 Mb) and would probably need some kind of caching file for lots of romsets.

I think that slaanesh started a native port but i would not expect him to share his source.

Wait and see.

Anyway, the dingoo a320 is still an amazing device.

Offline Twinaphex

  • Jr. Member
  • **
  • Posts: 81
  • Karma: +8/-0
Re: New libretro patch - Android/Xbox 1 support - sync to mainline
« Reply #8 on: December 08, 2012, 10:36:23 AM »
Quote
I updated the compile guides and posted them in the FB Alpha section. The two new guides require the next version of FB Alpha which won't be too far behind!

Can we have the libretro patch pushed upstream finally before the next version of FB Alpha hits? I don't mean to sound annoyed but in a way I kind of am (can't lie) - it's been over five weeks and counting since I submitted this diff patch and I can't really continue on my end until this gets merged. If I had an easy way of giving you pull requests I would do that but I've tried twice/thrice now and it just isn't working out with this version management website.
« Last Edit: December 08, 2012, 10:43:26 AM by Twinaphex »

Offline Barry Harris

  • dontbeabarry
  • *
  • Posts: 1785
  • Karma: +0/-65535
  • I'm Barry Harris and I like to f*** people over
Re: New libretro patch - Android/Xbox 1 support - sync to mainline
« Reply #9 on: December 14, 2012, 04:35:17 PM »
Sorry for the delay - it was a big patch and I kept putting off going through it. I've committed it now with the following exceptions;

Code: [Select]
Index: src/burn/burn.cpp
===================================================================
--- src/burn/burn.cpp (revision 850)
+++ src/burn/burn.cpp (working copy)
@@ -8,7 +8,9 @@
 // filler function, used if the application is not printing debug messages
 static INT32 __cdecl BurnbprintfFiller(INT32, TCHAR* , ...) { return 0; }
 // pointer to burner printing function
+#ifndef __LIBRETRO__
 INT32 (__cdecl *bprintf)(INT32 nStatus, TCHAR* szFormat, ...) = BurnbprintfFiller;
+#endif
 
 INT32 nBurnVer = BURN_VERSION; // Version number of the library
 
Index: src/burn/burn.h
===================================================================
--- src/burn/burn.h (revision 850)
+++ src/burn/burn.h (working copy)
@@ -209,7 +209,9 @@
 #define PRINT_IMPORTANT (2)
 #define PRINT_ERROR (3)
 
+#ifndef __LIBRETRO__
 extern INT32 (__cdecl *bprintf) (INT32 nStatus, TCHAR* szFormat, ...);
+#endif
 
 INT32 BurnLibInit();
 INT32 BurnLibExit();
Index: src/burn/burn_gun.cpp
===================================================================
--- src/burn/burn_gun.cpp (revision 850)
+++ src/burn/burn_gun.cpp (working copy)
@@ -155,10 +155,17 @@
  UINT8* pTile = pBurnDraw + nBurnGunMaxX * nBurnBpp * (y - 1) + nBurnBpp * x;
 
  UINT32 nTargetCol = 0;
+#ifdef __LIBRETRO__
+ if (num == 0) nTargetCol = BurnHighCol(0xfc, 0x12, 0xee, 0);
+ if (num == 1) nTargetCol = BurnHighCol(0x1c, 0xfc, 0x1c, 0);
+ if (num == 2) nTargetCol = BurnHighCol(0x15, 0x93, 0xfd, 0);
+ if (num == 3) nTargetCol = BurnHighCol(0xf7, 0xfa, 0x0e, 0);
+#else
  if (num == 0) nTargetCol = BurnHighCol(P1Colour, 0);
  if (num == 1) nTargetCol = BurnHighCol(P2Colour, 0);
  if (num == 2) nTargetCol = BurnHighCol(P3Colour, 0);
  if (num == 3) nTargetCol = BurnHighCol(P4Colour, 0);
+#endif
 
  for (INT32 y2 = 0; y2 < 17; y2++) {
Index: src/burn/drv/neogeo/d_neogeo.cpp
===================================================================
--- src/burn/drv/neogeo/d_neogeo.cpp (revision 850)
+++ src/burn/drv/neogeo/d_neogeo.cpp (working copy)
@@ -932,7 +932,7 @@
  { "",                  0x00000, 0x00000000, 0                                                   }, // 12
 #endif
  { "sp-1v1_3db8c.bin",  0x20000, 0x162f0ebe, BRF_ESS | BRF_PRG | BRF_BIOS | BRF_SELECT | BRF_OPT }, // 13 Deck ver. 6 (Git Ver 1.3)
-#if !defined (ROM_VERIFY)
+#if !defined (ROM_VERIFY) && !defined(__LIBRETRO__)
  { "uni-bios_3_0.rom",  0x20000, 0xa97c89a9, BRF_ESS | BRF_PRG | BRF_BIOS | BRF_SELECT | BRF_OPT }, // 14 Universe BIOS ver. 3.0 (free)
 // { "uni-bios_3_0.rom",  0x20000, 0x4cd01e5f, BRF_ESS | BRF_PRG | BRF_BIOS | BRF_SELECT | BRF_OPT }, // 14 Universe BIOS ver. 3.0 (full)
 #else

I can't see any reason to commit these. If they are necessary I could be convinced, but I feel they should be handled by your port.
Account of Barry Harris; the traitor.
Send me an e-mail at barry@fbalpha.com letting me know how big of a piece of sh** I am.

Offline Twinaphex

  • Jr. Member
  • **
  • Posts: 81
  • Karma: +8/-0
Re: New libretro patch - Android/Xbox 1 support - sync to mainline
« Reply #10 on: December 15, 2012, 09:57:01 AM »
Hi, thanks for adding the patch - I might have another one coming up shortly.

Regarding burn_gun.cpp - what I do with BurnHighCol is that I've made that into a macro so that I don't have to go through a function pointer. Now, this approach works everywhere except for the usage of BurnHighCol in burn_gun.cpp - P1Colour, P2Colour and so on don't seem to properly expand into three params, so since the values are always the same and  hardcoded anyways I changed the lines using BurnHighCol to that shown in the patch.

Regarding d_neogeo.cpp - it seems the FBA libretro port is more strict right now about certain ROM files being included in ZIPs than mainline FBA - the uni-bios_3_0.rom file is not present in a lot of neogeo.zip files that people use, so I commented it out. I guess I can just not define ROM_VERIFY instead in the future.

Regarding bprintf - as with BurnHighCol, that was turned by me into a macro and therefore I commented out the function pointer definition for Libretro.

Changing these function pointers to macros was done for speed considerations since I target a whole host of platforms now (everything from Raspberry to PS3s/360s to PCs and Android/iOS) where function calls can be very costly - never mind 'virtuals'.
« Last Edit: December 15, 2012, 10:00:07 AM by Twinaphex »

Offline Barry Harris

  • dontbeabarry
  • *
  • Posts: 1785
  • Karma: +0/-65535
  • I'm Barry Harris and I like to f*** people over
Re: New libretro patch - Android/Xbox 1 support - sync to mainline
« Reply #11 on: December 15, 2012, 10:33:15 AM »
Hi, thanks for adding the patch - I might have another one coming up shortly.

Regarding burn_gun.cpp - what I do with BurnHighCol is that I've made that into a macro so that I don't have to go through a function pointer. Now, this approach works everywhere except for the usage of BurnHighCol in burn_gun.cpp - P1Colour, P2Colour and so on don't seem to properly expand into three params, so since the values are always the same and  hardcoded anyways I changed the lines using BurnHighCol to that shown in the patch.

Regarding d_neogeo.cpp - it seems the FBA libretro port is more strict right now about certain ROM files being included in ZIPs than mainline FBA - the uni-bios_3_0.rom file is not present in a lot of neogeo.zip files that people use, so I commented it out. I guess I can just not define ROM_VERIFY instead in the future.

Regarding bprintf - as with BurnHighCol, that was turned by me into a macro and therefore I commented out the function pointer definition for Libretro.

Changing these function pointers to macros was done for speed considerations since I target a whole host of platforms now (everything from Raspberry to PS3s/360s to PCs and Android/iOS) where function calls can be very costly - never mind 'virtuals'.

for burn_gun.cpp, I'll change it in mainline not to use macros (a bit unnceccesary anyway). Should resolve the issue.

for release builds I would recommend not having ROM_VERIFY defined (it's a debugging feature, and I also undefine it for release builds). I suppose the proper fix to the issue though is for lib retro to support use of optional roms (BRF_OPT).

I'll have a think on the bprintf situation.
Account of Barry Harris; the traitor.
Send me an e-mail at barry@fbalpha.com letting me know how big of a piece of sh** I am.

Offline Twinaphex

  • Jr. Member
  • **
  • Posts: 81
  • Karma: +8/-0
Re: New libretro patch - Android/Xbox 1 support - sync to mainline
« Reply #12 on: December 15, 2012, 07:40:11 PM »
I believe that latest patch (r929) you pushed nails it for my needs, yes.

I'll pull from repo and look at what other changes I've done since so that I can make a new patch file for you. This time there won't be any sweeping changes - changes should be mostly confined to libretro.cpp.

Offline Twinaphex

  • Jr. Member
  • **
  • Posts: 81
  • Karma: +8/-0
Re: New libretro patch - Android/Xbox 1 support - sync to mainline
« Reply #13 on: December 24, 2012, 09:27:49 PM »
Hi there treblewinner,

here is a new patch.

https://gist.github.com/4371288

Hopefully this can be merged.
« Last Edit: December 24, 2012, 09:29:23 PM by Twinaphex »

Offline Twinaphex

  • Jr. Member
  • **
  • Posts: 81
  • Karma: +8/-0
Re: New libretro patch - Android/Xbox 1 support - sync to mainline
« Reply #14 on: December 25, 2012, 07:51:44 AM »
This second patch (to be applied after the first one) should take care of the BRF_OPT ROM issues I have been having with the libretro port -

https://github.com/libretro/fba-libretro/commit/37677034f730bd07b66b7ee2d6c229c8b2a87d47