-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from libretro core adaptation. #376
Conversation
The actual libretro core adapter code is in another repo, but these changes should cause no change to original b2 building. SDL and UI related functions put behind #ifdef, a few replacement functions from load_save are referenced from elsewhere. Static designation removed from Certain ROM structures, to be able to refer to them with proper name from libretro side. strlcpy definition in case of Linux moved behind HAVE_STRLCPY, this may also be useful for b2 as newer glibc has this function and will stop building with conflict.
Thanks. I still hadn't got too looking at this (just a quick skim to see which files it touched). Having it as a PR will make it easier to work through though. I have some comments and suggestions immediately, which I'll add. I'm hoping this can be done with even fewer source changes at all, though it may require a bit of rearrangement of b2 in places as suggested by this PR. |
src/shared/h/shared/system.h
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this is a good idea.
src/shared/h/shared/system_windows.h
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this change for? Should this header do something different?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are 32-bit Windows versions supported for Libretro, and it is compiled using a cross-compiling docker image set up with older WIN32_WINNT value. Since there should be nothing Windows version dependent in the code that the libretro version uses, this change enables building for those older platforms.
src/b2/misc.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm hoping the other changes will mean misc.cpp will become unnecessary.
src/shared/c/system_windows.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was the problem that prompted these changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bunch of these messages, coming from the cross-compilation environment:
../shared/c/system_windows.cpp: In function 'const char* GetErrorDescription(DWORD)':
../shared/c/system_windows.cpp:153:12: error: narrowing conversion of '-2147205019' from 'SCODE' {aka 'long int'} to 'long unsigned int' [-Wnarrowing]
I have not looked much into it, I must admit.
Sorry, a big pile of comments. Requests/suggestions/thoughts welcome! I think this can be done with no libretro-specific stuff in b2, just with the code arranged a bit better to simplify reuse. This should be better all round as there'll be less to keep on top of and it'll ideally be harder for me to break things. It was always supposed to be this way anyway, but nobody's actually really tested this (aside from the hints of it in the test code), so thanks for doing this and getting it working! I'd have to do these changes on one of my WIP branches, but it looks like all the libretro code is isolated to I'm afraid this plan comes with no time commitment, but I would like to do this. It'll make the code better generally. |
BTW, I pushed some changes: https://github.com/tom-seddon/b2/tree/libretro/master - this was me poking about by building on a Linux VM, without trying to run it. I tried to build the WIndows version using MSYS2 MINGW64, but all I got was Note: this is me experimenting with a view to assessing changes I could make to b2 to make this work! I am not contributing to libretro, sorry, I have to keep my spare time projects scoped! |
Thanks for taking care! I will go through the items. |
Poke about a bit.
Improvements administered, now amount of changes is less. No worries about timeline, all this work is for making future b2 changes easily transferable, it does not prevent me from refining the libretro side meanwhile. |
While looking at this stuff, I realised that I suggest working from |
On it. But this PR has become contaminated with large amount of other changes I never meant to be upstreamed, so I am closing it now and will reopen in some format. |
Changes adapted, the only remaining diffs (to current master) are:
Does the wip/master branch contain new features? I see some references to state handling, that is probably the biggest missing feature also for the libretro core version: emulation states that can be saved/loaded. |
It could be worth switching to I've got the |
Regarding For the header: I can't remember why I even put that version check in (and the comment from my old repo isn't very illuminating...), so maybe I should just take it out? Looks like it was attempting to prevent building for Windows targets that don't necessarily support WMF, but there's probably a better place for that test than the shared code (and maybe it doesn't actually even need checking for at all). For the source: I'll put a cast or two in so the code can build as-is without needing to strip anything out. I don't build for Windows using gcc/clang (but see: #385), so not surprising if they barf on something up that VC++ doesn't. |
7ea2524 removes the windows version checks and adds an explicit cast for the Current |
Some earlier discussion in #373 .
This is a collection of changes that enables the libretro core to use the same b2 source files as the current standalone version. The actual libretro core adapter code is currently in another repo, but these changes should cause no change to original b2 building.
SDL and UI related functions put behind #ifdef, a few replacement functions from load_save are referenced from elsewhere. By doing this, I could avoid bringing in any dependency during libretro core build.
Static designation removed from certain ROM structures, to be able to refer to them with proper name from libretro side.
strlcpy definition in case of Linux moved behind HAVE_STRLCPY, this may also be useful for b2 as newer glibc has this function and will stop building with conflict.
Few files added to .gitignore.